blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dea44214ddae25e9f2afd8c29385b5256ffc05cd | 6236164bd1998bc4a1d7014ba5f9f69525fcd69c | /center/src/main/Java/com/kld/gsm/center/dao/oss_sysmanage_timeSaleOutMapper.java | 7010b0598beefa88fd1b3722f6d629e14ef9f0f8 | [] | no_license | yyangssen/yanxwer | 26d04b22c8464efc0280d344de4a3291bb7d6362 | 31b74a42c2eca1fbc99f2d429595b6ba2d6065e2 | refs/heads/master | 2021-01-02T08:15:19.034765 | 2016-08-16T07:31:25 | 2016-08-16T07:31:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 669 | java | package com.kld.gsm.center.dao;
import com.kld.gsm.center.common.MysqlRepository;
import com.kld.gsm.center.domain.oss_sysmanage_timeSaleOut;
import com.kld.gsm.center.domain.oss_sysmanage_timeSaleOutKey;
@MysqlRepository
public interface oss_sysmanage_timeSaleOutMapper {
int deleteByPrimaryKey(oss_sysmanage_timeSaleOutKey key);
int insert(oss_sysmanage_timeSaleOut record);
int insertSelective(oss_sysmanage_timeSaleOut record);
oss_sysmanage_timeSaleOut selectByPrimaryKey(oss_sysmanage_timeSaleOutKey key);
int updateByPrimaryKeySelective(oss_sysmanage_timeSaleOut record);
int updateByPrimaryKey(oss_sysmanage_timeSaleOut record);
} | [
"934704255@qq.com"
] | 934704255@qq.com |
7bab6b5001b32e0fe420895f887403d1152620fb | 183f26addaadc9a69b15c0c354c3fe5d57a5f747 | /core/src/me/timbals/transmere/entity/components/RandomMovementComponent.java | 8849885870ff7db93de58f80c26c46b5a5524bf5 | [] | no_license | Timbals/Transmere | d743f45ea5f3acd8dae9415d2b3038425078fca7 | 9a88dff70b778a7358678dccec913dc83d261500 | refs/heads/master | 2021-01-20T20:35:54.376923 | 2016-07-28T18:59:46 | 2016-07-28T18:59:46 | 63,683,211 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 355 | java | package me.timbals.transmere.entity.components;
import com.badlogic.ashley.core.Component;
import com.badlogic.gdx.utils.Pool;
/**
* Created by Tim Balsfulland on 24.07.2016.
*/
public class RandomMovementComponent implements Component, Pool.Poolable {
public float timer = 0;
@Override
public void reset() {
timer = 0;
}
}
| [
"tim.balsfulland@gmx.de"
] | tim.balsfulland@gmx.de |
dab55735c90063dbed48462f770333552a086110 | 1ad30fc0a351ff079024a4e38cbfe218eee82839 | /test/com/appspot/gaejwiki/common/template/TemplateMergerTest.java | 59e9e77826c509d5d91d4790c41779064bc94d18 | [] | no_license | daxanya1/GAEJWiki | 8c09a2d9fb1434a91bfd6581f94057bebcb02d55 | 2c4cb99f3cf570fd0c8248ef3ddcb7f45d939e74 | refs/heads/master | 2021-01-20T06:31:00.095710 | 2009-10-14T13:54:58 | 2009-10-14T13:54:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,057 | java | /**
Copyright 2009 GAEJWiki Team.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package com.appspot.gaejwiki.common.template;
import static org.junit.Assert.assertEquals;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
/**
*
* @author Ryuichi Danno
*/
public class TemplateMergerTest {
/**
* @return
*/
private TemplateReplaceMap getReplaceMap1() {
TemplateReplaceMap map = new TemplateReplaceMap();
map.put("test", "a");
map.put("<test>", "b");
map.put("test\n", "c");
return map;
}
@Test
public void testSubMargeMap1a() {
TemplateMerger.Sub sub = new TemplateMerger.Sub();
String str = sub.margeMap("test<test>test\n", null, getReplaceMap1());
assertEquals(str, "test<test>test\n");
}
@Test
public void testSubMargeMap1b() {
TemplateMerger.Sub sub = new TemplateMerger.Sub();
String str = sub.margeMap("test<test>test\n", null, null);
assertEquals(str, "test<test>test\n");
}
@Test
public void testSubMargeMap2() {
TemplateMerger.Sub sub = new TemplateMerger.Sub();
Map<String, String> map = new HashMap<String, String>();
map.put("test", null);
String str = sub.margeMap("[test]<[test]>[test]\n", map, getReplaceMap1());
assertEquals(str, "a<a>a\n");
}
@Test
public void testSubMargeMap3() {
TemplateMerger.Sub sub = new TemplateMerger.Sub();
Map<String, String> map = new HashMap<String, String>();
String str = sub.margeMap("[test][<test>][test]\n", map, getReplaceMap1());
assertEquals(str, "[test][<test>][test]\n");
}
@Test
public void testSubMargeMap4() {
TemplateMerger.Sub sub = new TemplateMerger.Sub();
Map<String, String> map = new HashMap<String, String>();
map.put("<test>", null);
String str = sub.margeMap("[test][<test>][test]\n", map, getReplaceMap1());
assertEquals(str, "[test]b[test]\n");
}
@Test
public void testSubMargeMap5() {
TemplateMerger.Sub sub = new TemplateMerger.Sub();
Map<String, String> map = new HashMap<String, String>();
map.put("test\n", null);
String str = sub.margeMap("[test][<test>][test]\n", map, getReplaceMap1());
assertEquals(str, "[test][<test>][test]\n");
}
@Test
public void testSubMargeMap6() {
TemplateMerger.Sub sub = new TemplateMerger.Sub();
Map<String, String> map = new HashMap<String, String>();
map.put("test\n", null);
map.put("test", null);
String str = sub.margeMap("[test][<test>][test]\n", map, getReplaceMap1());
assertEquals(str, "a[<test>]a\n");
}
}
| [
"daxanya@gmail.com"
] | daxanya@gmail.com |
1ee1df1255ec79ab6bf97bda698f08a5b983bd63 | 780c3045764ee488df1c3485863bee91f1a6e63a | /src/main/java/de/tudarmstadt/ukp/dkpro/core/api/segmentation/type/Document.java | f27bcbb7b96963b32eb6c4ca1875f4953b273506 | [] | no_license | jonasmeise/TransferAnalysisSentimentExtraction | f215d487e678520dc4048b75f695a7910c76b7b9 | 5d60f2bc9d5427e58787c42d9fee5152c04d4399 | refs/heads/master | 2020-04-11T05:27:43.062833 | 2019-03-13T21:31:35 | 2019-03-13T21:31:35 | 161,550,255 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,040 | java |
/* First created by JCasGen Fri Dec 14 23:20:04 CET 2018 */
package de.tudarmstadt.ukp.dkpro.core.api.segmentation.type;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.jcas.cas.TOP_Type;
import org.apache.uima.jcas.tcas.Annotation;
/**
* Updated by JCasGen Mon Jan 07 22:47:38 CET 2019
* XML source: C:/Users/Jonas/Downloads/de.unidue.langtech.bachelor.meise/de.unidue.langtech.bachelor.meise/typesystem.xml
* @generated */
public class Document extends Annotation {
/** @generated
* @ordered
*/
@SuppressWarnings ("hiding")
public final static int typeIndexID = JCasRegistry.register(Document.class);
/** @generated
* @ordered
*/
@SuppressWarnings ("hiding")
public final static int type = typeIndexID;
/** @generated
* @return index of the type
*/
@Override
public int getTypeIndexID() {return typeIndexID;}
/** Never called. Disable default constructor
* @generated */
protected Document() {/* intentionally empty block */}
/** Internal - constructor used by generator
* @generated
* @param addr low level Feature Structure reference
* @param type the type of this Feature Structure
*/
public Document(int addr, TOP_Type type) {
super(addr, type);
readObject();
}
/** @generated
* @param jcas JCas to which this Feature Structure belongs
*/
public Document(JCas jcas) {
super(jcas);
readObject();
}
/** @generated
* @param jcas JCas to which this Feature Structure belongs
* @param begin offset to the begin spot in the SofA
* @param end offset to the end spot in the SofA
*/
public Document(JCas jcas, int begin, int end) {
super(jcas);
setBegin(begin);
setEnd(end);
readObject();
}
/**
* <!-- begin-user-doc -->
* Write your own initialization here
* <!-- end-user-doc -->
*
* @generated modifiable
*/
private void readObject() {/*default - does nothing empty block */}
}
| [
"32752445+jonasmeise@users.noreply.github.com"
] | 32752445+jonasmeise@users.noreply.github.com |
7fe639f168a6db3b29c388dde38394ece5bca1c8 | bea3269614e3f2301f0e9decc49aa444cd38703b | /src/replit/datatypes/create_double_4.java | ba0618181f90d9b0eadf125beae92086c79f9f90 | [] | no_license | kemalasci/JavaKursu | 84b2a99b2248b3a494876b91c0da120001c72923 | 67e278669c8ee74fc901c9f1acb919d557b8c132 | refs/heads/master | 2022-11-18T14:29:31.321031 | 2020-07-03T18:54:49 | 2020-07-03T18:54:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 208 | java | package replit.datatypes;
public class create_double_4 {
public static void main(String[] args) {
//Kodu aşağıya yazınız.
double a = 550.24;
System.out.println(a);
}
}
| [
"isk.metin.isk@gmail.com"
] | isk.metin.isk@gmail.com |
98a5e46e86910bc6d4cbb35f77c0589e7cf21d66 | a68414f2bb06cb9296be9ca368a6770bbe0dfc7d | /src/main/java/com/duia/commodity/dao/LiveTeacherMapper.java | 63b6fc1618ba561eaa1cdb7f04bfcafe51a3fd87 | [] | no_license | alice920524/template-commodity | 6b0dc3ef548ffd779ff8dc3f8dd475eccb086ebf | 7cdb39cda066e33b40804d8363aed65a6df01e95 | refs/heads/master | 2020-04-01T19:34:29.192893 | 2018-10-18T03:59:47 | 2018-10-18T03:59:47 | 153,560,698 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 236 | java | package com.duia.commodity.dao;
import com.duia.commodity.core.Mapper;
import com.duia.commodity.model.LiveTeacher;
public interface LiveTeacherMapper extends Mapper<LiveTeacher> {
LiveTeacher findByAuthUserId(Long authUserId);
} | [
"liuxue0524@duia.com"
] | liuxue0524@duia.com |
18ace9223a418a0b3a36475c86d293ed2e3a1dfc | d4d69538d2b7efbd6b1d9c3a39676b218c3a03f7 | /src/test/java/fr/davidc/api/cahierliaison/MessagesRestApiVerticleTest.java | e9a8f42dac325730b95f1c834459fa07a51031d1 | [] | no_license | david-cc/cahier-liaison-api | d63a9ac5c3546055529ccf2081ac7e107eab2434 | 34857678ae4d5afb00b3d6f833ed8f37b09e3be1 | refs/heads/master | 2021-01-13T05:20:19.794508 | 2017-02-09T12:26:20 | 2017-02-09T12:26:20 | 81,355,116 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,033 | java | package fr.davidc.api.cahierliaison;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import fr.davidc.api.cahierliaison.MessagesRestApiVerticle;
import io.vertx.core.Vertx;
import io.vertx.ext.unit.Async;
import io.vertx.ext.unit.TestContext;
import io.vertx.ext.unit.junit.VertxUnitRunner;
@RunWith(VertxUnitRunner.class)
public class MessagesRestApiVerticleTest {
private Vertx vertx;
@Before
public void setUp(TestContext context) {
vertx = Vertx.vertx();
vertx.deployVerticle(MessagesRestApiVerticle.class.getName(), context.asyncAssertSuccess());
}
@After
public void tearDown(TestContext context) {
vertx.close(context.asyncAssertSuccess());
}
@Test
public void testMyApplication(TestContext context) {
final Async async = context.async();
vertx.createHttpClient().getNow(8081, "localhost", "/monitor", response -> {
response.handler(body -> {
context.assertTrue(body.toString().contains("UP"));
async.complete();
});
});
}
}
| [
"david.caudeli@gmail.com"
] | david.caudeli@gmail.com |
0c3ea7d16928c723bd670d1273c775f1cab82da4 | 757a5f88e04da1290438b45ea84058415d39d5bf | /src/cn/pauu/javase/enhence/ReflectTest3.java | 6ec89e775c85630a25ff40c750ac604c2a2f6cc2 | [] | no_license | southeastpx/javase | 6382f9ea6552580f4986219980b24b19d6156723 | c8b4a476d806887316ee7f6aa8d6ce0b5a8c00bc | refs/heads/master | 2021-01-13T04:43:32.155246 | 2017-07-21T15:34:24 | 2017-07-21T15:34:24 | 79,209,012 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 349 | java | package cn.pauu.javase.enhence;
import java.lang.reflect.Method;
public class ReflectTest3 {
public static void main(String[] args) throws Exception{
String className = args[0];
Method mainMethod = Class.forName(className).getMethod("main", String[].class);
mainMethod.invoke(null, (Object)new String[]{"aaa","bbb","ccc"});
}
}
| [
"southeast_px@163.com"
] | southeast_px@163.com |
e16b0fe78d652a5e2dd2093bd53418da7e17047b | d1748e25d67edf56f7625ec9410f88f6d4caf6e8 | /example-hystrix-turbine2/src/test/java/com/springcloudexample/eureka/eurekaserver/EurekaServerApplicationTests.java | 5ad0926e49f551664b82dce8a3512496edfd5a78 | [] | no_license | querenjie/springcloudexample | 420b95e1b40d80ac8f08768655858c9daf576549 | 01324805fb866032627abaf297cb5a39de62819c | refs/heads/master | 2020-03-20T05:55:18.678851 | 2018-06-19T13:59:46 | 2018-06-19T13:59:46 | 137,231,323 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 374 | java | package com.springcloudexample.eureka.eurekaserver;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class EurekaServerApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"347794892@qq.com"
] | 347794892@qq.com |
a533b9d0eaf12c49453672c5091ed1b1fc55aeb0 | 2405fcf4158e4b15c380b51240121e478c74d7a3 | /src/main/java/com/ironw/service/pdf/PdfServiceImpl.java | d992b75cac427e899183a8db7a66bf90d15bcf66 | [] | no_license | trgoofi/ironw | ca78aaf2f2cfe63d59a9157255b628c3b83a2ae3 | 626ad98e9ac9e4c35abc51df8781557fa15bf5c5 | refs/heads/master | 2020-05-20T14:24:31.919221 | 2013-07-19T16:42:30 | 2013-07-19T16:42:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,451 | java | package com.ironw.service.pdf;
import com.ironw.domain.Order;
import com.ironw.domain.OrderItem;
import com.ironw.domain.Ware;
import com.itextpdf.text.*;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;
import org.springframework.stereotype.Service;
import javax.inject.Inject;
import java.io.ByteArrayOutputStream;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
/**
* @author trgoofi
*/
@Service
public class PdfServiceImpl implements PdfService {
@Inject private PrintConfig config;
@Override
public byte[] createPdfOf(Order order) {
try {
Font font = FontUtil.createFont(config.getContentFontSize());
Rectangle pageSize = new Rectangle(config.getPageWidth(), config.getPageHeight());
Document doc = new Document(pageSize, 0, 0, config.getTableMarginTop(), config.getTableMarginBottom());
ByteArrayOutputStream ostream = new ByteArrayOutputStream();
PdfWriter writer = PdfWriter.getInstance(doc, ostream);
writer.setBoxSize("art", pageSize);
writer.setPageEvent(new PdfHeaderFooterEvent(order, config));
doc.open();
PdfPTable table = new PdfPTable(7);
table.setTotalWidth(config.getTableColumnWidths());
table.setLockedWidth(true);
table.setHeaderRows(2);
table.setFooterRows(1);
String[] tableHeads= {"编号", "商品", "单位", "数量", "单价", "实价", "金额"};
for (String head : tableHeads) {
PdfPCell cell = createCell(head, font, Element.ALIGN_CENTER);
table.addCell(cell);
}
String total = moneyStyle(order.getTotal());
PdfPCell tableFoot = createCell(String.format("总金额:¥%s", total), font, Element.ALIGN_RIGHT);
tableFoot.setColspan(7);
table.addCell(tableFoot);
for (OrderItem orderItem : order.getItems()) {
Ware ware = orderItem.getWare();
table.addCell(createCell(ware.getCode(), font, Element.ALIGN_LEFT));
table.addCell(createCell(ware.getName(), font, Element.ALIGN_LEFT));
table.addCell(createCell(ware.getUnits(), font, Element.ALIGN_CENTER));
table.addCell(createCell(atMostTwoFraction(orderItem.getQuantity()), font, Element.ALIGN_RIGHT));
table.addCell(createCell(moneyStyle(orderItem.getPrice()), font, Element.ALIGN_RIGHT));
table.addCell(createCell(moneyStyle(orderItem.getWare().getPrice().getRetail()), font, Element.ALIGN_RIGHT));
table.addCell(createCell(moneyStyle(orderItem.getTotal()), font, Element.ALIGN_RIGHT));
}
doc.add(table);
doc.close();
return ostream.toByteArray();
} catch (DocumentException e) {
throw new RuntimeException(e);
}
}
private PdfPCell createCell(String content, Font font, int alignment) {
PdfPCell cell = new PdfPCell(new Phrase(content, font));
cell.setBorderWidth(config.getTableBorderWidth());
cell.setPadding(1);
cell.setHorizontalAlignment(alignment);
return cell;
}
private String atMostTwoFraction(BigDecimal decimal) {
DecimalFormat df = new DecimalFormat("#,##0.##");
String result = df.format(decimal);
return result;
}
private String moneyStyle(BigDecimal decimal) {
decimal.setScale(2, RoundingMode.HALF_UP);
DecimalFormat df = new DecimalFormat("#,##0.00");
String result = df.format(decimal);
return result;
}
}
| [
"trgoofi@gmail.com"
] | trgoofi@gmail.com |
6c90d2a12ca99175dbbed1f41f08f70f5d39914f | 25193bc71a8e8f8ec3b682722262381acb081675 | /app/src/main/java/com/example/local_json_read/CityList.java | 8be62d772d03e792cb45c6cba98ed0f7f791ffaa | [] | no_license | dogusipeksac/local_json_read | b284660bb82b76412459708c641abaae9b2fcf45 | 5e58d0502ecdc2aeea0b10f54b5e92da5dba3760 | refs/heads/master | 2023-07-09T16:51:49.847534 | 2021-08-09T17:17:04 | 2021-08-09T17:17:04 | 394,378,335 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 465 | java | package com.example.local_json_read;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class CityList {
@SerializedName("cityDetail")
@Expose
private List<CityDetail> cityDetail = null;
public List<CityDetail> getCityDetail() {
return cityDetail;
}
public void setCityDetail(List<CityDetail> cityDetail) {
this.cityDetail = cityDetail;
}
}
| [
"dogus.ads.1998@hotmail.com"
] | dogus.ads.1998@hotmail.com |
e3ffc5b68ab6965fe3e30cfde00b360b6852b05e | 3d32bae16cc5e43f3b56464950d7bb7cdf924b10 | /src/main/java/org/seckill/enums/SeckillStatEnum.java | 3a84444916650a1f251de1dc5251221aebf672a8 | [] | no_license | guanghuiyuan999/seckill | bd137bb2e721691c635104b0c92df906b78b3fb3 | 74b1051e2b577f3c25019ef773bd19586842ba4c | refs/heads/master | 2020-06-16T21:21:39.499577 | 2017-12-04T04:24:32 | 2017-12-04T04:24:32 | 75,065,196 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 840 | java | package org.seckill.enums;
/**
* 使用枚举表示数据字段
* Created by yuanguanghui on 2016/5/21.
*/
public enum SeckillStatEnum{
SUCCESS(1, "秒杀成功"),
END(0, "秒杀结束"),
REPEAT_KILL(-1, "重复秒杀"),
INNER_ERROE(-2, "系统异常"),
DATA_REWRITE(-3, "数据篡改");
private int state;
private String stateInfo;
SeckillStatEnum(int state, String stateInfo) {
this.state = state;
this.stateInfo = stateInfo;
}
public int getState() {
return state;
}
public String getStateInfo() {
return stateInfo;
}
public static SeckillStatEnum stateof(int index){
for(SeckillStatEnum state : values()){
if(state.getState()==index){
return state;
}
}
return null;
}
}
| [
"yuanguanghui999@gmail.com"
] | yuanguanghui999@gmail.com |
921aa78003b5c4a22b414693ff0c4db4e13c034d | b8f1ae843844b66c7f6c67634f1bbd10bc7c1cee | /com/fynal/item/SteelcnPick.java | b4d84347e307bf22a5fd4cc8a2023f1f2a91044c | [] | no_license | redaxed/coilcraft | 4b13155cbca71675b7a81d4640472fb182999b44 | 7263dba03767aa49d57bb479865405812a860380 | refs/heads/master | 2021-05-30T06:16:29.401261 | 2015-04-01T02:24:22 | 2015-04-01T02:24:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 445 | java | package com.fynal.item;
import net.minecraft.item.ItemPickaxe;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public class SteelcnPick extends ItemPickaxe{
protected SteelcnPick(ToolMaterial material) {
super(material);
}
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4){
par3List.add("Nickel-Carbon Alloy");
}
} | [
"chaken2@illinois.edu"
] | chaken2@illinois.edu |
e43b620b90ff669c4e0b60cd255ce81b45faaf7b | 7a9746b5c57033dcbf8fbcaa305a483c8423b173 | /src/main/java/imo/EndPaint.java | 2d8a4a0ecdf7fe3eb4f1369485cc274935b59618 | [] | no_license | piropiro/dragon2 | 6df21a01c65dfc91fddce303938fe19f3f0f165b | c89bd18b3c639de54894edc374974bc27f7305d3 | refs/heads/master | 2020-09-27T02:44:38.804859 | 2016-08-20T08:55:15 | 2016-08-20T08:55:15 | 66,137,895 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,290 | java |
package imo;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.KeyEvent;
import mine.Mine;
// Referenced classes of package imo:
// PaintListener, Images, MainWorks
public class EndPaint implements PaintListener {
EndPaint(MainWorks mainworks, int i) {
mw = mainworks;
type = i;
trueFlag = i == 5;
count = 0;
}
public void paint(Graphics g) {
int i = Math.min(320, count * 6);
if (trueFlag)
g.drawImage(Images.endi, 0, 0, 300, i, 180, 0, 480, i, null);
else
g.drawImage(Images.endi, 0, 0, 300, i, 0, 0, 300, i, null);
if ((count / 12) % 2 == 0)
g.setColor(Color.black);
else
g.setColor(new Color(180, 240, 180));
Mine.setAntialias(g, true);
g.setFont(Mine.getFont(14));
g.drawString("press C to close", 20, 290);
}
public void keyReleased(KeyEvent keyevent) {
}
public void keyPressed(KeyEvent keyevent) {
switch (keyevent.getKeyCode()) {
case 32: // ' '
case 67: // 'C'
mw.gameExit();
break;
case 27: // '\033'
case 88: // 'X'
mw.gameStart();
break;
}
}
public void run() {
mw.sleep(30L);
mw.repaint();
count++;
}
MainWorks mw;
private boolean trueFlag;
private int count;
private int type;
}
| [
"mela825@gmail.com"
] | mela825@gmail.com |
b7d6214f16a9473302cb015f60f25875b6bb6f42 | 87873856a23cd5ebdcd227ef39386fb33f5d6b13 | /java-best-of/src/main/java/io/jsd/training/designpattern/behavioural/command/party/pattern/MacroCommand.java | 82201c9d00fd5d516b07e6e067badd90ba8d2325 | [] | no_license | jsdumas/java-training | da204384223c3e7871ccbb8f4a73996ae55536f3 | 8df1da57ea7a5dd596fea9b70c6cd663534d9d18 | refs/heads/master | 2022-06-28T16:08:47.529631 | 2019-06-06T07:49:30 | 2019-06-06T07:49:30 | 113,677,424 | 0 | 0 | null | 2022-06-20T23:48:24 | 2017-12-09T14:55:56 | Java | UTF-8 | Java | false | false | 539 | java | package io.jsd.training.designpattern.behavioural.command.party.pattern;
public class MacroCommand implements Command {
Command[] commands;
public MacroCommand(Command[] commands) {
this.commands = commands;
}
public void execute() {
for (int i = 0; i < commands.length; i++) {
commands[i].execute();
}
}
/**
* NOTE: these commands have to be done backwards to ensure proper undo functionality
*/
public void undo() {
for (int i = commands.length -1; i >= 0; i--) {
commands[i].undo();
}
}
}
| [
"jsdumas@free.fr"
] | jsdumas@free.fr |
aaf8ec318a2712439b5010cc3048e812a814da04 | 76814bf67bb1662f641687a76425a1e4832231dc | /Plugin/src/main/java/com/dc/appengine/plugins/loader/ClassLoaderFactory.java | 41b22191377a91b5f0c896eff240421c834fefe3 | [] | no_license | lpy2017/smart-cd- | 9bc1b8ed24598bc168c2f74232e63d2f16d477ab | 955921b9baa63b005abe249f7cc14e9c8b8639ed | refs/heads/master | 2020-03-20T04:09:14.935206 | 2019-01-15T11:01:05 | 2019-01-15T11:01:05 | 137,172,699 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,348 | java | package com.dc.appengine.plugins.loader;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.List;
public class ClassLoaderFactory {
private static final String shareLib = System.getenv("localpackage") + File.separator + "pluginClass";
/**
* Get a new ServiceClassLoader
* @param classPath
* @return
*/
public static ServiceClassLoader getClassloader(String classPath) {
return new ServiceClassLoader(Thread.currentThread().getContextClassLoader(), classPath);
}
/**
* Get Independent ClassLoader
* @param classPath
* @return
*/
public static URLClassLoader getIndependentCL(String classPath) {
File cp = null;
if (classPath != null && !"".equals(classPath)) {
cp = new File(classPath);
}
File shared = new File(shareLib);
try {
List<URL> list = URLCollector.collect(shared);
URL[] urls = new URL[list.size() + (cp != null && cp.exists() ? 1 : 0)];
list.toArray(urls);
if (urls.length > list.size()) {
urls[urls.length - 1] = cp.toURL();
}
return new URLClassLoader(urls, Thread.currentThread().getContextClassLoader(), null);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return new URLClassLoader(null); //never comes here
}
}
| [
"395365661@qq.com"
] | 395365661@qq.com |
84a935a3713d791abdad1c77b44d185139a9eb89 | f0914a897b8c73ca3f08f680411b7503542ae420 | /server/appciip/src/ch/appciip/modele/StationManagerBean.java | 068ab9da5a8f0bf5a14c1971f95eb4f013b1022e | [] | no_license | gaelteguia/appciip | b417e504fa79363b7b588ef651f64b069202ce6c | c98e78e69749e6c367a2d54198d1106b280c91aa | refs/heads/master | 2021-01-18T03:33:55.903360 | 2017-06-16T09:24:10 | 2017-06-16T09:24:10 | 85,811,401 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,175 | java | package modele;
import static modele.Utilitaire.fermeturesSilencieuses;
import static modele.Utilitaire.initialisationRequetePreparee;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import org.joda.time.DateTime;
import beans.Station;
import beans.Collaborateur;
import beans.Fournisseur;
import beans.Salle;
public class StationManagerBean implements StationManager {
private static final String SQL_SELECT_PAR_NUMERO = "SELECT * FROM station WHERE numero =?";
private static final String SQL_SELECT = "SELECT * FROM station";
private static final String SQL_SELECT_PAR_ID = "SELECT * FROM station WHERE id_station = ?";
private static final String SQL_INSERT = "INSERT INTO station (numero,prix,marque,modele,os,amortissement,type,date_achat,date_peremption,id_collaborateur,id_fournisseur,id_salle) VALUES(UPPER(?),?,?,?,?,?,?,?,?,?,?,?)";
private static final String SQL_UPDATE = "UPDATE station SET numero=UPPER(?),prix=?,marque=?,modele=?,os=?,amortissement=?,type=?,date_achat=?,date_peremption=?,id_collaborateur=?,id_fournisseur=?,id_salle=? WHERE id_station =?";
private static final String SQL_DELETE_PAR_ID = "DELETE FROM Station WHERE id_station = ?";
private Factory factory;
public StationManagerBean(Factory factory) {
this.factory = factory;
}
@Override
public Station retrouver(Station station) throws DatabaseException {
if (station.getId() != null)
return retrouver(SQL_SELECT_PAR_ID, station.getId());
return retrouver(SQL_SELECT_PAR_NUMERO, station.getNumero());
}
private Station retrouver(String sql, Object... objets) throws DatabaseException {
Connection connexion = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
Station station = null;
try {
/* R�cup�ration d'une connexion depuis la Factory */
connexion = factory.getConnection();
/*
* Pr�paration de la requ�te avec les objets pass�s en arguments et
* ex�cution.
*/
preparedStatement = initialisationRequetePreparee(connexion, sql, false, objets);
resultSet = preparedStatement.executeQuery();
/* Parcours de la ligne de donn�es retourn�e dans le ResultSet */
if (resultSet.next()) {
station = map(resultSet);
}
} catch (SQLException e) {
throw new DatabaseException(e);
} finally {
fermeturesSilencieuses(resultSet, preparedStatement, connexion);
}
return station;
}
@Override
public void supprimer(Station station) throws DatabaseException {
Connection connexion = null;
PreparedStatement preparedStatement = null;
try {
connexion = factory.getConnection();
preparedStatement = initialisationRequetePreparee(connexion, SQL_DELETE_PAR_ID, true, station.getId());
int statut = preparedStatement.executeUpdate();
if (statut == 0) {
throw new DatabaseException(
"�chec de la suppression de l'station, aucune ligne supprim�e de la table.");
} else {
station.setId(null);
}
} catch (SQLException e) {
throw new DatabaseException(e);
} finally {
fermeturesSilencieuses(preparedStatement, connexion);
}
}
/*
* Impl�mentation de la m�thode d�finie dans l'interface StationManager
*/
@Override
public List<Station> lister() throws DatabaseException {
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
List<Station> clients = new ArrayList<Station>();
try {
connection = factory.getConnection();
preparedStatement = connection.prepareStatement(SQL_SELECT);
resultSet = preparedStatement.executeQuery();
while (resultSet.next()) {
clients.add(map(resultSet));
}
} catch (SQLException e) {
throw new DatabaseException(e);
} finally {
fermeturesSilencieuses(resultSet, preparedStatement, connection);
}
return clients;
}
@Override
public void modifier(Station station) throws DatabaseException {
Long idCollaborateur = null;
Long idFournisseur = null;
Long idSalle = null;
if (station.getCollaborateur() != null)
idCollaborateur = station.getCollaborateur().getId();
if (station.getFournisseur() != null)
idFournisseur = station.getFournisseur().getId();
if (station.getSalle() != null)
idSalle = station.getSalle().getId();
modifier(SQL_UPDATE, station.getNumero(), station.getPrix(), station.getMarque(), station.getModele(),
station.getOs(), station.getAmortissement(), station.getType(), station.getDateAchat(),
station.getDatePeremption(), idCollaborateur, idFournisseur, idSalle, station.getId());
}
@Override
public Station creer(Station station) throws DatabaseException {
Connection connexion = null;
PreparedStatement preparedStatement = null;
ResultSet valeursAutoGenerees = null;
Long idCollaborateur = null;
Long idFournisseur = null;
Long idSalle = null;
if (station.getCollaborateur() != null)
idCollaborateur = station.getCollaborateur().getId();
if (station.getFournisseur() != null)
idFournisseur = station.getFournisseur().getId();
if (station.getSalle() != null)
idSalle = station.getSalle().getId();
try {
connexion = factory.getConnection();
preparedStatement = initialisationRequetePreparee(connexion, SQL_INSERT, true, station.getNumero(),
station.getPrix(), station.getMarque(), station.getModele(), station.getOs(),
station.getAmortissement(), station.getType(), station.getDateAchat(), station.getDatePeremption(),
idCollaborateur, idFournisseur, idSalle);
int statut = preparedStatement.executeUpdate();
if (statut == 0) {
throw new DatabaseException("�chec de la cr�ation de l'station, aucune ligne ajout�e dans la table.");
}
valeursAutoGenerees = preparedStatement.getGeneratedKeys();
if (valeursAutoGenerees.next()) {
station = retrouver(new Station((valeursAutoGenerees.getLong(1))));
} else {
throw new DatabaseException(
"�chec de la cr�ation de l'station en base, aucun ID auto-g�n�r� retourn�.");
}
} catch (SQLException e) {
throw new DatabaseException(e);
} finally {
fermeturesSilencieuses(valeursAutoGenerees, preparedStatement, connexion);
}
return station;
}
private Station map(ResultSet resultSet) throws SQLException {
Station station = new Station();
Timestamp dateAchat = resultSet.getTimestamp("date_achat");
if (dateAchat != null)
station.setDateAchat(new DateTime(dateAchat));
Timestamp datePeremption = resultSet.getTimestamp("date_peremption");
if (datePeremption != null)
station.setDatePeremption(new DateTime(datePeremption));
station.setId(resultSet.getLong("id_station"));
station.setNumero(resultSet.getString("numero"));
station.setPrix(resultSet.getBigDecimal("prix"));
station.setMarque(resultSet.getString("marque"));
station.setModele(resultSet.getString("modele"));
station.setOs(resultSet.getString("os"));
station.setAmortissement(resultSet.getFloat("amortissement"));
station.setType(resultSet.getString("type"));
CollaborateurManager collaborateur = factory.getCollaborateurManager();
station.setCollaborateur(collaborateur.retrouver(new Utilisateur(resultSet.getLong("id_collaborateur"))));
FournisseurManager fournisseur = factory.getFournisseurManager();
station.setFournisseur(fournisseur.retrouver(new Fournisseur(resultSet.getLong("id_fournisseur"))));
SalleManager salle = factory.getSalleManager();
station.setSalle(salle.retrouver(new Salle(resultSet.getLong("id_salle"))));
return station;
}
private void modifier(String sql, Object... objets) throws DatabaseException {
Connection connexion = null;
PreparedStatement preparedStatement = null;
ResultSet valeursAutoGenerees = null;
try {
connexion = factory.getConnection();
preparedStatement = initialisationRequetePreparee(connexion, sql, false, objets);
preparedStatement.executeUpdate();
} catch (SQLException e) {
throw new DatabaseException(e);
} finally {
fermeturesSilencieuses(valeursAutoGenerees, preparedStatement, connexion);
}
}
}
| [
"gael.teguia@gmail.com"
] | gael.teguia@gmail.com |
3ed46c2a8552183917136d3864fe0e924a3ef4a9 | 74b47b895b2f739612371f871c7f940502e7165b | /aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/LocalGatewayVirtualInterfaceGroup.java | 1a7ec146a4418ba65578a04db155bd3c9e936d87 | [
"Apache-2.0"
] | permissive | baganda07/aws-sdk-java | fe1958ed679cd95b4c48f971393bf03eb5512799 | f19bdb30177106b5d6394223a40a382b87adf742 | refs/heads/master | 2022-11-09T21:55:43.857201 | 2022-10-24T21:08:19 | 2022-10-24T21:08:19 | 221,028,223 | 0 | 0 | Apache-2.0 | 2019-11-11T16:57:12 | 2019-11-11T16:57:11 | null | UTF-8 | Java | false | false | 13,753 | java | /*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.ec2.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
* <p>
* Describes a local gateway virtual interface group.
* </p>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/LocalGatewayVirtualInterfaceGroup"
* target="_top">AWS API Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class LocalGatewayVirtualInterfaceGroup implements Serializable, Cloneable {
/**
* <p>
* The ID of the virtual interface group.
* </p>
*/
private String localGatewayVirtualInterfaceGroupId;
/**
* <p>
* The IDs of the virtual interfaces.
* </p>
*/
private com.amazonaws.internal.SdkInternalList<String> localGatewayVirtualInterfaceIds;
/**
* <p>
* The ID of the local gateway.
* </p>
*/
private String localGatewayId;
/**
* <p>
* The ID of the Amazon Web Services account that owns the local gateway virtual interface group.
* </p>
*/
private String ownerId;
/**
* <p>
* The tags assigned to the virtual interface group.
* </p>
*/
private com.amazonaws.internal.SdkInternalList<Tag> tags;
/**
* <p>
* The ID of the virtual interface group.
* </p>
*
* @param localGatewayVirtualInterfaceGroupId
* The ID of the virtual interface group.
*/
public void setLocalGatewayVirtualInterfaceGroupId(String localGatewayVirtualInterfaceGroupId) {
this.localGatewayVirtualInterfaceGroupId = localGatewayVirtualInterfaceGroupId;
}
/**
* <p>
* The ID of the virtual interface group.
* </p>
*
* @return The ID of the virtual interface group.
*/
public String getLocalGatewayVirtualInterfaceGroupId() {
return this.localGatewayVirtualInterfaceGroupId;
}
/**
* <p>
* The ID of the virtual interface group.
* </p>
*
* @param localGatewayVirtualInterfaceGroupId
* The ID of the virtual interface group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LocalGatewayVirtualInterfaceGroup withLocalGatewayVirtualInterfaceGroupId(String localGatewayVirtualInterfaceGroupId) {
setLocalGatewayVirtualInterfaceGroupId(localGatewayVirtualInterfaceGroupId);
return this;
}
/**
* <p>
* The IDs of the virtual interfaces.
* </p>
*
* @return The IDs of the virtual interfaces.
*/
public java.util.List<String> getLocalGatewayVirtualInterfaceIds() {
if (localGatewayVirtualInterfaceIds == null) {
localGatewayVirtualInterfaceIds = new com.amazonaws.internal.SdkInternalList<String>();
}
return localGatewayVirtualInterfaceIds;
}
/**
* <p>
* The IDs of the virtual interfaces.
* </p>
*
* @param localGatewayVirtualInterfaceIds
* The IDs of the virtual interfaces.
*/
public void setLocalGatewayVirtualInterfaceIds(java.util.Collection<String> localGatewayVirtualInterfaceIds) {
if (localGatewayVirtualInterfaceIds == null) {
this.localGatewayVirtualInterfaceIds = null;
return;
}
this.localGatewayVirtualInterfaceIds = new com.amazonaws.internal.SdkInternalList<String>(localGatewayVirtualInterfaceIds);
}
/**
* <p>
* The IDs of the virtual interfaces.
* </p>
* <p>
* <b>NOTE:</b> This method appends the values to the existing list (if any). Use
* {@link #setLocalGatewayVirtualInterfaceIds(java.util.Collection)} or
* {@link #withLocalGatewayVirtualInterfaceIds(java.util.Collection)} if you want to override the existing values.
* </p>
*
* @param localGatewayVirtualInterfaceIds
* The IDs of the virtual interfaces.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LocalGatewayVirtualInterfaceGroup withLocalGatewayVirtualInterfaceIds(String... localGatewayVirtualInterfaceIds) {
if (this.localGatewayVirtualInterfaceIds == null) {
setLocalGatewayVirtualInterfaceIds(new com.amazonaws.internal.SdkInternalList<String>(localGatewayVirtualInterfaceIds.length));
}
for (String ele : localGatewayVirtualInterfaceIds) {
this.localGatewayVirtualInterfaceIds.add(ele);
}
return this;
}
/**
* <p>
* The IDs of the virtual interfaces.
* </p>
*
* @param localGatewayVirtualInterfaceIds
* The IDs of the virtual interfaces.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LocalGatewayVirtualInterfaceGroup withLocalGatewayVirtualInterfaceIds(java.util.Collection<String> localGatewayVirtualInterfaceIds) {
setLocalGatewayVirtualInterfaceIds(localGatewayVirtualInterfaceIds);
return this;
}
/**
* <p>
* The ID of the local gateway.
* </p>
*
* @param localGatewayId
* The ID of the local gateway.
*/
public void setLocalGatewayId(String localGatewayId) {
this.localGatewayId = localGatewayId;
}
/**
* <p>
* The ID of the local gateway.
* </p>
*
* @return The ID of the local gateway.
*/
public String getLocalGatewayId() {
return this.localGatewayId;
}
/**
* <p>
* The ID of the local gateway.
* </p>
*
* @param localGatewayId
* The ID of the local gateway.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LocalGatewayVirtualInterfaceGroup withLocalGatewayId(String localGatewayId) {
setLocalGatewayId(localGatewayId);
return this;
}
/**
* <p>
* The ID of the Amazon Web Services account that owns the local gateway virtual interface group.
* </p>
*
* @param ownerId
* The ID of the Amazon Web Services account that owns the local gateway virtual interface group.
*/
public void setOwnerId(String ownerId) {
this.ownerId = ownerId;
}
/**
* <p>
* The ID of the Amazon Web Services account that owns the local gateway virtual interface group.
* </p>
*
* @return The ID of the Amazon Web Services account that owns the local gateway virtual interface group.
*/
public String getOwnerId() {
return this.ownerId;
}
/**
* <p>
* The ID of the Amazon Web Services account that owns the local gateway virtual interface group.
* </p>
*
* @param ownerId
* The ID of the Amazon Web Services account that owns the local gateway virtual interface group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LocalGatewayVirtualInterfaceGroup withOwnerId(String ownerId) {
setOwnerId(ownerId);
return this;
}
/**
* <p>
* The tags assigned to the virtual interface group.
* </p>
*
* @return The tags assigned to the virtual interface group.
*/
public java.util.List<Tag> getTags() {
if (tags == null) {
tags = new com.amazonaws.internal.SdkInternalList<Tag>();
}
return tags;
}
/**
* <p>
* The tags assigned to the virtual interface group.
* </p>
*
* @param tags
* The tags assigned to the virtual interface group.
*/
public void setTags(java.util.Collection<Tag> tags) {
if (tags == null) {
this.tags = null;
return;
}
this.tags = new com.amazonaws.internal.SdkInternalList<Tag>(tags);
}
/**
* <p>
* The tags assigned to the virtual interface group.
* </p>
* <p>
* <b>NOTE:</b> This method appends the values to the existing list (if any). Use
* {@link #setTags(java.util.Collection)} or {@link #withTags(java.util.Collection)} if you want to override the
* existing values.
* </p>
*
* @param tags
* The tags assigned to the virtual interface group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LocalGatewayVirtualInterfaceGroup withTags(Tag... tags) {
if (this.tags == null) {
setTags(new com.amazonaws.internal.SdkInternalList<Tag>(tags.length));
}
for (Tag ele : tags) {
this.tags.add(ele);
}
return this;
}
/**
* <p>
* The tags assigned to the virtual interface group.
* </p>
*
* @param tags
* The tags assigned to the virtual interface group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LocalGatewayVirtualInterfaceGroup withTags(java.util.Collection<Tag> tags) {
setTags(tags);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getLocalGatewayVirtualInterfaceGroupId() != null)
sb.append("LocalGatewayVirtualInterfaceGroupId: ").append(getLocalGatewayVirtualInterfaceGroupId()).append(",");
if (getLocalGatewayVirtualInterfaceIds() != null)
sb.append("LocalGatewayVirtualInterfaceIds: ").append(getLocalGatewayVirtualInterfaceIds()).append(",");
if (getLocalGatewayId() != null)
sb.append("LocalGatewayId: ").append(getLocalGatewayId()).append(",");
if (getOwnerId() != null)
sb.append("OwnerId: ").append(getOwnerId()).append(",");
if (getTags() != null)
sb.append("Tags: ").append(getTags());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof LocalGatewayVirtualInterfaceGroup == false)
return false;
LocalGatewayVirtualInterfaceGroup other = (LocalGatewayVirtualInterfaceGroup) obj;
if (other.getLocalGatewayVirtualInterfaceGroupId() == null ^ this.getLocalGatewayVirtualInterfaceGroupId() == null)
return false;
if (other.getLocalGatewayVirtualInterfaceGroupId() != null
&& other.getLocalGatewayVirtualInterfaceGroupId().equals(this.getLocalGatewayVirtualInterfaceGroupId()) == false)
return false;
if (other.getLocalGatewayVirtualInterfaceIds() == null ^ this.getLocalGatewayVirtualInterfaceIds() == null)
return false;
if (other.getLocalGatewayVirtualInterfaceIds() != null
&& other.getLocalGatewayVirtualInterfaceIds().equals(this.getLocalGatewayVirtualInterfaceIds()) == false)
return false;
if (other.getLocalGatewayId() == null ^ this.getLocalGatewayId() == null)
return false;
if (other.getLocalGatewayId() != null && other.getLocalGatewayId().equals(this.getLocalGatewayId()) == false)
return false;
if (other.getOwnerId() == null ^ this.getOwnerId() == null)
return false;
if (other.getOwnerId() != null && other.getOwnerId().equals(this.getOwnerId()) == false)
return false;
if (other.getTags() == null ^ this.getTags() == null)
return false;
if (other.getTags() != null && other.getTags().equals(this.getTags()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getLocalGatewayVirtualInterfaceGroupId() == null) ? 0 : getLocalGatewayVirtualInterfaceGroupId().hashCode());
hashCode = prime * hashCode + ((getLocalGatewayVirtualInterfaceIds() == null) ? 0 : getLocalGatewayVirtualInterfaceIds().hashCode());
hashCode = prime * hashCode + ((getLocalGatewayId() == null) ? 0 : getLocalGatewayId().hashCode());
hashCode = prime * hashCode + ((getOwnerId() == null) ? 0 : getOwnerId().hashCode());
hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode());
return hashCode;
}
@Override
public LocalGatewayVirtualInterfaceGroup clone() {
try {
return (LocalGatewayVirtualInterfaceGroup) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}
| [
""
] | |
9ab529e92808c995465281657cf9acdd1d9a6d0e | fc4150290b10e2e331b55e54e628798eabaa47ad | /HAL/src/jkt/hms/masters/business/base/BaseStoreCopyAddressList.java | ef5a369a9b8d58210c77d072db20c64e4796f626 | [] | no_license | vadhwa11/newproject2 | 8e40bd4acfd4edc6b721eeca8636f8b7d589af2b | fc9bd770fdadf650f004323f85884dc143827f4d | refs/heads/master | 2020-05-05T04:01:05.628775 | 2019-04-05T14:38:10 | 2019-04-05T14:38:10 | 179,694,408 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,472 | java | package jkt.hms.masters.business.base;
import java.io.Serializable;
/**
* This is an object that contains data related to the store_copy_address_list
* table. Do not modify this class because it will be overwritten if the
* configuration file related to this class is modified.
*
* @hibernate.class table="store_copy_address_list"
*/
public abstract class BaseStoreCopyAddressList implements Serializable {
public static String REF = "StoreCopyAddressList";
public static String PROP_ADDRESS4 = "Address4";
public static String PROP_DESCRIPTION = "Description";
public static String PROP_ADDRESS3 = "Address3";
public static String PROP_ADDRESS1 = "Address1";
public static String PROP_ID = "Id";
public static String PROP_ADDRESS2 = "Address2";
// constructors
public BaseStoreCopyAddressList() {
initialize();
}
/**
* Constructor for primary key
*/
public BaseStoreCopyAddressList(java.lang.Integer id) {
this.setId(id);
initialize();
}
/**
* Constructor for required fields
*/
public BaseStoreCopyAddressList(java.lang.Integer id,
java.lang.String description, java.lang.String address1) {
this.setId(id);
this.setDescription(description);
this.setAddress1(address1);
initialize();
}
protected void initialize() {
}
private int hashCode = Integer.MIN_VALUE;
// primary key
private java.lang.Integer id;
// fields
private java.lang.String description;
private java.lang.String address1;
private java.lang.String address2;
private java.lang.String address3;
private java.lang.String address4;
/**
* Return the unique identifier of this class
*
* @hibernate.id generator-class="native" column="id"
*/
public java.lang.Integer getId() {
return id;
}
/**
* Set the unique identifier of this class
*
* @param id
* the new ID
*/
public void setId(java.lang.Integer id) {
this.id = id;
this.hashCode = Integer.MIN_VALUE;
}
/**
* Return the value associated with the column: description
*/
public java.lang.String getDescription() {
return description;
}
/**
* Set the value related to the column: description
*
* @param description
* the description value
*/
public void setDescription(java.lang.String description) {
this.description = description;
}
/**
* Return the value associated with the column: address1
*/
public java.lang.String getAddress1() {
return address1;
}
/**
* Set the value related to the column: address1
*
* @param address1
* the address1 value
*/
public void setAddress1(java.lang.String address1) {
this.address1 = address1;
}
/**
* Return the value associated with the column: address2
*/
public java.lang.String getAddress2() {
return address2;
}
/**
* Set the value related to the column: address2
*
* @param address2
* the address2 value
*/
public void setAddress2(java.lang.String address2) {
this.address2 = address2;
}
/**
* Return the value associated with the column: address3
*/
public java.lang.String getAddress3() {
return address3;
}
/**
* Set the value related to the column: address3
*
* @param address3
* the address3 value
*/
public void setAddress3(java.lang.String address3) {
this.address3 = address3;
}
/**
* Return the value associated with the column: address4
*/
public java.lang.String getAddress4() {
return address4;
}
/**
* Set the value related to the column: address4
*
* @param address4
* the address4 value
*/
public void setAddress4(java.lang.String address4) {
this.address4 = address4;
}
public boolean equals(Object obj) {
if (null == obj)
return false;
if (!(obj instanceof jkt.hms.masters.business.StoreCopyAddressList))
return false;
else {
jkt.hms.masters.business.StoreCopyAddressList storeCopyAddressList = (jkt.hms.masters.business.StoreCopyAddressList) obj;
if (null == this.getId() || null == storeCopyAddressList.getId())
return false;
else
return (this.getId().equals(storeCopyAddressList.getId()));
}
}
public int hashCode() {
if (Integer.MIN_VALUE == this.hashCode) {
if (null == this.getId())
return super.hashCode();
else {
String hashStr = this.getClass().getName() + ":"
+ this.getId().hashCode();
this.hashCode = hashStr.hashCode();
}
}
return this.hashCode;
}
public String toString() {
return super.toString();
}
} | [
"vadhwa11@gmail.com"
] | vadhwa11@gmail.com |
19b54e8e712311896d235c23cda502bf827c3a2a | 233def926a3f4f6131333f087538b2fbc6610dbf | /pluralsight-springcloud-m3-tasksink/src/main/java/pluralsight/demo/PluralsightSpringcloudM3TasksinkApplication.java | 3f87ba65ab22b2def2ecde102b3a580f69895211 | [] | no_license | justin-tuck/springCloud | cedb75cc4f6f40089113545d4cebe1c9385d65d5 | 651eb17ff2e0c10a24aea5cf973f578b14cee05c | refs/heads/master | 2021-05-09T05:08:24.573343 | 2018-01-28T21:49:53 | 2018-01-28T21:49:53 | 119,300,612 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 458 | java | package pluralsight.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.task.launcher.annotation.EnableTaskLauncher;
@SpringBootApplication
@EnableTaskLauncher
public class PluralsightSpringcloudM3TasksinkApplication {
public static void main(String[] args) {
SpringApplication.run(PluralsightSpringcloudM3TasksinkApplication.class, args);
}
}
| [
"p.justin.tuck@gmail.com"
] | p.justin.tuck@gmail.com |
6867129dc0c3857125020c396fae48200ec80dd6 | f0738fffc59729a2592d134d08b514ac222a20be | /sl-core/src/main/java/cn.pg.sl.core/model/UnitFuncIndicatorPara.java | 0722c0ee648dc7f3285894bff64687f23922e064 | [] | no_license | aligenzhong/StrategyLayout | 7869c6f09a504d05bf040f6e0ab46c321b549f13 | 2a8a02ed135bec7feed9fd2ec705b0a14d622ed4 | refs/heads/master | 2022-07-14T15:07:45.093202 | 2020-05-16T03:39:38 | 2020-05-16T04:38:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 318 | java | package cn.pg.sl.core.model;
import lombok.AllArgsConstructor;
import lombok.Data;
/**
* @author lianzheng04
* @version 1.0
* @date 2020/5/3 10:52 下午
*/
@Data
@AllArgsConstructor
public class UnitFuncIndicatorPara {
private final String name;//接口中参数名称
private final String dataType;
}
| [
"lianzheng04@meituan.com"
] | lianzheng04@meituan.com |
1fa60f414a3a5502f892e1f338ff0e915ed52122 | 22502066dd1ca547f6e7b5de7970ae4e2e9c1349 | /app/src/main/java/com/jiewen/qrcodepay/util/QrCodeUtil.java | 30ca8c3f1e799afd6c98330e513ba6a8781af46f | [] | no_license | springwindyike/QrcodePay | 1a1bf7f101ae00bdd609157e712eed792adf3ae0 | 8d17a177e519cd8190c9b237ce637d60de22a530 | refs/heads/master | 2022-11-14T17:32:48.481572 | 2020-07-14T00:47:20 | 2020-07-14T00:47:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,637 | java | package com.jiewen.qrcodepay.util;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.text.TextUtils;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
import java.util.Hashtable;
public class QrCodeUtil {
/**
* 二维码生成工具
* */
/**
* 生成简单二维码
*
* @param content 字符串内容
* @param width 二维码宽度
* @param height 二维码高度
* @param character_set 编码方式(一般使用UTF-8)
* @param error_correction_level 容错率 L:7% M:15% Q:25% H:35%
* @param margin 空白边距(二维码与边框的空白区域)
* @param color_black 黑色色块
* @param color_white 白色色块
* @return BitMap
*/
//createQRCodeBitmap(content, 800, 800,"UTF-8","H", "1", Color.BLACK, Color.WHITE);
public static Bitmap createQRCodeBitmap(String content, int width,int height,
String character_set,String error_correction_level,
String margin,int color_black, int color_white) {
// 字符串内容判空
if (TextUtils.isEmpty(content)) {
return null;
}
// 宽和高>=0
if (width < 0 || height < 0) {
return null;
}
try {
/** 1.设置二维码相关配置 */
Hashtable<EncodeHintType, String> hints = new Hashtable<>();
// 字符转码格式设置
if (!TextUtils.isEmpty(character_set)) {
hints.put(EncodeHintType.CHARACTER_SET, character_set);
}
// 容错率设置
if (!TextUtils.isEmpty(error_correction_level)) {
hints.put(EncodeHintType.ERROR_CORRECTION, error_correction_level);
}
// 空白边距设置
if (!TextUtils.isEmpty(margin)) {
hints.put(EncodeHintType.MARGIN, margin);
}
/** 2.将配置参数传入到QRCodeWriter的encode方法生成BitMatrix(位矩阵)对象 */
BitMatrix bitMatrix = new QRCodeWriter().encode(content, BarcodeFormat.QR_CODE, width, height, hints);
/** 3.创建像素数组,并根据BitMatrix(位矩阵)对象为数组元素赋颜色值 */
int[] pixels = new int[width * height];
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
//bitMatrix.get(x,y)方法返回true是黑色色块,false是白色色块
if (bitMatrix.get(x, y)) {
pixels[y * width + x] = color_black;//黑色色块像素设置
} else {
pixels[y * width + x] = color_white;// 白色色块像素设置
}
}
}
/** 4.创建Bitmap对象,根据像素数组设置Bitmap每个像素点的颜色值,并返回Bitmap对象 */
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
bitmap.setPixels(pixels, 0, width, 0, 0, width, height);
return bitmap;
} catch (WriterException e) {
e.printStackTrace();
return null;
}
}
/**
* 向二维码中间添加logo图片(图片合成)
*
* @param srcBitmap 原图片(生成的简单二维码图片)
* @param logoBitmap logo图片
* @param logoPercent 百分比 (用于调整logo图片在原图片中的显示大小, 取值范围[0,1] )
* @return
*/
//createQRCodeBitmap(content, 800, 800,"UTF-8","H", "1", Color.GREEN, Color.WHITE);
private static Bitmap addLogo(Bitmap srcBitmap, Bitmap logoBitmap, float logoPercent){
if(srcBitmap == null){
return null;
}
if(logoBitmap == null){
return srcBitmap;
}
//传值不合法时使用0.2F
if(logoPercent < 0F || logoPercent > 1F){
logoPercent = 0.2F;
}
/** 1. 获取原图片和Logo图片各自的宽、高值 */
int srcWidth = srcBitmap.getWidth();
int srcHeight = srcBitmap.getHeight();
int logoWidth = logoBitmap.getWidth();
int logoHeight = logoBitmap.getHeight();
/** 2. 计算画布缩放的宽高比 */
float scaleWidth = srcWidth * logoPercent / logoWidth;
float scaleHeight = srcHeight * logoPercent / logoHeight;
/** 3. 使用Canvas绘制,合成图片 */
Bitmap bitmap = Bitmap.createBitmap(srcWidth, srcHeight, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
canvas.drawBitmap(srcBitmap, 0, 0, null);
canvas.scale(scaleWidth, scaleHeight, srcWidth/2, srcHeight/2);
canvas.drawBitmap(logoBitmap, srcWidth/2 - logoWidth/2, srcHeight/2 - logoHeight/2, null);
return bitmap;
}
/**
*
* @param content 字符串内容
* @param width 二维码宽度
* @param height 二维码高度
* @param character_set 编码方式(一般使用UTF-8)
* @param error_correction_level 容错率 L:7% M:15% Q:25% H:35%
* @param margin 空白边距(二维码与边框的空白区域)
* @param color_black 黑色色块
* @param color_white 白色色块
* @param logoBitmap logo图片
* @param logoPercent logo所占百分比
* @return
*/
//Resources res = getResources();
//Bitmap logoBitmap= BitmapFactory.decodeResource(res,R.mipmap.logo);
//createQRCodeBitmap(content, 800, 800,"UTF-8","H", "1", Color.BLACK, Color.WHITE,logoBitmap,0.2F);
public static Bitmap createQRCodeBitmap(String content, int width, int height, String character_set,
String error_correction_level,String margin, int color_black,
int color_white,Bitmap logoBitmap, float logoPercent) {
// 字符串内容判空
if (TextUtils.isEmpty(content)) {
return null;
}
// 宽和高>=0
if (width < 0 || height < 0) {
return null;
}
try {
/** 1.设置二维码相关配置,生成BitMatrix(位矩阵)对象 */
Hashtable<EncodeHintType, String> hints = new Hashtable<>();
// 字符转码格式设置
if (!TextUtils.isEmpty(character_set)) {
hints.put(EncodeHintType.CHARACTER_SET, character_set);
}
// 容错率设置
if (!TextUtils.isEmpty(error_correction_level)) {
hints.put(EncodeHintType.ERROR_CORRECTION, error_correction_level);
}
// 空白边距设置
if (!TextUtils.isEmpty(margin)) {
hints.put(EncodeHintType.MARGIN, margin);
}
/** 2.将配置参数传入到QRCodeWriter的encode方法生成BitMatrix(位矩阵)对象 */
BitMatrix bitMatrix = new QRCodeWriter().encode(content, BarcodeFormat.QR_CODE, width, height, hints);
/** 3.创建像素数组,并根据BitMatrix(位矩阵)对象为数组元素赋颜色值 */
int[] pixels = new int[width * height];
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
//bitMatrix.get(x,y)方法返回true是黑色色块,false是白色色块
if (bitMatrix.get(x, y)) {
pixels[y * width + x] = color_black;//黑色色块像素设置
} else {
pixels[y * width + x] = color_white;// 白色色块像素设置
}
}
}
/** 4.创建Bitmap对象,根据像素数组设置Bitmap每个像素点的颜色值,并返回Bitmap对象 */
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
bitmap.setPixels(pixels, 0, width, 0, 0, width, height);
/** 5.为二维码添加logo图标 */
if(logoBitmap != null){
return addLogo(bitmap, logoBitmap, logoPercent);
}
return bitmap;
} catch (WriterException e) {
e.printStackTrace();
return null;
}
}
/**
* 生成自定义二维码
*
* @param content 字符串内容
* @param width 二维码宽度
* @param height 二维码高度
* @param character_set 编码方式(一般使用UTF-8)
* @param error_correction_level 容错率 L:7% M:15% Q:25% H:35%
* @param margin 空白边距(二维码与边框的空白区域)
* @param color_black 黑色色块
* @param color_white 白色色块
* @param logoBitmap logo图片(传null时不添加logo)
* @param logoPercent logo所占百分比
* @param bitmap_black 用来代替黑色色块的图片(传null时不代替)
* @return
*/
//
public static Bitmap createQRCodeBitmap(String content, int width, int height, String character_set, String error_correction_level,
String margin, int color_black, int color_white, Bitmap logoBitmap, float logoPercent, Bitmap bitmap_black) {
// 字符串内容判空
if (TextUtils.isEmpty(content)) {
return null;
}
// 宽和高>=0
if (width < 0 || height < 0) {
return null;
}
try {
/** 1.设置二维码相关配置,生成BitMatrix(位矩阵)对象 */
Hashtable<EncodeHintType, String> hints = new Hashtable<>();
// 字符转码格式设置
if (!TextUtils.isEmpty(character_set)) {
hints.put(EncodeHintType.CHARACTER_SET, character_set);
}
// 容错率设置
if (!TextUtils.isEmpty(error_correction_level)) {
hints.put(EncodeHintType.ERROR_CORRECTION, error_correction_level);
}
// 空白边距设置
if (!TextUtils.isEmpty(margin)) {
hints.put(EncodeHintType.MARGIN, margin);
}
/** 2.将配置参数传入到QRCodeWriter的encode方法生成BitMatrix(位矩阵)对象 */
BitMatrix bitMatrix = new QRCodeWriter().encode(content, BarcodeFormat.QR_CODE, width, height, hints);
/** 3.创建像素数组,并根据BitMatrix(位矩阵)对象为数组元素赋颜色值 */
if (bitmap_black != null) {
//从当前位图按一定的比例创建一个新的位图
bitmap_black = Bitmap.createScaledBitmap(bitmap_black, width, height, false);
}
int[] pixels = new int[width * height];
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
//bitMatrix.get(x,y)方法返回true是黑色色块,false是白色色块
if (bitMatrix.get(x, y)) {// 黑色色块像素设置
if (bitmap_black != null) {//图片不为null,则将黑色色块换为新位图的像素。
pixels[y * width + x] = bitmap_black.getPixel(x, y);
} else {
pixels[y * width + x] = color_black;
}
} else {
pixels[y * width + x] = color_white;// 白色色块像素设置
}
}
}
/** 4.创建Bitmap对象,根据像素数组设置Bitmap每个像素点的颜色值,并返回Bitmap对象 */
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
bitmap.setPixels(pixels, 0, width, 0, 0, width, height);
/** 5.为二维码添加logo图标 */
if (logoBitmap != null) {
return addLogo(bitmap, logoBitmap, logoPercent);
}
return bitmap;
} catch (WriterException e) {
e.printStackTrace();
return null;
}
}
}
| [
"595379642@qq.com"
] | 595379642@qq.com |
3e3e8bd45bc5e66b6e76b166737ec72bf2c14480 | 4be60410bfc07e3f71fa8b738d7a33235e803914 | /Automation/src/JavaScriptConcept/ScrollToSpecificElement.java | d76f08bdc0469a29de9e7bc8ede76bb0d06c40f2 | [] | no_license | summitbarman/Automation_Eclipse | 21407d044f143e3d7ab685f63827cf9b99beded7 | 8383992a360a983e426d734b2bcff11f8ac84992 | refs/heads/master | 2021-01-22T10:40:21.973768 | 2017-05-29T08:49:57 | 2017-05-29T08:49:57 | 92,650,199 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 876 | java | package JavaScriptConcept;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class ScrollToSpecificElement
{
public static void main(String[] args) throws Exception
{
WebDriver driver=new FirefoxDriver();
driver.navigate().to("https://news.google.co.in/");
String element="//span[contains(text(),'Entertainment')]";
WebElement e=driver.findElement(By.xpath(element));
int y=e.getLocation().getY();
System.out.println(y);
JavascriptExecutor j=(JavascriptExecutor)driver;
j.executeScript("window.scrollTo(0,"+y+")");
Thread.sleep(3000);
// String script="document.bodyscrollHeight(0,0-2344)";
j.executeScript("window.scrollTo(0,-1234)"); //this will scroll up
}
}
| [
"adminisrator@admin"
] | adminisrator@admin |
daba3a81ff89d615756e36216c37ad11b6505205 | e652d775c8443b399ecfaec6fe427583aa6e7d94 | /Molap/Molap-Engine/src/com/huawei/unibi/molap/engine/datastorage/DimensionHierarichyStore.java | 104e8b72b60eb8b06f80692024b895451a67dd8a | [] | no_license | gvramana/carbondata | 52d95dcb44546b71630c0680b42f8f76dacf9f96 | 3e7af59daa726d61d6437e0ed74efe4f28e1a249 | refs/heads/master | 2020-12-28T09:28:04.153050 | 2016-03-14T14:24:12 | 2016-03-14T14:24:12 | 54,021,189 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,821 | java | /*--------------------------------------------------------------------------------------------------------------------------*/
/*!!Warning: This is a key information asset of Huawei Tech Co.,Ltd */
/*CODEMARK:kOyQZYzjDpyGdBAEC2GaWmnksNUG9RKxzMKuuAYTdbJ5ajFrCnCGALet/FDi0nQqbEkSZoTs
2wdXgejaKCr1dP3uE3wfvLHF9gW8+IdXbwdh/HjOjN0Brs7b7TRorj6S6iAIeaqK90lj7BAM
GSGxBmp06KryXpQHqSFui2gCm5Pfla1wTGsYpR0B+DkWYBRCOhwjuGPrW9Y4jRsasbkP85uk
Pa6ACSnr7XtTKCkOtfyMRePRWYopF9B4Ve9HIbfV6MsTKhQjI4vKPJbFZ1ZDBQ==*/
/*--------------------------------------------------------------------------------------------------------------------------*/
/**
*
*/
package com.huawei.unibi.molap.engine.datastorage;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import com.huawei.iweb.platform.logging.LogService;
import com.huawei.iweb.platform.logging.LogServiceFactory;
import com.huawei.unibi.molap.constants.MolapCommonConstants;
import com.huawei.unibi.molap.engine.util.MolapEngineLogEvent;
import com.huawei.unibi.molap.metadata.MolapSchemaReader;
import com.huawei.unibi.molap.olap.MolapDef;
/**
* @author R00900208
*/
public class DimensionHierarichyStore
{
/**
* Hierarchy name --> HierarchyCache
*
* Maintains all the hierarchies
*/
private Map<String, HierarchyStore> hiers = new HashMap<String, HierarchyStore>(MolapCommonConstants.DEFAULT_COLLECTION_SIZE);
/**
* Can hold members, each level
*
* column name and the cache
*/
private Map<String, MemberStore> membersCache;
/**
*
*/
private String cubeName;
/**
* Attribute for Molap LOGGER
*/
private static final LogService LOGGER = LogServiceFactory.getLogService(DimensionHierarichyStore.class.getName());
/**
* @return
*/
public String getCubeName()
{
return cubeName;
}
public DimensionHierarichyStore(MolapDef.CubeDimension dimension, Map<String, MemberStore> membersCache, String cubeName,
String factTableName, MolapDef.Schema schema)
{
this.membersCache = membersCache;
this.cubeName = cubeName;
com.huawei.unibi.molap.olap.MolapDef.Hierarchy[] extractHierarchies = MolapSchemaReader.extractHierarchies(schema, dimension);
if(null != extractHierarchies)
{
for(com.huawei.unibi.molap.olap.MolapDef.Hierarchy hierarchy : extractHierarchies)
{
String hName = hierarchy.name == null ? dimension.name : hierarchy.name;
hiers.put(hName, new HierarchyStore(hierarchy, factTableName, dimension.name));
for(MolapDef.Level level : hierarchy.levels)
{
String tableName = hierarchy.relation == null ? factTableName
: ((MolapDef.Table)hierarchy.relation).name;
// Store empty members
// if(!level.isAll())
// {
MemberStore memberCache = new MemberStore(level, tableName);
membersCache.put(memberCache.getTableForMember() + '_' + dimension.name + '_' + hName, memberCache);
// }
}
}
}
}
/**
* This method will unload the level file from memory
*
*/
public void unloadLevelFile(String tableName, String dimName, String heirName, String levelActualName)
{
MemberStore memberStore = membersCache.get(tableName + '_' + levelActualName + '_' + dimName + '_' + heirName);
memberStore.clear();
}
/**
* Access the dimension members through levelName
*/
public MemberStore getMemberCache(String levelName)
{
return membersCache.get(levelName);
}
//Raghu check if this works
public Member getMember(int key, String tableName)
{
return membersCache.get(tableName).getMemberByID(key);
}
/**
* @return the hiers
*/
public HierarchyStore getHier(String hier)
{
return hiers.get(hier);
}
/**
* @param hiers
* the hiers to set
*/
public void setHiers(String hierName, HierarchyStore hiers)
{
this.hiers.put(hierName, hiers);
}
/**
* Process cache from database store
*/
/*public void processCache(DataSource datasource)
{
try
{
// Process hierarchies cache
for(HierarchyStore hCache : hiers.values())
{
Level[] levels = hCache.getRolapHierarchy().getLevels();
List<String> dimNames = new ArrayList<String>();
int depth = 0;
for(int i = 0;i < levels.length;i++)
{
RolapLevel level3 = (RolapLevel)levels[i];
if(!level3.isAll())
{
depth++;
// Process level cache
String memberKey = ((MondrianDef.Column)level3.getKeyExp()).name;
MemberStore membercache = membersCache.get(memberKey);
DimensionCacheLoader.loadMembersFromDataSource(membercache, datasource);
dimNames.add(memberKey);
}
}
if(depth > 1)
{
DimensionCacheLoader.loadHierarichyFromDataSource(hCache, datasource);
}
// else
// {
// // Hierarchy with single level can be loaded directly from
// // level
// // member cache. So, make it null here.
// // hCache.setDimension(null);
// }
}
}
catch(IOException e)
{
LOGGER.error(MolapEngineLogEvent.UNIBI_MOLAPENGINE_MSG, e,
"IOException happened while processing cache");
}
}*/
/**
* Process all hierarchies and members of each level to load cache.
*
* @param slice
* @param fileStore
*
* @return false if any problem during cache load
*/
public boolean processCacheFromFileStore(final String fileStore,ExecutorService executorService)
{
try
{
// Process hierarchies cache
for(final HierarchyStore hCache : hiers.values())
{
MolapDef.Level[] levels = hCache.getRolapHierarchy().levels;
final List<String> dimNames = new ArrayList<String>(MolapCommonConstants.CONSTANT_SIZE_TEN);
int depth = 0;
final String tableName = hCache.getRolapHierarchy().relation == null ? hCache.getFactTableName()
: ((MolapDef.Table)hCache.getRolapHierarchy().relation).name;
for(int i = 0;i < levels.length;i++)
{
final MolapDef.Level tempLevel = levels[i];
// if(!level3.isAll())
// {
depth++;
executorService.submit(new Callable<Void>()
{
@Override
public Void call() throws Exception
{
loadDimensionLevels(fileStore, hCache, dimNames, tempLevel,hCache.getHierName(),tableName,hCache.getDimensionName());
return null;
}
});
// }
}
if(depth > 1)
{
DimensionCacheLoader.loadHierarichyFromFileStore(hCache, fileStore);
}
// else
// {
// Hierarchy with single level can be loaded directly from
// level member cache. So, make it null here.
// hCache.setDimension(null);
// }
}
}
catch(IOException e)
{
LOGGER.error(MolapEngineLogEvent.UNIBI_MOLAPENGINE_MSG, e);
return false;
}
return true;
}
/**
* @param fileStore
* @param hCache
* @param dimNames
* @param level3
*/
private void loadDimensionLevels(String fileStore, HierarchyStore hCache, List<String> dimNames,
MolapDef.Level level3, String hierarchyName, String tableName, String dimensionName)
{
// Process level cache
if(hierarchyName.contains("."))
{
hierarchyName = hierarchyName.substring(hierarchyName.indexOf(".") + 1, hierarchyName.length());
}
String memberKey = tableName+'_'+level3.column + '_' + dimensionName + '_' + hierarchyName;
MemberStore membercache = membersCache.get(memberKey);
if(null == membercache.getAllMembers())
{
DimensionCacheLoader.loadMemberFromFileStore(membercache, fileStore, level3.type,
hCache.getFactTableName(), tableName);
dimNames.add(memberKey);
}
}
// /**
// * Process all hierarchies and members of each level to load cache.
// *
// * @param slice
// * @param fileStore
// *
// * @return false if any problem during cache load
// */
// public boolean processCacheFromSlice(List<InMemoryCube> slices, String fileStore)
// {
// // Process hierarchies cache
// for(HierarchyStore hCache : hiers.values())
// {
// Level[] levels = hCache.getRolapHierarchy().getLevels();
// List<String> dimNames = new ArrayList<String>();
// int depth = 0;
// for(int i = 0;i < levels.length;i++)
// {
// RolapLevel level3 = (RolapLevel)levels[i];
// if(!level3.isAll())
// {
// depth++;
//
// // Process level cache
// String hierarchyName = level3.getHierarchy().getName();
// if(hierarchyName.contains("."))
// {
// hierarchyName = hierarchyName.substring(hierarchyName.indexOf(".") + 1, hierarchyName.length());
// }
// String memberKey = ((MondrianDef.Column)level3.getKeyExp()).table + '_'
// + ((MondrianDef.Column)level3.getKeyExp()).name + '_' + level3.getDimension().getName()
// + '_' + hierarchyName;
// MemberStore membercache = membersCache.get(memberKey);
//
// List<MemberStore> memberStores = new ArrayList<MemberStore>();
// for(InMemoryCube slice : slices)
// {
// memberStores.add(slice.getMemberCache(memberKey));
// }
//
// DimensionCacheLoader.loadMemberFromSlices(membercache, memberStores, fileStore,level3.getDatatype().name(),hCache.getFactTableName());
//
// dimNames.add(memberKey);
// }
// }
//
// if(depth > 1)
// {
// List<HierarchyStore> hStores = new ArrayList<HierarchyStore>();
// for(InMemoryCube slice : slices)
// {
// hStores.add(slice.getDimensionAndHierarchyCache(hCache.getDimensionName()).getHier(
// hCache.getRolapHierarchy().getSubName()==null?hCache.getRolapHierarchy().getName():hCache.getRolapHierarchy().getSubName()));
// }
//
// DimensionCacheLoader.loadHierarchyFromSlice(hCache, hStores, fileStore);
// }
// // else
// // {
// // Hierarchy with single level can be loaded directly from level
// // member cache. So, make it null here.
// // hCache.setDimension(null);
// // }
// }
//
// return true;
// }
// public static void main(String[] args) throws IOException
// {
//
// String name = "ggsn";
// HierarchyStore hie = new HierarchyStore(null);
// // hie.setHierName("protocol");
// // hie.setHierName("time");
// hie.setHierName(name);
//
// // HbaseDataSource hbaseDataSource = new
// // HbaseDataSource("jdbc:hbase://10.124.19.125:2181");
// // HTablePool hTablePool = hbaseDataSource.getTablePool();
//
// // String[] dims = new String[] {"year","month","day", "hour"};
// // String[] dims = new String[] {"prot_cat","prot_id"};
// String[] dims = new String[]{"ggsn"};
// // new DimensionCacheLoader(hTablePool).loadHierarichy(hie, dims);
//
// MemberStore memCache = new MemberStore(null);
// memCache.setLevelName(name);
//
// // new DimensionCacheLoader(hbaseDataSource).loadMemberCache(memCache);
//
// // Map<Integer,String> maps =
// // getMappingMems(hie.getDimension().keySet(), "prot_cat", hTablePool);
//
// // TODO this will not work until we load cube cache correctly
// // InMemoryQueryExecutor inMemoryExecutor = new
// // InMemoryQueryExecutor(null);
//
// Map<Integer, List<String>> cons = new HashMap<Integer, List<String>>();
// // cons.put(0, Arrays.asList(new String[]{"2"}));
//
// // System.out.println(hie.getCache().keySet());
//
// // HIterator hIterator = new HIterator();
// // inMemoryExecutor.executeHier(hie.getHierName(), new
// // Integer[]{2,0,1,3}, Arrays.asList(dims), cons, hIterator);
// // inMemoryExecutor.executeDimension("cube", "dimension",
// // hie.getHierName(), hie.getHierName(), new Integer[]{0}, cons,
// // hIterator);
//
// // for(Object[] row:hIterator.getData())
// // {
// //
// // for(Object value : row)
// // {
// // String spacer = " ";
// // //TODO bad way of identifying the spacer even for sysop
// // if(Integer.valueOf(String.valueOf(value))>10) spacer=" ";
// //
// // System.out.printf(value + spacer);
// // }
// // System.out.println(",");
// // }
// }
}
| [
"chenliang613@huawei.com"
] | chenliang613@huawei.com |
35d37a83889cf4ff16b6f7b6176860350ae5c478 | cb322dee38f32caf8ee5d2e7f68f6281c5b0352c | /Tests/org.emftext.language.java.test/src-input/resolving_new/typeparametersC_0/CollectionsSource.java | 6400859a3ad99918e9be75c19c7cc63f5d767cd9 | [] | no_license | DevBoost/JaMoPP | b83458ea74d0ead50f8879d8d9fdcae914686b13 | 8bc07e8407993e463323a5e0325540bed839502a | refs/heads/master | 2022-09-23T19:12:43.803464 | 2019-06-09T20:54:34 | 2019-06-09T20:54:34 | 5,324,796 | 13 | 13 | null | 2022-09-05T10:47:42 | 2012-08-07T07:25:32 | Java | UTF-8 | Java | false | false | 925 | java | /*******************************************************************************
* Copyright (c) 2006-2012
* Software Technology Group, Dresden University of Technology
* DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Software Technology Group - TU Dresden, Germany;
* DevBoost GmbH - Berlin, Germany
* - initial API and implementation
******************************************************************************/
package resolving_new.typeparametersC_0;
import java.util.Map;
public class CollectionsSource {
public static <K,V> Map<K,V> singletonMap(K key, V value) {
return null;
}
}
| [
"jendrik.johannes@devboost.de"
] | jendrik.johannes@devboost.de |
68fd7f1634899a677396335c962846cc8d4b3b37 | b4bd26d43a8c9ee16ced4c8f374b060a774dcbac | /src/main/java/com/example/demo/common/config/JerseyConfig.java | 2ab2c7dc96498f15b493f356d3b39dd4c78819fc | [] | no_license | sysout0418/spring-jersey-restapi | 2dbb7838f7f26c10b9c0f88fc2e93ef8cc5195a6 | 8fc7181bf38551e6e2f016c4e9409a82d533dd73 | refs/heads/master | 2021-01-07T03:54:27.622361 | 2020-02-10T00:25:48 | 2020-02-10T00:25:48 | 241,570,976 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,040 | java | package com.example.demo.common.config;
import com.example.demo.api.controller.AlbumController;
import com.example.demo.api.controller.PlayListController;
import com.example.demo.api.controller.SearchController;
import org.glassfish.jersey.server.ResourceConfig;
import org.springframework.context.annotation.Configuration;
@Configuration
public class JerseyConfig extends ResourceConfig {
public JerseyConfig() {
register(AlbumController.class);
register(PlayListController.class);
register(SearchController.class);
//register(new ObjectMapperContextResolver(objectMapper));
}
/*@Provider
public static class ObjectMapperContextResolver implements ContextResolver<ObjectMapper> {
private final ObjectMapper objectMapper;
public ObjectMapperContextResolver(ObjectMapper objectMapper) {
this.objectMapper = objectMapper;
}
@Override
public ObjectMapper getContext(Class<?> type) {
return objectMapper;
}
}*/
}
| [
"sysout0418@gmail.com"
] | sysout0418@gmail.com |
415f6867e3832b4ed1fe5c95fcb8f72d057b17f0 | 82a0e8ae1340d1f1fcb92af96a49264fbd3f938a | /혼자 푼 것/BOJ_8980_택배.java | a38b4a6d127b29b60966b920bded22d4bf6d6dbf | [] | no_license | Gumi-algorithm/Gumi-algorithm-Choo | d169805aef69a30b297072d5d9c5ceeaaba5b9f4 | 1980f438ab212b26bcdb67e9e318d53b6bbcf058 | refs/heads/main | 2023-08-21T05:28:14.560993 | 2021-10-05T05:50:04 | 2021-10-05T05:50:04 | 332,707,270 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,400 | java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
public class BOJ_8980_택배 {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
String[] str=br.readLine().split(" ");
int n=Integer.parseInt(str[0]);
int c=Integer.parseInt(str[1]);
int m=Integer.parseInt(br.readLine());
int[][] arr=new int[m][3];
for(int i=0;i<m;i++) {
str=br.readLine().split(" ");
arr[i][0]=Integer.parseInt(str[0]);//출발
arr[i][1]=Integer.parseInt(str[1]);//도착
arr[i][2]=Integer.parseInt(str[2]);//갯수
}
//도착이 빠른순으로 정렬 같으면 출발 빠른순
Arrays.sort(arr,(a,b)->(a[1]==b[1]?a[0]-b[0]:a[1]-b[1]));
int[] truck=new int[n+1];//각 마을별 담긴 박스갯수
int answer=0;
for(int i=0;i<m;i++) {
int s=arr[i][0];
int d=arr[i][1];
int cnt=arr[i][2];
//싣을수 잇는지 확인
for(int j=s;j<d;j++) {
if(c-truck[j]<cnt) {//용량 부족하면
cnt=c-truck[j];//일부만 넣어
}
if(cnt==0)
break;
}
//싣어
if(cnt!=0) {
for(int j=s;j<d;j++)
truck[j]+=cnt;
answer+=cnt;
}
}
pw.print(answer);
pw.flush();
br.close();
pw.close();
}
} | [
"cngjsrnr@naver.com"
] | cngjsrnr@naver.com |
11b08443bc5dc7963b5acc68073e4fe42e630397 | 006b6fb90bf4acc147169f606691c593749ca567 | /app/src/main/java/com/barmej/wecare1/data/database/dao/UserDataDao.java | 67e6d14e6aba36819fcfa3d8ccc6b24dbafca3fa | [] | no_license | AmaniAtiah/WeCare | bf3078d517fc9991f4a5d06418240ce418fb6c77 | 9ea21e4ec290c58a709f6b10d672da5770e31699 | refs/heads/master | 2023-01-31T22:56:04.565350 | 2020-12-14T18:25:01 | 2020-12-14T18:25:01 | 312,118,552 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 865 | java | package com.barmej.wecare1.data.database.dao;
import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;
import com.barmej.wecare1.data.entity.UserData;
import java.util.List;
@Dao
public interface UserDataDao {
@Query("SELECT * FROM userdata_table WHERE date = :date")
LiveData<UserData> getUserData(String date);
@Query("SELECT * FROM userdata_table")
LiveData <List<UserData>> getAllUserData();
@Query("SELECT * FROM userdata_table WHERE date >= :date")
LiveData<List<UserData>> getUserDateInPeriod(String date);
@Insert(onConflict = OnConflictStrategy.REPLACE)
long addData(UserData userData);
@Update(onConflict = OnConflictStrategy.REPLACE)
void updateData(UserData userData);
}
| [
"amaniatiah@gmail.com"
] | amaniatiah@gmail.com |
86df117b0d9c93c34abe0020a3f2113d7d8565fe | 32d4cc75a6da771a73689063e42d9752092d6977 | /a1/jcrivas/Company.java | 5f1e9a9c8f89c5f33b4cba91c78ec7d441a45b40 | [] | no_license | jessicarivas/CS414 | 1efef869cec55a5521eb26a4ecf83e2e6f7c299f | 6ae3488c85bcafc967815bdc08669e54705d87b1 | refs/heads/master | 2020-12-05T11:34:41.821050 | 2016-09-09T02:53:11 | 2016-09-09T02:53:11 | 67,387,994 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,755 | java | package cs414.a1.jcrivas;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
public class Company
{
private String _companyName;
private Set<Worker> _availableWorkers;
private Set<Worker> _unassignedWorkers;
private Set<Worker> _assignedWorkers;
private Set<Project> _projects;
public Company(String name)
{
_companyName = name;
_availableWorkers = new HashSet<Worker>();
_unassignedWorkers = new HashSet<Worker>();
_assignedWorkers = new HashSet<Worker>();
_projects = new HashSet<Project>();
}
public String getName()
{
return _companyName;
}
public Set<Worker> getAvailableWorkers()
{
return _availableWorkers;
}
public Set<Worker> getAssignedWorkers()
{
return _assignedWorkers;
}
public Set<Worker> getUnassignedWorkers()
{
return _unassignedWorkers;
}
public boolean equals(Object project)
{
if (project instanceof Company && ((Company) project).getName() == _companyName)
{
return true;
}
else {
return false;
}
}
@Override
public int hashCode() {
int result = 17;
result = 31 * result + _companyName.hashCode();
return result;
}
public String toString()
{
String companyString = _companyName + ":" + _availableWorkers.size() + ":" + _projects.size();
return companyString;
}
private boolean containsWorker(Set<Worker> workerSet, Worker worker) {
boolean containsWorker = false;
for (Worker temp: workerSet) {
if ((temp.equals(worker))) {
containsWorker = true;
break;
}
}
return containsWorker;
}
private boolean containsProject(Set<Project> projectSet, Project project) {
boolean containsProject = false;
for (Project temp: projectSet) {
if ((temp.equals(project))) {
containsProject = true;
break;
}
}
return containsProject;
}
public void addToAvailableWorkerPool(Worker worker)
{
if (!containsWorker(_availableWorkers, worker) && worker.canBeAssignedToCompany()) {
_availableWorkers.add(worker);
_unassignedWorkers.add(worker);
}
}
public void assign(Worker worker, Project project)
{
if (containsWorker(_availableWorkers, worker) && project.getCompany() == _companyName) {
if (!(containsProject(worker.getProjects(), project)) && !worker.willOverload(project) && project.isHelpful(worker)) {
if ((project.getStatus() != ProjectStatus.ACTIVE) && (project.getStatus() != ProjectStatus.FINISHED)) {
worker.assignTo(project);
project.addWorker(worker);
if (!containsWorker(_assignedWorkers, worker)) {
_assignedWorkers.add(worker);
_unassignedWorkers.remove(worker);
}
}
}
}
}
private void editProjectStatus(Project project)
{
System.out.println(project.missingQualifications().size());
if (project.missingQualifications().size() > 0 && project.getStatus() == ProjectStatus.ACTIVE) {
project.setStatus(ProjectStatus.SUSPENDED);
}
}
public void unassign(Worker worker, Project project)
{
if (containsProject(worker.getProjects(), project)) {
worker.unassignFrom(project);
project.removeWorker(worker);
if (worker.getProjects().size() == 0) {
_unassignedWorkers.add(worker);
_assignedWorkers.remove(worker);
}
editProjectStatus(project);
}
}
public void unassignAll(Worker worker)
{
for (Project temp: worker.getProjects()) {
temp.removeWorker(worker);
editProjectStatus(temp);
}
worker.unassignAll();
_unassignedWorkers.add(worker);
_assignedWorkers.remove(worker);
}
public void start(Project project) {
if (project.getCompany() == _companyName) {
if (project.getStatus() == ProjectStatus.PLANNED || project.getStatus() == ProjectStatus.SUSPENDED) {
if (project.missingQualifications().size() == 0) {
project.setStatus(ProjectStatus.ACTIVE);
}
}
}
}
//TODO
public void finish(Project project) {
if (project.getCompany() == _companyName) {
if (project.getStatus() == ProjectStatus.ACTIVE) {
project.setStatus(ProjectStatus.FINISHED);
for (Iterator<Worker> i = project.getAssignedWorkers().iterator(); i.hasNext();) {
Worker worker = i.next();
worker.unassignFrom(project);
if (worker.getProjects().size() == 0) {
_unassignedWorkers.add(worker);
_assignedWorkers.remove(worker);
}
}
project.getAssignedWorkers().clear();
}
}
}
public Project createProject(String name, Set<Qualification> qualifications, ProjectSize size, ProjectStatus status)
{
if (qualifications.size() > 0) {
Project project = new Project(name, size, ProjectStatus.PLANNED);
project.addRequiredQualifications(qualifications);
project.setCompany(_companyName);
_projects.add(project);
return project;
}
return null;
}
} | [
"jessicarivas92@gmail.com"
] | jessicarivas92@gmail.com |
9a98b049901ec64733140027bc1708c6b0e5e7b2 | 9e14c27b776fbff471fd56e2978d96aca0cc4898 | /section4/ex5_DecimalComparator.java | 8d7c3c1cb69a0d1593683ece3d41ccc15e8c961f | [] | no_license | gabrielnardes/course-udemy-java | bcd6f927418dfbe9757baedf545176e327619a3f | c1251bec204b533bd5fc774b27d6bbb25907f6ba | refs/heads/main | 2023-05-27T11:23:17.630745 | 2021-06-04T04:27:37 | 2021-06-04T04:27:37 | 367,521,200 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 193 | java | package section4;
public class ex5_DecimalComparator {
public static boolean areEqualByThreeDecimalPlaces(double a, double b) {
return (int)(a * 1000) == (int)(b * 1000);
}
}
| [
"gabrielnardeslobao@gmail.com"
] | gabrielnardeslobao@gmail.com |
1eb7fa565559ca9538e36335c7d63bf5d6341a1a | 34296c80ed767da33460c8e41f8fb57abd915afe | /Hilo.java | 2396df407465d534f48380f7a7f5d86acfd99f07 | [] | no_license | Sheffman01/practica-final | 02280a0829ec18ac5d13e6cd5323b6290b2cf4fc | 0e50c2b2b92d15fef084a87149e35aa7f44d357c | refs/heads/main | 2023-01-07T14:06:48.687049 | 2020-11-06T18:32:27 | 2020-11-06T18:32:27 | 310,676,739 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,730 | java | package condicionescompetenciafinal;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import javax.swing.JTextArea;
public class Hilo extends Thread{
private JTextArea area;
private RCompartido rc;
private final static int inicio = 995;
private final static int fin = 1000;
private boolean dead=false;
private boolean block=false;
private int elegido, algoritmo;
private int id;
private static final int Nthreads = 4;
//private static volatile boolean[] wannaB = new boolean[Nthreads];
//private static volatile boolean[] seccionC = new boolean[Nthreads];
//private static volatile int k = 0;
private Lock mutexApi;
private Mutex mutex;
Hilo(JTextArea area,RCompartido rc){
this.area = area; //Creamos el hilo con su respectiva area y rc
this.rc = rc;
mutexApi = new ReentrantLock();
mutex = new Mutex();
}
public void run(){
switch(this.algoritmo){
/////////////////////// CONDICIONES COMPETENCIAS ////////////////////////////////////////////////////////////////////////////
case 1:
while(true){
try{
rc.setrc(this.getName());
area.append(rc.getrc()+" eats \n");
sleep(500);
}catch(Exception e){
e.printStackTrace();
}
}
//********************* DESACTIVACION DE INTERRUPCIONES ****************************************************************
//**************************************************************************************************************************
case 2:
while(true){
try{
if(rc.estadoDeLasInterrupciones()){ //Verificamos nuestro estado de nuestras interrupciones
rc.desactivarInterrupciones(); //Desactivamos nuestras interrupciones antes de entrar a la sección crítica
rc.setrc(this.getName());
area.append(rc.getrc()+" eats\n");
if(isDead()){
stop(); //Método de clase para ejemplificar kill
}
rc.activarInterrupciones(); //Activamos las interrupciones una vez salimos de la sección crítica
}
else{
area.append("Esperando...\n"); //Sino puede acceder al recurso se queda en espera
}
Thread.sleep((int) (inicio+Math.random()*fin));
}catch(Exception e){
e.printStackTrace();
}
}
// ---------------------------- VARIABLE DE CERRADURA --------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------------
case 3:
while(true){ //Recordando que para bloquear y desbloquear se hace uso de la cerradura
try{
if(rc.statusCerradura()){ //Verificamos si podemos acceder el rc
rc.cerrarCerradura(); //Lo bloqueamos para los demás procesos
rc.setrc(this.getName());
area.append(rc.getrc()+" eats\n");
if(isDead()){
stop(); //Método de clase para ejemplificasr kill
} //El cual NO debe ser usado
rc.abrirCerradura(); //Una vez acabamos de usar el recurso lo desbloqueamos
}
else{
area.append("Esperando...\n"); //Sino puede acceder al recurso se queda en espera
}
Thread.sleep((int) (inicio+Math.random()*fin));
}catch(Exception e)
{e.printStackTrace();
}
}
//!!!!!!!!!!!!!!!!!!!!!!!!!!!! ALGORITMO DEKKER !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
case 4:
while (true){ // empezamos con el ciclo
try{
rc.setH(rc.getTurno(), true); // verificamos el estado de la sc y el proceso en ejecucion.
while(Ocupada() != -1){ //le ponemos un marcador al proceso que ingresa
rc.setH(rc.getTurno(), false); //
Thread.sleep((int)(inicio + Math.random() * fin)); //
}
rc.setH(rc.getTurno(), true);
rc.setrc(this.getName());
area.append(rc.getrc() + "\n");
if(isDead()){
stop();
}
rc.setH(rc.getTurno(), false); // verificamos el estado de la sc y el proceso en ejecucion.
if(rc.getTurno() == 3){ //le ponemos un marcador al proceso que ingresa
rc.setTurno(0);
}
else{
rc.setTurno(rc.getTurno()+1);
}
Thread.sleep((int)(inicio + Math.random() * fin));
}catch(Exception e){
System.out.println(e.getMessage());
}
}
case 5: //Dijkstra
/*
dijkstra:
while (true) {
wannaB[id] = true;
wannaB = wannaB;
while (k != id) {
seccionC[id] = false;
seccionC = seccionC;
if (!wannaB[k]) {
k = id;
}
}
//Busca en el arreglo, esperando que ninguno este en la sección crítica, así, si encuentra que uno esta, sigue sin entrar.
seccionC[id] = true;
seccionC = seccionC;
for (int i = 0; i < seccionC.length; i++) {
if (i != id && seccionC[i]) {
continue dijkstra;
}
}
//Cuando se cumple que al revisar el arreglo puede entrar, intentará esto. Así pudiendo ejecutar su sección c'ritica.
try{
rc.setrc(this.getName());
area.append(rc.getrc()+"\n");
if(isDead()){
stop();
}
Thread.sleep(1000);
}catch(Exception e){
e.printStackTrace();
}
//Se reinicia su turno
seccionC[id] = false;
seccionC = seccionC;
wannaB[id] = false;
wannaB = wannaB;
}
*/
//////////////////////////////// M U T E X /////////////////////////////////////////////////////////////////////////
case 6:
while(true){ //Recordando que para bloquear y desbloquear se hace uso de mutex
try{
if(mutexApi.tryLock()){
mutexApi.lock();
rc.setrc(this.getName());
area.append(rc.getrc()+" eats" + "\n");
if(isDead()){
stop(); //Método de clase para ejemplificasr kill
}
mutexApi.unlock();
}
else{
area.append("Esperando...\n");
}
Thread.sleep((int) (inicio+Math.random()*fin));
}catch(Exception e){e.printStackTrace();}
}
///////////////////////////// OTRO MUTEX /////////////////////////////////////////////////////////////////////////////////////
case 7:
while(true){ //Recordando que para bloquear y desbloquear se hace uso de mutex
try{
if(mutex.trylock()){
mutex.lock();
rc.setrc(this.getName());
area.append(rc.getrc()+" eats" + "\n");
if(isDead()){
stop(); //Método de clase para ejemplificasr kill
}
mutex.unlock();
}
else{
area.append("Esperando...");
}
Thread.sleep((int) (inicio+Math.random()*fin));
}catch(Exception e){
e.printStackTrace();
}
}
}
}
public boolean isDead(){
return dead;
}
public void setDead(boolean d){
dead=d;
}
public boolean isBloquear(){
return block;
}
public void setBlock(boolean b){
block=b;
}
public void Elegido(int i){
elegido=i;
}
public int getAlgoritmo() {
return algoritmo;
}
public void setAlgoritmo(int algoritmo) {
this.algoritmo = algoritmo;
}
public int Ocupada(){ // Verificamos el estado del proceso y de la seccion critica
boolean b[] = rc.getH();
for(int i=0;i<b.length;i++){
if(rc.getTurno() != i){
if(b[i]){
return i;
}
}
}
return -1;
}
public void setID(int i){
id = i;
}
}
| [
"70719539+Sheffman01@users.noreply.github.com"
] | 70719539+Sheffman01@users.noreply.github.com |
8c326a50aaa5121abf14e73972751062afb8fcb6 | 04047765210f5ac3fa5c9bd919d1498cadeeca96 | /src/main/java/com/bxf/hradmin/common/persistence/query/utils/QueryParameterTransformer.java | 311358362af932d00250799138770e761b97fd26 | [
"MIT"
] | permissive | Coffee0127/RandomTestGenerator | 600febecd3ec35e20e32dec42f66445ba17022c0 | 81b28c6435e08fdf6b000bb8e2340aa70a52ddc6 | refs/heads/master | 2020-06-09T11:47:19.538135 | 2017-10-01T01:33:39 | 2017-10-01T01:33:39 | 76,039,971 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,125 | java | /*
* The MIT License (MIT)
*
* Copyright (c) 2017 Bo-Xuan Fan
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.bxf.hradmin.common.persistence.query.utils;
import java.lang.reflect.Array;
import java.util.Collection;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.Path;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import org.apache.commons.lang3.StringUtils;
import com.bxf.hradmin.common.persistence.query.QueryParameter;
/**
* QueryParameterTransformer
*
* @since 2017-04-15
* @author Bo-Xuan Fan
*/
@SuppressWarnings("rawtypes")
public final class QueryParameterTransformer {
private QueryParameterTransformer() {
}
public static Predicate generatePredicate(Root root, CriteriaBuilder builder, QueryParameter... queryParameters) {
Predicate condition = builder.conjunction();
for (QueryParameter queryParameter : queryParameters) {
Object value = queryParameter.getValue();
if (value == null || StringUtils.isBlank(value.toString())) {
continue;
}
Path path = root.get(queryParameter.getKey());
condition = doGenerateCondition(builder, condition, queryParameter, value, path);
}
return condition;
}
@SuppressWarnings("unchecked")
private static Predicate doGenerateCondition(CriteriaBuilder builder,
Predicate condition, QueryParameter queryParameter, Object value,
Path path) {
switch (queryParameter.getMode()) {
case BETWEEN:
Object[] values = asArray(value);
if (values != null) {
return builder.and(builder.between((Path<Comparable>) path, asComparable(values[0]), asComparable(values[1])));
}
return condition;
case GREATER_THAN:
return builder.and(condition, builder.greaterThan((Path<Comparable>) path, asComparable(value)));
case GREATER_EQUALS:
return builder.and(condition, builder.greaterThanOrEqualTo((Path<Comparable>) path, asComparable(value)));
case LESS_THAN:
return builder.and(condition, builder.lessThan((Path<Comparable>) path, asComparable(value)));
case LESS_EQUALS:
return builder.and(condition, builder.lessThanOrEqualTo((Path<Comparable>) path, asComparable(value)));
case IS_NULL:
return builder.and(condition, builder.isNull(path));
case IS_NOT_NULL:
return builder.and(condition, builder.isNotNull(path));
case IN:
return builder.and(condition, path.in(asArray(value)));
case NOT_IN:
return builder.and(condition, builder.not(path.in(asArray(value))));
case LIKE:
return builder.and(condition, builder.like(path, "%" + value + "%"));
case NOT_LIKE:
return builder.and(condition, builder.notLike(path, "%" + value + "%"));
case EQUALS:
return builder.and(condition, builder.equal(path, value));
case NOT_EQUALS:
return builder.and(condition, builder.notEqual(path, value));
default:
return condition;
}
}
private static Object[] asArray(Object value) {
if (value.getClass().isArray()) {
Object[] result = new Object[Array.getLength(value)];
for (int i = 0; i < result.length; ++i) {
result[i] = Array.get(value, i);
}
return result;
} else if (value instanceof Collection) {
return ((Collection) value).toArray();
}
return new Object[] { value };
}
private static Comparable asComparable(Object value) {
if (value instanceof Comparable) {
return (Comparable) value;
}
throw new IllegalArgumentException(value + " cannot be cast to java.lang.Comparable");
}
}
| [
"coffee0127@gmail.com"
] | coffee0127@gmail.com |
a9de74e4b2621754e6d8fafc4ea91b613d60d71f | 07318a0a708add1152e0de341d9dac6b237666f1 | /overloading.java | 3eecdcb6e6caac71d8e6c53a8d2bd6289a3af20d | [] | no_license | Pascal1623/JAVA1 | 5472d6e6ded1d3be3c57770edeefe75c64a4eac7 | fac2574b6b07e8ed2135e962b117b62dbf14a602 | refs/heads/master | 2020-03-22T15:39:50.047304 | 2018-07-09T10:14:43 | 2018-07-09T10:14:43 | 140,267,996 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 552 | java |
public class overloading {
public static void main(String[] args) {
System.out.println(max(5, 9, 2));
System.out.println(max(3.1, 10.33, -32.1));
}
/*정수형 max() 함수*/
public static int max(int a, int b, int c)
{
int max=0;
if(a>b) {
max=a;
}
else {
max=b;
}
if(c>max) {
max=c;
}
return max;
}
/*실수형 max() 함수*/
public static double max(double a, double b, double c) {
double max=0;
if(a>b) {
max=a;
}
else {
max=b;
}
if(c>max) {
max=c;
}
return max;
}
}
| [
"toyooka399@gmail.com"
] | toyooka399@gmail.com |
fdabc3470112856ad07b4c8a7d498a7c07c0192a | f7748b5a5551df8272777c32002cbecce1e44cbf | /src/com/asign1/generics/BaseTest.java | c7f3c1c3a298a8c652483af2f566398594dff4d3 | [] | no_license | OmkarByale/Assignment1 | 0713679f22582dd87859df24be0e83bcf485e43f | 03e57a9cd7999da306e41c5f1a2bfedd146c5ad3 | refs/heads/master | 2021-06-30T10:09:04.051695 | 2021-05-17T07:04:45 | 2021-05-17T07:04:45 | 233,183,508 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 746 | java | package com.asign1.generics;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
abstract public class BaseTest implements IAutoConstant {
static
{
System.setProperty(CHROME_KEY,CHROME_VALUE);
}
public WebDriver driver;
@BeforeClass
public void openBrowser()
{
driver=new ChromeDriver();
}
@BeforeMethod
public void openApplication()
{
driver.manage().timeouts().implicitlyWait(ITO,TimeUnit.SECONDS);
driver.manage().window().maximize();
}
@AfterMethod
public void closeBrowser()
{
driver.quit();
}
}
| [
"omkarsb99@gmail.com"
] | omkarsb99@gmail.com |
4055ea52caeb08438bb581f720bb088680a87d44 | 0d561e76f98e3226a9d71139c53dd9894735bb6c | /1.JavaSyntax/src/com/javarush/task/task09/task0904/Solution.java | ad060cee8fac9fb0cab7d8ec8a2369b6584ee5f4 | [] | no_license | Mr-ILYAS/JavaRushTasks | 3f9870cda06701a37a3a661b15b5a973bc43bfa9 | 622567831801a376ebf9cdbe23021b640d786cd5 | refs/heads/master | 2020-04-06T12:06:15.485476 | 2019-06-01T19:55:09 | 2019-06-01T19:55:09 | 111,448,526 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,366 | java | package com.javarush.task.task09.task0904;
/*
Стек-трейс длиной 10 вызовов
Напиши код, чтобы получить стек-трейс длиной 10 вызовов.
Требования:
1. В классе должно быть 10 методов (метод main не учитывать).
2. Длина стек-трейса в методе method10 должна быть 10.
3. Каждый метод должен вызывать другой метод.
4. Используй метод Thread.currentThread().getStackTrace().
*/
public class Solution{
public static void main(String[] args) throws Exception{method1();}
public static StackTraceElement[] method1(){return method2();}
public static StackTraceElement[] method2(){return method3();}
public static StackTraceElement[] method3(){return method4();}
public static StackTraceElement[] method4(){return method5();}
public static StackTraceElement[] method5(){return method6();}
public static StackTraceElement[] method6(){return method7();}
public static StackTraceElement[] method7(){return method8();}
public static StackTraceElement[] method8(){return method9();}
public static StackTraceElement[] method9(){return method10();}
public static StackTraceElement[] method10(){return Thread.currentThread().getStackTrace();}
} | [
"box-mail-1@mail.ru"
] | box-mail-1@mail.ru |
b802fa924c8560d0b85d1c58a0eb7f72b026539c | e5aa601a135dae8c9beedfc66fe9729ebd63ca65 | /src/main/java/com/baghira/search/filesystem/CSVUsageFileNameFinder.java | 6ab78e7619f01e0fb1e31c17972d397c1b176877 | [] | no_license | sandeepnitsgr/RemoteLibraryImageViewer | dde8531294847a27b25101fc841edf9209667aa1 | f56ee8c855cff055d2911f7bb453d0390fcd241a | refs/heads/master | 2023-02-26T21:25:51.334914 | 2021-02-01T18:08:31 | 2021-02-01T18:08:31 | 319,349,238 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 611 | java | package com.baghira.search.filesystem;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class CSVUsageFileNameFinder implements FileNameFinder<List<String>> {
@Override
public List<String> findAllFileNames(String basePath, String rawString) {
List<String> nameList = new ArrayList<>();
String[] allOutputLines = rawString.split("\\n");
for (String outputLine : allOutputLines) {
if(!outputLine.isEmpty())
nameList.add(outputLine.substring(0, outputLine.indexOf(File.separator)));
}
return nameList;
}
}
| [
"sandeep.gupta@tokopedia.com"
] | sandeep.gupta@tokopedia.com |
f18690af506006abab08e595066f115f76bd4ec0 | b5bddaee3475cfc7a38e51a2a2b1326fcb5cb0c1 | /MikhailBedarev/Day2/src/com/company/cars/Ship.java | 0f76315432f8c60c0f7a096eb660b4b97808ddb9 | [] | no_license | anton-tupy/java-course-2017-07 | a6f633adf30f22207e36b4b86b1a9bbcd4a4b993 | c01c7944d4b8a46ab58cb9fa97510d595f9a98d5 | refs/heads/master | 2021-01-01T05:00:00.507163 | 2017-08-12T09:54:30 | 2017-08-12T09:54:30 | 97,290,031 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 194 | java | package com.company.cars;
/**
* Created by WizZo on 15.07.2017.
*/
public class Ship extends Vehicle{
@Override
public void move() {
System.out.println("Ship float");
}
}
| [
"qwerdy@yande.ru"
] | qwerdy@yande.ru |
7b22ab50f69a567b43a4b3a1a3ed33ac236fc6d0 | f8e9cd9c7155d4ec8db8fd49b6ad88982bf54d54 | /module3/finalmodule3/src/service/ProductServiceImpl.java | a0bae6cf51aa23199094b6b65b32607c21eb8f61 | [] | no_license | MyHanh288/A1120I1-LyTranMyHanh | a81e1409bf59d200ad7e05ab67642c88ac1de130 | a883318f333253f85455a5f2609a90a02abc7fc5 | refs/heads/main | 2023-07-24T00:07:59.887876 | 2021-09-10T14:23:05 | 2021-09-10T14:23:05 | 315,953,037 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 990 | java | package service;
import model.Product;
import repository.ProductRepository;
import repository.ProductRepositoryImpl;
import java.util.List;
public class ProductServiceImpl implements ProductService{
private ProductRepository productRepository = new ProductRepositoryImpl();
@Override
public List<Product> findAll() {
return productRepository.findAll();
}
@Override
public void save(Product product) {
productRepository.save(product);
}
@Override
public List<Product> findByName(String productName) {
return productRepository.findByName(productName);
}
@Override
public Product update(int productId, Product product) {
return productRepository.update(productId,product);
}
@Override
public void remove(int productId){
productRepository.remove(productId);
}
@Override
public Product findById(int productId) {
return productRepository.findById(productId);
}
}
| [
"hanhly288@gmail.com"
] | hanhly288@gmail.com |
37b1773a4ad22bb91c35cad6e5d7c72c421930a7 | 5598faaaaa6b3d1d8502cbdaca903f9037d99600 | /code_changes/Apache_projects/HDFS-105/098ec2b11ff3f677eb823f75b147a1ac8dbf959e/~EditLogTailer.java | 116261b0d17af755f3a614b18788a1ee2c4b3bad | [] | no_license | SPEAR-SE/LogInBugReportsEmpirical_Data | 94d1178346b4624ebe90cf515702fac86f8e2672 | ab9603c66899b48b0b86bdf63ae7f7a604212b29 | refs/heads/master | 2022-12-18T02:07:18.084659 | 2020-09-09T16:49:34 | 2020-09-09T16:49:34 | 286,338,252 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 17,498 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hdfs.server.namenode.ha;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.Callable;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.HAUtil;
import org.apache.hadoop.hdfs.protocolPB.NamenodeProtocolPB;
import org.apache.hadoop.hdfs.protocolPB.NamenodeProtocolTranslatorPB;
import org.apache.hadoop.hdfs.server.common.HdfsServerConstants;
import org.apache.hadoop.hdfs.server.namenode.EditLogInputException;
import org.apache.hadoop.hdfs.server.namenode.EditLogInputStream;
import org.apache.hadoop.hdfs.server.namenode.FSEditLog;
import org.apache.hadoop.hdfs.server.namenode.FSImage;
import org.apache.hadoop.hdfs.server.namenode.FSNamesystem;
import org.apache.hadoop.hdfs.server.namenode.NameNode;
import org.apache.hadoop.hdfs.server.protocol.NamenodeProtocol;
import org.apache.hadoop.ipc.RPC;
import org.apache.hadoop.ipc.RemoteException;
import org.apache.hadoop.ipc.StandbyException;
import org.apache.hadoop.security.SecurityUtil;
import static org.apache.hadoop.util.Time.monotonicNow;
import static org.apache.hadoop.util.ExitUtil.terminate;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
/**
* EditLogTailer represents a thread which periodically reads from edits
* journals and applies the transactions contained within to a given
* FSNamesystem.
*/
@InterfaceAudience.Private
@InterfaceStability.Evolving
public class EditLogTailer {
public static final Log LOG = LogFactory.getLog(EditLogTailer.class);
private final EditLogTailerThread tailerThread;
private final Configuration conf;
private final FSNamesystem namesystem;
private final Iterator<RemoteNameNodeInfo> nnLookup;
private FSEditLog editLog;
private RemoteNameNodeInfo currentNN;
/**
* The last transaction ID at which an edit log roll was initiated.
*/
private long lastRollTriggerTxId = HdfsServerConstants.INVALID_TXID;
/**
* The highest transaction ID loaded by the Standby.
*/
private long lastLoadedTxnId = HdfsServerConstants.INVALID_TXID;
/**
* The last time we successfully loaded a non-zero number of edits from the
* shared directory.
*/
private long lastLoadTimeMs;
/**
* How often the Standby should roll edit logs. Since the Standby only reads
* from finalized log segments, the Standby will only be as up-to-date as how
* often the logs are rolled.
*/
private final long logRollPeriodMs;
/**
* How often the Standby should check if there are new finalized segment(s)
* available to be read from.
*/
private final long sleepTimeMs;
private final int nnCount;
private NamenodeProtocol cachedActiveProxy = null;
// count of the number of NNs we have attempted in the current lookup loop
private int nnLoopCount = 0;
/**
* maximum number of retries we should give each of the remote namenodes before giving up
*/
private int maxRetries;
public EditLogTailer(FSNamesystem namesystem, Configuration conf) {
this.tailerThread = new EditLogTailerThread();
this.conf = conf;
this.namesystem = namesystem;
this.editLog = namesystem.getEditLog();
lastLoadTimeMs = monotonicNow();
logRollPeriodMs = conf.getInt(DFSConfigKeys.DFS_HA_LOGROLL_PERIOD_KEY,
DFSConfigKeys.DFS_HA_LOGROLL_PERIOD_DEFAULT) * 1000;
List<RemoteNameNodeInfo> nns = Collections.emptyList();
if (logRollPeriodMs >= 0) {
try {
nns = RemoteNameNodeInfo.getRemoteNameNodes(conf);
} catch (IOException e) {
throw new IllegalArgumentException("Remote NameNodes not correctly configured!", e);
}
for (RemoteNameNodeInfo info : nns) {
// overwrite the socket address, if we need to
InetSocketAddress ipc = NameNode.getServiceAddress(info.getConfiguration(), true);
// sanity check the ipc address
Preconditions.checkArgument(ipc.getPort() > 0,
"Active NameNode must have an IPC port configured. " + "Got address '%s'", ipc);
info.setIpcAddress(ipc);
}
LOG.info("Will roll logs on active node every " +
(logRollPeriodMs / 1000) + " seconds.");
} else {
LOG.info("Not going to trigger log rolls on active node because " +
DFSConfigKeys.DFS_HA_LOGROLL_PERIOD_KEY + " is negative.");
}
sleepTimeMs = conf.getInt(DFSConfigKeys.DFS_HA_TAILEDITS_PERIOD_KEY,
DFSConfigKeys.DFS_HA_TAILEDITS_PERIOD_DEFAULT) * 1000;
maxRetries = conf.getInt(DFSConfigKeys.DFS_HA_TAILEDITS_ALL_NAMESNODES_RETRY_KEY,
DFSConfigKeys.DFS_HA_TAILEDITS_ALL_NAMESNODES_RETRY_DEFAULT);
if (maxRetries <= 0) {
LOG.error("Specified a non-positive number of retries for the number of retries for the " +
"namenode connection when manipulating the edit log (" +
DFSConfigKeys.DFS_HA_TAILEDITS_ALL_NAMESNODES_RETRY_KEY + "), setting to default: " +
DFSConfigKeys.DFS_HA_TAILEDITS_ALL_NAMESNODES_RETRY_DEFAULT);
maxRetries = DFSConfigKeys.DFS_HA_TAILEDITS_ALL_NAMESNODES_RETRY_DEFAULT;
}
nnCount = nns.size();
// setup the iterator to endlessly loop the nns
this.nnLookup = Iterators.cycle(nns);
LOG.debug("logRollPeriodMs=" + logRollPeriodMs +
" sleepTime=" + sleepTimeMs);
}
public void start() {
tailerThread.start();
}
public void stop() throws IOException {
tailerThread.setShouldRun(false);
tailerThread.interrupt();
try {
tailerThread.join();
} catch (InterruptedException e) {
LOG.warn("Edit log tailer thread exited with an exception");
throw new IOException(e);
}
}
@VisibleForTesting
FSEditLog getEditLog() {
return editLog;
}
@VisibleForTesting
public void setEditLog(FSEditLog editLog) {
this.editLog = editLog;
}
public void catchupDuringFailover() throws IOException {
Preconditions.checkState(tailerThread == null ||
!tailerThread.isAlive(),
"Tailer thread should not be running once failover starts");
// Important to do tailing as the login user, in case the shared
// edits storage is implemented by a JournalManager that depends
// on security credentials to access the logs (eg QuorumJournalManager).
SecurityUtil.doAsLoginUser(new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws Exception {
try {
// It is already under the full name system lock and the checkpointer
// thread is already stopped. No need to acqure any other lock.
doTailEdits();
} catch (InterruptedException e) {
throw new IOException(e);
}
return null;
}
});
}
@VisibleForTesting
void doTailEdits() throws IOException, InterruptedException {
// Write lock needs to be interruptible here because the
// transitionToActive RPC takes the write lock before calling
// tailer.stop() -- so if we're not interruptible, it will
// deadlock.
namesystem.writeLockInterruptibly();
try {
FSImage image = namesystem.getFSImage();
long lastTxnId = image.getLastAppliedTxId();
if (LOG.isDebugEnabled()) {
LOG.debug("lastTxnId: " + lastTxnId);
}
Collection<EditLogInputStream> streams;
try {
streams = editLog.selectInputStreams(lastTxnId + 1, 0, null, false);
} catch (IOException ioe) {
// This is acceptable. If we try to tail edits in the middle of an edits
// log roll, i.e. the last one has been finalized but the new inprogress
// edits file hasn't been started yet.
LOG.warn("Edits tailer failed to find any streams. Will try again " +
"later.", ioe);
return;
}
if (LOG.isDebugEnabled()) {
LOG.debug("edit streams to load from: " + streams.size());
}
// Once we have streams to load, errors encountered are legitimate cause
// for concern, so we don't catch them here. Simple errors reading from
// disk are ignored.
long editsLoaded = 0;
try {
editsLoaded = image.loadEdits(streams, namesystem);
} catch (EditLogInputException elie) {
editsLoaded = elie.getNumEditsLoaded();
throw elie;
} finally {
if (editsLoaded > 0 || LOG.isDebugEnabled()) {
LOG.debug(String.format("Loaded %d edits starting from txid %d ",
editsLoaded, lastTxnId));
}
}
if (editsLoaded > 0) {
lastLoadTimeMs = monotonicNow();
}
lastLoadedTxnId = image.getLastAppliedTxId();
} finally {
namesystem.writeUnlock();
}
}
/**
* @return time in msec of when we last loaded a non-zero number of edits.
*/
public long getLastLoadTimeMs() {
return lastLoadTimeMs;
}
/**
* @return true if the configured log roll period has elapsed.
*/
private boolean tooLongSinceLastLoad() {
return logRollPeriodMs >= 0 &&
(monotonicNow() - lastLoadTimeMs) > logRollPeriodMs ;
}
/**
* Trigger the active node to roll its logs.
*/
private void triggerActiveLogRoll() {
LOG.info("Triggering log roll on remote NameNode");
try {
new MultipleNameNodeProxy<Void>() {
@Override
protected Void doWork() throws IOException {
cachedActiveProxy.rollEditLog();
return null;
}
}.call();
lastRollTriggerTxId = lastLoadedTxnId;
} catch (IOException ioe) {
if (ioe instanceof RemoteException) {
ioe = ((RemoteException)ioe).unwrapRemoteException();
if (ioe instanceof StandbyException) {
LOG.info("Skipping log roll. Remote node is not in Active state: " +
ioe.getMessage().split("\n")[0]);
return;
}
}
LOG.warn("Unable to trigger a roll of the active NN", ioe);
}
}
/**
* The thread which does the actual work of tailing edits journals and
* applying the transactions to the FSNS.
*/
private class EditLogTailerThread extends Thread {
private volatile boolean shouldRun = true;
private EditLogTailerThread() {
super("Edit log tailer");
}
private void setShouldRun(boolean shouldRun) {
this.shouldRun = shouldRun;
}
@Override
public void run() {
SecurityUtil.doAsLoginUserOrFatal(
new PrivilegedAction<Object>() {
@Override
public Object run() {
doWork();
return null;
}
});
}
private void doWork() {
while (shouldRun) {
try {
// There's no point in triggering a log roll if the Standby hasn't
// read any more transactions since the last time a roll was
// triggered.
if (tooLongSinceLastLoad() &&
lastRollTriggerTxId < lastLoadedTxnId) {
triggerActiveLogRoll();
}
/**
* Check again in case someone calls {@link EditLogTailer#stop} while
* we're triggering an edit log roll, since ipc.Client catches and
* ignores {@link InterruptedException} in a few places. This fixes
* the bug described in HDFS-2823.
*/
if (!shouldRun) {
break;
}
// Prevent reading of name system while being modified. The full
// name system lock will be acquired to further block even the block
// state updates.
namesystem.cpLockInterruptibly();
try {
doTailEdits();
} finally {
namesystem.cpUnlock();
}
//Update NameDirSize Metric
namesystem.getFSImage().getStorage().updateNameDirSize();
} catch (EditLogInputException elie) {
LOG.warn("Error while reading edits from disk. Will try again.", elie);
} catch (InterruptedException ie) {
// interrupter should have already set shouldRun to false
continue;
} catch (Throwable t) {
LOG.fatal("Unknown error encountered while tailing edits. " +
"Shutting down standby NN.", t);
terminate(1, t);
}
try {
Thread.sleep(sleepTimeMs);
} catch (InterruptedException e) {
LOG.warn("Edit log tailer interrupted", e);
}
}
}
}
/**
* Manage the 'active namenode proxy'. This cannot just be the a single proxy since we could
* failover across a number of NameNodes, rather than just between an active and a standby.
* <p>
* We - lazily - get a proxy to one of the configured namenodes and attempt to make the request
* against it. If it doesn't succeed, either because the proxy failed to be created or the request
* failed, we try the next NN in the list. We try this up to the configuration maximum number of
* retries before throwing up our hands. A working proxy is retained across attempts since we
* expect the active NameNode to switch rarely.
* <p>
* This mechanism is <b>very bad</b> for cases where we care about being <i>fast</i>; it just
* blindly goes and tries namenodes.
*/
private abstract class MultipleNameNodeProxy<T> implements Callable<T> {
/**
* Do the actual work to the remote namenode via the {@link #cachedActiveProxy}.
* @return the result of the work, if there is one
* @throws IOException if the actions done to the proxy throw an exception.
*/
protected abstract T doWork() throws IOException;
public T call() throws IOException {
// reset the loop count on success
nnLoopCount = 0;
while ((cachedActiveProxy = getActiveNodeProxy()) != null) {
try {
T ret = doWork();
return ret;
} catch (RemoteException e) {
Throwable cause = e.unwrapRemoteException(StandbyException.class);
// if its not a standby exception, then we need to re-throw it, something bad has happened
if (cause == e) {
throw e;
} else {
// it is a standby exception, so we try the other NN
LOG.warn("Failed to reach remote node: " + currentNN
+ ", retrying with remaining remote NNs");
cachedActiveProxy = null;
// this NN isn't responding to requests, try the next one
nnLoopCount++;
}
}
}
throw new IOException("Cannot find any valid remote NN to service request!");
}
private NamenodeProtocol getActiveNodeProxy() throws IOException {
if (cachedActiveProxy == null) {
while (true) {
// if we have reached the max loop count, quit by returning null
if ((nnLoopCount / nnCount) >= maxRetries) {
return null;
}
currentNN = nnLookup.next();
try {
int rpcTimeout = conf.getInt(
DFSConfigKeys.DFS_HA_LOGROLL_RPC_TIMEOUT_KEY,
DFSConfigKeys.DFS_HA_LOGROLL_RPC_TIMEOUT_DEFAULT);
NamenodeProtocolPB proxy = RPC.waitForProxy(NamenodeProtocolPB.class,
RPC.getProtocolVersion(NamenodeProtocolPB.class), currentNN.getIpcAddress(), conf,
rpcTimeout, Long.MAX_VALUE);
cachedActiveProxy = new NamenodeProtocolTranslatorPB(proxy);
break;
} catch (IOException e) {
LOG.info("Failed to reach " + currentNN, e);
// couldn't even reach this NN, try the next one
nnLoopCount++;
}
}
}
assert cachedActiveProxy != null;
return cachedActiveProxy;
}
}
}
| [
"archen94@gmail.com"
] | archen94@gmail.com |
a866bc330a6b34a34d792281dc7115086288f935 | 9b060e046431ca062d750953c1a9fa227bb78b92 | /src/main/java/org/cimmyt/config/EndpointFormat.java | 5e1a9bcf0f5268e4d00ac957f7d0b1f983be5f64 | [] | no_license | itucimmyt/brapiServices | 42eab13dea205859abdac54f44a38ff112402839 | 331160ae58e30456eb71d6a47b2ae4786b973011 | refs/heads/master | 2021-01-25T06:24:01.877012 | 2017-06-06T21:36:20 | 2017-06-06T21:36:20 | 93,561,940 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 469 | java | package org.cimmyt.config;
import org.cimmyt.api.ApiFormat;
/**
* Static Thread Local variable to identify the {@link ApiFormat} of the requested REST endpoint
* @author JAROJAS
*
*/
public class EndpointFormat {
private static final ThreadLocal<ApiFormat> endpointLocal = new ThreadLocal<>();
public static ApiFormat getCurrent() {
return endpointLocal.get();
}
public static void setCurrent(ApiFormat apiFormat) {
endpointLocal.set(apiFormat);
}
}
| [
"j.a.rojas@cgiar.org"
] | j.a.rojas@cgiar.org |
554c84ec76b84b875e938118b19846ca286f1787 | 31e3226b3623df88f62ec68cf8b908659018b778 | /Procesadores de Lenguajes/src/Pair.java | 7d2de6c5873cdd493edf2c5ffc9650469fc87384 | [] | no_license | DavidGR01/ProcesadoresDeLenguajes | 9c5133070935060e624ef24636825b988a5023dd | 1bcf484995c7aad494e47b57169257c0a4242ea7 | refs/heads/master | 2023-07-11T02:13:00.024918 | 2021-01-18T17:28:21 | 2021-01-18T17:28:21 | 330,975,087 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 606 | java | public class Pair<L, R> {
private final L left;
private final R right;
public Pair(L left, R right) {
assert left != null;
assert right != null;
this.left = left;
this.right = right;
}
public L getLeft() {
return left;
}
public R getRight() {
return right;
}
@Override
public int hashCode() {
return left.hashCode() ^ right.hashCode();
}
@Override
public boolean equals(Object o) {
if (!(o instanceof Pair))
return false;
@SuppressWarnings("rawtypes")
Pair pairo = (Pair) o;
return this.left.equals(pairo.getLeft()) && this.right.equals(pairo.getRight());
}
} | [
"oscar.izval@gmail.com"
] | oscar.izval@gmail.com |
06bbbfaafa7ad6af501d6ddf913f13dc73e8a874 | 1c7a5f499472e5c71a38550bb950ca809070269d | /app/src/main/java/com/forpoint/notebook/Adapter/OnItemClick.java | 15d624773395d769847bcbd435cdbcb0b7e8c0df | [] | no_license | ForPoint/NoteBook | 1ebe0340afcf65303bb091610f42e42cb5700b65 | 26beaa5fb60efdd258afdb0ddf6427a6bfb020bd | refs/heads/master | 2020-07-01T01:43:21.001943 | 2016-11-23T08:55:16 | 2016-11-23T08:55:16 | 74,558,259 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 248 | java | package com.forpoint.notebook.Adapter;
import android.view.View;
/**
* Created by Administrator on 2016/11/14.
*/
public interface OnItemClick {
void onItemClick(View view , String data);
void onLongItemClick(View view , String data);
} | [
"429508297@qq.com"
] | 429508297@qq.com |
3af60b8d321ecd3a5d95bfbdabfb637d1d1f2f66 | 2061fb71750c013122ed9e6f7d6d723d602b87bd | /src/main/java/Controller/CheckoutCounterController.java | 937a83a1ddbbfed5194930cfd6d9c6145b36d5a2 | [] | no_license | jasonct05/CheckoutCounter | 324e372ab1f2e3aaf3747600a346725d9b7f4f2d | 6b033a64081c23ef0457a6f8aef1bd42fa68685e | refs/heads/master | 2020-03-27T05:59:26.158635 | 2018-08-25T22:41:49 | 2018-08-25T22:41:49 | 146,069,702 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,302 | java | package Controller;
import Model.TransactionProcessingModel;
import View.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import static Util.Utility.debug;
public class CheckoutCounterController extends JPanel {
public static final int LENGTH = 700;
public static final int HEIGHT = 300;
public static final int HEADER_HEIGHT = 25;
public static final int FOOTER_HEIGHT = 25;
private TransactionProcessingModel tpm;
public CheckoutCounterController(TransactionProcessingModel tpm) {
this.tpm = tpm;
// to layout the various panels properly
setLayout(new BorderLayout());
setPreferredSize(new Dimension(LENGTH, HEIGHT));
// set the top panel
JLabel title = new JLabel("Checkout Counter");
JPanel titlePanel = new JPanel();
titlePanel.setPreferredSize(new Dimension(LENGTH, HEADER_HEIGHT));
titlePanel.add(title);
titlePanel.setBackground(Color.lightGray);
JPanel barcodeScanner = new CheckoutCounterBarcodeScannerView(this.tpm, new Dimension(LENGTH / 2, HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT));
barcodeScanner.setPreferredSize( new Dimension(LENGTH / 2, HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT));
JPanel transactionInformation = new TransactionInformationView(this.tpm);
barcodeScanner.setMinimumSize( new Dimension(LENGTH / 2, HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT));
JPanel footerPanel = new JPanel();
JButton validateTransaction = new ValidateTransactionView("Validate checkout", this.tpm);
JButton checkoutTransaction = new CheckoutTransactionView("Proceed to checkout", this.tpm);
footerPanel.add(validateTransaction);
footerPanel.add(checkoutTransaction);
// add everything to main
add(titlePanel, BorderLayout.NORTH);
add(barcodeScanner, BorderLayout.WEST);
add(transactionInformation, BorderLayout.CENTER);
add(footerPanel, BorderLayout.SOUTH);
// Add Action Listeners
ValidateListener validateListener = new ValidateListener();
validateTransaction.addActionListener(validateListener);
CheckoutListener checkoutListener = new CheckoutListener();
checkoutTransaction.addActionListener(checkoutListener);
// add component to repaint
this.tpm.addView((ICheckoutViewComponent) transactionInformation);
this.tpm.addView((ICheckoutViewComponent) validateTransaction);
this.tpm.addView((ICheckoutViewComponent) checkoutTransaction);
debug("Ready for Transaction");
}
private boolean fAllowCheckoutTransaction() {
return tpm.getTransaction() != null && tpm.getTransaction().getValidated();
}
/**
* Handle Validate options for Checkout
*/
class ValidateListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
tpm.validateTransaction();
debug("Validating");
}
}
/**
* Handle Checkout options for Checkout
*/
class CheckoutListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
tpm.resetTransaction();
JOptionPane.showMessageDialog(null, "Thank you come again!");
}
}
} | [
"jct96@cs.washington.edu"
] | jct96@cs.washington.edu |
bb5d7eb36557abe7780cc5284d1eb448fa884129 | 5e1ee1111b3478fd51e2ab8e700e74c7107c01cb | /HelloWolrd/gen/com/javajima/example/hellowolrd/R.java | 708249da6bb869b648fa20db22df239dfd074412 | [] | no_license | javajima/HelloWorld | 0e0ce1ed71dfa22f6f94867acbe9b279d82c9cc6 | a5b4fa46d6e6dea3031dd94fb9f0673918835477 | refs/heads/master | 2021-01-19T13:52:54.684608 | 2014-09-14T17:07:01 | 2014-09-14T17:07:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,002 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.javajima.example.hellowolrd;
public final class R {
public static final class attr {
}
public static final class drawable {
public static final int ic_launcher=0x7f020000;
}
public static final class id {
public static final int menu_settings=0x7f070000;
}
public static final class layout {
public static final int activity_main=0x7f030000;
}
public static final class menu {
public static final int activity_main=0x7f060000;
}
public static final class string {
public static final int app_name=0x7f040000;
public static final int hello_world=0x7f040001;
public static final int menu_settings=0x7f040002;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
API 11 theme customizations can go here.
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
API 14 theme customizations can go here.
*/
public static final int AppBaseTheme=0x7f050000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f050001;
}
}
| [
"javajima@gmail.com"
] | javajima@gmail.com |
ee5798880d97e77a7f7e915060fb34c013444c6c | 9d7fee23d9fd302e7c1a8c73a8657a3932ba2b97 | /oop/src/simpleRPS0/SimpleRPS.java | 7a43e159a08829d740d6288309970ae5ca6a1b9c | [] | no_license | ckan2010/oop | 588f6403e11a6598c4b40977e539441923ebb3c1 | 81d7676b4e2ab4fac4583a467c0f15b9185545df | refs/heads/master | 2021-01-20T20:27:59.912091 | 2016-07-14T09:24:14 | 2016-07-14T09:24:14 | 61,774,660 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,979 | java | package simpleRPS0;
import java.util.Random;
import javax.swing.JOptionPane;
import com.sun.xml.internal.bind.v2.runtime.unmarshaller.InterningXmlVisitor;
public class SimpleRPS {
public static void main(String[] args) {
JOptionPane.showMessageDialog(null, "===가위바위보 게임===");
int comp = 0,player = 0,gamer = 0;
String result = "";
Random r = new Random();
while (true) {
switch (JOptionPane.showInputDialog("1계속 1않이면종료")) {
case "1":
String sele = JOptionPane.showInputDialog("1가위 2바위 3보");
player = Integer.parseInt(sele);
comp = r.nextInt(3)+1;
gamer = (int)((player - comp + 3)%3);
/*switch (gamer){
case 0:
result = "TIE";
break;
case 1:
result = "LOSE"
break;
case 2:
result = "WIN";
break;
default
break;
}*/
result = gameEngine(comp, player, result);
break;
default:
return;
}
JOptionPane.showMessageDialog(null, "player = "+player+" comp = "+comp+" 결과 "+result);
}
}
/**
* @param comp
* @param player
* @param result
* @return
*/
private static String gameEngine(int comp, int player, String result) {
switch (player) {
case 1:
switch (comp) {
case 1:
result = "TIE";
break;
case 2:
result = "LOSE";
break;
case 3:
result = "WIN";
break;
default:
break;
}
break;
case 2:
switch (comp) {
case 1:
result = "WIN";
break;
case 2:
result = "TIE";
break;
case 3:
result = "LOSE";
break;
default:
break;
}
break;
case 3:
switch (comp) {
case 1:
result = "LOSE";
break;
case 2:
result = "WIN";
break;
case 3:
result = "TIE";
break;
default:
break;
}
break;
default:
break;
}
return result;
}
}
| [
"ckan2010@gmail.com"
] | ckan2010@gmail.com |
5ff309a144b9d46dfc9d6c17558413174d08925a | 49319f0c4d5ec7813fcb63d14162ee083d3c7d99 | /src/main/java/com/smn/client/token/impl/IAMServiceImpl.java | 1f2e2b4ea2780043a376c6ed1f84cf680b527ed0 | [] | no_license | zhongyuer9/Simple-Message-Notification-Client | a7a510c34beb711eb7f3b4735f59a0b6d09de0c9 | b2b1e3b8e01e37e23059ab4130746bb8158a0b99 | refs/heads/master | 2021-01-17T08:47:37.668346 | 2017-07-14T05:05:14 | 2017-07-14T05:05:14 | 83,964,649 | 2 | 1 | null | 2017-03-08T13:07:07 | 2017-03-05T11:22:05 | null | UTF-8 | Java | false | false | 5,759 | java | /*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package com.smn.client.token.impl;
import java.util.Date;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.smn.client.IAMService;
import com.smn.client.bean.AuthBean;
import com.smn.client.util.DateUtil;
import com.smn.client.util.HttpUtil;
/**
* This class {@link IAMServiceImpl} implements the {@link IAMService} interface
*
* @author liuqiangqiang
* @version 0.5.0
*
*/
public class IAMServiceImpl implements IAMService {
/**
* LOGGER
*/
private static Logger LOGGER = LoggerFactory.getLogger(IAMServiceImpl.class);
/**
* request info for iam
*/
private static final String IAM_TOKEN_REQUEST = "{\"auth\":{\"identity\":{\"methods\":[\"password\"],\"password\":{\"user\":{\"name\":\"{0}\",\"password\":\"{1}\",\"domain\":{\"name\":\"{2}\"}}}},\"scope\":{\"project\":{\"name\":\"{3}\"}}}}";
/**
* user's name
*/
private String userName;
/**
* user's password
*/
private String password;
/**
* user's domain name
*/
private String domainName;
/**
* region Id
*/
private String regionId;
/**
* the URL of IAM
*/
private String iamUrl;
/**
* Token expired 5 minutes in advance
*/
private long expiredInterval = 5 * 60 * 1000;
/**
* IAM获取token请求的请求体
*/
private String requestMessage = null;
/**
* 构造函数
*
* @param userName
* 用户名
* @param password
* 密码
* @param domainName
* 用户Domain名称
* @param regionId
* region的ID
* @param iamUrl
* IAM的URL访问地址
*/
public IAMServiceImpl(String userName, String password, String domainName, String regionId, String iamUrl) {
setUserName(userName);
setPassword(password);
setDomainName(domainName);
setRegionId(regionId);
setIamUrl(iamUrl);
requestMessage = IAM_TOKEN_REQUEST.replaceFirst("\\{0\\}", userName).replaceFirst("\\{2\\}", domainName)
.replaceFirst("\\{3\\}", regionId).replaceFirst("\\{1\\}", password);
}
/**
* Obtain authorization information from the IAM service, which includes
* projectId, user token, and token expiration time
*
* @return {@code AuthBean} User token information
* @throws RuntimeException
* Failed to get token, then ran out of the exception
*/
public AuthBean getAuthentication() throws RuntimeException {
AuthBean authBean = null;
try {
authBean = HttpUtil.postForIamToken(iamUrl, requestMessage);
// parse time
Date tempDate = DateUtil.parseDate(authBean.getExpiresAt());
authBean.setExpiresTime(tempDate.getTime() - expiredInterval);
return authBean;
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
LOGGER.error("Faied to get token from iam.", e);
throw new RuntimeException("Failed to get token from iam.", e);
}
}
/**
* @return the expiredInterval
*/
public long getExpiredInterval() {
return expiredInterval;
}
/**
* @param expiredInterval
* the expiredInterval to set
*/
public void setExpiredInterval(long expiredInterval) {
this.expiredInterval = expiredInterval;
}
/**
* @return the userName
*/
public String getUserName() {
return userName;
}
/**
* @return the password
*/
public String getPassword() {
return password;
}
/**
* @return the domainName
*/
public String getDomainName() {
return domainName;
}
/**
* @return the regionId
*/
public String getRegionId() {
return regionId;
}
/**
* @return the iamUrl
*/
public String getIamUrl() {
return iamUrl;
}
/**
* @param userName
* the userName to set
*/
public void setUserName(String userName) {
if (userName == null) {
LOGGER.error("Username is null.");
throw new NullPointerException("username is null.");
}
this.userName = userName;
}
/**
* @param password
* the password to set
*/
public void setPassword(String password) {
if (password == null) {
LOGGER.error("Password is null.");
throw new NullPointerException("password is null.");
}
this.password = password;
}
/**
* @param domainName
* the domainName to set
*/
public void setDomainName(String domainName) {
if (domainName == null) {
LOGGER.error("Domainname is null.");
throw new NullPointerException("domainName is null.");
}
this.domainName = domainName;
}
/**
* @param regionId
* the regionId to set
*/
public void setRegionId(String regionId) {
if (regionId == null) {
LOGGER.error("Regionid is null.");
throw new NullPointerException("regionId is null.");
}
this.regionId = regionId;
}
/**
* @param iamUrl
* the iamUrl to set
*/
public void setIamUrl(String iamUrl) {
if (iamUrl == null) {
LOGGER.error("IAMurl is null.");
throw new NullPointerException("iamUrl is null.");
}
this.iamUrl = iamUrl;
}
}
| [
"p00314552@szxbz876.huaweiobz.com"
] | p00314552@szxbz876.huaweiobz.com |
df4894ecf998b536e12486e409a67fd441217879 | 8ac8dc162f58e0cec961fd11f98cf683393a5b06 | /app/src/test/java/sg/edu/rp/c346/id18054367/demoandroidlist/ExampleUnitTest.java | da34620154c1e274cff97f6c43123bda1d9c78b2 | [] | no_license | yjj9939/Demo_Android_List | e2496d54aa558cd9bf47c68433310ca70998b1a6 | eb2a23b232db10607ed5de932d64da9de8739ac5 | refs/heads/master | 2022-11-23T06:44:54.631977 | 2020-07-20T02:56:18 | 2020-07-20T02:56:18 | 280,998,106 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 402 | java | package sg.edu.rp.c346.id18054367.demoandroidlist;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"18054367@myrp.edu.sg"
] | 18054367@myrp.edu.sg |
b67faf77bbf2527f2b003200fd711b2fa0526384 | a31d003d5268412d68e3a6aa2dbce43e9bc7651e | /src/main/java/my/practice/dp/IslandCount.java | 7b164e7c8d8cda14d67e2d565ba128ab8cde248e | [] | no_license | kunalmanch/algoIV | c61c2ec8f587448734eb1a9bd106e7a0059f3cef | 7e835bef2e6064240270054a768ef15c349e7cb6 | refs/heads/master | 2020-05-21T20:09:34.096887 | 2016-09-19T13:35:20 | 2016-09-19T13:35:20 | 65,329,644 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,112 | java | package my.practice.dp;
/**
* Created by kmishra on 8/29/2016.
*/
public class IslandCount {
public static int islandCount(int[][] mat) {
int m = mat.length;
int n = mat[0].length;
int count = 0;
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if (mat[i][j] == 1) {
helper(mat, i, j);
count++;
}
}
}
return count;
}
private static void helper(int[][] mat, int i, int j) {
int m = mat.length;
int n = mat[0].length;
if (i < 0 || i >= m) return;
if (j < 0 || j >= n) return;
if (mat[i][j] == 0) return;
mat[i][j] = 0;
helper(mat, i + 1, j);
helper(mat, i - 1, j);
helper(mat, i, j + 1);
helper(mat, i, j - 1);
}
public static void main(String[] args) {
int[][] mat = {
{1,1,0,0},
{1,0,0,1},
{0,0,1,1},
{1,0,0,0}
};
System.err.println(islandCount(mat));
}
}
| [
"kmishra@CSVAKMISHRA02.office.comscore.com"
] | kmishra@CSVAKMISHRA02.office.comscore.com |
6b6fc788a49681fd1b4b73e68ed81cca22a6d0e0 | a0736274a654f339dbb5a2ea7d3e1a14f6af28a1 | /tron-framework/src/main/java/com/dadsunion/framework/interceptor/impl/SameUrlDataInterceptor.java | 53ebe8b4504b261b7a9b00c0160a2336c01cd37d | [
"MIT"
] | permissive | andy-li/tron-center-wallet | f7213dfe35456c1cd42b0a0507f64e7e7e5a423f | c577005416770b79ce79c8dd1107b66d7caee2f8 | refs/heads/master | 2023-06-05T01:45:49.450285 | 2021-06-22T06:55:24 | 2021-06-22T06:55:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,352 | java | package com.dadsunion.framework.interceptor.impl;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletRequest;
import com.dadsunion.common.constant.Constants;
import com.dadsunion.common.filter.RepeatedlyRequestWrapper;
import com.dadsunion.common.utils.StringUtils;
import com.dadsunion.common.utils.http.HttpHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSONObject;
import com.dadsunion.common.core.redis.RedisCache;
import com.dadsunion.framework.interceptor.RepeatSubmitInterceptor;
/**
* 判断请求url和数据是否和上一次相同,
* 如果和上次相同,则是重复提交表单。 有效时间为10秒内。
*
* @author ruoyi
*/
@Component
public class SameUrlDataInterceptor extends RepeatSubmitInterceptor
{
public final String REPEAT_PARAMS = "repeatParams";
public final String REPEAT_TIME = "repeatTime";
// 令牌自定义标识
@Value("${token.header}")
private String header;
@Autowired
private RedisCache redisCache;
/**
* 间隔时间,单位:秒 默认10秒
*
* 两次相同参数的请求,如果间隔时间大于该参数,系统不会认定为重复提交的数据
*/
private int intervalTime = 10;
public void setIntervalTime(int intervalTime)
{
this.intervalTime = intervalTime;
}
@SuppressWarnings("unchecked")
@Override
public boolean isRepeatSubmit(HttpServletRequest request)
{
String nowParams = "";
if (request instanceof RepeatedlyRequestWrapper)
{
RepeatedlyRequestWrapper repeatedlyRequest = (RepeatedlyRequestWrapper) request;
nowParams = HttpHelper.getBodyString(repeatedlyRequest);
}
// body参数为空,获取Parameter的数据
if (StringUtils.isEmpty(nowParams))
{
nowParams = JSONObject.toJSONString(request.getParameterMap());
}
Map<String, Object> nowDataMap = new HashMap<String, Object>();
nowDataMap.put(REPEAT_PARAMS, nowParams);
nowDataMap.put(REPEAT_TIME, System.currentTimeMillis());
// 请求地址(作为存放cache的key值)
String url = request.getRequestURI();
// 唯一值(没有消息头则使用请求地址)
String submitKey = request.getHeader(header);
if (StringUtils.isEmpty(submitKey))
{
submitKey = url;
}
// 唯一标识(指定key + 消息头)
String cache_repeat_key = Constants.REPEAT_SUBMIT_KEY + submitKey;
Object sessionObj = redisCache.getCacheObject(cache_repeat_key);
if (sessionObj != null)
{
Map<String, Object> sessionMap = (Map<String, Object>) sessionObj;
if (sessionMap.containsKey(url))
{
Map<String, Object> preDataMap = (Map<String, Object>) sessionMap.get(url);
if (compareParams(nowDataMap, preDataMap) && compareTime(nowDataMap, preDataMap))
{
return true;
}
}
}
Map<String, Object> cacheMap = new HashMap<String, Object>();
cacheMap.put(url, nowDataMap);
redisCache.setCacheObject(cache_repeat_key, cacheMap, intervalTime, TimeUnit.SECONDS);
return false;
}
/**
* 判断参数是否相同
*/
private boolean compareParams(Map<String, Object> nowMap, Map<String, Object> preMap)
{
String nowParams = (String) nowMap.get(REPEAT_PARAMS);
String preParams = (String) preMap.get(REPEAT_PARAMS);
return nowParams.equals(preParams);
}
/**
* 判断两次间隔时间
*/
private boolean compareTime(Map<String, Object> nowMap, Map<String, Object> preMap)
{
long time1 = (Long) nowMap.get(REPEAT_TIME);
long time2 = (Long) preMap.get(REPEAT_TIME);
if ((time1 - time2) < (this.intervalTime * 1000))
{
return true;
}
return false;
}
}
| [
"lezai@sina.cn"
] | lezai@sina.cn |
431d13ca6806ce5f4b209250a731e21165ebabe7 | 4a29399c7ef83ca31a257c1211712de36f17835d | /src/com/kpos/domain/CompanyDiscount.java | 9a0ace96ad172672f37ec7cd3a3bfcdd4963506b | [] | no_license | su547g/kpos | 41da3a3ea2cdc64b135654bac470680a15b0bdde | 1e793fa359ce14ef45033a6d953ea6642faad741 | refs/heads/master | 2021-01-15T10:14:13.489639 | 2013-01-17T04:38:00 | 2013-01-17T04:38:00 | 34,023,034 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,333 | java | package com.kpos.domain;
import javax.persistence.*;
/**
* Created by kpos.
* Author: kkwang
* Date: 6/8/12 12:35 AM
*/
@NamedQueries({
@NamedQuery(
name = "CompanyDiscount.findDiscountRate",
query = "from CompanyDiscount where rate = :aRate"
),
@NamedQuery(
name = "CompanyDiscount.findDiscountByName",
query = "from CompanyDiscount where name=:aName"
)
})
@Entity
@Table(name = "company_discount")
public class CompanyDiscount extends AbstractDomainObject {
public static enum DiscountTypeEnum {
AMOUNT(1),
PERCENT(2);
private int statusCode;
DiscountTypeEnum(int val) {
statusCode = val;
}
public int getStatusCode(){
return statusCode;
}
public static DiscountTypeEnum getType(int val) {
if(val == 1) return AMOUNT;
else return PERCENT;
}
}
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
@Column(name = "rate")
private double rate;
@Column(name = "type")
private int type;
@Column(name = "name")
private String name;
@Column(name = "description")
private String description;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public double getRate() {
return rate;
}
public void setRate(double rate) {
this.rate = rate;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CompanyDiscount that = (CompanyDiscount) o;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (description != null ? !description.equals(that.description) : that.description != null) return false;
if (Double.compare(that.type, type) != 0) return false;
if (Double.compare(that.rate, rate) != 0) return false;
if (id != null ? !id.equals(that.id) : that.id != null) return false;
return true;
}
@Override
public int hashCode() {
int result;
long temp;
result = id != null ? id.hashCode() : 0;
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (description != null ? description.hashCode() : 0);
temp = rate != +0.0d ? Double.doubleToLongBits(rate) : 0L;
result = 31 * result + (int) (temp ^ (temp >>> 32));
temp = type != +0.0d ? Double.doubleToLongBits(type) : 0L;
result = 31 * result + (int) (temp ^ (temp >>> 32));
return result;
}
}
| [
"kangwang1982@gmail.com@ea9e98a1-8d46-a6bd-9028-500515dead74"
] | kangwang1982@gmail.com@ea9e98a1-8d46-a6bd-9028-500515dead74 |
f2252df1f0f3629e93f39c16431cbf97f613b803 | 97ec051a298720412219aa6dabc0dbfe1fc1976d | /app/src/main/java/echedeygarcias/gmail/com/login/register/model/IModelRegister.java | ab1958d8277e06ea4efc15e2b9dc5e467bd7b36a | [] | no_license | eche23/PAIT | 0abfc79059e0a0f88323bf6a99e58b45a63bb00a | 82a42d2163b57fdf456d636849645b77ccf42580 | refs/heads/master | 2020-04-10T19:12:08.251354 | 2018-12-10T19:35:34 | 2018-12-10T19:35:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 146 | java | package echedeygarcias.gmail.com.login.register.model;
public interface IModelRegister {
void register(String username, String password);
}
| [
"eche2312@gmail.com"
] | eche2312@gmail.com |
baa9f213f9720ac7afdfbc41e98be59373232024 | d2dea7fba47e1242d8c93f7c522d49fb5ff0dd45 | /j_collection/ArrayListClass.java | c04d7beee49696f5b176d795e0770a503cb361cb | [] | no_license | youngwooooo/Java | 13f952701ce87957498ac6a1a715bc51b6afb1ca | 462f2b926da950de4781f7f45bd433ec1afcefff | refs/heads/master | 2023-04-06T15:46:23.493028 | 2021-04-10T08:08:52 | 2021-04-10T08:08:52 | 347,038,033 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,976 | java | package j_collection;
import java.util.ArrayList;
import java.util.Scanner;
public class ArrayListClass {
public static void main(String[] args) {
/*
* Collections Framework
* - 다수의 데이터를 다루기 위한 표준 방식
* - List
* - Map
* - Set
* - List, Map, Set은 interface다.
*/
/*
* ArrayList의 주요메서드 - 처음 길이는 0, 저장을 할 수록 길이가 점점 늘어남. 값을 삭제하면 길이가 줄어듬 ==> 즉 저장한 개수만큼을 유지한다.
* - boolean add(Object obj) : 마지막 위치에 객체를 추가 후 성공여부를 반환한다.
* - void add(int index, Object obj) : 지정된 위치에 객체를 추가한다. 기존의 길이를 벗어난 곳에 인덱스를 저장할 수는 없다. 인덱스를 밀어냄 => 인덱스 한 칸씩 뒤로 감
* - Object set(int index, Object obj) : 지정된 위치에 객체를 저장 후 기존 객체를 반환한다. 인덱스를 덮어 씀
* - Object get(int index) : 지정된 위치의 객체를 반환한다.
* - int size() : 저장된 객체의 수를 반환한다.
* - Object remove(int index) : 지정된 위치의 객체를 제거한다. 제거한 인덱스 뒤에 있던 인덱스들이 앞으로 한 칸씩 땡겨진다.
*/
ArrayList sample = new ArrayList();
sample.add("abc");
sample.add(100);
sample.add(new Scanner(System.in));
// 저장은 어떤 타입도 가능하지만 인덱스를 꺼냈을 때 예측할 수가 없다!
ArrayList<Integer> list = new ArrayList<>();
// collections 뒤에 <>(제네릭)을 붙일 수 있다. <> 안에는 ArrayList에 저장할 수 있는 타입을 지정해 줄 수 있음.
list.add(new Integer(10));
// list.add("abc");
list.add(20);
/*
* 래퍼 클래스 : 자동 형변환을 해줌, <>안에 들어가는 클래스
* - byte : Byte
* - short : Short
* - int : Integer
* - long : Long
* - float : Float
* - double : Double
* - boolean : Boolean
* - char : Character
*/
System.out.println(list);
list.add(1, 30);
System.out.println(list);
int before = list.set(2, 40); // set은 return 값이 있다. return값 = 기존에 있던 값
System.out.println("before : " + before);
System.out.println("after : " + list.get(2)); // get은 해당 인덱스의 값을 불러옴.
System.out.println(list);
// int size -> ArrayList의 길이를 말함. for문에서 자주 사용
for(int i=0; i<list.size(); i++){
System.out.println(i + " : " + list.get(i));
}
// Object remove
list.remove(1); // 1번 인덱스 제거
System.out.println(list); // 3번 인덱스였던 40이 2번 인덱스로 땡겨짐. int size = 2
// for문에서 remove를 사용하려면 for문을 거꾸로 돌려야함!
for(int i=list.size()-1; i>=0; i--){
list.remove(i);
}
System.out.println(list);
// list에 1~100사이의 랜덤값을 10개 저장해주세요
for(int i=0; i<10; i++){
int random = (int)(Math.random()*100)+1;
list.add(random);
}
System.out.println(list);
// list에 저장된 값의 합계와 평균을 구해주세요
int sum = 0;
double avg = 0;
for(int i=0; i<list.size(); i++){
sum += list.get(i);
}
avg = (double)sum / list.size(); // 둘다 int기 떄문에 한 쪽을 double로 형 변환해줘야함!
System.out.println("합계 : " + sum + " / " + "평균 : " + avg);
// 최소값과 최대값을 구해주세요
int min = list.get(0);
int max = list.get(0);
for(int i=0; i<list.size(); i++){
if(list.get(i) < min){
min = list.get(i);
}
if(list.get(i) > max){
max = list.get(i);
}
}
System.out.println("최소값 : " + min + " / " + "최대값 : " + max);
// list를 오름차순으로 정렬해주세요.
for(int i=0; i<list.size()-1; i++){
min = i;
for(int j=i+1; j<list.size(); j++){
if(list.get(j) < list.get(min)){
min = j;
}
}
int temp = list.get(i);
list.set(i, list.get(min)); // 수정하는 것이기 때문에 set을 사용할 것!
list.set(min, temp);
}
System.out.println(list);
// ArrayList 2차원 배열 만드는법
ArrayList<ArrayList<Integer>> list2 = new ArrayList<>();
ArrayList<Integer> list3 = new ArrayList<>();
list3.add(10);
list3.add(20);
list3.add(30);
list2.add(list3); // list3이라는 변수가 아닌 list3에 들어있는 ArrayList를 저장한 것임!
System.out.println(list2);
list3 = new ArrayList<>(); // 새로운 ArrayList 만듬
list3.add(40);
list3.add(50);
list2.add(list3);
System.out.println(list2);
for(int i=0; i<list2.size(); i++){
ArrayList<Integer> list4 = list2.get(i);
for(int j=0; j<list4.size(); j++){
System.out.print(list4.get(j) + "\t");
}
System.out.println();
// for(int j=0; j<list2.get(i).size(); j++){
// System.out.println(list2.get(i).get(j));
// }
}
}
}
| [
"dlddudn02@gmail.com"
] | dlddudn02@gmail.com |
794b6c6ac0772796e94aeae9d05cf5c2fb2482d2 | 20eb62855cb3962c2d36fda4377dfd47d82eb777 | /IntroClassJava/dataset/grade/95362737dcd262ddd67b0fe1381c25f1e6b885860b4e51efb6f57223dceb77b4c6c7d855e3fe891c10cd51b48c9b052cf2c74f181a28d3020d77a4a2d6e4db18/010/mutations/188/grade_95362737_010.java | f03bdf1d2a39e000ed1692ebe951d622eeae261f | [] | no_license | ozzydong/CapGen | 356746618848065cce4e253e5d3c381baa85044a | 0ba0321b6b1191443276021f1997833342f02515 | refs/heads/master | 2023-03-18T20:12:02.923428 | 2020-08-21T03:08:28 | 2020-08-21T03:08:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,511 | java | package introclassJava;
class IntObj {
public int value;
public IntObj () {
} public IntObj (int i) {
value = i;
}
}
class FloatObj {
public float value;
public FloatObj () {
} public FloatObj (float i) {
value = i;
}
}
class LongObj {
public long value;
public LongObj () {
} public LongObj (long i) {
value = i;
}
}
class DoubleObj {
public double value;
public DoubleObj () {
} public DoubleObj (double i) {
value = i;
}
}
class CharObj {
public char value;
public CharObj () {
} public CharObj (char i) {
value = i;
}
}
public class grade_95362737_010 {
public java.util.Scanner scanner;
public String output = "";
public static void main (String[]args) throws Exception {
grade_95362737_010 mainClass = new grade_95362737_010 ();
String output;
if (args.length > 0) {
mainClass.scanner = new java.util.Scanner (args[0]);
} else {
mainClass.scanner = new java.util.Scanner (System.in);
}
mainClass.exec ();
System.out.println (mainClass.output);
}
public void exec () throws Exception {
FloatObj a = new FloatObj (), b = new FloatObj (), c =
new FloatObj (), d = new FloatObj (), score = new FloatObj ();
output +=
(String.format
("Enter thresholds for A, B, C, D\nin that order, decreasing percentages > "));
a.value = scanner.nextFloat ();
b.value = scanner.nextFloat ();
c.value = scanner.nextFloat ();
d.value = scanner.nextFloat ();
output +=
(String.format ("Thank you. Now enter student score (percent) >"));
score.value = scanner.nextFloat ();
if (score.value >= a.value) {
output += (String.format ("Student has a A grade\n"));
} else if (score.value >= b.value && score.value < a.value) {
output += (String.format ("Student has a B grade\n"));
} else if (true) return ;
if (score.value >= c.value && score.value < b.value) {
output += (String.format ("Student has a C grade\n"));
} else if (score.value >= d.value && score.value < c.value) {
output += (String.format ("Student has a D grade\n"));
} else if (score.value < d.value) {
output += (String.format ("Student has failed the course\n"));
}
if (true)
return;;
}
}
| [
"justinwm@163.com"
] | justinwm@163.com |
0d86d61481d7cbdc01b75cdbdc690b96f6980431 | dc304beaaf2afb1f7148db6b8748938af2162f5f | /src/main/java/curso/springboot/model/Pessoa.java | 329b2e690bb9b19f95373c00d9978ff5eeeccfdd | [] | no_license | GustavoWendel/SistemaDeCadastro-CRUD | 79becd37100caf9129ebbe4a150f9abebf38036b | d68dfe780072440f5d3b549b5050099f9490e747 | refs/heads/master | 2023-01-24T07:21:29.073706 | 2020-12-08T15:17:56 | 2020-12-08T15:17:56 | 315,337,421 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,245 | java | package curso.springboot.model;
import com.sun.istack.NotNull;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
@Entity
public class Pessoa implements Serializable{
private static final long serialVersionUID = 1;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@NotNull
private Long id;
@NotNull
private String nome;
@NotNull
private int idade;
@NotNull
private String sobrenome;
@OneToMany(mappedBy = "pessoa")
private List<Telefone> telefones;
public void setTelefones(List<Telefone> telefones) {
this.telefones = telefones;
}
public List<Telefone> getTelefones() {
return telefones;
}
public int getIdade() {
return idade;
}
public void setIdade(int idade) {
this.idade = idade;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getSobrenome() {
return sobrenome;
}
public void setSobrenome(String sobrenome) {
this.sobrenome = sobrenome;
}
}
| [
"gustavo.borges@basis.com.br"
] | gustavo.borges@basis.com.br |
19e5ffac96b258e40eb62eeae59c8d229f49a9f9 | 5c82c96a58361d2f2f58da7413bf325ee9f4ec1c | /tietrk-ja-algoritmit/src/lajitteludemo/SortAlgorithms.java | 3a9caf33db424aeb5858ad4428aa4a768a788ed1 | [] | no_license | Puune/Palautusrepo | 55adc5b672c5a3b1e797094e4c5896b13d612ddc | c1bf8e72bc712b01fc6ab98ca304da374a637164 | refs/heads/master | 2021-04-04T16:32:52.071160 | 2020-04-26T12:47:30 | 2020-04-26T12:47:30 | 248,471,334 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,051 | java | package lajitteludemo;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author kamaj
*/
import java.util.Random;
public class SortAlgorithms {
final static int MAX = 30000;
static long laskuri = 0;
public static void main(String[] args) {
selectSort();
mergeSort();
quickSortLoop();
}
public static void selectSort() {
int[] taul = new int[MAX]; // taul tallettaa lajiteltavat tiedot
int i, j, k, apu, pienin;
Random r = new Random(); // luodaan satunnaislukugeneraattori
System.out.println("Generoidaan syöttöaineisto: ");
for (i = 0; i < MAX; i++) {
taul[i] = r.nextInt(1000); // generoidaan luvut
System.out.print(taul[i] + " ");
if (i > 0 && i % 40 == 0) // rivinvaihto
System.out.println();
}
System.out.println("\nSuoritetaan valintalajittelu, paina Enter ");
Lue.merkki();
laskuri++;
for (i = 0; i < MAX; i++) {
pienin = i;
laskuri++;
for (j = i + 1; j < MAX; j++) {
/* löytyykö taulukon loppupäästä pienempää alkiota? */
laskuri++;
if (taul[j] < taul[pienin]) {
pienin = j;
}
laskuri++;
}
laskuri++;
if (pienin != i) {
/* jos löytyi suoritetaan alkioiden vaihto */
apu = taul[pienin];
taul[pienin] = taul[i];
taul[i] = apu;
}
}
System.out.println();
for (i = 0; i < MAX; i++) {
System.out.print(taul[i] + " ");
if (i > 0 && i % 40 == 0) // rivinvaihto
System.out.println();
}
System.out.println("\nKuittaa tulos, paina Enter ");
System.out.println("laskuri: " + laskuri);
laskuri = 0;
Lue.merkki();
}
public static void mergeSort() {
int[] a = new int[MAX];
int i;
Random r = new Random(); // luodaan satunnaislukugeneraattori
System.out.println("\nGeneroidaan syöttöaineisto: ");
for (i = 0; i < MAX; i++) {
a[i] = r.nextInt(1000); // generoidaan luvut
System.out.print(a[i] + " ");
if (i > 0 && i % 40 == 0) // rivinvaihto
System.out.println();
}
System.out.println("\nSuoritetaan lomituslajittelu, paina Enter ");
Lue.merkki();
mergeSort(a, 0, MAX - 1);
for (i = 0; i < MAX; i++) {
System.out.print(a[i] + " ");
if (i > 0 && i % 40 == 0) // rivinvaihto
System.out.println();
}
System.out.println("\nlaskuri: " + laskuri);
laskuri = 0;
}
private static int[] tau = new int[MAX]; // aputaulukko (ei varata tätä pinosta!)
// oletus: osataulukot t[p..q] ja t[q+1...r] ovat järjestyksess„
public static void merge(int t[], int p, int q, int r) {
// i osoittaa 1. osataulukkoa, j osoittaa 2. osataulukkoa
// k osoittaa aputaulukkoa, johon yhdiste kirjoitetaan.
int i = p, j = q + 1, k = 0;
while (i < q + 1 && j < r + 1) {
laskuri++;
if (t[i] < t[j]) {
tau[k++] = t[i++];
} else {
tau[k++] = t[j++];
}
}
// toinen osataulukko käsitelty, siirretään toisen käsittelemättömät
laskuri++;
while (i < q + 1)
tau[k++] = t[i++];
laskuri++;
while (j < r + 1)
tau[k++] = t[j++];
// siirretään yhdiste alkuperäiseen taulukkoon
laskuri++;
for (i = 0; i < k; i++) {
t[p + i] = tau[i];
}
}
public static void mergeSort(int t[], int alku, int loppu) {
int ositus;
long la, ll, lt;
if (alku < loppu) { // onko väh. 2 alkiota, että voidaan suorittaa ositus
la = alku;
ll = loppu;
lt = (la + ll) / 2;
ositus = (int) lt;
mergeSort(t, alku, ositus);// lajitellaan taulukon alkupää
mergeSort(t, ositus + 1, loppu);// lajitellaan taulukon loppupää
merge(t, alku, ositus, loppu);// yhdistetään lajitellut osataulukot
}
}
public static void quickSortLoop() {
System.out.println("\nSuoritetaan pikalajittelu, paina Enter ");
Lue.merkki();
int taulukko[] = new int[MAX];
Random r = new Random();
for (int i = 0; i < MAX; i++) {
taulukko[i] = r.nextInt(1000);
System.out.print(taulukko[i] + " ");
if (i > 0 && i % 40 == 0) {// rivinvaihto
System.out.println();
}
}
System.out.println("\nJärjestellään käyttämällä Quicksorttia, paina Enter");
Lue.merkki();
qs(taulukko, MAX);
System.out.println("Valmis");
System.out.println("Vertailujen lukumäärä: " + laskuri);
laskuri = 0;
}
public static void quickSort(int table[], int lo0, int hi0) {
int lo = lo0;
int hi = hi0;
int mid, swap;
mid = table[(lo0 + hi0) / 2];
while (lo <= hi) {
laskuri++;
while (table[lo] < mid) {
++lo;
}
laskuri++;
while (table[hi] > mid) {
--hi;
}
laskuri++;
if (lo <= hi) {
swap = table[lo];
table[lo] = table[hi];
++lo;
table[hi] = swap;
--hi;
}
}
laskuri++;
if (lo0 < hi) {
quickSort(table, lo0, hi);
}
laskuri++;
if (lo < hi0) {
quickSort(table, lo, hi0);
}
}
public static void qs(int table[], int values) {
quickSort(table, 0, values - 1);
System.out.println("\nJärjestetty aineisto:\n");
for (int i = 0; i < values; i++) {
System.out.print(table[i] + " ");
if (i > 0 && i % 40 == 0) { // rivinvaihto
System.out.println();
}
}
}
}
| [
"panu.lindqvist@gmail.com"
] | panu.lindqvist@gmail.com |
9275f33e2aeb2b73ce125a6a7578dd7deff8e082 | 9d95e9210c6944a96d5a7e19733a5cd2bf8e8c27 | /src/main/java/flexjson/factories/DateObjectFactory.java | bda15ed535d2df73f08809fbd5e5e92940b02c09 | [] | no_license | kontomierz/flexjson | 22e4f1a271cc9fdcddee508fb3ac7c866069094d | 1784f8c709b55080f5d17c2a518273f5c1fdbb7a | refs/heads/master | 2021-01-16T00:10:16.282099 | 2015-05-29T13:49:17 | 2015-05-29T13:49:17 | 36,424,006 | 0 | 0 | null | 2015-05-28T08:08:43 | 2015-05-28T08:08:43 | null | UTF-8 | Java | false | false | 6,972 | java | package flexjson.factories;
import flexjson.ObjectFactory;
import flexjson.JSONException;
import flexjson.ObjectBinder;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Type;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.Date;
/**
* DateObjectFactory instantiates java.lang.Date using a list of known java.text.DateFormat instances for json
* string types, or milliseconds from Jan 1, 1970 GMT for json numeric types.
*
* By default it uses the following patterns to recognize dates from json strings:
*
* DateFormat.getDateTimeInstance()
* DateFormat.getDateTimeInstance( DateFormat.LONG, DateFormat.LONG )
* DateFormat.getDateTimeInstance( DateFormat.MEDIUM, DateFormat.MEDIUM )
* DateFormat.getDateTimeInstance( DateFormat.SHORT, DateFormat.SHORT )
* EEE MMM d hh:mm:ss a z yyyy
* EEE MMM d HH:mm:ss z yyyy
* MM/dd/yy hh:mm:ss a
* MM/dd/yy
*
*/
public class DateObjectFactory implements ObjectFactory {
private static List<String> defaultFormats;
protected List<String> dateFormats;
protected boolean fromDefaults = false;
protected ThreadLocal<List<DateFormat>> dateFormatters = new ThreadLocal<List<DateFormat>>();
static {
defaultFormats = new ArrayList<String>();
defaultFormats.add( "EEE MMM d hh:mm:ss a z yyyy" );
defaultFormats.add( "EEE MMM d HH:mm:ss z yyyy" );
defaultFormats.add( "MM/dd/yy hh:mm:ss a" );
defaultFormats.add( "MM/dd/yy" );
}
/**
* This method adds a default format for all DateObjectFactory. This can be used to add
* a new DateFormat to every instance created after this call.
*
* @param formats one or more date formats to add to the known default formats. All formats must conform to the SimpleDateFormat syntax.
*/
public static void addDefaultFormat( String... formats ) {
defaultFormats.addAll( Arrays.asList(formats) );
}
/**
* This constructor constructs a DateObjectFactory using the default formats known
* to all instances of the DateObjectFactory.
*/
public DateObjectFactory() {
fromDefaults = true;
dateFormats = new ArrayList<String>(defaultFormats);
}
/**
* This constructs a DateObjectFactory that only knows how to recognize the given
* DateFormat instances. This instance ignores any default formats. This can be
* used to as a way to optimize performance because it doesn't have to test each
* date against formats that will never occur in your program. This is great to use
* if you can predict all formats you might parse up front.
*
* @param dateFormats a list of the date formats you want to recognize.
*/
public DateObjectFactory(List<String> dateFormats) {
this.dateFormats = dateFormats;
}
/**
* Add a new DateFormat to the known formats this instance will recognise.
*
* @param formats one or more DateFormat instances to add to the list of
* known formats.
* @return this instance for chaining calls.
*/
public DateObjectFactory add( String... formats ) {
dateFormats.addAll( Arrays.asList( formats ) );
return this;
}
/**
* This is a method is used by Flexjson deserialization process to instantiate and bind all
* data into a Date instance. You shouldn't need to call this method directly.
*
* @param context the object binding context to keep track of where we are in the object graph
* and used for binding into objects.
* @param value This is the value from the json object at the current path.
* @param targetType This is the type pulled from the object introspector. Used for Collections and generic types.
* @param targetClass concrete class pulled from the configuration of the deserializer.
*
* @return a properly initialized java.lang.Date object.
*/
public Object instantiate(ObjectBinder context, Object value, Type targetType, Class targetClass) {
try {
if( value instanceof Number ) {
return instantiateDate( (Class)targetType, ((Number)value).longValue(), context );
} else {
for( DateFormat format : getDateFormats() ) {
try {
return format.parse( value.toString() );
} catch (ParseException e) {
// try next format
}
}
throw new JSONException( String.format("%s: Parsing date %s was not recognized as a date format", context.getCurrentPath(), value ) );
}
} catch (IllegalAccessException e) {
throw new JSONException( String.format("%s: Error encountered trying to instantiate %s", context.getCurrentPath(), ((Class)targetType).getName() ), e);
} catch (InstantiationException e) {
throw new JSONException( String.format("%s: Error encountered trying to instantiate %s. Make sure there is a public constructor that accepts a single Long.", context.getCurrentPath(), ((Class)targetType).getName() ), e);
} catch (InvocationTargetException e) {
throw new JSONException( String.format("%s: Error encountered trying to instantiate %s. Make sure there is a public constructor that accepts a single Long.", context.getCurrentPath(), ((Class)targetType).getName() ), e);
}
}
private Date instantiateDate( Class targetType, Long value, ObjectBinder context ) throws IllegalAccessException, InstantiationException, InvocationTargetException {
try {
Constructor constructor = targetType.getConstructor(Long.TYPE);
return (Date)constructor.newInstance( value );
} catch (NoSuchMethodException e) {
Date d = (Date)targetType.newInstance();
d.setTime( value );
return d;
}
}
protected List<DateFormat> getDateFormats() {
if( this.dateFormatters.get() == null ) {
List<DateFormat> dateFormatList = new ArrayList<DateFormat>();
if( fromDefaults ) {
dateFormatList.add( DateFormat.getDateTimeInstance() );
dateFormatList.add( DateFormat.getDateTimeInstance( DateFormat.LONG, DateFormat.LONG ) );
dateFormatList.add( DateFormat.getDateTimeInstance( DateFormat.MEDIUM, DateFormat.MEDIUM ) );
dateFormatList.add( DateFormat.getDateTimeInstance( DateFormat.SHORT, DateFormat.SHORT ) );
}
for( String format : dateFormats ) {
dateFormatList.add( new SimpleDateFormat( format ) );
}
this.dateFormatters.set( dateFormatList );
}
return this.dateFormatters.get();
}
}
| [
"charliehubbard@1649a90f-f54c-0410-9814-d0bc849eed40"
] | charliehubbard@1649a90f-f54c-0410-9814-d0bc849eed40 |
617d6d8ccd3ae6eeccfb6651feb643a3fac6721a | a9765b5d751bf1dfd4c7073dbcc271147acc9b76 | /Topics/Arrays as parameters/Inverse boolean flags/src/Main.java | 946afccef5183bd7d3990452f8e3f2ab4b7c7a37 | [] | no_license | HashmalS/Bulls_and_Cows | 769d99d6ad57ec3891d362405c8cc0673af69bb2 | 9cad4060bc1b712259410c3243bd2601d02de049 | refs/heads/master | 2023-07-05T12:10:44.719387 | 2021-08-27T17:08:24 | 2021-08-27T17:08:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 988 | java | import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class Main {
public static void inverseFlags(boolean[] flags) {
IntStream.range(0, flags.length).forEach(i -> flags[i] = !flags[i]);
}
/* Do not change code below */
public static void main(String[] args) {
final Scanner scanner = new Scanner(System.in);
final List<Boolean> booleans = Arrays
.stream(scanner.nextLine().split("\\s+"))
.map(Boolean::parseBoolean)
.collect(Collectors.toList());
final boolean[] flags = new boolean[booleans.size()];
for (int i = 0; i < flags.length; i++) {
flags[i] = booleans.get(i);
}
inverseFlags(flags);
final String representation = Arrays.toString(flags)
.replace("[", "")
.replace("]", "")
.replace(",", "");
System.out.println(representation);
}
} | [
"dragoon8370@gmail.com"
] | dragoon8370@gmail.com |
3773d5d7abee559bb03cd23b448ffd92835e0197 | 6cd74eab28c3480c2553e465fe613906c92abba5 | /src/net/mdrjr/m1db/config/WorkConfig.java | 60b3263bfafb7ab29f65e5678afd3ac649212948 | [] | no_license | mdrjr/m1db | c0063279321631d7f0042ee73060a78b9a80c80c | 3fdfeae9e7c4a4595e70e60a12e3cf3e0e719bc8 | refs/heads/master | 2021-01-02T22:45:09.162811 | 2012-01-09T11:06:31 | 2012-01-09T11:06:31 | 2,898,658 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 612 | java | package net.mdrjr.m1db.config;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
public class WorkConfig {
public M1DBConfig WorkConfigInit(Properties prop) {
M1DBConfig m1dbConf = null;
List<String> tables = new ArrayList<String>();
String[] sTables = prop.getProperty("tables").split(";");
for (String string : sTables) {
tables.add(string);
}
m1dbConf = new M1DBConfig(prop.getProperty("storageFolder"), tables, prop.getProperty("logFile"), Integer.valueOf(prop.getProperty("5102")), prop.getProperty("networkPassword"));
return m1dbConf;
}
}
| [
"git@mdrjr.net"
] | git@mdrjr.net |
2d9eba76eed1cc3edb927f08633c93ee5b7e19fd | 3f2a91bdf318dba2888692a931f1f3eb34f8cb0c | /src/test/java/org/yaml/snakeyaml/Example2_24Test.java | aa5446417948a774fd70086247b068fbe3fdebf7 | [
"Apache-2.0"
] | permissive | aosp-caf-upstream/platform_external_snakeyaml | 43ed24df769e26f62087405711c4f7bb71293cbf | 1bc636a306795fc40770bdd73ee01477ce1cb189 | refs/heads/pie | 2021-07-04T01:47:43.527040 | 2018-03-13T18:24:02 | 2018-03-13T18:24:02 | 188,864,487 | 0 | 0 | NOASSERTION | 2020-10-13T13:29:35 | 2019-05-27T15:03:21 | Java | UTF-8 | Java | false | false | 8,632 | java | /**
* Copyright (c) 2008, http://www.snakeyaml.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.yaml.snakeyaml;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import junit.framework.TestCase;
import org.yaml.snakeyaml.constructor.AbstractConstruct;
import org.yaml.snakeyaml.constructor.Constructor;
import org.yaml.snakeyaml.nodes.MappingNode;
import org.yaml.snakeyaml.nodes.Node;
import org.yaml.snakeyaml.nodes.SequenceNode;
import org.yaml.snakeyaml.nodes.Tag;
import org.yaml.snakeyaml.representer.Represent;
import org.yaml.snakeyaml.representer.Representer;
/**
* Test Example 2.24 from the YAML specification
*
* @see <a href="http://yaml.org/spec/1.1/"></a>
*/
public class Example2_24Test extends TestCase {
class MyConstructor extends Constructor {
public MyConstructor() {
this.yamlConstructors.put(new Tag("tag:clarkevans.com,2002:shape"),
new ConstructShape());
this.yamlConstructors.put(new Tag("tag:clarkevans.com,2002:circle"),
new ConstructCircle());
this.yamlConstructors.put(new Tag("tag:clarkevans.com,2002:line"), new ConstructLine());
this.yamlConstructors.put(new Tag("tag:clarkevans.com,2002:label"),
new ConstructLabel());
}
private class ConstructShape extends AbstractConstruct {
@SuppressWarnings("unchecked")
public Object construct(Node node) {
SequenceNode snode = (SequenceNode) node;
List<Entity> values = (List<Entity>) constructSequence(snode);
Shape shape = new Shape(values);
return shape;
}
}
private class ConstructCircle extends AbstractConstruct {
@SuppressWarnings("unchecked")
public Object construct(Node node) {
MappingNode mnode = (MappingNode) node;
Map<Object, Object> values = constructMapping(mnode);
Circle circle = new Circle((Map<String, Integer>) values.get("center"),
(Integer) values.get("radius"));
return circle;
}
}
private class ConstructLine extends AbstractConstruct {
@SuppressWarnings("unchecked")
public Object construct(Node node) {
MappingNode mnode = (MappingNode) node;
Map<Object, Object> values = constructMapping(mnode);
Line line = new Line((Map<String, Integer>) values.get("start"),
(Map<String, Integer>) values.get("finish"));
return line;
}
}
private class ConstructLabel extends AbstractConstruct {
@SuppressWarnings("unchecked")
public Object construct(Node node) {
MappingNode mnode = (MappingNode) node;
Map<Object, Object> values = constructMapping(mnode);
Label label = new Label((Map<String, Integer>) values.get("start"),
(Integer) values.get("color"), (String) values.get("text"));
return label;
}
}
}
class MyRepresenter extends Representer {
public MyRepresenter() {
this.representers.put(Shape.class, new RepresentShape());
this.representers.put(Circle.class, new RepresentCircle());
this.representers.put(Line.class, new RepresentLine());
this.representers.put(Label.class, new RepresentLabel());
this.representers.put(HexInteger.class, new RepresentHex());
}
private class RepresentShape implements Represent {
public Node representData(Object data) {
Shape shape = (Shape) data;
List<Entity> value = shape.getEntities();
return representSequence(new Tag("!shape"), value, Boolean.FALSE);
}
}
private class RepresentCircle implements Represent {
public Node representData(Object data) {
Circle circle = (Circle) data;
Map<String, Object> map = new TreeMap<String, Object>();
map.put("center", circle.getCenter());
map.put("radius", circle.getRadius());
return representMapping(new Tag("!circle"), map, Boolean.FALSE);
}
}
private class RepresentLine implements Represent {
public Node representData(Object data) {
Line line = (Line) data;
Map<String, Object> map = new TreeMap<String, Object>();
map.put("start", line.getStart());
map.put("finish", line.getFinish());
return representMapping(new Tag("!line"), map, Boolean.FALSE);
}
}
private class RepresentLabel implements Represent {
public Node representData(Object data) {
Label label = (Label) data;
Map<String, Object> map = new TreeMap<String, Object>();
map.put("start", label.getStart());
map.put("color", new HexInteger(label.getColor()));
map.put("text", label.getText());
return representMapping(new Tag("!label"), map, Boolean.FALSE);
}
}
private class RepresentHex implements Represent {
public Node representData(Object data) {
HexInteger hex = (HexInteger) data;
return representScalar(Tag.INT, "0x"
+ Integer.toHexString(hex.getColor()).toUpperCase(), null);
}
}
}
private class HexInteger {
private Integer color;
public HexInteger(Integer color) {
this.color = color;
}
public Integer getColor() {
return color;
}
}
private class Shape {
private List<Entity> entities;
public List<Entity> getEntities() {
return entities;
}
public Shape(List<Entity> entities) {
this.entities = entities;
}
}
private class Entity {
}
private class Circle extends Entity {
private Map<String, Integer> center;
private Integer radius;
public Circle(Map<String, Integer> center, Integer radius) {
this.center = center;
this.radius = radius;
}
public Map<String, Integer> getCenter() {
return center;
}
public Integer getRadius() {
return radius;
}
}
private class Line extends Entity {
private Map<String, Integer> start;
private Map<String, Integer> finish;
public Line(Map<String, Integer> start, Map<String, Integer> finish) {
this.start = start;
this.finish = finish;
}
public Map<String, Integer> getStart() {
return start;
}
public Map<String, Integer> getFinish() {
return finish;
}
}
private class Label extends Entity {
private Map<String, Integer> start;
private Integer color;
private String text;
public Label(Map<String, Integer> start, Integer color, String text) {
this.start = start;
this.color = color;
this.text = text;
}
public Map<String, Integer> getStart() {
return start;
}
public Integer getColor() {
return color;
}
public String getText() {
return text;
}
}
public void testExample_2_24() {
Yaml yaml = new Yaml(new MyConstructor());
Shape shape = (Shape) yaml.load(Util.getLocalResource("specification/example2_24.yaml"));
assertNotNull(shape);
yaml = new Yaml(new MyRepresenter());
String output = yaml.dump(shape);
String etalon = Util.getLocalResource("specification/example2_24_dumped.yaml");
assertEquals(etalon, output);
}
}
| [
"public.somov@gmail.com"
] | public.somov@gmail.com |
20faa2288a375de7b76229285c492b1d768bad9e | ba005c6729aed08554c70f284599360a5b3f1174 | /lib/selenium-server-standalone-3.4.0/org/apache/http/impl/client/DefaultServiceUnavailableRetryStrategy.java | 2ec84c4f35c73475bea5ededa64beb54c0a2ce45 | [] | no_license | Viral-patel703/Testyourbond-aut0 | f6727a6da3b1fbf69cc57aeb89e15635f09e249a | 784ab7a3df33d0efbd41f3adadeda22844965a56 | refs/heads/master | 2020-08-09T00:27:26.261661 | 2017-11-07T10:12:05 | 2017-11-07T10:12:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,226 | java | package org.apache.http.impl.client;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.client.ServiceUnavailableRetryStrategy;
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.Args;
@Contract(threading=ThreadingBehavior.IMMUTABLE)
public class DefaultServiceUnavailableRetryStrategy
implements ServiceUnavailableRetryStrategy
{
private final int maxRetries;
private final long retryInterval;
public DefaultServiceUnavailableRetryStrategy(int maxRetries, int retryInterval)
{
Args.positive(maxRetries, "Max retries");
Args.positive(retryInterval, "Retry interval");
this.maxRetries = maxRetries;
this.retryInterval = retryInterval;
}
public DefaultServiceUnavailableRetryStrategy() {
this(1, 1000);
}
public boolean retryRequest(HttpResponse response, int executionCount, HttpContext context)
{
return (executionCount <= maxRetries) && (response.getStatusLine().getStatusCode() == 503);
}
public long getRetryInterval()
{
return retryInterval;
}
}
| [
"VIRUS-inside@users.noreply.github.com"
] | VIRUS-inside@users.noreply.github.com |
da587cb9b079a50567871a4532e09c81ff7b7d91 | 0ff906d0bc552539668acc6ad767dc6078e731f1 | /3.semwebpractie/src/java/test/test2.java | adcef7c6686ca50eb953ebf6216ca44c61885309 | [] | no_license | Rolf88/school-2 | 40bb7a757a56ac605498fed5d0de879c141d4334 | 020962595352cf15604f80934ae4b805b889faa5 | refs/heads/master | 2021-01-19T05:36:13.165923 | 2016-08-14T10:21:01 | 2016-08-14T10:21:01 | 65,660,699 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 719 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package test;
import entity.Person;
import javax.persistence.EntityManager;
import javax.persistence.Persistence;
/**
*
* @author RolfMoikjær
*/
public class test2 {
public static void main(String[] args) {
EntityManager en = Persistence.createEntityManagerFactory("3.semwebpractiePU").createEntityManager();
Person p = new Person();
p.setFirstName("Rolf");
p.setLastName("Moikjær");
en.getTransaction().begin();
en.persist(p);
en.getTransaction().commit();
}
}
| [
"cb88@jubii.dk"
] | cb88@jubii.dk |
7bbd50d0fdc56f75512a01d077c2b46148dd8ed4 | ec8ed4e7283c4566d6a6327c8c8a7b3d45d2d530 | /app/src/main/java/cl/appdrbyte/condor_code/drbyteappv10/CotizListAdapter.java | e1053ae28c5224e875abfad0e4b68064a30b2f40 | [] | no_license | vglarra/DrByteAppV10 | 3cbd672b91c62dcea8a797f44a12f336557ef662 | 3e765a89579d5f6f3212c2695b2f219df1ceb9e3 | refs/heads/master | 2021-10-09T13:19:15.539029 | 2018-12-28T20:40:36 | 2018-12-28T20:40:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,883 | java | package cl.appdrbyte.condor_code.drbyteappv10;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.TextView;
import java.util.ArrayList;
public class CotizListAdapter extends ArrayAdapter<CotizaDatos> {
//private static final String TAG = "ClientesListAdapter";
private Context mContext;
int mResource;
public CotizListAdapter(Context context, int resource, ArrayList<CotizaDatos> objects) {
super(context, resource, objects);
mContext = context;
mResource = resource;
}
@NonNull
@Override
public View getView(int position, View convertView, ViewGroup parent) {
String item_cot = getItem(position).getServ_item();
String valor_cot = getItem(position).getServ_valor();
CotizaDatos user = new CotizaDatos(item_cot, valor_cot );
LayoutInflater inflater = LayoutInflater.from(mContext);
convertView = inflater.inflate(mResource, parent, false);
TextView val_serv = (TextView) convertView.findViewById(R.id.txt_valor_num);
TextView item_val = (TextView) convertView.findViewById(R.id.txt_valor_num_2);
/*
TextView numero_serie = (TextView) convertView.findViewById(R.id.lv_txtv_num_serie);
TextView estado_job = (TextView) convertView.findViewById(R.id.lv_txt_estado);
TextView fecha_ing = (TextView) convertView.findViewById(R.id.lv_txt_fecha);*/
val_serv.setText(valor_cot);
item_val.setText(item_cot);
/*
nombre_equipo.setText(nom_equipo);
numero_serie.setText(num_serie);
estado_job.setText(estado);
fecha_ing.setText(fecha);
*/
return convertView;
}
} | [
"42652229+condorcode@users.noreply.github.com"
] | 42652229+condorcode@users.noreply.github.com |
6f9bf66ba16857f8f96760dd54741dd694bfb422 | 6c322aa33c2d0f135bb0df2e33c2b8039976bf20 | /app/src/main/java/com/kaiwukj/android/communityhui/mvp/browse/zoonview/GingerScroller.java | badd85a3f01dc655bfa6c195a79a1f3658f50866 | [] | no_license | haife/CommunityHui | 0adadc0317cc7c3ec33ce732f585793e7509badd | 51f46ef0386ac16dbd16a60f3295aebcbf81e6c6 | refs/heads/master | 2022-02-18T04:20:17.216167 | 2019-08-13T07:49:17 | 2019-08-13T07:49:17 | 196,985,030 | 6 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,076 | java | /*
* Copyright (C) 2014 pengjianbo(pengjianbosoft@gmail.com), Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.kaiwukj.android.communityhui.mvp.browse.zoonview;
import android.annotation.TargetApi;
import android.content.Context;
import android.widget.OverScroller;
@TargetApi(9)
public class GingerScroller extends ScrollerProxy {
protected final OverScroller mScroller;
private boolean mFirstScroll = false;
public GingerScroller(Context context) {
mScroller = new OverScroller(context);
}
@Override
public boolean computeScrollOffset() {
// Workaround for first scroll returning 0 for the direction of the edge it hits.
// Simply recompute values.
if (mFirstScroll) {
mScroller.computeScrollOffset();
mFirstScroll = false;
}
return mScroller.computeScrollOffset();
}
@Override
public void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY, int maxY,
int overX, int overY) {
mScroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY, overX, overY);
}
@Override
public void forceFinished(boolean finished) {
mScroller.forceFinished(finished);
}
@Override
public boolean isFinished() {
return mScroller.isFinished();
}
@Override
public int getCurrX() {
return mScroller.getCurrX();
}
@Override
public int getCurrY() {
return mScroller.getCurrY();
}
} | [
"penghaifeng94@gmail.com"
] | penghaifeng94@gmail.com |
2199413446835a59c5efd262abd04fbef659311d | 7324de8fe77648724d27ddeba7df069f2a7cfb8c | /COMP16121/ex3/task5.3/LargestSquare.java | c83868dda25feb117511aa0bd24696042aa0b2d9 | [] | no_license | JamesWP/UNI-Y1-2 | 4978fe3c52d5200936879ea9cf9f6b4f2eaaa790 | c25ca5247f991d23650ec1ed5bc015bdea2593b0 | refs/heads/master | 2021-01-17T17:53:45.384497 | 2015-09-29T09:24:09 | 2015-09-29T09:24:09 | 64,395,533 | 2 | 3 | null | null | null | null | UTF-8 | Java | false | false | 346 | java | public class LargestSquare
{
public static void main(String[] args)
{
int number = Integer.parseInt(args[0]);
System.out.println("finding the largest sn <= to: "
+ number);
int bestGuess = number;
while(bestGuess * bestGuess > number)
bestGuess--;
System.out.println("Its: " + bestGuess);
}
}
| [
"mbax3jp2@student.manchester.ac.uk"
] | mbax3jp2@student.manchester.ac.uk |
aa1c88826c7345d63c042abc737ecb9482a07e84 | eedb997fdfd2d5ba586e5efe73cb16a18002dadb | /OffCardAPP/src/main/java/clientAPI/BonusCreditStore.java | 9741e1e059246d9e31429c83f2836b2347e204e8 | [
"MIT"
] | permissive | philippsied/smartcard-course | bf44f7996ff219d9a1d090ae674b8fb6cd3cada2 | 8f9907a5ca41ce8cdebccdd1effaf29b9eba31f7 | refs/heads/master | 2020-06-30T03:26:51.439624 | 2015-08-24T12:20:49 | 2015-08-24T12:20:49 | 40,535,260 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 921 | java | package clientAPI;
import javax.smartcardio.CardException;
/**
* Schnittstelle zur Festlegung der Funktionalität des Bonussystem-Applets.
*
*
*/
public interface BonusCreditStore {
/**
* Fügt die angegebenen Anzahl an Bonuspunkten dem Bonuspunktekonto hinzu.
*
* @param amount
* Anzahl Bonuspunkte
* @throws CardException
*/
public void addBonusCredits(int amount) throws CardException;
/**
* Entfernt die angegebene Anzahl an Bonuspunkten von der Karte.
*
* @param amount
* Anzahl Bonuspunkte
* @throws CardException
*/
public void removeBonusCredits(int amount) throws CardException;
/**
* Liefert den aktuellen Bonuspunktestand.
*
* @return Bonuspunktestand
* @throws CardException
*/
public int checkBalance() throws CardException;
}
| [
"philipp.sieder@web.de"
] | philipp.sieder@web.de |
193acbe0b0122e9f115447e36672ba206a5e83a2 | 3ef14e9b3dd67969f28c4d15a3d1a4290329e8ca | /src/net/shopxx/dao/impl/CouponCodeDaoImpl.java | 504c37544d8934a76e923727f19f6e60aa8cf15e | [] | no_license | jackoulee/demo | e38d32d2838c8580590a3da2c53ab747b68246ef | a84b11db827e6f1a51d63e8985b7b614e238d1df | refs/heads/master | 2021-08-22T19:26:51.825190 | 2017-12-01T02:28:29 | 2017-12-01T02:28:29 | 112,680,754 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,976 | java | /*
* Copyright 2005-2015 shopxx.net. All rights reserved.
* Support: http://www.shopxx.net
* License: http://www.shopxx.net/license
*/
package net.shopxx.dao.impl;
import java.util.Date;
import javax.persistence.NoResultException;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Path;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import net.shopxx.Page;
import net.shopxx.Pageable;
import net.shopxx.dao.CouponCodeDao;
import net.shopxx.entity.Coupon;
import net.shopxx.entity.CouponCode;
import net.shopxx.entity.Member;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Repository;
@Repository("couponCodeDaoImpl")
public class CouponCodeDaoImpl extends BaseDaoImpl<CouponCode, Long> implements CouponCodeDao {
public boolean codeExists(String code) {
if (StringUtils.isEmpty(code)) {
return false;
}
String jpql = "select count(*) from CouponCode couponCode where lower(couponCode.code) = lower(:code)";
Long count = entityManager.createQuery(jpql, Long.class).setParameter("code", code).getSingleResult();
return count > 0;
}
public CouponCode findByCode(String code) {
if (StringUtils.isEmpty(code)) {
return null;
}
try {
String jpql = "select couponCode from CouponCode couponCode where lower(couponCode.code) = lower(:code)";
return entityManager.createQuery(jpql, CouponCode.class).setParameter("code", code).getSingleResult();
} catch (NoResultException e) {
return null;
}
}
public Page<CouponCode> findPage(Member member, Pageable pageable) {
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<CouponCode> criteriaQuery = criteriaBuilder.createQuery(CouponCode.class);
Root<CouponCode> root = criteriaQuery.from(CouponCode.class);
criteriaQuery.select(root);
if (member != null) {
criteriaQuery.where(criteriaBuilder.equal(root.get("member"), member));
}
return super.findPage(criteriaQuery, pageable);
}
public Long count(Coupon coupon, Member member, Boolean hasBegun, Boolean hasExpired, Boolean isUsed) {
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<CouponCode> criteriaQuery = criteriaBuilder.createQuery(CouponCode.class);
Root<CouponCode> root = criteriaQuery.from(CouponCode.class);
criteriaQuery.select(root);
Predicate restrictions = criteriaBuilder.conjunction();
Path<Coupon> couponPath = root.get("coupon");
if (coupon != null) {
restrictions = criteriaBuilder.and(restrictions, criteriaBuilder.equal(couponPath, coupon));
}
if (member != null) {
restrictions = criteriaBuilder.and(restrictions, criteriaBuilder.equal(root.get("member"), member));
}
if (hasBegun != null) {
if (hasBegun) {
restrictions = criteriaBuilder.and(restrictions, criteriaBuilder.or(couponPath.get("beginDate").isNull(), criteriaBuilder.lessThanOrEqualTo(couponPath.<Date> get("beginDate"), new Date())));
} else {
restrictions = criteriaBuilder.and(restrictions, couponPath.get("beginDate").isNotNull(), criteriaBuilder.greaterThan(couponPath.<Date> get("beginDate"), new Date()));
}
}
if (hasExpired != null) {
if (hasExpired) {
restrictions = criteriaBuilder.and(restrictions, couponPath.get("endDate").isNotNull(), criteriaBuilder.lessThanOrEqualTo(couponPath.<Date> get("endDate"), new Date()));
} else {
restrictions = criteriaBuilder.and(restrictions, criteriaBuilder.or(couponPath.get("endDate").isNull(), criteriaBuilder.greaterThan(couponPath.<Date> get("endDate"), new Date())));
}
}
if (isUsed != null) {
restrictions = criteriaBuilder.and(restrictions, criteriaBuilder.equal(root.get("isUsed"), isUsed));
}
criteriaQuery.where(restrictions);
return super.count(criteriaQuery, null);
}
} | [
"jackou@qq.com"
] | jackou@qq.com |
9593cb26f146290ebb9f46944f9d12d3efdcffe8 | bb876970f96ab7e5a693ec09da9e3d0dc55317fe | /src/main/java/amit/problems/dp/MaxProductOfInteger.java | cee3b637cc3af06ceb9403e55d6086e426dd2068 | [] | no_license | amitjain-in/datastructures-Algorithms | 93a26b5993a82ad865ed14a589f41dc0a43dd219 | 614dad1fda2a9ecf6832c8b2c813ad65670b1595 | refs/heads/master | 2023-05-11T14:32:34.520967 | 2021-08-01T15:41:02 | 2021-08-01T15:41:02 | 236,341,839 | 2 | 0 | null | 2023-05-09T18:46:13 | 2020-01-26T16:42:00 | Java | UTF-8 | Java | false | false | 936 | java | package amit.problems.dp;
/**
* Given an integer n, break it into the sum of k positive integers, where k >= 2, and maximize the product of those integers.
* <p>
* Return the maximum product you can get.
* <p>
* https://leetcode.com/problems/integer-break/
*
* Status: works
*/
public class MaxProductOfInteger {
public static void main(String[] args) {
MaxProductOfInteger ofInteger = new MaxProductOfInteger();
System.out.println(ofInteger.integerBreak(10));
System.out.println(ofInteger.integerBreak(2));
System.out.println(ofInteger.integerBreak(4));
}
public int integerBreak(int n) {
int[] dp = new int[n + 1];
dp[0] = 0;
dp[1] = 0;
for (int i = 2; i <= n; i++) {
for (int j = 2; j <= i; j++) {
dp[i] = Math.max(dp[i], Math.max((i - j) * j, dp[i - j] * j));
}
}
return dp[n];
}
}
| [
"amit.jain.in@outlook.com"
] | amit.jain.in@outlook.com |
b09630fd63d7f27a89692ee198c11078f0b5f219 | c742cc5d181dd6105a26d586f513177a18e28250 | /src/revision/Hashing_lc_hands_of_straight.java | 371ede7ef58eb88b50165560b6d730979487b9cc | [] | no_license | gaurirawat/Coding | a5542f71be5da538cc438a8d4070ce4c748ee044 | d69fb40befbf9a30774b723fff90ae7cba384f7a | refs/heads/master | 2023-02-20T00:33:31.632223 | 2021-01-22T11:49:14 | 2021-01-22T11:49:14 | 275,333,532 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 986 | java | package revision;
import java.util.TreeMap;
//https://leetcode.com/problems/hand-of-straights/submissions/
public class Hashing_lc_hands_of_straight {
public boolean isNStraightHand(int[] hand, int k) {
if (hand.length % k != 0) {
return false;
}
TreeMap<Integer, Integer> map = new TreeMap<Integer, Integer>();
for (int x : hand) {
map.put(x, map.getOrDefault(x,0) + 1);
}
while (!map.isEmpty()) {
int min = map.firstKey();
int minReq = map.get(min);
for (int i = min; i < min + k; ++i) {
Integer value = map.get(i);
if (value == null || value.compareTo(minReq) < 0) {
return false;
}
if (value == minReq) {
map.remove(i);
} else{
map.put(i, value - minReq);
}
}
}
return true;
}
} | [
"gaurirawat97@gmail.com"
] | gaurirawat97@gmail.com |
afbd9aefeeb9e7d00cad877b9f5e297ffd75716c | 4aa90348abcb2119011728dc067afd501f275374 | /app/src/main/java/com/tencent/mm/plugin/favorite/ui/base/FavDetailFooterView.java | ae6c1fce3388124f4f0d97bc06a039b860999550 | [] | no_license | jambestwick/HackWechat | 0d4ceb2d79ccddb45004ca667e9a6a984a80f0f6 | 6a34899c8bfd50d19e5a5ec36a58218598172a6b | refs/heads/master | 2022-01-27T12:48:43.446804 | 2021-12-29T10:36:30 | 2021-12-29T10:36:30 | 249,366,791 | 0 | 0 | null | 2020-03-23T07:48:32 | 2020-03-23T07:48:32 | null | UTF-8 | Java | false | false | 925 | java | package com.tencent.mm.plugin.favorite.ui.base;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;
import com.tencent.mm.R;
import com.tencent.mm.plugin.fav.a.f;
import com.tencent.mm.plugin.favorite.a.g;
public class FavDetailFooterView extends TextView {
public FavDetailFooterView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
}
public FavDetailFooterView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
public final void F(f fVar) {
if (fVar != null) {
if (fVar.field_edittime > 0) {
setText(getContext().getString(R.l.eeX) + g.e(getContext(), fVar.field_edittime * 1000));
} else {
setText(getContext().getString(R.l.egN) + g.e(getContext(), fVar.field_updateTime));
}
}
}
}
| [
"malin.myemail@163.com"
] | malin.myemail@163.com |
5a1cc978f1ea863056cbfde56dcdda97a68d7c1c | b616b05fa5d773e8a34db7ed9e184dffb7a0c68f | /Storage/Services/src/org/vle/aid/metadata/ws/SkosLensWS.java | 8c579d7cf6be979f6ab2b1a64f7241c1e570bc86 | [] | no_license | kaspervandenberg/aida | 367ef5d878a279a4eb768133ea5e1889e1a1fed9 | 70918dbee569b99708ec19629b78898e9742eac8 | refs/heads/master | 2016-09-06T18:12:20.907567 | 2014-04-29T15:51:28 | 2014-04-29T15:51:28 | 7,894,939 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,453 | java | /*
* SkosLensWS.java
*
* Created on March 7, 2006, 10:28 AM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package org.vle.aid.metadata.ws;
import java.rmi.RemoteException;
import java.util.AbstractMap;
import java.util.Collection;
import java.util.Vector;
import javax.ws.rs.Path;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Request;
import javax.ws.rs.core.UriInfo;
import org.vle.aid.metadata.SkosLens;
import org.vle.aid.metadata.SkosLensType;
import org.vle.aid.metadata.exception.UnknownException;
import org.vle.aid.metadata.ws.ThesaurusRepositoryWS.Topterms.Topterm;
/**
*
* @author wrvhage
*/
@Path("/skoslensbrowser")
public class SkosLensWS
{
@Context UriInfo uriInfo;
@Context Request request;
/**
*
* Class to hold the topconcepts
*
* @author emeij
*
*/
public class Topterms {
/**
* A single topconcept
* @author emeij
*
*/
public class Topterm {
/**
* ID of the concept
*/
public String id;
/**
* Label of the concept
*/
public String term;
/**
* Creates a new Topterm
* @param id the ID
* @param term the label
*/
public Topterm(String id, String term) {
this.id = id;
this.term = term;
}
}
/**
* The topterms
*/
public final Collection<Topterm> topterms = new Vector<Topterm>();
/**
* Construct a new Topterms object with the terms in the argument
* @param terms the topconcepts to use
*/
public Topterms(AbstractMap<String,String> terms) {
for (String k : terms.keySet()) {
this.topterms.add(new Topterm(terms.get(k), k));
}
}
}
static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(SkosLensWS.class);
/*
* Semantic Relations
*/
/**
* Find narrower Concepts and their prefLabel.
*
* @param server_url
* the URL of the meta-data server that will be queried (e.g.
* http://www.host.org:8080/sesame)
* @param repository
* the name of the repository or model in the meta-data server
* (e.g. mem-rdfs-db)
* @param username
* the username of the user to access the repository as used by
* the meta-data server (e.g. testuser)
* @param password
* the password of the user to access the repository as used by
* the meta-data server (e.g. opensesame)
* @param term
* the URI of the "broader" skos:Concept, the "focus" concept.
* @return an array of pairs of skos:Concepts and their skos:prefLabel
* @throws RemoteException
*/
public String[][] getNarrowerTerms(String server_url, String repository,
String username, String password, String term, String TOP_CONCEPT, String PREDICATE, String skosVersion, String virtuosoNamedGraph) throws RemoteException
{
try
{
SkosLens tr = new SkosLens(server_url, repository, username, password);
tr.setLensType(TOP_CONCEPT, PREDICATE, skosVersion, virtuosoNamedGraph);
return tr.getNarrowerTerms(term);
}
catch (RemoteException e1)
{
throw e1;
}
catch (Throwable e2)
{
logger.error(e2.getMessage(),e2);
throw new UnknownException("Unknown Exception:"+e2.getMessage(),e2);
}
}
public Vector<SkosLensType> getAvailableLenses(String server_url, String repository,
String username, String password){
SkosLens tr = new SkosLens(server_url,repository, username, password);
return tr.getAvailableLenses();
}
public SkosLensType getCurrentSkosLens(){
return new SkosLensType("Default", "Default", "Default");
}
public String[][] getBroaderTerms(String server_url, String repository,
String username, String password, String term, String TOP_CONCEPT, String PREDICATE, String skosVersion, String virtuosoNamedGraph) throws RemoteException
{
try
{
SkosLens tr = new SkosLens(server_url,
repository, username, password);
tr.setLensType(TOP_CONCEPT, PREDICATE, skosVersion, virtuosoNamedGraph);
return tr.getBroaderTerms(term);
}
catch (RemoteException e1)
{
throw e1;
}
catch (Throwable e2)
{
logger.error(e2.getMessage(),e2);
throw new UnknownException("Unknown Exception:"+e2.getMessage(),e2);
}
}
public String[][] getRelatedTerms(String server_url, String repository,
String username, String password, String term) throws RemoteException
{
try
{
SkosLens tr = new SkosLens(server_url,
repository, username, password);
return tr.getRelatedTerms(term);
}
catch (RemoteException e1)
{
throw e1;
}
catch (Throwable e2)
{
logger.error(e2.getMessage(),e2);
throw new UnknownException("Unknown Exception:"+e2.getMessage(),e2);
}
}
/*
* Labelling
*/
/**
* Find rdfs:label values for a Class, e.g. a skos:Collection or
* skos:ConceptScheme.
*
* @return an array of rdfs:labels, literal values
*/
public String[] getRDFSLabels(String server_url, String repository,
String username, String password, String term) throws RemoteException
{
try
{
SkosLens tr = new SkosLens(server_url,
repository, username, password);
return tr.getRDFSLabels(term);
}
catch (RemoteException e1)
{
throw e1;
}
catch (Throwable e2)
{
logger.error(e2.getMessage(),e2);
throw new UnknownException("Unknown Exception:"+e2.getMessage(),e2);
}
}
public String[] getAlternativeTerms(String server_url, String repository,
String username, String password, String term) throws RemoteException
{
try
{
SkosLens tr = new SkosLens(server_url,
repository, username, password);
return tr.getAlternativeTerms(term);
}
catch (RemoteException e1)
{
throw e1;
}
catch (Throwable e2)
{
logger.error(e2.getMessage(),e2);
throw new UnknownException("Unknown Exception:"+e2.getMessage(),e2);
}
}
/*
* Concept Schemes
*/
public String[][] getTopConcepts(String server_url, String repository,
String username, String password, String scheme_label, String TOP_CONCEPT, String PREDICATE, String skosVersion, String virtuosoNamedGraph ) throws RemoteException
{
try
{
SkosLens tr = new SkosLens(server_url, repository, username, password);
tr.setLensType(TOP_CONCEPT, PREDICATE, skosVersion, virtuosoNamedGraph);
return tr.getTopConcepts(scheme_label);
}
catch (RemoteException e1)
{
throw e1;
}
catch (Throwable e2)
{
logger.error(e2.getMessage(),e2);
throw new UnknownException("Unknown Exception:"+e2.getMessage(),e2);
}
}
/**
* Return all URI's of skos:ConceptSchemes in namespace "namespace".
*
* @param namespace
* the URI of the namespace
* @return array of pairs of URI's of skos:ConceptSchemes and their
* rdfs:label
*/
public String[][] getConceptSchemesWithNamespace(String server_url,
String repository, String username, String password,
String namespace, String TOP_CONCEPT, String PREDICATE, String skosVersion, String virtuosoNamedGraph) throws RemoteException
{
try
{
SkosLens tr = new SkosLens(server_url, repository, username, password);
tr.setLensType(TOP_CONCEPT, PREDICATE, skosVersion, virtuosoNamedGraph);
return tr.getConceptSchemes(namespace);
}
catch (RemoteException e1)
{
throw e1;
}
catch (Throwable e2)
{
logger.error(e2.getMessage(),e2);
throw new UnknownException("Unknown Exception:"+e2.getMessage(),e2);
}
}
public String[][] getConceptSchemes(String server_url, String repository,
String username, String password, String TOP_CONCEPT, String PREDICATE, String skosVersion, String virtuosoNamedGraph) throws RemoteException
{
try
{
SkosLens tr = new SkosLens(server_url, repository, username, password);
tr.setLensType(TOP_CONCEPT, PREDICATE, skosVersion, virtuosoNamedGraph);
//tr.setLensType("rdfs:Property", "rdfs:SubPropertyOf");
logger.debug("CHECK123 "+skosVersion+ " "+ virtuosoNamedGraph);
return tr.getConceptSchemes();
}
catch (RemoteException e1)
{
throw e1;
}
catch (Throwable e2)
{
logger.error(e2.getMessage(),e2);
throw new UnknownException("This Unknown Exception ? SV:"+skosVersion + " vng: "+ virtuosoNamedGraph + " "+ e2.getMessage(),e2);
}
}
public String[][] getTermCompletion(String server_url, String repository,
String username, String password, String term) throws RemoteException
{
try
{
SkosLens tr = new SkosLens(server_url, repository, username, password);
return tr.getTermCompletion(term);
}
catch (RemoteException e1)
{
throw e1;
}
catch (Throwable e2)
{
logger.error(e2.getMessage(),e2);
throw new UnknownException("Unknown Exception:"+e2.getMessage(),e2);
}
}
/**
* Gets the URI of all skos:Concepts with a skos:prefLabel or skos:altLabel
* that matches "term".
*
* @param term
* a literal string that describes a concept. (e.g.
* "Spline Reticulation")
* @return an array of pairs of skos:Concepts and their skos:prefLabel or
* skos:altLabel (that matched "term")
* @throws RemoteException
*/
public String[][] getTermUri(String server_url, String repository,
String username, String password, String term) throws RemoteException
{
try
{
SkosLens tr = new SkosLens(server_url,
repository, username, password);
return tr.getTermUri(term);
}
catch (RemoteException e1)
{
throw e1;
}
catch (Throwable e2)
{
logger.error(e2.getMessage(),e2);
throw new UnknownException("Unknown Exception:"+e2.getMessage(),e2);
}
}
public String[][] getNumberOfNarrowerTerms(String server_url,
String repository, String username, String password, String term) throws RemoteException
{
try
{
SkosLens tr = new SkosLens(server_url,
repository, username, password);
return tr.getNumberOfNarrowerTerms(term);
}
catch (RemoteException e1)
{
throw e1;
}
catch (Throwable e2)
{
logger.error(e2.getMessage(),e2);
throw new UnknownException("Unknown Exception:"+e2.getMessage(),e2);
}
}
public String[][] getNumberOfNarrowerTermsMulti(String server_url,
String repository, String username, String password, String terms[]) throws RemoteException
{
try
{
SkosLens tr = new SkosLens(server_url,
repository, username, password);
return tr.getNumberOfNarrowerTerms(terms);
}
catch (RemoteException e1)
{
throw e1;
}
catch (Throwable e2)
{
logger.error(e2.getMessage(),e2);
throw new UnknownException("Unknown Exception:"+e2.getMessage(),e2);
}
}
}
| [
"kasper@kaspervandenberg.net"
] | kasper@kaspervandenberg.net |
b165252a6cc3b1880b4eb17fd627a407a5f20ad0 | 3bf5254add773ed0d3c414360da0c873908338ec | /Session 1/code/network-java/src/main/java/com/compnet/practical1/A3Server.java | f96631eaffd35b8a6efc42cecb8ab3342b64e58f | [] | no_license | odehnalm/networkPractice | 343fcf1f0f809097e3a87f9ab94012684841e4c6 | 6df500fedc49feb03f9a2320b707dfff489fea66 | refs/heads/master | 2020-04-20T22:33:59.604658 | 2019-02-10T09:49:30 | 2019-02-10T09:49:30 | 169,144,186 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,029 | java | /*
*
*/
package com.compnet.practical1;
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;
/**
*
* @author
*/
public class A3Server {
/*
public static void main(String[] args) throws IOException {
Display display = new Display();
// start a new thread to accept new connections
handleAcceptAll(display).start()
}
private static Thread handleAcceptAll(final Display display) {
return new Thread(() -> {
// create a socket that listens (on a port of your choice)
??? serverSocket = ???;
???
// accept new clients connections,
// and start a handleClient thread every time
???
});
}
// processClient returns a Thread that can be started, i.e., use: processClient(.......).start();
private static Thread handleClient(final Socket socket, final Display display) {
return new Thread(() -> {
// initialise a random integer position, e.g. between 0 and 100
int i = ???
// initialize a random direction (for later)
int by = Math.random() > 0.5 ? 1 : -1;
// add 1 to the display, at index i (and render it)
???
// get ready to receive from the socket
InputStream in = socket.getInputStream();
// loop over the received data, ignoring (or just printing) this data for now (e.g., use NetUtils to read lines)
// be sure to end the loop when the connection is closed (readLine returns null or throws an exception)
???
// Later, we will use move_value_right(i, by) and increase the i variable by
// ???
// when the connection is closed, subtract at index (and rerender)
???
// when the connection is closed, add a red circle, in x,y, and with a radius of 5 (and redraw the window)
???
});
}
//*/
}
| [
"markodehnal@gmail.com"
] | markodehnal@gmail.com |
c1b0b58c1c11d9f3b410567f078cbf0e79268ef6 | 2a31fefc756991c44c7bfcfd2878000d8adcc25b | /mOverseer/src/com/mordrum/moverseer/Main.java | c4389f4b536aa744bf223ebe2b29a95b49a32bf0 | [] | no_license | Rhyuken/MordrumPlugins | 0e89b1d7f2943972269c158021a2ee2eee0849ca | c84d9d647efcd49a0aabcc82902e7636ffd668e9 | refs/heads/master | 2020-04-11T00:45:56.626126 | 2013-06-05T23:18:27 | 2013-06-05T23:18:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,213 | java | package com.mordrum.moverseer;
import com.mordrum.moverseer.commands.*;
import com.mordrum.moverseer.listeners.BanListener;
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.api.plugin.PluginManager;
/**
* Created with IntelliJ IDEA.
* User: Jesse
* Date: 5/30/13
* Time: 10:25 PM
*/
public class Main extends Plugin {
PluginConfig config;
IOHandler IO;
/*
Called when mOverseer is enabled. Takes care of registering listeners and commands.
*/
public void onEnable() {
config = new PluginConfig(this); //Create the config
RegisterCommands();
RegisterListeners();
IO = new IOHandler(this);
}
/*
Called when mOverseer is disabled.
*/
public void onDisable() {
config = null;
IO.SaveRecords();
}
/*
Method to fetch mOverseer's config
*/
public PluginConfig getConfig() {
return config;
}
public IOHandler getIO() {
return IO;
}
private void RegisterListeners() {
PluginManager pm = this.getProxy().getPluginManager();
pm.registerListener(this, new BanListener(this));
}
private void RegisterCommands() {
PluginManager pm = this.getProxy().getPluginManager();
//Below all commands are registered, really should find a better way to do it
//TODO see if passing config to classes is faster
if (config.commands_ban_enabled)
pm.registerCommand(this, new BanCommand(this));
if (config.commands_home_enabled)
pm.registerCommand(this, new HomeCommand(this));
if (config.commands_kick_enabled)
pm.registerCommand(this, new KickCommand(this));
if (config.commands_sethome_enabled)
pm.registerCommand(this, new SetHomeCommand(this));
if (config.commands_setspawn_enabled)
pm.registerCommand(this, new SetSpawnCommand(this));
if (config.commands_spawn_enabled)
pm.registerCommand(this, new SpawnCommand(this));
if (config.commands_teleportask_enabled)
pm.registerCommand(this, new TeleportAskCommand(this));
if (config.commands_teleportaskhere_enabled)
pm.registerCommand(this, new TeleportAskHereCommand(this));
if (config.commands_teleport_enabled)
pm.registerCommand(this, new TeleportCommand(this));
if (config.commands_teleporthere_enabled)
pm.registerCommand(this, new TeleportHereCommand(this));
if (config.commands_tempban_enabled)
pm.registerCommand(this, new TempbanCommand(this));
if (config.commands_unban_enabled)
pm.registerCommand(this, new UnbanCommand(this));
}
private void UnregisterCommands() {
PluginManager pm = this.getProxy().getPluginManager();
//Below all commands are unregistered, useful for some sort of plugin disable situation
pm.unregisterCommand(new BanCommand(this));
pm.unregisterCommand(new HomeCommand(this));
pm.unregisterCommand(new KickCommand(this));
pm.unregisterCommand(new SetHomeCommand(this));
pm.unregisterCommand(new SetSpawnCommand(this));
pm.unregisterCommand(new SpawnCommand(this));
pm.unregisterCommand(new TeleportAskCommand(this));
pm.unregisterCommand(new TeleportAskHereCommand(this));
pm.unregisterCommand(new TeleportCommand(this));
pm.unregisterCommand(new TeleportHereCommand(this));
pm.unregisterCommand(new TempbanCommand(this));
pm.unregisterCommand(new UnbanCommand(this));
}
}
| [
"jesse.savary@live.com"
] | jesse.savary@live.com |
9464092b02b7ca0af839f85c3cc3500451457e24 | 75a2e444b835210b77accddf6962741b70b981b3 | /back-end/book-common/src/main/java/com/book/common/api/CommonResult.java | 5138b4cd30078faa91940c9ad6c98a53740c253a | [
"Apache-2.0"
] | permissive | Destings/Book-Storm | c7f876217fd86b987cf60a5eb33ebbc5973c23e6 | ccbcae852fddcf048c65c0950666d12b8526d229 | refs/heads/master | 2022-01-21T09:19:28.118333 | 2019-07-13T16:40:54 | 2019-07-13T16:40:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,761 | java | package com.book.common.api;
/**
* 通用返回对象
*/
public class CommonResult<T> {
private long code;
private String message;
private T data;
protected CommonResult() {
}
protected CommonResult(long code, String message, T data) {
this.code = code;
this.message = message;
this.data = data;
}
/**
* 成功返回结果
*
* @param data 获取的数据
*/
public static <T> CommonResult<T> success(T data) {
return new CommonResult<T>(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMessage(), data);
}
/**
* 成功返回结果
*
* @param data 获取的数据
* @param message 提示信息
*/
public static <T> CommonResult<T> success(T data, String message) {
return new CommonResult<T>(ResultCode.SUCCESS.getCode(), message, data);
}
/**
* 失败返回结果
* @param errorCode 错误码
*/
public static <T> CommonResult<T> failed(IErrorCode errorCode) {
return new CommonResult<T>(errorCode.getCode(), errorCode.getMessage(), null);
}
/**
* 失败返回结果
* @param message 提示信息
*/
public static <T> CommonResult<T> failed(String message) {
return new CommonResult<T>(ResultCode.FAILED.getCode(), message, null);
}
/**
* 失败返回结果
*/
public static <T> CommonResult<T> failed() {
return failed(ResultCode.FAILED);
}
/**
* 参数验证失败返回结果
*/
public static <T> CommonResult<T> validateFailed() {
return failed(ResultCode.VALIDATE_FAILED);
}
/**
* 参数验证失败返回结果
* @param message 提示信息
*/
public static <T> CommonResult<T> validateFailed(String message) {
return new CommonResult<T>(ResultCode.VALIDATE_FAILED.getCode(), message, null);
}
/**
* 未登录返回结果
*/
public static <T> CommonResult<T> unauthorized(T data) {
return new CommonResult<T>(ResultCode.UNAUTHORIZED.getCode(), ResultCode.UNAUTHORIZED.getMessage(), data);
}
/**
* 未授权返回结果
*/
public static <T> CommonResult<T> forbidden(T data) {
return new CommonResult<T>(ResultCode.FORBIDDEN.getCode(), ResultCode.FORBIDDEN.getMessage(), data);
}
public long getCode() {
return code;
}
public void setCode(long code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
}
| [
"BaerfootBKK@163.com"
] | BaerfootBKK@163.com |
41c466827b9a96b40c430376a7abc1e3372f5874 | 041d99317ff5644896a60b6d6af446f19ad47ed2 | /src/com/az24/test/RegexMatches2.java | 027bc09a8cc8a5358107d43999fa9c71fe104128 | [] | no_license | thangttttv/ttv_crawler | 839a592b8440ee0dc1693beae285598f09ca87eb | 13dbdb7794730dd977c91f7ff99fbfef73ce0968 | refs/heads/master | 2022-03-12T11:50:36.915000 | 2021-10-22T18:17:51 | 2021-10-22T18:17:51 | 92,563,106 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,818 | java | package com.az24.test;
import hdc.util.text.StringUtil;
import java.math.BigInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RegexMatches2 {
private static final String REGEX = "foo";
private static final String INPUT = "fooooooooooooooooo";
private static Pattern pattern;
private static Matcher matcher;
public static void main( String args[] ){
pattern = Pattern.compile(REGEX);
matcher = pattern.matcher(INPUT);
System.out.println("Current REGEX is: "+REGEX);
System.out.println("Current INPUT is: "+INPUT);
System.out.println("lookingAt(): "+matcher.lookingAt());
System.out.println("lookingAt(): "+matcher.find(1));
System.out.println("matches(): "+matcher.matches());
String url = "http://thegioinem.com/home/modules.php?name=Shop&go=goods&pid=180";
String REGEX2 ="modules.php\\?name=Shop&go=goods&pid=\\d+";
pattern = Pattern.compile(REGEX2);
matcher = pattern.matcher(url);
System.out.println("lookingAt(): "+matcher.find());
int s1 = 131080;
int s2= 8;
BigInteger bigInteger1 = new BigInteger("131074");
BigInteger bigInteger2 = new BigInteger("2");
BigInteger is = bigInteger1.and(bigInteger2);
System.out.println("lookingAt(): "+is);
String file = "small_132971584423520120111161719_0.jpg?w=55&h=38";
pattern = Pattern.compile(".");
matcher = pattern.matcher(file);
String files[] = file.split("\\.");
if(files!=null)
{ int i = 0;
for (String string : files) {
System.out.println(files[i].substring(0,3));i++;
}
}
String src ="http://imgs.vietnamnet.vn/Images/2012/02/20/14/20120220142745_Foxconn.jpg?w=190&h=125";
String image_name =src.substring(src.lastIndexOf("/")+1);
String arrSrc[] =image_name.split("\\.");
Pattern r = Pattern.compile("\\W");
Matcher m = r.matcher( arrSrc[0]);
arrSrc[0] = m.replaceAll("_");
image_name = arrSrc[0]+"."+arrSrc[1].substring(0,3);
System.out.println(image_name);
String date ="Th? m?c: Bóng ?á Châu Âu . Ngày g?i: Th? n?m, 14:21, 16/9/2010 fdf 16/9/2010 .... ph?n h?i";
r = Pattern.compile("\\d+/\\d+/\\d+");
m = r.matcher(date);
if(m.find()){
//System.out.println(m.group(1));
}
String url1 ="http://baobinhduong.org.vn/printThumbImg.aspx?imgurl=\\resources\\newsimg\\08062011/34129.jpg&width=150" ;
r = Pattern.compile("[^a-z,^A-Z,^\\d+,^&,^.,^=,^/,^:,^\\?]");
m = r.matcher(url1);
if(m.find())
System.out.println(m.replaceAll("/"));
url1 =".gif? d ";
url1 = url1.trim();
r = Pattern.compile("\\s+");
m = r.matcher(url1);
if(m.find()) url1 = m.replaceAll("%20");
System.out.println(url1);
r = Pattern.compile("jpg\\?|png\\?|gif\\?|bmp\\?|jpg&|png&|gif&|bmp&");
m = r.matcher(url1);
System.out.println(m.find());
url ="http://tuoitre.vn/Nhip-song-tre/Lam-dep/My-pham/382895/Mau-mat-nao len-ngoi_ he-nay.html";
r = Pattern.compile("[^\\.\\w:/-_]");
m = r.matcher(url);
//if(m.find())
url = m.replaceAll("%20");
System.out.println("Extract url=" + url);
System.out.println("66="+url.substring(66,69));
pattern = Pattern.compile("\\D");
matcher = pattern.matcher("545.445 vnd");
System.out.println("66="+matcher.replaceAll(""));
char chars[] = {60,97,32,104,114,101,102,61,34,109,97,105,108,116,111,58,109,121,108,97,110,100,115,97,105,103,111,110,50,48,49,50,64,103,109,97,105,108,46,99,111,109,34,62,109,121,108,97,110,100,115,97,105,103,111,110,50,48,49,50,64,103,109,97,105,108,46,99,111,109,60,47,97,62,32};
String s = new String(chars);
System.out.println(s);
src ="../../fafd.jp";
r = Pattern.compile("\\.\\./");
m = r.matcher(src);
src = m.replaceAll("/");
System.out.println(src);
String ss=" document.write(String.fromCharCode(60,97,32,104,114,101,102,61,34,109,97,105,108,116,111,58,109,121,108,97,110,100,115,97,105,103,111,110,50,48,49,50,64,103,109,97,105,108,46,99,111,109,34,62,109,121,108,97,110,100,115,97,105,103,111,110,50,48,49,50,64,103,109,97,105,108,46,99,111,109,60,47,97,62,32));";
if(StringUtil.isEmpty(ss))
{
r = Pattern.compile("[^\\d,]");
m = r.matcher(ss);System.out.println(m.replaceAll(""));
String strChar[]=m.replaceAll("").split(",");
int i = 0;
for (String string : strChar) {
chars[i]= new Character((char)Integer.parseInt(string));
i++;
}
s = new String(chars);
r = Pattern.compile(">(.*)<");
m = r.matcher(s);
if(m.find())
System.out.println(m.group(1));
}
r = Pattern.compile("!^(84)");
m = r.matcher("2384");
System.out.println(m.find());
}
}
| [
"thang24011983@gmail.com"
] | thang24011983@gmail.com |
335135c0c63935dd68c6e956596afb0eb4c17b45 | f083c7fd469c8f1f1f06d5fc2300d0fd3ae80d0f | /PracticaFinal/src/main/java/com/mycompany/practicafinal/servlets/LogOut.java | f599b2bd8bcd811dca126e3288d05a670b141028 | [] | no_license | Lazenn24/NetBeansProjects | 211faa2b5ae028132d7b6d4f4f5126004c57ecb0 | 373d8c7e5c6c99eb92bbecc07e00c375ca6a8d61 | refs/heads/master | 2020-04-05T13:27:31.888381 | 2019-02-14T19:48:22 | 2019-02-14T19:48:22 | 156,903,712 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,543 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.mycompany.practicafinal.servlets;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author admin
*/
public class LogOut extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
/* TODO output your page here. You may use following sample code. */
request.getSession().invalidate();
request.getRequestDispatcher("index.jsp").forward(request, response);
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"se.lopezperez@gmail.com"
] | se.lopezperez@gmail.com |
24fcaa210001e74cd25857d4f8a9bb11fdd4e8ea | 5c8cdc4f433b7658e31fffd5adf7175d6bad9d30 | /mate-platform/mate-system/src/main/java/vip/mate/system/controller/SysRouteController.java | 8b84632e927211e6000ab55f55cbc745e5c8a9d7 | [
"Apache-2.0"
] | permissive | matevip/matecloud | 9e603dde9be212f045549332d76a18a171297714 | 3a39a7a7090850b5936068f228dd58d73960410e | refs/heads/dev | 2023-09-03T12:41:19.704337 | 2023-07-30T02:05:17 | 2023-07-30T02:05:17 | 218,435,426 | 1,438 | 427 | Apache-2.0 | 2023-06-22T11:17:52 | 2019-10-30T03:25:43 | Java | UTF-8 | Java | false | false | 4,641 | java | /*
* Copyright 2020-2030, MateCloud, DAOTIANDI Technology Inc All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Author: pangu(7333791@qq.com)
*/
package vip.mate.system.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import vip.mate.core.auth.annotation.PreAuth;
import vip.mate.core.common.api.Result;
import vip.mate.core.database.entity.Search;
import vip.mate.core.log.annotation.Log;
import vip.mate.core.web.controller.BaseController;
import vip.mate.core.web.util.CollectionUtil;
import vip.mate.system.entity.SysRoute;
import vip.mate.system.service.ISysRouteService;
import javax.validation.Valid;
/**
* <p>
* 系统路由表 前端控制器
* </p>
*
* @author pangu
* @since 2020-10-17
*/
@RestController
@AllArgsConstructor
@RequestMapping("/route")
@Tag(name = "系统路由表", description = "系统路由表接口")
public class SysRouteController extends BaseController {
private final ISysRouteService sysRouteService;
/**
* 分页列表
*
* @param search 搜索关键词
* @return Result
*/
@PreAuth
@Log(value = "系统路由分页列表", exception = "系统路由分页列表请求异常")
@GetMapping("/page")
@Operation(summary = "系统路由分页", description = "分页查询")
@Parameters({
@Parameter(name = "current", required = true, description = "当前页", in = ParameterIn.DEFAULT),
@Parameter(name = "size", required = true, description = "每页显示数据", in = ParameterIn.DEFAULT),
@Parameter(name = "keyword", required = true, description = "模糊查询关键词", in = ParameterIn.DEFAULT),
@Parameter(name = "startDate", required = true, description = "创建开始日期", in = ParameterIn.DEFAULT),
@Parameter(name = "endDate", required = true, description = "创建结束日期", in = ParameterIn.DEFAULT),
})
public Result<?> page(Search search) {
return Result.data(sysRouteService.listPage(search));
}
/**
* 系统路由表信息
*
* @param id Id
* @return Result
*/
@PreAuth
@Log(value = "系统路由表信息", exception = "系统路由表信息请求异常")
@GetMapping("/get")
@Operation(summary = "系统路由表信息", description = "根据ID查询")
@Parameters({
@Parameter(name = "id", required = true, description = "ID", in = ParameterIn.DEFAULT),
})
public Result<?> get(@RequestParam String id) {
return Result.data(sysRouteService.getById(id));
}
/**
* 系统路由表设置
*
* @param sysRoute SysRoute 对象
* @return Result
*/
@PreAuth
@Log(value = "系统路由表设置", exception = "系统路由表设置请求异常")
@PostMapping("/set")
@Operation(summary = "系统路由表设置", description = "系统路由表设置,支持新增或修改")
public Result<?> set(@Valid @RequestBody SysRoute sysRoute) {
return Result.condition(sysRouteService.saveOrUpdate(sysRoute));
}
/**
* 系统路由表删除
*
* @param ids id字符串,根据,号分隔
* @return Result
*/
@PreAuth
@Log(value = "系统路由表删除", exception = "系统路由表删除请求异常")
@PostMapping("/del")
@Operation(summary = "系统路由表删除", description = "系统路由表删除")
@Parameters({
@Parameter(name = "ids", required = true, description = "多个用,号隔开", in = ParameterIn.DEFAULT)
})
public Result<?> del(@RequestParam String ids) {
return Result.condition(sysRouteService.removeByIds(CollectionUtil.stringToCollection(ids)));
}
/**
* 系统路由列表
*
* @return Result<List<SysRouteVO>>
*/
@PreAuth
@Log(value = "系统路由列表", exception = "系统路由列表请求异常")
@GetMapping("/list-item")
@Operation(summary = "系统路由列表", description = "系统路由列表")
public Result<?> listItem() {
return Result.data(sysRouteService.listItem());
}
}
| [
"7333791@qq.com"
] | 7333791@qq.com |
7c165cf626d9e5785d75aac59e920e6e2c518060 | 0b480c081e51007b421b62ed823a9dd4f40be6ff | /studydatacollection/src/main/java/org/md2k/studydatacollection/ServiceStudy.java | 39f4bfec96488bb3209e395df1b30f10cdec5423 | [
"BSD-2-Clause"
] | permissive | MD2Korg/mCerebrum-StudyDataCollection | 0db6c3769bca523af92c0aee4cc5fc42ed550c82 | 1ee3da8ef62f7ea69adc0db4f4f53b088ec7a1a5 | refs/heads/master | 2018-10-21T04:05:38.730098 | 2018-07-25T20:41:37 | 2018-07-25T20:41:37 | 107,695,859 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,990 | java | package org.md2k.studydatacollection;
import android.app.Notification;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.IBinder;
import android.util.Log;
import org.md2k.mcerebrum.core.access.appinfo.AppAccess;
import org.md2k.mcerebrum.core.access.appinfo.AppBasicInfo;
import org.md2k.mcerebrum.system.update.Update;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
import rx.Observable;
import rx.Observer;
import rx.Subscription;
import rx.functions.Func1;
/*
* Copyright (c) 2015, The University of Memphis, MD2K Center
* - Syed Monowar Hossain <monowar.hossain@gmail.com>
* - Nazir Saleheen <nazir.saleheen@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
public class ServiceStudy extends Service {
ArrayList<String> packageNames;
String study;
String dataKit;
String mCerebrum;
Subscription subscription;
Subscription subscriptionCheckUpdate;
public static final int NOTIFY_ID=98764;
@Override
public void onCreate() {
super.onCreate();
Log.d("abc","---------------service onCreate()");
packageNames= AppBasicInfo.get(this);
dataKit=AppBasicInfo.getDataKit(this);
study = getPackageName();
mCerebrum=AppBasicInfo.getMCerebrum(this);
watchDog();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId)
{
Log.d("abc","---------------service onStartCommand()...start");
startForeground(NOTIFY_ID, getCompatNotification(this, "Data Collection - ON"));
return START_STICKY; // or whatever your flag
}
void watchDog(){
subscription=Observable.interval(2,30, TimeUnit.SECONDS)
.map(new Func1<Long, Boolean>() {
@Override
public Boolean call(Long aLong) {
start();
checkUpdateIfNecessary();
updateNotification();
return false;
}
}).subscribe(new Observer<Boolean>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
stop();
}
@Override
public void onNext(Boolean aBoolean) {
}
});
}
void updateNotification(){
startForeground(NOTIFY_ID, getCompatNotification(this, "Data Collection - ON"));
}
void checkUpdateIfNecessary(){
SharedPreferences sharedPref = getSharedPreferences("update", MODE_PRIVATE);
long lastChecked= sharedPref.getLong("last_time_checked",0);
if(System.currentTimeMillis() - lastChecked>=24*60*60*1000L) {
checkUpdate();
SharedPreferences.Editor editor = getSharedPreferences("update", MODE_PRIVATE).edit();
editor.putLong("last_time_checked", System.currentTimeMillis());
editor.apply();
}
}
@Override
public IBinder onBind(Intent intent) {
throw new UnsupportedOperationException("Not yet implemented");
}
void unsubscribe(){
if(subscription!=null && !subscription.isUnsubscribed())
subscription.unsubscribe();
if(subscriptionCheckUpdate!=null && !subscriptionCheckUpdate.isUnsubscribed())
subscriptionCheckUpdate.unsubscribe();
}
@Override
public void onDestroy(){
Log.d("abc","------------------------> onDestroy...................");
unsubscribe();
stop();
stopForeground(true);
super.onDestroy();
}
public static Notification getCompatNotification(Context context, String msg) {
String heading=context.getResources().getString(R.string.app_name);
Intent myIntent = new Intent(context, ActivityMain.class);
myIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, myIntent, PendingIntent.FLAG_UPDATE_CURRENT);
Notification.Builder builder = new Notification.Builder(context);
if(Update.hasUpdate(context)!=0)
heading+= " (Update Available)";
builder.setSmallIcon(R.mipmap.ic_launcher).setContentTitle(heading).setContentText(msg).setContentIntent(pendingIntent);
return builder.build();
}
void stop(){
for(int i=0;i<packageNames.size();i++){
if(!AppAccess.getMCerebrumSupported(this, packageNames.get(i))) continue;
if(packageNames.get(i).equals(study)) continue;
if(packageNames.get(i).equals(mCerebrum)) continue;
AppAccess.stopBackground(this, packageNames.get(i));
}
}
void start(){
for(int i=0;i<packageNames.size();i++){
if(!AppAccess.getMCerebrumSupported(this, packageNames.get(i))) continue;
if(packageNames.get(i).equals(study)) continue;
if(packageNames.get(i).equals(mCerebrum)) continue;
AppAccess.startBackground(this, packageNames.get(i));
}
}
void checkUpdate(){
subscriptionCheckUpdate = Update.checkUpdate(this).subscribe(new Observer<Boolean>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(Boolean aBoolean) {
}
});
}
}
| [
"smhssain@gmail.com"
] | smhssain@gmail.com |
2a971597d7a39761349a1907c436140c0b821b9f | 7f48c0ee6738e730d33db6f152ee58aa5799f09a | /SpringPractice/src/main/java/com/zonray/extra/App.java | 2ef966ff7594c803449541cbc30ac9b37be1e373 | [] | no_license | kumarjagadeesh25/SpringLoggingSession | 59e0acc8cb91d33b1ffeec3e2ec1c9a04419b5b0 | fbdc802bdfdd027f5189831fca4cbc780ca7413d | refs/heads/master | 2022-06-01T16:06:26.427692 | 2019-09-19T13:01:06 | 2019-09-19T13:01:06 | 209,551,011 | 0 | 0 | null | 2022-05-25T06:42:09 | 2019-09-19T12:41:54 | Java | UTF-8 | Java | false | false | 282 | java | package com.zonray.extra;
public class App {
public static void main(String[] args) {
MyInterface myInterface = new Cone();
myInterface.demo();
myInterface.methodOne();
((Cone)myInterface).methodTwo();
Cone.class.cast(myInterface).methodTwo();
}
}
| [
"you@example.com"
] | you@example.com |
2e8e675d0ca83adcd65887c5604598a0c9509d2a | dfafe4443f904a493819dc30b17634ee9287ab48 | /android/app/src/main/java/com/elibrary/MainActivity.java | 860a47d6a5af27eebb0ddc793be32b2e4522462f | [] | no_license | sunilkumarkm/react-native-login | 5b7c198cb8ff7f85aae4013c35d08163e5ac7813 | f2e737649eb36175451724bde0483d17da34de84 | refs/heads/master | 2020-05-07T13:07:27.895971 | 2019-04-10T08:17:20 | 2019-04-10T08:17:20 | 180,535,435 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 361 | java | package com.elibrary;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "eLibrary";
}
}
| [
"sunilkm@3esofttech.com"
] | sunilkm@3esofttech.com |
f7b94f11becf130f55b61937547e6b5637255e7d | 5728f50a394b62394587b0b255a57dcf4d13d20d | /src/java/org/jsimpledb/parse/expr/LValue.java | 45ffde85c25dc380d08cc0904661064416b47fbd | [
"Apache-2.0"
] | permissive | mayoricodevault/jsimpledb | 3d905744c7a5e55c1fe530dd6d91c99c4c730f1e | 9ee8301a6cda92a2d85ec1b0d94cfde6a78e5e38 | refs/heads/master | 2021-06-13T06:30:51.209136 | 2015-05-08T15:56:55 | 2015-05-08T15:56:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 582 | java |
/*
* Copyright (C) 2014 Archie L. Cobbs. All rights reserved.
*
* $Id$
*/
package org.jsimpledb.parse.expr;
import org.jsimpledb.parse.ParseSession;
/**
* Extension of the {@link Value} interface for instances that are capable of assignment.
*/
public interface LValue extends Value {
/**
* Make assignment to this instance.
*
* @param session parse session
* @param value new value for this instance
* @throws IllegalArgumentException if {@code value} is null or otherwise invalid
*/
void set(ParseSession session, Value value);
}
| [
"archie.cobbs@3d3da37c-52f5-b908-f4a3-ab77ce6ea90f"
] | archie.cobbs@3d3da37c-52f5-b908-f4a3-ab77ce6ea90f |
ed0858711bc3695c02f5e72dc1c881ff64d03765 | afa7f558400b92adaf22418e6a046b13a3541635 | /src/main/java/uk/co/datadisk/webservices/restfulwebservices/controllers/BasicAuthenticationController.java | 1b87677a7cddc19a9d6639f6db88c5a9fa7a540c | [] | no_license | datadiskpfv/restful-web-services | 24800f485625e3178fcd342fd30ec06769e69b71 | fccf4d8e8e82a4aef3f283b46c5f3f1ec98cee25 | refs/heads/master | 2020-04-16T10:51:40.345769 | 2019-01-17T08:05:04 | 2019-01-17T08:05:04 | 165,519,253 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 770 | java | //package uk.co.datadisk.webservices.restfulwebservices.controllers;
//
//import org.springframework.web.bind.annotation.CrossOrigin;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RestController;
//import uk.co.datadisk.webservices.restfulwebservices.beans.AuthenticationBean;
//
//@CrossOrigin(origins="http://localhost:4200")
//@RestController
//public class BasicAuthenticationController {
//
// @GetMapping(path="/basicauth")
// public AuthenticationBean helloWorldBean() {
// // throw new RuntimeException("Some error has happened, please contact support");
// System.out.println("You tried to login");
// return new AuthenticationBean("You are authenticated");
// }
//}
| [
"paul.valle@orbian.com"
] | paul.valle@orbian.com |
706b5c353f1e45b024292d8af7e1a4e3c43ae141 | 2a07a7af7cbada8ea6334fcfe4e8822c9bd04c28 | /service/src/test/java/com/amertkara/udm/service/validator/UserValidatorImplTest.java | 060449c4cd3c4820fe3dbebd767320cd498ea0f3 | [
"Apache-2.0"
] | permissive | amertkara/user-data-manager | feb1ea46071592770bafc98fef27185942aaf1fd | de21fd43a20898ad79dabbb82ca76dd81999b8fa | refs/heads/master | 2021-05-26T05:22:16.656761 | 2020-11-17T17:27:22 | 2020-11-17T17:27:22 | 127,583,595 | 0 | 0 | Apache-2.0 | 2020-11-17T17:27:23 | 2018-04-01T00:49:15 | Java | UTF-8 | Java | false | false | 2,566 | java | package com.amertkara.udm.service.validator;
import static com.amertkara.udm.service.exception.ErrorCode.INVALID_USER_DATA;
import static com.amertkara.udm.service.exception.ErrorCode.INVALID_USER_IDENTIFIER;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import org.apache.commons.lang3.RandomUtils;
import org.assertj.core.api.Condition;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import com.amertkara.udm.service.exception.InvalidUserDataException;
import com.amertkara.udm.service.exception.InvalidUserIdentifierException;
import com.amertkara.udm.service.vo.UserPayload;
public class UserValidatorImplTest {
@Mock
private Validator validator;
private UserValidator userValidator;
@BeforeMethod
public void beforeMethod() {
MockitoAnnotations.initMocks(this);
userValidator = new UserValidatorImpl(validator);
}
@Test
public void testValidateId_givenNullId_shouldThrowInvalidUserIdentifierException() throws Exception {
assertThatExceptionOfType(InvalidUserIdentifierException.class)
.isThrownBy(() -> userValidator.validateId(null))
.is(new Condition<>(e -> e.getErrorPayload().getCode() == INVALID_USER_IDENTIFIER, "Expeting a InvalidUserIdentifierException with code=INVALID_USER_IDENTIFIER"));
}
@Test
public void testValidateId_givenValidId_shouldQuitNormally() throws Exception {
userValidator.validateId(RandomUtils.nextLong());
}
@Test
public void testValidatePayload_givenInvalidPayload_shouldThrowInvalidUserDataException() throws Exception {
doReturn(new HashSet<>(Arrays.asList(mock(ConstraintViolation.class)))).when(validator).validate(any(UserPayload.class));
assertThatExceptionOfType(InvalidUserDataException.class)
.isThrownBy(() -> userValidator.validatePayload(new UserPayload()))
.is(new Condition<>(e -> e.getErrorPayload().getCode() == INVALID_USER_DATA, "Expeting a InvalidUserDataException with code=INVALID_USER_DATA"));
}
@Test
public void testValidatePayload_givenValidPayload_shouldQuitNormally() throws Exception {
doReturn(Collections.emptySet()).when(validator).validate(any(UserPayload.class));
userValidator.validatePayload(new UserPayload());
}
}
| [
"mert.kara@appdirect.com"
] | mert.kara@appdirect.com |
47fa357e942028a1d9ef62ed7cb3ce4ddce1f0d1 | 4f80bc36568ff26fc16732401e6c7ba7ab922299 | /src/main/java/com/epam/xmlparserproject/xmlparsers/DOMParser.java | 57ddda04bcbf1b5bea65f51a3553f17a2b472016 | [] | no_license | KiroYan/xmlparsers | 2e9a65b85bccd85887ea5784455d8c5fa63372d9 | 4b8781223c57ca3e25b1c9a4b31665a1d0272757 | refs/heads/master | 2021-01-06T20:37:03.570469 | 2014-08-12T17:37:21 | 2014-08-12T17:37:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,924 | java | package com.epam.xmlparserproject.xmlparsers;
import java.io.File;
import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
public class DOMParser {
public static void main(String argv[]) throws ParserConfigurationException, SAXException, IOException {
File fXmlFile = new File("D:/workspace1/xmlproject/productlist.xml");
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
dbFactory.setIgnoringElementContentWhitespace(true);
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(fXmlFile);
StringBuilder xmlDoc = new StringBuilder();
doc.getDocumentElement().normalize();
Element rootElement = doc.getDocumentElement();
NodeList nList = rootElement.getChildNodes();
Element categories = (Element) nList.item(0);
NodeList category = categories.getElementsByTagName("category");
for (int i = 0; i < category.getLength(); i++) {
xmlDoc.append("Category :" + category.item(i).getFirstChild().getTextContent() + "\n");
NodeList subcategories = ((Element)category.item(i)).getElementsByTagName("subcategory");
for (int j = 0; j < subcategories.getLength(); j++) {
xmlDoc.append("Subcategory :" + subcategories.item(j).getFirstChild().getTextContent() + "\n");
NodeList products = ((Element)subcategories.item(j)).getElementsByTagName("product");
for (int z = 0; z < products.getLength(); z++) {
xmlDoc.append("Product name :" + ((Element)products.item(z)).getElementsByTagName("name").item(0).getTextContent() + "\n");
xmlDoc.append("Product producer :" + ((Element)products.item(z)).getElementsByTagName("producer").item(0).getTextContent() + "\n");
xmlDoc.append("Product model :" + ((Element)products.item(z)).getElementsByTagName("model").item(0).getTextContent() + "\n");
xmlDoc.append("Product dateOfIssue :" + ((Element)products.item(z)).getElementsByTagName("dateOfIssue").item(0).getTextContent() + "\n");
xmlDoc.append("Product color :" + ((Element)products.item(z)).getElementsByTagName("producer").item(0).getTextContent() + "\n");
xmlDoc.append("Product inStock :" + ((Element)products.item(z)).getElementsByTagName("model").item(0).getTextContent() + "\n");
xmlDoc.append("Product price :" + ((Element)products.item(z)).getElementsByTagName("dateOfIssue").item(0).getTextContent() + "\n");
xmlDoc.append("-------------------------------------------" + "\n");
}
}
}
System.out.println(xmlDoc);
}
}
/*File fXmlFile = new File("D:/workspace1/xmlproject/productlist.xml");
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
dbFactory.setIgnoringElementContentWhitespace(true);
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(fXmlFile);
StringBuilder xmlDoc = new StringBuilder();
doc.getDocumentElement().normalize();
Element rootElement = doc.getDocumentElement();
NodeList nList = rootElement.getChildNodes();
for (int temp = 0; temp < nList.getLength(); temp++) {
Element categories = (Element) nList.item(temp);
NodeList category = categories.getElementsByTagName("category");
for (int i = 0; i < category.getLength(); i++) {
xmlDoc.append("Category :" + category.item(i).getFirstChild().getTextContent() + "\n");
NodeList subcategories = categories.getElementsByTagName("subcategory");
for (int j = 0; j < subcategories.getLength(); j++) {
xmlDoc.append("Subcategory :" + subcategories.item(i).getFirstChild().getTextContent() + "\n");
NodeList products = ((Element)subcategories.item(j)).getElementsByTagName("product");
for (int z = 0; z < products.getLength(); z++) {
xmlDoc.append("Product name :" + ((Element)products.item(z)).getElementsByTagName("name").item(0).getTextContent() + "\n");
xmlDoc.append("Product producer :" + ((Element)products.item(z)).getElementsByTagName("producer").item(0).getTextContent() + "\n");
xmlDoc.append("Product model :" + ((Element)products.item(z)).getElementsByTagName("model").item(0).getTextContent() + "\n");
xmlDoc.append("Product dateOfIssue :" + ((Element)products.item(z)).getElementsByTagName("dateOfIssue").item(0).getTextContent() + "\n");
xmlDoc.append("Product color :" + ((Element)products.item(z)).getElementsByTagName("producer").item(0).getTextContent() + "\n");
xmlDoc.append("Product inStock :" + ((Element)products.item(z)).getElementsByTagName("model").item(0).getTextContent() + "\n");
xmlDoc.append("Product price :" + ((Element)products.item(z)).getElementsByTagName("dateOfIssue").item(0).getTextContent() + "\n");
xmlDoc.append("-------------------------------------------" + "\n");*/
| [
"storrraggge@gmail.com"
] | storrraggge@gmail.com |
47e1767430900b07ba8d0ef1461cf984e808571e | 7b9681b74e74b96e7a72f620d1b89d1b8559b89f | /JavaExplored/src/testCode/applt.java | 9cd00129d352debba8626d2ab54d8b647429a859 | [] | no_license | exexzian/Java-CodeWare | 08e3a0eefe1c6d019a192fcd29a45cdb69dd3fca | 862d23368f12c21e031abf117619a053b43805b6 | refs/heads/master | 2022-11-07T13:32:20.710986 | 2022-10-26T18:17:29 | 2022-10-26T18:17:29 | 13,093,175 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,380 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package testCode;
import java.awt.*;
import java.awt.Graphics;
import java.awt.event.*;
import java.applet.*;
public class applt extends Applet implements ActionListener {
Font f;
MenuBar menubar;
Menu menu1,menu2,menu3,menu4,submenu1,submenu2;
MenuItem item1,item2,item3,item4,item5,item6,item7,item8,item9,item10,item11,item12,item13,item14,item15,item16,item17;
private String s1 = "DEVENDRA";
int flag=0;
public void init() {
menubar = new MenuBar();
menu1 = new Menu("Font");
submenu1 = new Menu("Font name ");
item1 = new MenuItem("Times New Roman");
item2 = new MenuItem("Arial");
item3 = new MenuItem("Normal");
submenu1.add(item1);
submenu1.add(item2);
submenu1.add(item3);
menu1.add(submenu1);
submenu2 = new Menu("Font Size");
item4 = new MenuItem("10");
item5 = new MenuItem("12");
item6 = new MenuItem("15");
item7 = new MenuItem("20");
submenu2.add(item4);
submenu2.add(item5);
submenu2.add(item6);
submenu2.add(item7);
menu1.add(submenu2);
menubar.add(menu1);
menu2 = new Menu("Style");
item8 = new MenuItem("Bold");
item9 = new MenuItem("Italic");
item10 = new MenuItem("Underline");
menu2.add(item8);
menu2.add(item9);
menu2.add(item10);
menubar.add(menu2);
menu3 = new Menu("Shape");
item11 = new MenuItem("Oval");
item12 = new MenuItem("Rectangle");
item13 = new MenuItem("Line");
menu3.add(item11);
menu3.add(item12);
menu3.add(item13);
menubar.add(menu3);
menu4 = new Menu("Color");
item14 = new MenuItem("Red");
item15 = new MenuItem("Green");
item16 = new MenuItem("Blue");
item17 = new MenuItem("Black");
menu4.add(item14);
menu4.add(item15);
menu4.add(item16);
menu4.add(item17);
menubar.add(menu4);
f= new Font("DEVENDRA",Font.BOLD,12);
setFont(f);
Component c = this;
while (c != null && !(c instanceof Frame)) {
c = c.getParent();
}
((Frame)c).setMenuBar(menubar);
item9.addActionListener(this);
item10.addActionListener(this);
item8.addActionListener(this);
item12.addActionListener(this);
}
Graphics gr;
@Override
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==item12){
flag = 1;
System.out.println("calling repaint---------");
repaint();
}
}
public void update(Graphics g){
System.out.println("called update");
if(flag == 1){
g.drawRect(300,100,50,50);
}
System.out.println("*** caling paint from update**");
paint(g);
}
public void paint(Graphics g)
{
System.out.println("paint called");
s1="DEVENDRA";
g.drawString(s1,100,100);
g.drawOval(300,100,50,50);
}
}
| [
"genex4@gmail.com"
] | genex4@gmail.com |
ef93e46bbbfaeca8e66ba4c64b9c128593415310 | d1996208da6b9bfe543111a14ad1c273dd3ed587 | /src/com/nuobuluo/huangye/activity/FabuActivity.java | bdb9d7e329c276d8c978a7f7318022b8759569e3 | [] | no_license | 00zhengfu00/Huangye | 204ce40e9782af4d6a8678a4b35454f12a343017 | e107e92aa6c741d9f6c4bd0a36948bfac79c2411 | refs/heads/master | 2021-01-16T01:06:53.491073 | 2015-03-20T18:16:28 | 2015-03-20T18:16:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,383 | java | package com.nuobuluo.huangye.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.nuobuluo.huangye.R;
import com.nuobuluo.huangye.common.SystemMethod;
import com.nuobuluo.module.activity.AbstractTemplateActivity;
import com.nuobuluo.module.dialog.AlertDialog;
import com.nuobuluo.module.horizontalListView.HorizontalListView;
import com.nuobuluo.module.horizontalListView.ViewBean;
import com.nuobuluo.module.tab.SpinnerPopWindow;
import com.lidroid.xutils.DbUtils;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.exception.DbException;
import com.lidroid.xutils.exception.HttpException;
import com.lidroid.xutils.http.ResponseInfo;
import com.lidroid.xutils.http.callback.RequestCallBack;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;
import com.nuobuluo.huangye.adapter.SmallImageListViewAdapter;
import com.nuobuluo.huangye.bean.District;
import com.nuobuluo.huangye.bean.Publish;
import com.nuobuluo.huangye.bean.ShengHuoType;
import com.nuobuluo.huangye.bean.UploadImageInfo;
import com.nuobuluo.huangye.bean.UserInfo;
import com.nuobuluo.huangye.handler.TimeOutHandler;
import com.nuobuluo.huangye.utils.NetUtil;
import com.nuobuluo.huangye.utils.PreferenceConstants;
import com.nuobuluo.huangye.utils.PreferenceUtils;
import com.nuobuluo.huangye.utils.T;
import com.nuobuluo.huangye.utils.XutilHelper;
import java.util.ArrayList;
import java.util.List;
/**
* Created by zxl on 2015/1/30.
*/
public class FabuActivity extends AbstractTemplateActivity {
/**
* 添加后的图片显示区域*
*/
@ViewInject(R.id.horizontalListView)
private HorizontalListView horizontalListView;
@ViewInject(R.id.main)
private RelativeLayout main;
@ViewInject(R.id.category_layout)
private LinearLayout category_layout;
@ViewInject(R.id.changeAreaTextView)
private TextView changeAreaTextView;
@ViewInject(R.id.titleTextView)
private TextView titleTextView;
@ViewInject(R.id.contentTextView)
private TextView contentTextView;
SpinnerPopWindow puCountyWindow = null;
private String typeCode;
private Publish publish = new Publish();
/**
* 选择文件
*/
public static final int TO_SELECT_PHOTO = 3;
/**
* 过滤tab数据集合 *
*/
private List<ViewBean> filterTabViewBeanList = new ArrayList<ViewBean>();
private String parentTypeCode;
private TimeOutHandler timeOutHandler = new TimeOutHandler(this);
private SmallImageListViewAdapter smallImageListViewAdapter;
private List<String> imgAddList = new ArrayList<String>();
private String picPath = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fabu);
ViewUtils.inject(this);
initData();
initView();
}
private void initData() {
//得到变量
typeCode = getIntent().getStringExtra("typeCode");
parentTypeCode = getIntent().getStringExtra("parentTypeCode");
}
private void initView() {
//选择区域
puCountyWindow = new SpinnerPopWindow(FabuActivity.this);
//显示类别
queryShenghuoTypeData();
//选择后的相册区域组件
smallImageListViewAdapter = new SmallImageListViewAdapter(this, imgAddList);
horizontalListView.setAdapter(smallImageListViewAdapter);
}
private void queryShenghuoTypeData() {
//得到过滤信息(区域以及三级分类)
NetUtil.shenhuoType(PreferenceConstants.SHENHUO_TYPE_THREE, typeCode, new RequestCallBack<String>() {
@Override
public void onSuccess(ResponseInfo<String> stringResponseInfo) {
//判断是否有三级分类、判断是否有四级分类(判断规则如下:一旦有一个三级分类有四级分类,则所有的三级分类有四级分类)
List<ShengHuoType> shengHuoTypeList = ShengHuoType.parseMap(stringResponseInfo.result);
if (shengHuoTypeList != null && !shengHuoTypeList.isEmpty()) {
if (PreferenceConstants.IS_PARENT_TRUE.equals(shengHuoTypeList.get(0).getIsParent())) { //如果有四级菜单
filterTabViewBeanList.addAll(ShengHuoType.getlevel4ViewBean(shengHuoTypeList));
} else {
filterTabViewBeanList.add(ShengHuoType.getlevel3ViewBean(shengHuoTypeList));
}
}
//创建类别
for (final ViewBean temp : filterTabViewBeanList) {
RelativeLayout relativeLayout = new RelativeLayout(FabuActivity.this);
RelativeLayout.LayoutParams relativeLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, SystemMethod.dip2px(FabuActivity.this, 50));
relativeLayout.setLayoutParams(relativeLayoutParams);
relativeLayout.setBackgroundResource(R.drawable.item_bg);
TextView nameTextView = new TextView(FabuActivity.this);
final TextView tipTextView = new TextView(FabuActivity.this);
tipTextView.setHint("请选择");
tipTextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
puCountyWindow.initData(temp);
puCountyWindow.setItemSelectListener(new SpinnerPopWindow.IOnItemSelectListener() {
@Override
public void onItemClick(String tag, ViewBean viewBean, int position) {
tipTextView.setText(viewBean.getText());
publish.clearTypeList();
if (filterTabViewBeanList.size() == 1) { //没有四级分类
publish.addTypeList(viewBean.getId());
} else { //有四级分类
publish.addTypeList(temp.getId() + "::" + viewBean.getId());
}
}
});
puCountyWindow.showAtLocation(main, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
puCountyWindow.update();
}
});
nameTextView.setId(1);
nameTextView.setText(temp.getText());
nameTextView.setTextColor(getResources().getColor(R.color.grey));
nameTextView.setMinWidth(SystemMethod.dip2px(FabuActivity.this, 60));
RelativeLayout.LayoutParams nameTextViewLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
nameTextViewLayoutParams.setMargins(SystemMethod.dip2px(FabuActivity.this, 10), 0, 0, 0);
nameTextViewLayoutParams.addRule(RelativeLayout.CENTER_VERTICAL);
relativeLayout.addView(nameTextView, nameTextViewLayoutParams);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.RIGHT_OF, 1);
layoutParams.addRule(RelativeLayout.CENTER_VERTICAL);
layoutParams.setMargins(SystemMethod.dip2px(FabuActivity.this, 10), 0, 0, 0);
relativeLayout.addView(tipTextView, layoutParams);
category_layout.addView(relativeLayout);
View view = new View(FabuActivity.this);
ViewGroup.LayoutParams layout = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 1);
view.setLayoutParams(layout);
view.setBackgroundColor(getResources().getColor(R.color.white));
category_layout.addView(view);
}
}
@Override
public void onFailure(HttpException e, String s) {
T.showShort(FabuActivity.this, R.string.net_error);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK) {
picPath = data.getStringExtra(ChangePicActivity.KEY_PHOTO_PATH);
Log.i(FabuActivity.this.toString(), "最终选择的图片=" + picPath);
smallImageListViewAdapter.addLocalImgAddList(picPath);
smallImageListViewAdapter.notifyDataSetChanged();
}
super.onActivityResult(requestCode, resultCode, data);
}
/**
* add_pic 添加图片按钮
*/
@OnClick({R.id.add_pic, R.id.changeAreaTextView, R.id.publish_btn})
public void click(View view) {
switch (view.getId()) {
case R.id.add_pic:
//使用startActivityForResult启动SelectPicPopupWindow当返回到此Activity的时候就会调用onActivityResult函数
startActivityForResult(new Intent(FabuActivity.this,
ChangePicActivity.class), 1);
break;
case R.id.changeAreaTextView:
showDistrictDialog();
break;
case R.id.publish_btn:
savePublish();
break;
}
}
private void savePublish() {
//判断
if ("".equals(contentTextView.getText().toString())) {
T.showShort(FabuActivity.this,"服务介绍不能为空");
return ;
}
if ("".equals(titleTextView.getText().toString())) {
T.showShort(FabuActivity.this,"标题不能为空");
return ;
}
publish.setContent(contentTextView.getText().toString());
publish.setTitle(titleTextView.getText().toString());
publish.setLevel1Code(parentTypeCode);
publish.setLevel2Code(typeCode);
Integer userId = PreferenceUtils.getPrefInt(FabuActivity.this, PreferenceConstants.ACCOUNT_ID, -1);
DbUtils dbUtils = XutilHelper.getDB(FabuActivity.this);
try {
UserInfo userInfo = dbUtils.findById(UserInfo.class, userId);
publish.setUserId(userInfo.getUserId());
} catch (DbException e) {
e.printStackTrace();
}
//上传图片
if (smallImageListViewAdapter.getImgAddList().isEmpty()) {
uploadPublish(true);
} else {
NetUtil.uploadImg(smallImageListViewAdapter.getImgAddList(), new RequestCallBack<String>() {
@Override
public void onSuccess(ResponseInfo<String> stringResponseInfo) {
List<UploadImageInfo> imageInfos = UploadImageInfo.parseMap(stringResponseInfo.result);
List<String> filePath = new ArrayList<String>();
for (UploadImageInfo info : imageInfos) {
filePath.add(info.getFilePath());
}
publish.setImg(filePath);
uploadPublish(false);
}
@Override
public void onFailure(HttpException e, String s) {
T.showShort(FabuActivity.this, R.string.net_error);
timeOutHandler.stop();
}
@Override
public void onStart() {
super.onStart();
timeOutHandler.start(null);
}
});
}
}
private void uploadPublish(final boolean openDialog) {
//上传
NetUtil.publish(publish, new RequestCallBack<String>() {
@Override
public void onSuccess(ResponseInfo<String> stringResponseInfo) {
timeOutHandler.stop();
new AlertDialog(FabuActivity.this).builder().setTitle("提示").setMsg("发布成功")
.setPositiveButton("确定", new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(FabuActivity.this, FrameActivity.class);
intent.putExtra("click", "huangye");
startActivity(intent);
}
}).show();
}
@Override
public void onFailure(HttpException e, String s) {
T.showShort(FabuActivity.this, R.string.net_error);
timeOutHandler.stop();
}
@Override
public void onStart() {
super.onStart();
if (openDialog) {
timeOutHandler.start(null);
}
}
});
}
/**
* 显示选择行政区划弹出框
*/
private void showDistrictDialog() {
NetUtil.queryDistrictList(true, new RequestCallBack<String>() {
@Override
public void onSuccess(ResponseInfo<String> stringResponseInfo) {
//初始化数据
List<District> removeDistrictList = District.parseFabuMap(stringResponseInfo.result);
List<ViewBean> mapList = District.convertDistrictToViewBean(removeDistrictList);
//初始化filterTabLayout
ViewBean viewBean = ViewBean.getDistrictViewBean();
viewBean.setBizAreaList(mapList);
puCountyWindow = new SpinnerPopWindow(FabuActivity.this);
puCountyWindow.initData(viewBean);
puCountyWindow.setItemSelectListener(new SpinnerPopWindow.IOnItemSelectListener() {
@Override
public void onItemClick(String tag, ViewBean viewBean, int position) {
publish.clearBizArea();
publish.clearDistrict();
changeAreaTextView.setText(viewBean.getText());
if(viewBean.getId()==null||viewBean.getId().isEmpty()){//选中的是全部商圈
publish.addBizArea(viewBean.getId());
}else{
publish.addDistrict(viewBean.getParentId());
publish.addBizArea(viewBean.getId());
}
}
});
puCountyWindow.showAtLocation(main, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
puCountyWindow.update();
}
@Override
public void onFailure(HttpException e, String s) {
T.showShort(FabuActivity.this, R.string.net_error);
}
});
}
}
| [
"www.zzti@gmail.com"
] | www.zzti@gmail.com |
d23fd59b3ecb5015439cb63a10a7214e8136babd | 7a26d59d5f8292cf0b3ea762960bf3dbd3b861ca | /src/com/android/settings/development/UpdateRecoveryDialogHost.java | 29741dcc3091adf897923ba02b1ed7a2a38cd381 | [
"Apache-2.0"
] | permissive | ResurrectionRemix/Resurrection_packages_apps_Settings | bac0727c91db6d4d5d7f8f2b4ea01d8f4273853b | c65423981fe1f615b51dc534038110e6e86f88ad | refs/heads/Q | 2021-12-15T14:52:54.291575 | 2021-09-19T11:36:02 | 2021-09-19T11:36:02 | 17,210,708 | 228 | 1,613 | NOASSERTION | 2023-01-02T18:18:06 | 2014-02-26T13:00:14 | Java | UTF-8 | Java | false | false | 1,025 | java | /*
* Copyright (C) 2020 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.development;
/**
* Interface for UpdateRecoveryWarningDialogFragment callbacks.
*/
public interface UpdateRecoveryDialogHost {
/**
* Called when the user presses ok on the warning dialog.
*/
void onUpdateRecoveryDialogConfirmed();
/**
* Called when the user dismisses or cancels the warning dialog.
*/
void onUpdateRecoveryDialogDismissed();
}
| [
"date.varun123@gmail.com"
] | date.varun123@gmail.com |
de73d3b68e49745defd921b617c4328eeff4ddfe | 124df74bce796598d224c4380c60c8e95756f761 | /gov.noaa.nws.ncep.edex.common/src/gov/noaa/nws/ncep/edex/common/metparameters/UncondProbOfTstorms2hr.java | 4372241de2143ea7bfb27fcf765d1522ec41bd47 | [] | no_license | Mapoet/AWIPS-Test | 19059bbd401573950995c8cc442ddd45588e6c9f | 43c5a7cc360b3cbec2ae94cb58594fe247253621 | refs/heads/master | 2020-04-17T03:35:57.762513 | 2017-02-06T17:17:58 | 2017-02-06T17:17:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 885 | java | /**
*
*/
package gov.noaa.nws.ncep.edex.common.metparameters;
import javax.measure.quantity.Dimensionless;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.adapters.UnitAdapter;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
/**
* Maps to the parameter TS02
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class UncondProbOfTstorms2hr extends AbstractMetParameter implements
Dimensionless, ISerializableObject {
/**
*
*/
private static final long serialVersionUID = -7530180701363762459L;
public UncondProbOfTstorms2hr() throws Exception {
super( new UnitAdapter().marshal(UNIT) );
}
}
| [
"joshua.t.love@saic.com"
] | joshua.t.love@saic.com |
597570a875e495864c7cf19294d61bfaaabfd290 | 0cd4f337f806232b179748525c9331067618cce1 | /TestApplication/app/src/androidTest/java/com/example/muskan/testapplication/ExampleInstrumentedTest.java | f79c1398402f799b8f14d8e9a23e9dff4d365e5e | [] | no_license | Muskan-Mittal/Practice | 6a48812b4545430a5c6759212eed146705c2293e | 338db2d87767c68abe9c8a61e09e1efa1c7b19b7 | refs/heads/master | 2021-09-05T06:09:52.647055 | 2018-01-24T16:58:24 | 2018-01-24T16:58:24 | 108,505,535 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 772 | java | package com.example.muskan.testapplication;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.muskan.testapplication", appContext.getPackageName());
}
}
| [
"muskanmtl10@gmail.com"
] | muskanmtl10@gmail.com |
75ee363a548f5f595034a3d81b8a0ca4ad670509 | 55a0954f14e40868401cc37c933b16c80fac1866 | /ExcelTestProject/src/test/java/com/dataDrivenExcel/Xls_Reader.java | 6a1bda04753631c9376df3938cf0b904ad6a08c1 | [] | no_license | kandaguru/Maven-Projects | 5eb38a48b3cb8a05ac3544e7730d9b922f0f7fb3 | 7f6a4d0b069874c0cdb5b7fb29b662f1629c6ee2 | refs/heads/master | 2020-03-30T06:27:58.597407 | 2018-10-10T21:37:13 | 2018-10-10T21:37:13 | 150,863,460 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,292 | java | package com.dataDrivenExcel;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.apache.poi.common.usermodel.HyperlinkType;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.xssf.usermodel.*;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Calendar;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Calendar;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFCreationHelper;
import org.apache.poi.xssf.usermodel.XSSFFont;
import org.apache.poi.xssf.usermodel.XSSFHyperlink;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class Xls_Reader {
//public static String filename = System.getProperty("user.dir")+"\\src\\com\\qtpselenium\\xlsx\\Suite.xlsx";
public String path;
public FileInputStream fis = null;
public FileOutputStream fileOut =null;
private XSSFWorkbook workbook = null;
private XSSFSheet sheet = null;
private XSSFRow row =null;
private XSSFCell cell = null;
public Xls_Reader(String path) {
this.path=path;
try {
fis = new FileInputStream(path);
workbook = new XSSFWorkbook(fis);
sheet = workbook.getSheetAt(0);
fis.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
// returns the row count in a sheet
public int getRowCount(String sheetName){
int index = workbook.getSheetIndex(sheetName);
if(index==-1)
return 0;
else{
sheet = workbook.getSheetAt(index);
int number=sheet.getLastRowNum()+1;
return number;
}
}
// returns the data from a cell
public String getCellData(String sheetName,String colName,int rowNum){
try{
if(rowNum <=0)
return "";
int index = workbook.getSheetIndex(sheetName);
int col_Num=-1;
if(index==-1)
return "";
sheet = workbook.getSheetAt(index);
row=sheet.getRow(0);
for(int i=0;i<row.getLastCellNum();i++){
//System.out.println(row.getCell(i).getStringCellValue().trim());
if(row.getCell(i).getStringCellValue().trim().equals(colName.trim()))
col_Num=i;
}
if(col_Num==-1)
return "";
sheet = workbook.getSheetAt(index);
row = sheet.getRow(rowNum-1);
if(row==null)
return "";
cell = row.getCell(col_Num);
if(cell==null)
return "";
//System.out.println(cell.getCellType());
if(cell.getCellType()==Cell.CELL_TYPE_STRING)
return cell.getStringCellValue();
else if(cell.getCellType()==Cell.CELL_TYPE_NUMERIC || cell.getCellType()==Cell.CELL_TYPE_FORMULA ){
String cellText = String.valueOf(cell.getNumericCellValue());
if (HSSFDateUtil.isCellDateFormatted(cell)) {
// format in form of M/D/YY
double d = cell.getNumericCellValue();
Calendar cal =Calendar.getInstance();
cal.setTime(HSSFDateUtil.getJavaDate(d));
cellText =
(String.valueOf(cal.get(Calendar.YEAR))).substring(2);
cellText = cal.get(Calendar.DAY_OF_MONTH) + "/" +
cal.get(Calendar.MONTH)+1 + "/" +
cellText;
//System.out.println(cellText);
}
return cellText;
}else if(cell.getCellType()==Cell.CELL_TYPE_BLANK)
return "";
else
return String.valueOf(cell.getBooleanCellValue());
}
catch(Exception e){
e.printStackTrace();
return "row "+rowNum+" or column "+colName +" does not exist in xls";
}
}
// returns the data from a cell
public String getCellData(String sheetName,int colNum,int rowNum){
try{
if(rowNum <=0)
return "";
int index = workbook.getSheetIndex(sheetName);
if(index==-1)
return "";
sheet = workbook.getSheetAt(index);
row = sheet.getRow(rowNum-1);
if(row==null)
return "";
cell = row.getCell(colNum);
if(cell==null)
return "";
if(cell.getCellType()==Cell.CELL_TYPE_STRING)
return cell.getStringCellValue();
else if(cell.getCellType()==Cell.CELL_TYPE_NUMERIC || cell.getCellType()==Cell.CELL_TYPE_FORMULA ){
String cellText = String.valueOf(cell.getNumericCellValue());
if (HSSFDateUtil.isCellDateFormatted(cell)) {
// format in form of M/D/YY
double d = cell.getNumericCellValue();
Calendar cal =Calendar.getInstance();
cal.setTime(HSSFDateUtil.getJavaDate(d));
cellText =
(String.valueOf(cal.get(Calendar.YEAR))).substring(2);
cellText = cal.get(Calendar.MONTH)+1 + "/" +
cal.get(Calendar.DAY_OF_MONTH) + "/" +
cellText;
// System.out.println(cellText);
}
return cellText;
}else if(cell.getCellType()==Cell.CELL_TYPE_BLANK)
return "";
else
return String.valueOf(cell.getBooleanCellValue());
}
catch(Exception e){
e.printStackTrace();
return "row "+rowNum+" or column "+colNum +" does not exist in xls";
}
}
// returns true if data is set successfully else false
public boolean setCellData(String sheetName,String colName,int rowNum, String data){
try{
fis = new FileInputStream(path);
workbook = new XSSFWorkbook(fis);
if(rowNum<=0)
return false;
int index = workbook.getSheetIndex(sheetName);
int colNum=-1;
if(index==-1)
return false;
sheet = workbook.getSheetAt(index);
row=sheet.getRow(0);
for(int i=0;i<row.getLastCellNum();i++){
//System.out.println(row.getCell(i).getStringCellValue().trim());
if(row.getCell(i).getStringCellValue().trim().equals(colName))
colNum=i;
}
if(colNum==-1)
return false;
sheet.autoSizeColumn(colNum);
row = sheet.getRow(rowNum-1);
if (row == null)
row = sheet.createRow(rowNum-1);
cell = row.getCell(colNum);
if (cell == null)
cell = row.createCell(colNum);
// cell style
//CellStyle cs = workbook.createCellStyle();
//cs.setWrapText(true);
//cell.setCellStyle(cs);
cell.setCellValue(data);
fileOut = new FileOutputStream(path);
workbook.write(fileOut);
fileOut.close();
}
catch(Exception e){
e.printStackTrace();
return false;
}
return true;
}
// returns true if data is set successfully else false
public boolean setCellData(String sheetName,String colName,int rowNum, String data,String url){
//System.out.println("setCellData setCellData******************");
try{
fis = new FileInputStream(path);
workbook = new XSSFWorkbook(fis);
if(rowNum<=0)
return false;
int index = workbook.getSheetIndex(sheetName);
int colNum=-1;
if(index==-1)
return false;
sheet = workbook.getSheetAt(index);
//System.out.println("A");
row=sheet.getRow(0);
for(int i=0;i<row.getLastCellNum();i++){
//System.out.println(row.getCell(i).getStringCellValue().trim());
if(row.getCell(i).getStringCellValue().trim().equalsIgnoreCase(colName))
colNum=i;
}
if(colNum==-1)
return false;
sheet.autoSizeColumn(colNum); //ashish
row = sheet.getRow(rowNum-1);
if (row == null)
row = sheet.createRow(rowNum-1);
cell = row.getCell(colNum);
if (cell == null)
cell = row.createCell(colNum);
cell.setCellValue(data);
XSSFCreationHelper createHelper = workbook.getCreationHelper();
//cell style for hyperlinks
//by default hypelrinks are blue and underlined
CellStyle hlink_style = workbook.createCellStyle();
XSSFFont hlink_font = workbook.createFont();
hlink_font.setUnderline(XSSFFont.U_SINGLE);
hlink_font.setColor(IndexedColors.BLUE.getIndex());
hlink_style.setFont(hlink_font);
//hlink_style.setWrapText(true);
XSSFHyperlink link = createHelper.createHyperlink(HyperlinkType.FILE);
link.setAddress(url);
cell.setHyperlink(link);
cell.setCellStyle(hlink_style);
fileOut = new FileOutputStream(path);
workbook.write(fileOut);
fileOut.close();
}
catch(Exception e){
e.printStackTrace();
return false;
}
return true;
}
// returns true if sheet is created successfully else false
public boolean addSheet(String sheetname){
FileOutputStream fileOut;
try {
workbook.createSheet(sheetname);
fileOut = new FileOutputStream(path);
workbook.write(fileOut);
fileOut.close();
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
}
// returns true if sheet is removed successfully else false if sheet does not exist
public boolean removeSheet(String sheetName){
int index = workbook.getSheetIndex(sheetName);
if(index==-1)
return false;
FileOutputStream fileOut;
try {
workbook.removeSheetAt(index);
fileOut = new FileOutputStream(path);
workbook.write(fileOut);
fileOut.close();
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
}
// returns true if column is created successfully
public boolean addColumn(String sheetName,String colName){
//System.out.println("**************addColumn*********************");
try{
fis = new FileInputStream(path);
workbook = new XSSFWorkbook(fis);
int index = workbook.getSheetIndex(sheetName);
if(index==-1)
return false;
XSSFCellStyle style = workbook.createCellStyle();
style.setFillForegroundColor(HSSFColor.GREY_40_PERCENT.index);
//style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
sheet=workbook.getSheetAt(index);
row = sheet.getRow(0);
if (row == null)
row = sheet.createRow(0);
//cell = row.getCell();
//if (cell == null)
//System.out.println(row.getLastCellNum());
if(row.getLastCellNum() == -1)
cell = row.createCell(0);
else
cell = row.createCell(row.getLastCellNum());
cell.setCellValue(colName);
cell.setCellStyle(style);
fileOut = new FileOutputStream(path);
workbook.write(fileOut);
fileOut.close();
}catch(Exception e){
e.printStackTrace();
return false;
}
return true;
}
// removes a column and all the contents
public boolean removeColumn(String sheetName, int colNum) {
try{
if(!isSheetExist(sheetName))
return false;
fis = new FileInputStream(path);
workbook = new XSSFWorkbook(fis);
sheet=workbook.getSheet(sheetName);
XSSFCellStyle style = workbook.createCellStyle();
style.setFillForegroundColor(HSSFColor.GREY_40_PERCENT.index);
XSSFCreationHelper createHelper = workbook.getCreationHelper();
//style.setFillPattern(HSSFCellStyle.NO_FILL);
style.setFillPattern(FillPatternType.NO_FILL);
for(int i =0;i<getRowCount(sheetName);i++){
row=sheet.getRow(i);
if(row!=null){
cell=row.getCell(colNum);
if(cell!=null){
cell.setCellStyle(style);
row.removeCell(cell);
}
}
}
fileOut = new FileOutputStream(path);
workbook.write(fileOut);
fileOut.close();
}
catch(Exception e){
e.printStackTrace();
return false;
}
return true;
}
// find whether sheets exists
public boolean isSheetExist(String sheetName){
int index = workbook.getSheetIndex(sheetName);
if(index==-1){
index=workbook.getSheetIndex(sheetName.toUpperCase());
if(index==-1)
return false;
else
return true;
}
else
return true;
}
// returns number of columns in a sheet
public int getColumnCount(String sheetName){
// check if sheet exists
if(!isSheetExist(sheetName))
return -1;
sheet = workbook.getSheet(sheetName);
row = sheet.getRow(0);
if(row==null)
return -1;
return row.getLastCellNum();
}
//String sheetName, String testCaseName,String keyword ,String URL,String message
public boolean addHyperLink(String sheetName,String screenShotColName,String testCaseName,int index,String url,String message){
//System.out.println("ADDING addHyperLink******************");
url=url.replace('\\', '/');
if(!isSheetExist(sheetName))
return false;
sheet = workbook.getSheet(sheetName);
for(int i=2;i<=getRowCount(sheetName);i++){
if(getCellData(sheetName, 0, i).equalsIgnoreCase(testCaseName)){
//System.out.println("**caught "+(i+index));
setCellData(sheetName, screenShotColName, i+index, message,url);
break;
}
}
return true;
}
public int getCellRowNum(String sheetName,String colName,String cellValue){
for(int i=2;i<=getRowCount(sheetName);i++){
if(getCellData(sheetName,colName , i).equalsIgnoreCase(cellValue)){
return i;
}
}
return -1;
}
// to run this on stand alone
public static void main(String arg[]) throws IOException{
//System.out.println(filename);
Xls_Reader datatable = null;
/* datatable = new Xls_Reader(System.getProperty("user.dir")+"\\src\\com\\qtpselenium\\xls\\Controller.xlsx");
for(int col=0 ;col< datatable.getColumnCount("TC5"); col++){
System.out.println(datatable.getCellData("TC5", col, 1));
} */
}
}
| [
"42104999+kandaguru@users.noreply.github.com"
] | 42104999+kandaguru@users.noreply.github.com |
e5b681ef33972b2e895fc3d00e8ddb6bb1b1c055 | c2e95eb528cde47b37f6d477b2c1f0f36548cabd | /src/com/neuedu/dao/IStudentDAO.java | b7d5bfa1e957dd91fb544c775e392602d6e9ad36 | [] | no_license | jeaniely/java20181016jdbc | e26a9a5b8f704ec5d519ddb40ef3b622804ab523 | 9159da0f7d03b916774cfef2cfa7437c3c4115e1 | refs/heads/master | 2020-04-01T12:30:20.255730 | 2018-10-16T09:01:12 | 2018-10-16T09:01:12 | 153,210,734 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 269 | java | package com.neuedu.dao;
import com.neuedu.bean.Student;
import java.util.List;
public interface IStudentDAO {
List<Student> getAll();
Student getOne(String sno);
int delete(String sno);
int insert(Student student);
int update(Student student);
}
| [
"574156761@qq.com"
] | 574156761@qq.com |
0b34c1b21ae3d2762ebcb9914fc8befa546951e6 | 619fd5601ab261d62bda03f32e2ebc67df7facfd | /src/main/java/pages/HomePage.java | c0bb085e2141f88f25a38b4699bc7f131b436d5b | [] | no_license | kinelena/test | 022002f50de04e59e214ec0fa7342f3a1515ae6a | 46f6550537c9e13fdc8f7e77f6bf835538d0e12f | refs/heads/master | 2023-05-11T15:51:24.794010 | 2018-07-12T08:09:28 | 2018-07-12T08:09:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 759 | java | package pages;
import pages.MailPage;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
/**
* <pre>
* Title: HomePageMailRu
* Date: Jul 10, 2018
* </pre>
* @author ekin
*/
public class HomePage
{
private final WebDriver driver;
private static final By newMessageLocator = By.cssSelector("#b-toolbar__left > div > div > div.b-toolbar__group.b-toolbar__group_left > div > a");
/**
* @param driver
*/
public HomePage(WebDriver driver) {
this.driver = driver;
}
/**
* @return mailPage
*/
public MailPage buttonClickNewMessage(){
driver.findElement(newMessageLocator).click();
return new MailPage(driver);
}
}
| [
"zhidelevaelena@gmail.com"
] | zhidelevaelena@gmail.com |
1e62c1c52ff454790b9a138e5a6e7b728b4b67c4 | f2815b153cb05610e13bf529ec3effb850c45f24 | /src/main/java/com/faurecia/model/DManagerEntity.java | 18501ba2320c3dc7609a3e4517e03bd31249bfc6 | [] | no_license | zhangfan2015/faurecia-launch | 4a17d01892878eff3161020718be32ae62b01ac1 | 579e13f558df0918d4aa752038c468976a01d8c7 | refs/heads/master | 2021-12-01T06:30:41.725047 | 2021-11-17T05:14:45 | 2021-11-17T05:14:45 | 165,992,742 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,489 | java | package com.faurecia.model;
import javax.persistence.*;
/**
* Created by Administrator on 2018/8/24.
*/
@Entity(name = "d_manager")
@Table(name = "d_manager", schema = "launch")
public class DManagerEntity {
private int id;
private String userName;
private String pwd;
private String role;
private Long createTime;
private Integer isDel;
private Long delTime;
@Id
@Column(name = "id")
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Basic
@Column(name = "userName")
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
@Basic
@Column(name = "pwd")
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
@Basic
@Column(name = "role")
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DManagerEntity that = (DManagerEntity) o;
if (id != that.id) return false;
if (userName != null ? !userName.equals(that.userName) : that.userName != null) return false;
if (pwd != null ? !pwd.equals(that.pwd) : that.pwd != null) return false;
if (role != null ? !role.equals(that.role) : that.role != null) return false;
return true;
}
@Override
public int hashCode() {
int result = id;
result = 31 * result + (userName != null ? userName.hashCode() : 0);
result = 31 * result + (pwd != null ? pwd.hashCode() : 0);
result = 31 * result + (role != null ? role.hashCode() : 0);
return result;
}
@Basic
@Column(name = "createTime")
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
@Basic
@Column(name = "isDel")
public Integer getIsDel() {
return isDel;
}
public void setIsDel(Integer isDel) {
this.isDel = isDel;
}
@Basic
@Column(name = "delTime")
public Long getDelTime() {
return delTime;
}
public void setDelTime(Long delTime) {
this.delTime = delTime;
}
}
| [
"1436081163@qq.com"
] | 1436081163@qq.com |
8de6c590f373b373f9557c29ba53708296b3f0fb | e206a269a5f3f6e6cc251fac910a4e3745457ad8 | /app/src/main/java/com/perpule/apaysilent1/APayActivity.java | dbe7556390be56bb1c8a7f607406c183cd5e06b5 | [] | no_license | mukuliitkgp/Amazon-Pay-Perpule | dc25680344000f257a00c844ac77ad19094af146 | be73b8ba1261dc867ba21f5b649bed99779bb66e | refs/heads/master | 2020-06-17T04:12:35.071859 | 2019-07-05T07:37:56 | 2019-07-05T07:37:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,252 | java | package com.perpule.apaysilent1;
import android.app.PendingIntent;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.customtabs.CustomTabsIntent;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;
import com.amazon.identity.auth.device.AuthError;
import com.amazon.identity.auth.device.api.Listener;
import com.amazon.identity.auth.device.api.authorization.AuthorizationManager;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import amazonpay.silentpay.APayCallback;
import amazonpay.silentpay.APayError;
import amazonpay.silentpay.AmazonPay;
import amazonpay.silentpay.EncryptedRequest;
import amazonpay.silentpay.GetBalanceRequest;
import amazonpay.silentpay.GetBalanceResponse;
public class APayActivity extends AppCompatActivity {
private static final int REQUEST_CODE = 1;
// private static final String MERCHANT_ID = "A1T5DRWMBFNP17";
private static final String MERCHANT_ID = "AZ4WQCLDT2DF0";
boolean isSandbox = true;
String amount,amt ;
Float am;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_apay);
amount = getIntent().getStringExtra("TOTAL_AMOUNT");
am = Float.parseFloat(amount);
amt = String.format("%.2f", am);
// am = String.format("%.2f", amount);
// (TextView) findViewById(R.id.aPayMoreInfoView)).setText("Sign out failed, try again");
// Toast.makeText(AmazonPayActivity.this, "Amount is "+ amount , Toast.LENGTH_SHORT).show();
}
@Override
protected void onStart(){
TextView text = (TextView) findViewById(R.id.textView);
text.setText("Total Amount: "+ amt);
super.onStart();
}
@Override
protected void onResume() {
getBalance();
super.onResume();
}
@Override
protected void onPause() {
// hideProgressBar();
super.onPause();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE) {
// ResponseProcessor.processIntentForTextView(data, (TextView) findViewById(R.id.aPayMoreInfoView), this.getLocalClassName());
} else {
Log.e(this.getLocalClassName(), "received no response");
}
super.onActivityResult(requestCode, resultCode, data);
}
public void onSignOutClick(View v) {
// showProgressBar();
AuthorizationManager.signOut(this, new Listener<Void, AuthError>() {
@Override
public void onSuccess(Void aVoid) {
runOnUiThread(new Runnable() {
@Override
public void run() {
showLinkAccountView();
// ((TextView) findViewById(R.id.aPayMoreInfoView)).setText("Sign out successful");
// hideProgressBar();
}
});
getBalance();
}
@Override
public void onError(AuthError authError) {
runOnUiThread(new Runnable() {
@Override
public void run() {
// ((TextView) findViewById(R.id.aPayMoreInfoView)).setText("Sign out failed, try again");
showSignOutView();
// hideProgressBar();
}
});
}
});
}
public void onLinkAccountClick(View v) {
// if (((Switch) findViewById(R.id.pendingIntentSwitch)).isChecked()) {
// showProgressBar();
// linkUsingPendingIntent(getCustomTabIntent());
// } else {
linkUsingAuthIntent(getCustomTabIntent());
// }
}
private void getBalance() {
// showProgressBar();
// boolean isSandbox = true;
// boolean isSandbox = findViewById(R.id.sandboxSwitch)).isChecked();
GetBalanceRequest request = new GetBalanceRequest(MERCHANT_ID, isSandbox);
AmazonPay.getBalance(this, request, new APayCallback() {
@Override
public void onSuccess(Bundle bundle) {
final GetBalanceResponse response = GetBalanceResponse.fromBundle(bundle);
runOnUiThread(new Runnable() {
@Override
public void run() {
((TextView) findViewById(R.id.balanceView)).setText(response.getBalance()+"INR");
showSignOutView();
// enableUnsafeUiElements();
// hideProgressBar();
}
});
}
@Override
public void onError(final APayError aPayError) {
runOnUiThread(new Runnable() {
@Override
public void run() {
// ResponseProcessor.processErrorForTextView(aPayError, (TextView) findViewById(R.id.aPayMoreInfoView), "AmazonPayActivity");
// ((TextView) findViewById(R.id.balanceView)).setText("Balance: -");
showLinkAccountView();
// disableUnsafeUiElements();
// hideProgressBar();
}
});
}
});
}
private void linkUsingAuthIntent(CustomTabsIntent customTabIntent) {
startActivityForResult(AmazonPay.getAuthorizationIntent(this, customTabIntent), REQUEST_CODE);
}
private void linkUsingPendingIntent(CustomTabsIntent customTabIntent) {
AmazonPay.authorize(this,
customTabIntent,
PendingIntent.getActivity(this, 0, new Intent(this, CompletionActivity.class), 0),
PendingIntent.getActivity(this, 0, new Intent(this, CancelActivity.class), 0));
}
private CustomTabsIntent getCustomTabIntent() {
// if (((Switch) findViewById(R.id.mobileBrowserSwitch)).isChecked()) {
// return null;
// } else {
return new CustomTabsIntent.Builder()
.setToolbarColor(Color.BLACK)
.build();
//}
}
private void showProgressBar() {
runOnUiThread(new Runnable() {
@Override
public void run() {
((ProgressBar) findViewById(R.id.progressBar)).setVisibility(View.VISIBLE);
disableUnsafeUiElements();
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
}
});
}
private void hideProgressBar() {
runOnUiThread(new Runnable() {
@Override
public void run() {
((ProgressBar) findViewById(R.id.progressBar)).setVisibility(View.INVISIBLE);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
}
});
}
private void enableUnsafeUiElements() {
runOnUiThread(new Runnable() {
@Override
public void run() {
// ((Switch) findViewById(R.id.sandboxSwitch)).setEnabled(true);
// ((EditText) findViewById(R.id.amountEditText)).setEnabled(true);
((Button) findViewById(R.id.payButton)).setEnabled(true);
}
});
}
private void disableUnsafeUiElements() {
runOnUiThread(new Runnable() {
@Override
public void run() {
// ((Switch) findViewById(R.id.sandboxSwitch)).setEnabled(false);
// ((EditText) findViewById(R.id.amountEditText)).setEnabled(false);
((Button) findViewById(R.id.payButton)).setEnabled(false);
}
});
}
private void showSignOutView() {
runOnUiThread(new Runnable() {
@Override
public void run() {
(findViewById(R.id.AccountView)).setVisibility(View.GONE);
(findViewById(R.id.signOutView)).setVisibility(View.VISIBLE);
((Button) findViewById(R.id.payButton)).setEnabled(true);
}
});
}
private void showLinkAccountView() {
runOnUiThread(new Runnable() {
@Override
public void run() {
((TextView) findViewById(R.id.balanceView)).setText(" - ");
(findViewById(R.id.AccountView)).setVisibility(View.VISIBLE);
(findViewById(R.id.signOutView)).setVisibility(View.GONE);
((Button) findViewById(R.id.payButton)).setEnabled(true);
}
});
}
public void onSandboxClick(View v) {
getBalance();
}
public void onPayNowClick(View v) {
// showProgressBar();
disableUnsafeUiElements();
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(APayActivity.this, "Encrypting...", Toast.LENGTH_SHORT).show();
}
});
new EncryptionTask().execute(onEncryptionSuccess(),
EncryptionTask.Operation.PROCESS_CHARGE,
getProcessChargeParams());
}
private Map<String, String> getProcessChargeParams() {
return new HashMap<String, String>() {{
put("orderTotalAmount", amount);
put("orderTotalCurrencyCode", "INR");
put("sellerNote", "somesell ernote");
put("customInformation", "someseller customdata");
put("sellerStoreName", "someseller storename");
put("sellerOrderId", UUID.randomUUID().toString());
}};
}
private Handler.Callback onEncryptionSuccess() {
return new Handler.Callback() {
@Override
public boolean handleMessage(Message msg) {
Bundle data = msg.getData();
Intent completionIntent = new Intent(APayActivity.this, CompletionActivity.class);
Bundle b = new Bundle();
data.putBoolean("isSandbox", isSandbox);
completionIntent.putExtras(b);
//
AmazonPay.processCharge(APayActivity.this,
getCustomTabIntent(),
PendingIntent.getActivity(APayActivity.this, 0, completionIntent, 0),
PendingIntent.getActivity(APayActivity.this, 0, new Intent(APayActivity.this, CancelActivity.class), 0),
new EncryptedRequest(data.getString("payload"), data.getString("key"), data.getString("iv"), isSandbox));
// new EncryptedRequest(payload,key,iv, isSandbox));
return true;
}
};
}
}
| [
"lk.iitkgp@gmail.com"
] | lk.iitkgp@gmail.com |
dae2476e4632866e417fa7c079e7bf5bb898308f | a8b30e3c49bcdf6db1c0994831316ccebc613dba | /is/src/main/java/com/zxtech/is/ui/team/activity/ElaTeamAddTeamMemberElaDialog.java | 12c810367b855a499b04d4dbbecdf6d36e9cb769 | [] | no_license | jerry5213/eai | 48d3265808397a0554c9fcb5ead91a9e3882b83e | a5b828754e65c80c86ed82782db433a64f84cea3 | refs/heads/master | 2020-03-25T17:26:29.967693 | 2018-08-09T09:19:51 | 2018-08-09T09:19:51 | 143,977,737 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,091 | java | package com.zxtech.is.ui.team.activity;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.Display;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import com.zxtech.is.net.HttpFactory;
import com.zxtech.is.net.RxHelper;
import com.zxtech.is.util.ToastUtil;
import com.zxtech.is.widget.MyItemDecoration;
import com.zxtech.is.R;
import com.zxtech.is.R2;
import com.zxtech.is.common.net.BaseResponse;
import com.zxtech.is.common.net.DefaultObserver;
import com.zxtech.is.model.team.TeamAddMemberEla;
import com.zxtech.is.service.team.ElaTeamAddPersonService;
import com.zxtech.is.ui.team.adapter.AddTeamMemberElaAdapter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
/**
* Created by syp660 on 2018/5/5.
*/
public class ElaTeamAddTeamMemberElaDialog extends DialogFragment {
private AddTeamMemberElaAdapter mAdapter;
private List<TeamAddMemberEla> list = new ArrayList<>();
private String prjGuid;
public String getPrjGuid() {
return prjGuid;
}
public void setPrjGuid(String prjGuid) {
this.prjGuid = prjGuid;
}
public interface selectEla{
void elaList(String elaName, String teamGuid);
}
private selectEla selectEla;
public ElaTeamAddTeamMemberElaDialog.selectEla getSelectEla() {
return selectEla;
}
public void setSelectEla(ElaTeamAddTeamMemberElaDialog.selectEla selectEla) {
this.selectEla = selectEla;
}
@BindView(R2.id.ela_team_add_member_rv)
RecyclerView mRecyclerView;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.dialog_elevator_tem, null);
//加这句话去掉自带的标题栏
getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
getDialog().setCanceledOnTouchOutside(false);
getDialog().setCancelable(false);
getDialog().setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
return true;
}
return false;
}
});
requesNet();
ButterKnife.bind(this, view);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(linearLayoutManager);
mRecyclerView.addItemDecoration(new MyItemDecoration());
mAdapter = new AddTeamMemberElaAdapter(R.layout.item_elevator_team, list);
mAdapter.bindToRecyclerView(mRecyclerView);
mRecyclerView.setAdapter(mAdapter);
return view;
}
@Override
public void onStart() {
super.onStart();
WindowManager m = getActivity().getWindow().getWindowManager();
Display d = m.getDefaultDisplay();
Window window = getDialog().getWindow();
WindowManager.LayoutParams params = window.getAttributes();
//params.gravity = Gravity.BOTTOM;
params.width = (int) (d.getWidth() * 0.8);
window.setAttributes(params);
//设置背景透明
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
}
@OnClick({R2.id.ela_team_add_member_submit,R2.id.ela_team_add_member_cancel})
public void onClick(View view){
int i = view.getId();
if (i == R.id.ela_team_add_member_submit) {
if (check()) {
result();
this.dismiss();
}
} else if (i == R.id.ela_team_add_member_cancel) {
this.dismiss();
} else {
}
}
private void requesNet(){
ElaTeamAddPersonService elaTeamAddPersonService = HttpFactory.getService(ElaTeamAddPersonService.class);
elaTeamAddPersonService.selectTeamMemberEla(prjGuid)
.compose(RxHelper.<BaseResponse<List<TeamAddMemberEla>>>rxSchedulerHelper())
.subscribe(new DefaultObserver<BaseResponse<List<TeamAddMemberEla>>>(getActivity(),true) {
@Override
public void onSuccess(BaseResponse<List<TeamAddMemberEla>> response) {
list.clear();
list.addAll(response.getData());
mAdapter.notifyDataSetChanged();
}
});
}
public static ElaTeamAddTeamMemberElaDialog newInstance() {
ElaTeamAddTeamMemberElaDialog fragment = new ElaTeamAddTeamMemberElaDialog();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
private boolean check(){
if(mAdapter.getSelectCount() == 0) {
ToastUtil.showLong(getResources().getString(R.string.is_check_one_elevator));
return false;
}
return true;
}
private void result(){
String elaName = "";
String teamGuid = "";
for (int i = 0; i < list.size(); i++) {
if (list.get(i).isCheck()){
if (elaName.equals("")) {
elaName += list.get(i).getElaName();
teamGuid += list.get(i).getTeamGuid();
} else {
elaName += "," + list.get(i).getElaName();
teamGuid += "," + list.get(i).getTeamGuid();
}
}
}
selectEla.elaList(elaName,teamGuid);
}
}
| [
"SYP521@neuxa.com"
] | SYP521@neuxa.com |
6a7cc7f206bdb321634a2060fb88b24a150c3c0e | b3cf2ea427af482e788d702277d60061088dcd55 | /whereami.java | 731fc777b204918e5228bc803ad9fb10dd6b6acf | [
"MIT"
] | permissive | MrinallU/USACO-Bronze-Collection | 192202864dd3a2130cf1169b0a0d26049ecfd669 | 90725c68d1d8dc46baebe5bc294c8025f29472d6 | refs/heads/master | 2023-03-17T00:48:48.347726 | 2021-03-05T15:08:35 | 2021-03-05T15:08:35 | 274,975,184 | 7 | 4 | MIT | 2020-09-22T22:30:34 | 2020-06-25T17:23:16 | Java | UTF-8 | Java | false | false | 1,105 | java |
/*
ID: your_id_here
LANG: JAVA
TASK: word
*/
import java.io.*;
import java.util.*;
public class word{
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(new File("word"));
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("word")));
int N = sc.nextInt(); /* Strings */ int M = sc.nextInt(); /* Character limit*/ String [] arr = new String[N];
for(int i = 0; i < N; i++){
arr[i] = sc.next();
}
int length = 0; int nxtLength = 0 ;
for(int i = 0; i < N; i++){
String curWord = arr[i]; length += curWord.length(); boolean newLine = false;
if(i != N - 1){
String nextWord = arr[i + 1]; nxtLength = nextWord.length();
if(length + nxtLength > M){
length = 0;
out.println(arr[i]);
}else{
out.print(arr[i] + " ");
}
}else{
out.print(arr[i]);
}
}
out.close();
}
}
| [
"bossguy124567@gmail.com"
] | bossguy124567@gmail.com |
38f74f0161a907b5f5c35933f8e36e115e50904e | b38ca40c4e0df5991129b6320d2d248ccf780dc8 | /HAS22.java | 7baa9e6d532fb99dae7f0b8ec25b6072f32029f3 | [] | no_license | HimanshuGarg701/java_programming | 40082255318f29fc0c98880825a88765386a32ae | 58c67a1f17d88d97f9065d8f8584f9f220205ea0 | refs/heads/master | 2021-07-15T07:07:41.033000 | 2020-06-18T08:48:49 | 2020-06-18T08:48:49 | 172,657,229 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 538 | java | /*
Given an array of ints, return true if the array contains a 2 next to a 2 somewhere.
has22([1, 2, 2]) → true
has22([1, 2, 1, 2]) → false
has22([2, 1, 2]) → false
*/
package school;
public class HAS22 {
public static void main(String[] args){
int[] values = {1,2,2};
boolean answer = has22(values);
System.out.println(answer);
}
public static boolean has22(int[] nums) {
for(int i=0; i<nums.length-1; i++){
if (nums[i]==2 && nums[i+1]==2){
return true;
}
}return false;
}
}
| [
"hgarg701@gmail.com"
] | hgarg701@gmail.com |
c3cf3b5ee0f41648e2be24cb72f782e92c312475 | ef71494fef6618b48cfbcce2904dfd74b12a8948 | /icloud-common/framework-spiderbrowser/src/main/java/org/lobobrowser/html/renderer/MarkupLayout.java | 159a890a47bf575f7dd302184d4fb06346cf3016 | [] | no_license | djgrasss/icloud-2 | 128d8ba977afc1787f280c9b524d1704035476d7 | 796c0b53af2c05e82ef68f8c140a726e19a0e1ce | refs/heads/master | 2021-01-21T23:58:10.983738 | 2014-09-03T01:41:55 | 2014-09-03T01:41:55 | 23,603,476 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,242 | java | /*
GNU LESSER GENERAL PUBLIC LICENSE
Copyright (C) 2006 The Lobo Project
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Contact info: xamjadmin@users.sourceforge.net
*/
/*
* Created on Nov 6, 2005
*/
package org.lobobrowser.html.renderer;
import java.awt.Dimension;
import java.awt.Insets;
import org.lobobrowser.html.domimpl.HTMLElementImpl;
interface MarkupLayout {
public void layoutMarkup(RBlockViewport bodyLayout, RenderableContainer container, Dimension containerSize, Insets insets, HTMLElementImpl markupElement);
}
| [
"jiangning.cui2@travelzen.com"
] | jiangning.cui2@travelzen.com |
48b1879be6958f8960b6a32a6b4f2629e2ab26f4 | 5bfd100398e22f6c3e11e6062392828daa2259f4 | /src/main/java/com/aio/knimer/security/SecurityConfig.java | 5ba6b23b1dbd060d039c15654c9078ab98b30cf8 | [] | no_license | Sarem/knimer | 44e7aec731bd04c9722156173e8001898bfa6bce | 685ea62d7db6c66c65957783926ad74c35f0954b | refs/heads/master | 2021-01-26T04:24:50.729714 | 2020-07-08T10:26:34 | 2020-07-08T10:26:34 | 243,307,985 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,641 | java | package com.aio.knimer.security;
import org.keycloak.adapters.KeycloakConfigResolver;
import org.keycloak.adapters.springboot.KeycloakSpringBootProperties;
import org.keycloak.adapters.springsecurity.KeycloakConfiguration;
import org.keycloak.adapters.springsecurity.authentication.KeycloakAuthenticationProvider;
import org.keycloak.adapters.springsecurity.config.KeycloakWebSecurityConfigurerAdapter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.core.session.SessionRegistryImpl;
import org.springframework.security.web.authentication.session.RegisterSessionAuthenticationStrategy;
import org.springframework.security.web.authentication.session.SessionAuthenticationStrategy;
@KeycloakConfiguration
class SecurityConfig extends KeycloakWebSecurityConfigurerAdapter {
/**
* Registers the KeycloakAuthenticationProvider with the authentication manager.
*/
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
KeycloakAuthenticationProvider keycloakAuthenticationProvider = keycloakAuthenticationProvider();
auth.authenticationProvider(keycloakAuthenticationProvider);
}
/**
* Provide a session authentication strategy bean which should be of type
* RegisterSessionAuthenticationStrategy for public or confidential applications
* and NullAuthenticatedSessionStrategy for bearer-only applications.
*/
@Bean
@Override
protected SessionAuthenticationStrategy sessionAuthenticationStrategy() {
return new RegisterSessionAuthenticationStrategy(new SessionRegistryImpl());
}
/**
* Use properties in application.properties instead of keycloak.json
*/
@Bean
@Primary
public KeycloakConfigResolver keycloakConfigResolver(KeycloakSpringBootProperties properties) {
return new CustomKeycloakSpringBootConfigResolver(properties);
}
/**
* Secure appropriate endpoints
*/
@Override
protected void configure(HttpSecurity http) throws Exception {
super.configure(http);
http.authorizeRequests()
.antMatchers("/swagger-ui/**", "/v3/api-docs/**","/swagger-ui.html").permitAll()
.antMatchers("/**").authenticated()
.anyRequest().authenticated();
}
}
| [
"github.13"
] | github.13 |
105608f7629ea11a2d2b33b34fc4a7d01868a6e0 | 9097ddd8ad16ebcd91f999cd23619c691c075b41 | /src/someting/Main.java | 86eb002faf7dc162011f70521c457c91435ca345 | [] | no_license | leminhhoang-102/JavaSocketSendMess | 2869f11eab398d88f85c6dbb0c0d9f01e3322346 | df20f832b1c3a1df211176fb4f145d846660afc0 | refs/heads/main | 2023-07-06T05:13:28.701857 | 2021-08-13T13:46:58 | 2021-08-13T13:46:58 | 395,670,889 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,698 | java | package someting;
import someting.Asymetric.AsymmetricCryptography;
import javax.crypto.NoSuchPaddingException;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
public class Main
{
public static void main(String[] args) throws Exception {
AsymmetricCryptography ac = new AsymmetricCryptography();
PrivateKey privateKey = ac.getPrivate("KeyPair/privateKey");
PublicKey publicKey = ac.getPublic("KeyPair/publicKey");
DataInputStream din = null;
ServerSocket serverSocket = null;
DataOutputStream dout = null;
BufferedReader br = null;
try
{
serverSocket = new ServerSocket(8086);
System.out.println("Wait for client to say some thing ");
Socket socket = serverSocket.accept();
din = new DataInputStream(socket.getInputStream());
OutputStream outputStream = socket.getOutputStream();
dout = new DataOutputStream(outputStream);
br = new BufferedReader(new InputStreamReader(System.in));
String strFromClient = "", strToClient = "";
while (!strFromClient.equals("stop"))
{
strFromClient = din.readUTF();
String decrypted_msg = ac.decryptText(strFromClient, publicKey);
System.out.println("client says: " + decrypted_msg);
strToClient = br.readLine();
String encrypted_msg = ac.encryptText(strToClient, privateKey);
dout.writeUTF(encrypted_msg);
dout.flush();
}
}
catch (Exception exe)
{
exe.printStackTrace();
}
finally
{
try
{
if (br != null)
{
br.close();
}
if (din != null)
{
din.close();
}
if (dout != null)
{
dout.close();
}
if (serverSocket != null)
{
/*
* closes the server socket.
*/
serverSocket.close();
}
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
} | [
"59230706+leminhhoang-102@users.noreply.github.com"
] | 59230706+leminhhoang-102@users.noreply.github.com |
ebd71efbeb336ee6ee722fe95521c4d38271fa58 | 02db1343f5d5cbf365c4b00534dc4b40d6993571 | /04.Semestr/00.Semestrovka(FakeInstagram)/src/main/java/ru/itis/javalab/FakeInstagram/service/implementations/ChatServiceImpl.java | 1b00b30eb4e13c622ea414746df8ac5bc30a13bb | [] | no_license | ttr843/JavaLab | 2d3e80099a8cb7df436184f5f12d2b704a6ae42d | b54eadd2db0869cdffc43ed3e64703f9a55bdd82 | refs/heads/master | 2021-05-17T04:03:15.527146 | 2021-01-16T18:15:30 | 2021-01-16T18:15:30 | 250,612,163 | 0 | 0 | null | 2020-10-25T22:18:19 | 2020-03-27T18:21:13 | Java | UTF-8 | Java | false | false | 1,412 | java | package ru.itis.javalab.FakeInstagram.service.implementations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import ru.itis.javalab.FakeInstagram.dto.MessageDto;
import ru.itis.javalab.FakeInstagram.model.Message;
import ru.itis.javalab.FakeInstagram.repository.interfaces.MessageRepository;
import ru.itis.javalab.FakeInstagram.repository.interfaces.UserRepository;
import ru.itis.javalab.FakeInstagram.service.interfaces.ChatService;
import java.util.*;
@Service
public class ChatServiceImpl implements ChatService {
@Autowired
private MessageRepository messageRepository;
@Autowired
private UserRepository userRepository;
@Override
public List<MessageDto> takeAllMessages() {
return messageRepository.findAllMessages();
}
@Override
public void addMessage(MessageDto messageDto) {
Message message = Message.builder()
.pageId(messageDto.getPageId())
.text(messageDto.getText())
.userId(Integer.parseInt(messageDto.getUserId()))
.build();
messageRepository.save(message);
}
@Override
public void updateStatusOfMessage(long id) {
messageRepository.updateStatusOfMessage(id);
}
@Override
public List<String> getAllPageIds() {
return messageRepository.getAllPageIds();
}
}
| [
"empty-15@mail.ru"
] | empty-15@mail.ru |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.