blob_id
stringlengths
40
40
__id__
int64
225
39,780B
directory_id
stringlengths
40
40
path
stringlengths
6
313
content_id
stringlengths
40
40
detected_licenses
list
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
repo_url
stringlengths
25
151
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
70
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
7.28k
689M
star_events_count
int64
0
131k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
23 values
gha_fork
bool
2 classes
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_updated_at
timestamp[ns]
gha_pushed_at
timestamp[ns]
gha_size
int64
0
40.4M
gha_stargazers_count
int32
0
112k
gha_forks_count
int32
0
39.4k
gha_open_issues_count
int32
0
11k
gha_language
stringlengths
1
21
gha_archived
bool
2 classes
gha_disabled
bool
1 class
content
stringlengths
7
4.37M
src_encoding
stringlengths
3
16
language
stringclasses
1 value
length_bytes
int64
7
4.37M
extension
stringclasses
24 values
filename
stringlengths
4
174
language_id
stringclasses
1 value
entities
list
contaminating_dataset
stringclasses
0 values
malware_signatures
list
redacted_content
stringlengths
7
4.37M
redacted_length_bytes
int64
7
4.37M
alphanum_fraction
float32
0.25
0.94
alpha_fraction
float32
0.25
0.94
num_lines
int32
1
84k
avg_line_length
float32
0.76
99.9
std_line_length
float32
0
220
max_line_length
int32
5
998
is_vendor
bool
2 classes
is_generated
bool
1 class
max_hex_length
int32
0
319
hex_fraction
float32
0
0.38
max_unicode_length
int32
0
408
unicode_fraction
float32
0
0.36
max_base64_length
int32
0
506
base64_fraction
float32
0
0.5
avg_csv_sep_count
float32
0
4
is_autogen_header
bool
1 class
is_empty_html
bool
1 class
shard
stringclasses
16 values
838e4282536f2bb48ff971f9a1453b238bc3e02e
20,186,346,331,711
9ab5bdb918b886f1f2d09d81efb63ff83a86bfb0
/coordinator/src/main/java/com/jdt/fedlearn/coordinator/util/JdChainUtils.java
6f4cbe368e7a01331ce0397a9ae11f06032edcf5
[ "Apache-2.0" ]
permissive
BestJex/fedlearn
https://github.com/BestJex/fedlearn
75a795ec51c4a37af34886c551874df419da3a9c
15395f77ac3ddd983ae3affb1c1a9367287cc125
refs/heads/master
2023-06-17T01:27:36.143000
2021-07-19T10:43:09
2021-07-19T10:43:09
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* Copyright 2020 The FedLearn Authors. 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 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.jdt.fedlearn.coordinator.util; import com.google.common.base.Strings; import com.jd.blockchain.crypto.HashDigest; import com.jd.blockchain.crypto.KeyGenUtils; import com.jd.blockchain.crypto.PrivKey; import com.jd.blockchain.crypto.PubKey; import com.jd.blockchain.crypto.base.DefaultCryptoEncoding; import com.jd.blockchain.crypto.base.HashDigestBytes; import com.jd.blockchain.ledger.*; import com.jd.blockchain.sdk.BlockchainService; import com.jd.blockchain.sdk.EventContext; import com.jd.blockchain.sdk.UserEventListener; import com.jd.blockchain.sdk.UserEventPoint; import com.jd.blockchain.sdk.client.GatewayServiceFactory; import com.jd.blockchain.transaction.ContractEventSendOperationBuilder; import com.jdt.fedlearn.common.constant.JdChainConstant; import com.jdt.fedlearn.common.entity.jdchain.JdChainConfig; import com.jdt.fedlearn.common.util.IpAddress; import com.jdt.fedlearn.common.util.JsonUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import utils.codec.Base58Utils; import java.io.IOException; import java.util.*; /* * JDChain区块链底层协议工具类 * */ public class JdChainUtils { private static final Logger logger = LoggerFactory.getLogger(JdChainUtils.class); private static BlockchainService blockchainService; private static BlockchainKeypair adminKey; private static HashDigest ledgerHash; private static String contractAddress; private static String dataAccountAddress; private static String eventAccountAddress; private static String userTableAddress; private static String taskTableAddress; private static String trainTableAddress; private static String inferenceTableAddress; public static void init(){ try { initGateway(); //初始化网关服务] String ip = IpAddress.getInet4Address(); int port = ConfigUtil.getPortElseDefault(); invokeRegister(ip+":"+port, JdChainConstant.SERVER,getUUID()); //服务端注册 }catch (Exception e){ logger.error(e.getMessage()); } } //初始化网关服务 public static void initGateway(){ JdChainConfig jdChainConfig = ConfigUtil.getJdChainConfig(); String userPubkey = null; String userPrivkey = null; String userPrivpwd = null; String gatewayIp = null; String gatewayPort = null; String gatewaySecure = null; String ledgerAddress = null; try { userPubkey = jdChainConfig.getUserPubkey(); userPrivkey = jdChainConfig.getUserPrivkey(); userPrivpwd = jdChainConfig.getUserPrivpwd(); gatewayIp = jdChainConfig.getGatewayIp(); gatewayPort = jdChainConfig.getGatewayPort(); gatewaySecure = jdChainConfig.getGatewaySecure(); contractAddress = jdChainConfig.getContractAddress(); dataAccountAddress = jdChainConfig.getDataAccountAddress(); eventAccountAddress = jdChainConfig.getEventAccountAddress(); userTableAddress = jdChainConfig.getUserTableAddress(); taskTableAddress = jdChainConfig.getTaskTableAddress(); trainTableAddress = jdChainConfig.getTrainTableAddress(); inferenceTableAddress = jdChainConfig.getInferenceTableAddress(); ledgerAddress = jdChainConfig.getLedgerAddress(); }catch (Exception e){ logger.error("init gateway server error:"+ JsonUtil.object2json(jdChainConfig)); } PubKey pubKey = KeyGenUtils.decodePubKey(userPubkey); PrivKey privKey = KeyGenUtils.decodePrivKey(userPrivkey, userPrivpwd); adminKey= new BlockchainKeypair(pubKey, privKey); GatewayServiceFactory connect = GatewayServiceFactory.connect(gatewayIp, Integer.parseInt(gatewayPort), Boolean.parseBoolean(gatewaySecure), adminKey); blockchainService = connect.getBlockchainService(); connect.close(); if (Strings.isNullOrEmpty(ledgerAddress)){ ledgerHash = blockchainService.getLedgerHashs()[0]; }else{ ledgerHash = new HashDigestBytes(DefaultCryptoEncoding.decodeAlgorithm(Base58Utils.decode(ledgerAddress)),Base58Utils.decode(ledgerAddress)); } logger.info("ledgerhash:"+ ledgerHash); } /* * 服务端注册 * */ private static void invokeRegister(String ip,String type,String aesKey){ ArrayList<String> putValue = new ArrayList<>(); putValue.add(ip); putValue.add(type); putValue.add(aesKey); String fncName = JdChainConstant.INVOKE_REGISTER; String putKey = fncName + JdChainConstant.SEPARATOR + type + JdChainConstant.SEPARATOR + ip; TransactionResponse response = putByChaincodeNoEvents(fncName,putKey,putValue); if (!response.isSuccess()){ logger.info("invoke register server fail!"); return; } logger.info("invoke register server success!"); return; } /* * 随机服务端发起训练 * */ public static TransactionResponse invokeRandomtraining(String userName,String modelToken,String model){ Map<String,Object> metaMap = new HashMap<>(); metaMap.put("userName",userName); metaMap.put("taskId",modelToken); metaMap.put("model",model); metaMap.put("modelArgs",getUUID()); String fname = JdChainConstant.INVOKE_RANDOM_TRAINING; String putKey = fname + JdChainConstant.SEPARATOR + modelToken + JdChainConstant.SEPARATOR + JdChainConstant.SERVER; String eventName = fname; try { TransactionResponse response = putByChaincode(eventName,fname,putKey,metaMap); return response; } catch (IOException e) { logger.error("获取随机server异常:{}",e.getMessage()); } return null; } /** * 服务端发起训练(迭代) */ public static TransactionResponse invokeStarttraining(String tokenId,String phase,String phaseArgs){ Map<String,Object> metaMap = new HashMap<>(); metaMap.put("taskId",tokenId); metaMap.put("phase",phase); metaMap.put("phaseArgs",phaseArgs); String fname = JdChainConstant.INVOKE_START_TRAINING; String putKey = fname + JdChainConstant.SEPARATOR + JdChainConstant.SERVER + JdChainConstant.SEPARATOR + tokenId + JdChainConstant.SEPARATOR + phase; String eventName = fname; try { TransactionResponse response = putByChaincode(eventName,fname,putKey,metaMap); return response; } catch (IOException e) { logger.error("发起训练异常:{}",e.getMessage()); } return null; } /* * 服务端汇总结果 * */ public static TransactionResponse invokeSummarytraining(String taskId,String phase,String result){ ArrayList<String> putValue = new ArrayList<>(); putValue.add(taskId); putValue.add(phase); putValue.add(result); String fname = JdChainConstant.INVOKE_SUMMARY_TRAINING; String putKey = fname + JdChainConstant.SEPARATOR + taskId + JdChainConstant.SEPARATOR + phase + JdChainConstant.SERVER; String eventName = fname; TransactionResponse response = putByChaincode(eventName,fname,putKey,putValue); return response; } /* * 调用合约写入交易(没有事件) * @Param : annotationName: 注解名称 | putKey:设置key值 | putVal:设置value值 * */ public static TransactionResponse putByChaincodeNoEvents(String annotationName,String putKey,ArrayList<String> putVal){ // 新建交易 TransactionTemplate txTemp = blockchainService.newTransaction(ledgerHash); ContractEventSendOperationBuilder builder = txTemp.contract(); // 运行前,填写正确的合约地址,数据账户地址等参数 // 一次交易中可调用多个(多次调用)合约方法 // 调用合约的 registerUser 方法,传入合约地址,合约方法名,合约方法参数列表 builder.send(contractAddress,annotationName, new BytesDataList(new TypedValue[]{ TypedValue.fromText(dataAccountAddress), TypedValue.fromText(ledgerHash.toBase58()), TypedValue.fromText(putKey), TypedValue.fromText(putVal.toString()) }) ); TransactionResponse txResp = commit(txTemp); try { txTemp.close(); } catch (IOException e) { logger.error("TransactionTemplate close error :{}",e.getMessage()); } logger.info("txResp.isSuccess=" + txResp.isSuccess() + ",blockHeight=" + txResp.getBlockHeight()); return txResp; } /* * 调用合约写入交易(有事件) * params : eventName:事件名称 | annotationName:合约方法标注的注解名称(正常方法名称与注解名称一致) | putKey: 写入key值 | putVal: 写入values值 * jdchain注: * 1,调用合约向链上写入交易为key:value键值对形式,且value仅支持java 8种基本数据类型 * */ public static TransactionResponse putByChaincode(String eventName,String annotationName,String putKey,ArrayList<String> putVal){ // 新建交易 TransactionTemplate txTemp = blockchainService.newTransaction(ledgerHash); ContractEventSendOperationBuilder builder = txTemp.contract(); // 运行前,填写正确的合约地址,数据账户地址等参数 // 一次交易中可调用多个(多次调用)合约方法 // 调用合约的 registerUser 方法,传入合约地址,合约方法名,合约方法参数列表 builder.send(contractAddress,annotationName, new BytesDataList(new TypedValue[]{ TypedValue.fromText(dataAccountAddress), TypedValue.fromText(ledgerHash.toBase58()), TypedValue.fromText(eventAccountAddress), TypedValue.fromText(eventName), TypedValue.fromText(putKey), TypedValue.fromText(putVal.toString()) }) ); TransactionResponse txResp = commit(txTemp); try { txTemp.close(); } catch (IOException e) { logger.error("TransactionTemplate close error :{}",e.getMessage()); } logger.info("txResp.isSuccess=" + txResp.isSuccess() + ",blockHeight=" + txResp.getBlockHeight()); return txResp; } public static TransactionResponse putByChaincode(String eventName,String annotationName,String putKey,Map<String,Object> putVal) throws IOException { TransactionTemplate txTemp = blockchainService.newTransaction(ledgerHash); ContractEventSendOperationBuilder builder = txTemp.contract(); byte[] putValue = getMapToString(putVal).getBytes("UTF-8"); //map to string builder.send(contractAddress,annotationName, new BytesDataList(new TypedValue[]{ TypedValue.fromText(dataAccountAddress), TypedValue.fromText(ledgerHash.toBase58()), TypedValue.fromText(eventAccountAddress), TypedValue.fromText(eventName), TypedValue.fromText(putKey), TypedValue.fromBytes(putValue) }) ); TransactionResponse txResp = commit(txTemp); try { txTemp.close(); } catch (IOException e) { logger.error("TransactionTemplate close error :{}",e.getMessage()); } logger.info("txResp.isSuccess=" + txResp.isSuccess() + ",blockHeight=" + txResp.getBlockHeight()); return txResp; } /* * jdchain事件监听(合约已发布监听事件) * */ public static void eventListening(String eventName){ //事件监听 blockchainService.monitorUserEvent(ledgerHash, eventAccountAddress, eventName, 0, new UserEventListener<UserEventPoint>() { @Override public void onEvent(Event eventMessage, EventContext<UserEventPoint> eventContext) { System.out.println("接收:name:" + eventMessage.getName() + ", sequence:" + eventMessage.getSequence() + ",content:" + eventMessage.getContent().getBytes().toUTF8String() + ",blockheigh:" + eventMessage.getBlockHeight() + ",eventAccount:" + eventMessage.getEventAccount()); } }); } /* * 查询链上交易 * @Params : queryKey :查询的key值 * */ public static TypedKVEntry queryByChaincode(String queryKey){ String actionName = queryKey.substring(0,queryKey.indexOf("-")); String dataAccount = getOwnerDataAccount(dataAccountAddress,actionName); if (dataAccount.isEmpty()){ throw new IllegalStateException(String.format("actionName:%s 未注册数据账户!",actionName)); } TypedKVEntry[] kvDataEntries = blockchainService.getDataEntries(ledgerHash, dataAccount, queryKey); if (kvDataEntries == null || kvDataEntries.length == 0) { throw new IllegalStateException(String.format("Ledger %s Service inner Error !!!", ledgerHash.toBase58())); } TypedKVEntry kvDataEntry = kvDataEntries[0]; return kvDataEntry; } private static String getUUID(){ //随机生成一位整数 int random = (int) (Math.random()*9+1); String valueOf = String.valueOf(random); //生成uuid的hashCode值 int hashCode = UUID.randomUUID().toString().hashCode(); //可能为负数 if(hashCode<0){ hashCode = -hashCode; } String value = valueOf + String.format("%015d", hashCode); return value; } /* * 每一个执行动作均对应一个数据账户(目的:为了区分数据) * 如:invoke_register <-> LdeNrYZWydsWexHeiK9U2QWrRK9Fv3TXGTEgr (执行方法名称 <-> 数据账户地址) * */ private static String getOwnerDataAccount(String dataAccountAddr,String actionName){ TypedKVEntry[] dataaccount = blockchainService.getDataEntries(ledgerHash, dataAccountAddr, actionName); if (dataaccount == null || dataaccount.length == 0){ throw new IllegalStateException("getOwnerDataAccount dataaccount unregister"); } return dataaccount[0].getValue().toString(); } private static TransactionResponse commit(TransactionTemplate txTpl) { PreparedTransaction ptx = txTpl.prepare(); ptx.sign(adminKey); TransactionResponse commit = ptx.commit(); try { ptx.close(); } catch (IOException e) { logger.info("PreparedTransaction close error:{}",e.getMessage()); } return commit; } private static String getMapToString(Map<String,Object> map){ Set<String> keySet = map.keySet(); //将set集合转换为数组 String[] keyArray = keySet.toArray(new String[keySet.size()]); //给数组排序(升序) Arrays.sort(keyArray); //因为String拼接效率会很低的,所以转用StringBuilder StringBuilder sb = new StringBuilder(); for (int i = 0; i < keyArray.length; i++) { sb.append(keyArray[i]).append(":").append(String.valueOf(map.get(keyArray[i])).trim()); if(i != keyArray.length-1){ sb.append("#9#"); } } String result = sb.toString().replace("#9##9#","#9#"); return result; } /* * 向指定数据账户写入数据 * @Params: * dataAccountAddr :数据账户地址 * key : 向链上写入的key值 * value : 向链上写入的value值 * */ public static TransactionResponse saveKV(String dataAccountAddr,String key,String value){ String address = getAddressByType(dataAccountAddr); String[] checkParams = new String[]{address,key,value}; if (!verifyParamsIsNull(checkParams)){ return null; } long currentVersion = -1; TypedKVEntry[] kvDataEntries = blockchainService.getDataEntries(ledgerHash, address, key); if (kvDataEntries == null || kvDataEntries.length == 0) { return null; } TypedKVEntry kvDataEntry = kvDataEntries[0]; if (kvDataEntry.getVersion() != -1) { currentVersion = kvDataEntry.getVersion(); } TransactionTemplate txTpl = blockchainService.newTransaction(ledgerHash); txTpl.dataAccount(address).setText(key,value,currentVersion); TransactionResponse txResp = commit(txTpl); logger.info("txResp.isSuccess=" + txResp.isSuccess() + ",blockHeight=" + txResp.getBlockHeight()); try { txTpl.close(); } catch (IOException e) { logger.error("TransactionTemplate close error :{}",e.getMessage()); } return txResp; } /* * 根据key值查询最新数据 * @Params: * dataAccountAddr :数据账户地址 * key : 向链上写入的key值 * */ public static String queryLatestValueByKey(String dataAccountAddr,String key){ String address = getAddressByType(dataAccountAddr); String[] checkParams = new String[]{address,key}; if (!verifyParamsIsNull(checkParams)){ return ""; } TypedKVEntry[] kvDataEntries = blockchainService.getDataEntries(ledgerHash, address, key); if (kvDataEntries == null || kvDataEntries.length == 0) { return ""; } TypedKVEntry kvDataEntry = kvDataEntries[0]; if (kvDataEntry.getVersion() == -1) { return ""; } logger.info("query result:" + kvDataEntry.getValue().toString()); return kvDataEntry.getValue().toString(); } /* * 根据key值查询历史value值 * @Params: * dataAccountAddr :数据账户地址 * key : 向链上写入的key值 * */ public static TypedKVEntry[] queryHistoryValueByKey(String dataAccountAddr,String key){ String[] checkParams = new String[]{dataAccountAddr,key}; if (!verifyParamsIsNull(checkParams)){ return null; } TypedKVEntry[] kvDataEntrie = blockchainService.getDataEntries(ledgerHash,dataAccountAddr,key); if (kvDataEntrie == null || kvDataEntrie.length == 0) { return null; } long latestVersion = kvDataEntrie[0].getVersion(); long[] versionArr = new long[(int) latestVersion + 1]; for (long i = 0 ; i < latestVersion + 1; i ++ ){ versionArr[(int) i] = i; } KVDataVO kvDataVO = new KVDataVO(); kvDataVO.setKey(key); kvDataVO.setVersion(versionArr); KVInfoVO kvInfoVO = new KVInfoVO(); kvInfoVO.setData(new KVDataVO[]{kvDataVO}); TypedKVEntry[] kvDataEntries = blockchainService.getDataEntries(ledgerHash,dataAccountAddr,kvInfoVO); if (kvDataEntries == null || kvDataEntries.length == 0) { return null; } return kvDataEntries; } /* * 根据指定数据账户,查询所有key:value * @Params: * dataAccountAddr :数据账户地址 * */ public static TypedKVEntry[] queryAllKVByDataAccountAddr(String dataAccountAddr){ if (Strings.isNullOrEmpty(dataAccountAddr)) { return null; } String address = getAddressByType(dataAccountAddr); TypedKVEntry[] kvDataEntries = blockchainService.getDataEntries(ledgerHash,address,0,-1); logger.info("query dataaccount kv total:" + kvDataEntries.length); return kvDataEntries; } //校验参数是否为空 public static boolean verifyParamsIsNull(String... params){ if (params.length == 0){ return false; } for (String param : params){ if (param == null || param.length() == 0){ return false; } } return true; } /** * @description: 传入的表名和数据账户映射 * @param dataAccountAddr * @return: java.lang.String * @author: geyan29 * @date: 2021/1/29 6:11 下午 */ private static String getAddressByType(String dataAccountAddr){ String address=""; if(dataAccountAddr.equals(JdChainConstant.TASK_TABLE_ADDRESS)){ address = taskTableAddress; }else if(dataAccountAddr.equals(JdChainConstant.USER_TABLE_ADDRESS)){ address = userTableAddress; }else if(dataAccountAddr.equals(JdChainConstant.TRAIN_TABLE_ADDRESS)){ address = trainTableAddress; }else if(dataAccountAddr.equals(JdChainConstant.INFERENCE_TABLE_ADDRESS)){ address = inferenceTableAddress; } return address; } }
UTF-8
Java
21,704
java
JdChainUtils.java
Java
[ { "context": "g userPrivkey = null;\n String userPrivpwd = null;\n String gatewayIp = null;\n String ", "end": 2844, "score": 0.8850979804992676, "start": 2840, "tag": "PASSWORD", "value": "null" }, { "context": "nConstant.INVOKE_REGISTER;\n String putKey = fncName + JdChainConstant.SEPARATOR + type + JdChainConst", "end": 5184, "score": 0.6313366293907166, "start": 5177, "tag": "KEY", "value": "fncName" }, { "context": "= new HashMap<>();\n metaMap.put(\"userName\",userName);\n metaMap.put(\"taskId\",modelToken);\n ", "end": 5779, "score": 0.9886651039123535, "start": 5771, "tag": "USERNAME", "value": "userName" }, { "context": "ant.INVOKE_START_TRAINING;\n String putKey = fname + JdChainConstant.SEPARATOR + JdChainConstant.SER", "end": 6796, "score": 0.7481715679168701, "start": 6791, "tag": "KEY", "value": "fname" }, { "context": "t.INVOKE_SUMMARY_TRAINING;\n String putKey = fname + JdChainConstant.SEPARATOR + taskId + JdChainCon", "end": 7592, "score": 0.8555544018745422, "start": 7587, "tag": "KEY", "value": "fname" }, { "context": "ddr\n * @return: java.lang.String\n * @author: geyan29\n * @date: 2021/1/29 6:11 下午\n */\n private", "end": 19926, "score": 0.9996377229690552, "start": 19919, "tag": "USERNAME", "value": "geyan29" } ]
null
[]
/* Copyright 2020 The FedLearn Authors. 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 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.jdt.fedlearn.coordinator.util; import com.google.common.base.Strings; import com.jd.blockchain.crypto.HashDigest; import com.jd.blockchain.crypto.KeyGenUtils; import com.jd.blockchain.crypto.PrivKey; import com.jd.blockchain.crypto.PubKey; import com.jd.blockchain.crypto.base.DefaultCryptoEncoding; import com.jd.blockchain.crypto.base.HashDigestBytes; import com.jd.blockchain.ledger.*; import com.jd.blockchain.sdk.BlockchainService; import com.jd.blockchain.sdk.EventContext; import com.jd.blockchain.sdk.UserEventListener; import com.jd.blockchain.sdk.UserEventPoint; import com.jd.blockchain.sdk.client.GatewayServiceFactory; import com.jd.blockchain.transaction.ContractEventSendOperationBuilder; import com.jdt.fedlearn.common.constant.JdChainConstant; import com.jdt.fedlearn.common.entity.jdchain.JdChainConfig; import com.jdt.fedlearn.common.util.IpAddress; import com.jdt.fedlearn.common.util.JsonUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import utils.codec.Base58Utils; import java.io.IOException; import java.util.*; /* * JDChain区块链底层协议工具类 * */ public class JdChainUtils { private static final Logger logger = LoggerFactory.getLogger(JdChainUtils.class); private static BlockchainService blockchainService; private static BlockchainKeypair adminKey; private static HashDigest ledgerHash; private static String contractAddress; private static String dataAccountAddress; private static String eventAccountAddress; private static String userTableAddress; private static String taskTableAddress; private static String trainTableAddress; private static String inferenceTableAddress; public static void init(){ try { initGateway(); //初始化网关服务] String ip = IpAddress.getInet4Address(); int port = ConfigUtil.getPortElseDefault(); invokeRegister(ip+":"+port, JdChainConstant.SERVER,getUUID()); //服务端注册 }catch (Exception e){ logger.error(e.getMessage()); } } //初始化网关服务 public static void initGateway(){ JdChainConfig jdChainConfig = ConfigUtil.getJdChainConfig(); String userPubkey = null; String userPrivkey = null; String userPrivpwd = <PASSWORD>; String gatewayIp = null; String gatewayPort = null; String gatewaySecure = null; String ledgerAddress = null; try { userPubkey = jdChainConfig.getUserPubkey(); userPrivkey = jdChainConfig.getUserPrivkey(); userPrivpwd = jdChainConfig.getUserPrivpwd(); gatewayIp = jdChainConfig.getGatewayIp(); gatewayPort = jdChainConfig.getGatewayPort(); gatewaySecure = jdChainConfig.getGatewaySecure(); contractAddress = jdChainConfig.getContractAddress(); dataAccountAddress = jdChainConfig.getDataAccountAddress(); eventAccountAddress = jdChainConfig.getEventAccountAddress(); userTableAddress = jdChainConfig.getUserTableAddress(); taskTableAddress = jdChainConfig.getTaskTableAddress(); trainTableAddress = jdChainConfig.getTrainTableAddress(); inferenceTableAddress = jdChainConfig.getInferenceTableAddress(); ledgerAddress = jdChainConfig.getLedgerAddress(); }catch (Exception e){ logger.error("init gateway server error:"+ JsonUtil.object2json(jdChainConfig)); } PubKey pubKey = KeyGenUtils.decodePubKey(userPubkey); PrivKey privKey = KeyGenUtils.decodePrivKey(userPrivkey, userPrivpwd); adminKey= new BlockchainKeypair(pubKey, privKey); GatewayServiceFactory connect = GatewayServiceFactory.connect(gatewayIp, Integer.parseInt(gatewayPort), Boolean.parseBoolean(gatewaySecure), adminKey); blockchainService = connect.getBlockchainService(); connect.close(); if (Strings.isNullOrEmpty(ledgerAddress)){ ledgerHash = blockchainService.getLedgerHashs()[0]; }else{ ledgerHash = new HashDigestBytes(DefaultCryptoEncoding.decodeAlgorithm(Base58Utils.decode(ledgerAddress)),Base58Utils.decode(ledgerAddress)); } logger.info("ledgerhash:"+ ledgerHash); } /* * 服务端注册 * */ private static void invokeRegister(String ip,String type,String aesKey){ ArrayList<String> putValue = new ArrayList<>(); putValue.add(ip); putValue.add(type); putValue.add(aesKey); String fncName = JdChainConstant.INVOKE_REGISTER; String putKey = fncName + JdChainConstant.SEPARATOR + type + JdChainConstant.SEPARATOR + ip; TransactionResponse response = putByChaincodeNoEvents(fncName,putKey,putValue); if (!response.isSuccess()){ logger.info("invoke register server fail!"); return; } logger.info("invoke register server success!"); return; } /* * 随机服务端发起训练 * */ public static TransactionResponse invokeRandomtraining(String userName,String modelToken,String model){ Map<String,Object> metaMap = new HashMap<>(); metaMap.put("userName",userName); metaMap.put("taskId",modelToken); metaMap.put("model",model); metaMap.put("modelArgs",getUUID()); String fname = JdChainConstant.INVOKE_RANDOM_TRAINING; String putKey = fname + JdChainConstant.SEPARATOR + modelToken + JdChainConstant.SEPARATOR + JdChainConstant.SERVER; String eventName = fname; try { TransactionResponse response = putByChaincode(eventName,fname,putKey,metaMap); return response; } catch (IOException e) { logger.error("获取随机server异常:{}",e.getMessage()); } return null; } /** * 服务端发起训练(迭代) */ public static TransactionResponse invokeStarttraining(String tokenId,String phase,String phaseArgs){ Map<String,Object> metaMap = new HashMap<>(); metaMap.put("taskId",tokenId); metaMap.put("phase",phase); metaMap.put("phaseArgs",phaseArgs); String fname = JdChainConstant.INVOKE_START_TRAINING; String putKey = fname + JdChainConstant.SEPARATOR + JdChainConstant.SERVER + JdChainConstant.SEPARATOR + tokenId + JdChainConstant.SEPARATOR + phase; String eventName = fname; try { TransactionResponse response = putByChaincode(eventName,fname,putKey,metaMap); return response; } catch (IOException e) { logger.error("发起训练异常:{}",e.getMessage()); } return null; } /* * 服务端汇总结果 * */ public static TransactionResponse invokeSummarytraining(String taskId,String phase,String result){ ArrayList<String> putValue = new ArrayList<>(); putValue.add(taskId); putValue.add(phase); putValue.add(result); String fname = JdChainConstant.INVOKE_SUMMARY_TRAINING; String putKey = fname + JdChainConstant.SEPARATOR + taskId + JdChainConstant.SEPARATOR + phase + JdChainConstant.SERVER; String eventName = fname; TransactionResponse response = putByChaincode(eventName,fname,putKey,putValue); return response; } /* * 调用合约写入交易(没有事件) * @Param : annotationName: 注解名称 | putKey:设置key值 | putVal:设置value值 * */ public static TransactionResponse putByChaincodeNoEvents(String annotationName,String putKey,ArrayList<String> putVal){ // 新建交易 TransactionTemplate txTemp = blockchainService.newTransaction(ledgerHash); ContractEventSendOperationBuilder builder = txTemp.contract(); // 运行前,填写正确的合约地址,数据账户地址等参数 // 一次交易中可调用多个(多次调用)合约方法 // 调用合约的 registerUser 方法,传入合约地址,合约方法名,合约方法参数列表 builder.send(contractAddress,annotationName, new BytesDataList(new TypedValue[]{ TypedValue.fromText(dataAccountAddress), TypedValue.fromText(ledgerHash.toBase58()), TypedValue.fromText(putKey), TypedValue.fromText(putVal.toString()) }) ); TransactionResponse txResp = commit(txTemp); try { txTemp.close(); } catch (IOException e) { logger.error("TransactionTemplate close error :{}",e.getMessage()); } logger.info("txResp.isSuccess=" + txResp.isSuccess() + ",blockHeight=" + txResp.getBlockHeight()); return txResp; } /* * 调用合约写入交易(有事件) * params : eventName:事件名称 | annotationName:合约方法标注的注解名称(正常方法名称与注解名称一致) | putKey: 写入key值 | putVal: 写入values值 * jdchain注: * 1,调用合约向链上写入交易为key:value键值对形式,且value仅支持java 8种基本数据类型 * */ public static TransactionResponse putByChaincode(String eventName,String annotationName,String putKey,ArrayList<String> putVal){ // 新建交易 TransactionTemplate txTemp = blockchainService.newTransaction(ledgerHash); ContractEventSendOperationBuilder builder = txTemp.contract(); // 运行前,填写正确的合约地址,数据账户地址等参数 // 一次交易中可调用多个(多次调用)合约方法 // 调用合约的 registerUser 方法,传入合约地址,合约方法名,合约方法参数列表 builder.send(contractAddress,annotationName, new BytesDataList(new TypedValue[]{ TypedValue.fromText(dataAccountAddress), TypedValue.fromText(ledgerHash.toBase58()), TypedValue.fromText(eventAccountAddress), TypedValue.fromText(eventName), TypedValue.fromText(putKey), TypedValue.fromText(putVal.toString()) }) ); TransactionResponse txResp = commit(txTemp); try { txTemp.close(); } catch (IOException e) { logger.error("TransactionTemplate close error :{}",e.getMessage()); } logger.info("txResp.isSuccess=" + txResp.isSuccess() + ",blockHeight=" + txResp.getBlockHeight()); return txResp; } public static TransactionResponse putByChaincode(String eventName,String annotationName,String putKey,Map<String,Object> putVal) throws IOException { TransactionTemplate txTemp = blockchainService.newTransaction(ledgerHash); ContractEventSendOperationBuilder builder = txTemp.contract(); byte[] putValue = getMapToString(putVal).getBytes("UTF-8"); //map to string builder.send(contractAddress,annotationName, new BytesDataList(new TypedValue[]{ TypedValue.fromText(dataAccountAddress), TypedValue.fromText(ledgerHash.toBase58()), TypedValue.fromText(eventAccountAddress), TypedValue.fromText(eventName), TypedValue.fromText(putKey), TypedValue.fromBytes(putValue) }) ); TransactionResponse txResp = commit(txTemp); try { txTemp.close(); } catch (IOException e) { logger.error("TransactionTemplate close error :{}",e.getMessage()); } logger.info("txResp.isSuccess=" + txResp.isSuccess() + ",blockHeight=" + txResp.getBlockHeight()); return txResp; } /* * jdchain事件监听(合约已发布监听事件) * */ public static void eventListening(String eventName){ //事件监听 blockchainService.monitorUserEvent(ledgerHash, eventAccountAddress, eventName, 0, new UserEventListener<UserEventPoint>() { @Override public void onEvent(Event eventMessage, EventContext<UserEventPoint> eventContext) { System.out.println("接收:name:" + eventMessage.getName() + ", sequence:" + eventMessage.getSequence() + ",content:" + eventMessage.getContent().getBytes().toUTF8String() + ",blockheigh:" + eventMessage.getBlockHeight() + ",eventAccount:" + eventMessage.getEventAccount()); } }); } /* * 查询链上交易 * @Params : queryKey :查询的key值 * */ public static TypedKVEntry queryByChaincode(String queryKey){ String actionName = queryKey.substring(0,queryKey.indexOf("-")); String dataAccount = getOwnerDataAccount(dataAccountAddress,actionName); if (dataAccount.isEmpty()){ throw new IllegalStateException(String.format("actionName:%s 未注册数据账户!",actionName)); } TypedKVEntry[] kvDataEntries = blockchainService.getDataEntries(ledgerHash, dataAccount, queryKey); if (kvDataEntries == null || kvDataEntries.length == 0) { throw new IllegalStateException(String.format("Ledger %s Service inner Error !!!", ledgerHash.toBase58())); } TypedKVEntry kvDataEntry = kvDataEntries[0]; return kvDataEntry; } private static String getUUID(){ //随机生成一位整数 int random = (int) (Math.random()*9+1); String valueOf = String.valueOf(random); //生成uuid的hashCode值 int hashCode = UUID.randomUUID().toString().hashCode(); //可能为负数 if(hashCode<0){ hashCode = -hashCode; } String value = valueOf + String.format("%015d", hashCode); return value; } /* * 每一个执行动作均对应一个数据账户(目的:为了区分数据) * 如:invoke_register <-> LdeNrYZWydsWexHeiK9U2QWrRK9Fv3TXGTEgr (执行方法名称 <-> 数据账户地址) * */ private static String getOwnerDataAccount(String dataAccountAddr,String actionName){ TypedKVEntry[] dataaccount = blockchainService.getDataEntries(ledgerHash, dataAccountAddr, actionName); if (dataaccount == null || dataaccount.length == 0){ throw new IllegalStateException("getOwnerDataAccount dataaccount unregister"); } return dataaccount[0].getValue().toString(); } private static TransactionResponse commit(TransactionTemplate txTpl) { PreparedTransaction ptx = txTpl.prepare(); ptx.sign(adminKey); TransactionResponse commit = ptx.commit(); try { ptx.close(); } catch (IOException e) { logger.info("PreparedTransaction close error:{}",e.getMessage()); } return commit; } private static String getMapToString(Map<String,Object> map){ Set<String> keySet = map.keySet(); //将set集合转换为数组 String[] keyArray = keySet.toArray(new String[keySet.size()]); //给数组排序(升序) Arrays.sort(keyArray); //因为String拼接效率会很低的,所以转用StringBuilder StringBuilder sb = new StringBuilder(); for (int i = 0; i < keyArray.length; i++) { sb.append(keyArray[i]).append(":").append(String.valueOf(map.get(keyArray[i])).trim()); if(i != keyArray.length-1){ sb.append("#9#"); } } String result = sb.toString().replace("#9##9#","#9#"); return result; } /* * 向指定数据账户写入数据 * @Params: * dataAccountAddr :数据账户地址 * key : 向链上写入的key值 * value : 向链上写入的value值 * */ public static TransactionResponse saveKV(String dataAccountAddr,String key,String value){ String address = getAddressByType(dataAccountAddr); String[] checkParams = new String[]{address,key,value}; if (!verifyParamsIsNull(checkParams)){ return null; } long currentVersion = -1; TypedKVEntry[] kvDataEntries = blockchainService.getDataEntries(ledgerHash, address, key); if (kvDataEntries == null || kvDataEntries.length == 0) { return null; } TypedKVEntry kvDataEntry = kvDataEntries[0]; if (kvDataEntry.getVersion() != -1) { currentVersion = kvDataEntry.getVersion(); } TransactionTemplate txTpl = blockchainService.newTransaction(ledgerHash); txTpl.dataAccount(address).setText(key,value,currentVersion); TransactionResponse txResp = commit(txTpl); logger.info("txResp.isSuccess=" + txResp.isSuccess() + ",blockHeight=" + txResp.getBlockHeight()); try { txTpl.close(); } catch (IOException e) { logger.error("TransactionTemplate close error :{}",e.getMessage()); } return txResp; } /* * 根据key值查询最新数据 * @Params: * dataAccountAddr :数据账户地址 * key : 向链上写入的key值 * */ public static String queryLatestValueByKey(String dataAccountAddr,String key){ String address = getAddressByType(dataAccountAddr); String[] checkParams = new String[]{address,key}; if (!verifyParamsIsNull(checkParams)){ return ""; } TypedKVEntry[] kvDataEntries = blockchainService.getDataEntries(ledgerHash, address, key); if (kvDataEntries == null || kvDataEntries.length == 0) { return ""; } TypedKVEntry kvDataEntry = kvDataEntries[0]; if (kvDataEntry.getVersion() == -1) { return ""; } logger.info("query result:" + kvDataEntry.getValue().toString()); return kvDataEntry.getValue().toString(); } /* * 根据key值查询历史value值 * @Params: * dataAccountAddr :数据账户地址 * key : 向链上写入的key值 * */ public static TypedKVEntry[] queryHistoryValueByKey(String dataAccountAddr,String key){ String[] checkParams = new String[]{dataAccountAddr,key}; if (!verifyParamsIsNull(checkParams)){ return null; } TypedKVEntry[] kvDataEntrie = blockchainService.getDataEntries(ledgerHash,dataAccountAddr,key); if (kvDataEntrie == null || kvDataEntrie.length == 0) { return null; } long latestVersion = kvDataEntrie[0].getVersion(); long[] versionArr = new long[(int) latestVersion + 1]; for (long i = 0 ; i < latestVersion + 1; i ++ ){ versionArr[(int) i] = i; } KVDataVO kvDataVO = new KVDataVO(); kvDataVO.setKey(key); kvDataVO.setVersion(versionArr); KVInfoVO kvInfoVO = new KVInfoVO(); kvInfoVO.setData(new KVDataVO[]{kvDataVO}); TypedKVEntry[] kvDataEntries = blockchainService.getDataEntries(ledgerHash,dataAccountAddr,kvInfoVO); if (kvDataEntries == null || kvDataEntries.length == 0) { return null; } return kvDataEntries; } /* * 根据指定数据账户,查询所有key:value * @Params: * dataAccountAddr :数据账户地址 * */ public static TypedKVEntry[] queryAllKVByDataAccountAddr(String dataAccountAddr){ if (Strings.isNullOrEmpty(dataAccountAddr)) { return null; } String address = getAddressByType(dataAccountAddr); TypedKVEntry[] kvDataEntries = blockchainService.getDataEntries(ledgerHash,address,0,-1); logger.info("query dataaccount kv total:" + kvDataEntries.length); return kvDataEntries; } //校验参数是否为空 public static boolean verifyParamsIsNull(String... params){ if (params.length == 0){ return false; } for (String param : params){ if (param == null || param.length() == 0){ return false; } } return true; } /** * @description: 传入的表名和数据账户映射 * @param dataAccountAddr * @return: java.lang.String * @author: geyan29 * @date: 2021/1/29 6:11 下午 */ private static String getAddressByType(String dataAccountAddr){ String address=""; if(dataAccountAddr.equals(JdChainConstant.TASK_TABLE_ADDRESS)){ address = taskTableAddress; }else if(dataAccountAddr.equals(JdChainConstant.USER_TABLE_ADDRESS)){ address = userTableAddress; }else if(dataAccountAddr.equals(JdChainConstant.TRAIN_TABLE_ADDRESS)){ address = trainTableAddress; }else if(dataAccountAddr.equals(JdChainConstant.INFERENCE_TABLE_ADDRESS)){ address = inferenceTableAddress; } return address; } }
21,710
0.644363
0.640379
499
40.242485
30.795845
157
false
false
0
0
0
0
0
0
0.743487
false
false
12
7ed4c6d6b93e451f51f960c4258ed8fb8c7292ba
20,186,346,331,626
117c45236ccd7275977a53ff0cabb9f29fdc3498
/Charging/app/src/main/java/com/cartoo/charging/bean/Goods.java
73e7d4733d0e744091f170951a8110b38aa7a1d8
[]
no_license
ChenQHe/CarTooShopAd
https://github.com/ChenQHe/CarTooShopAd
253f103638191ef6801c3c6acac4886c7df15a96
ab0e75d779924464eb42a9929f8ebba9911e8160
refs/heads/master
2016-09-10T15:44:23.221000
2016-06-23T03:15:27
2016-06-23T03:15:27
56,651,356
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cartoo.charging.bean; /** * Created by Android Studio. * User:chenh * Date:2016/6/20 * Time:20:52 */ public class Goods { public String cover; public String title; public float nowPrice; public float prePrice; public int surplusNum; }
UTF-8
Java
273
java
Goods.java
Java
[ { "context": ".bean;\n\n/**\n * Created by Android Studio.\n * User:chenh\n * Date:2016/6/20\n * Time:20:52\n */\npublic class ", "end": 82, "score": 0.9995913505554199, "start": 77, "tag": "USERNAME", "value": "chenh" } ]
null
[]
package com.cartoo.charging.bean; /** * Created by Android Studio. * User:chenh * Date:2016/6/20 * Time:20:52 */ public class Goods { public String cover; public String title; public float nowPrice; public float prePrice; public int surplusNum; }
273
0.677656
0.637363
15
17.200001
10.703271
33
false
false
0
0
0
0
0
0
0.4
false
false
12
dcb70f2d080723d0482b7d71e94e52a1d9160074
14,757,507,661,233
e047b81ec2fd30d3d9c4ea76b40cb97596530a9c
/src/com/huanying/framework/user/UserController.java
9880b4ddd240c60a726179850af104b4b0afe624
[]
no_license
NANAmine/demo
https://github.com/NANAmine/demo
c590099b214bb8f405063e33f54cff4d9690d465
cf1d595855df91eed2cbca8caa9de7731a90d629
refs/heads/master
2020-04-01T19:52:56.990000
2018-10-18T06:59:07
2018-10-18T06:59:07
153,576,230
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.huanying.framework.user; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import com.huanying.framework.BaseController; import com.huanying.framework.PageBean; @Controller public class UserController extends BaseController { @Autowired private UserService userService; Logger logger = Logger.getLogger(UserController.class); @RequestMapping("/show_add_user.do") public String index(String name,String page_num,Model model) throws Exception { model.addAttribute("name", ""); if(page_num ==null){ page_num = "1"; } PageBean pageBean = userService.searchUsers(name, 3, Integer.valueOf(page_num)); model.addAttribute("users", pageBean.getList()); model.addAttribute("page",pageBean); model.addAttribute("name", name); return "user/add_user"; } }
UTF-8
Java
992
java
UserController.java
Java
[]
null
[]
package com.huanying.framework.user; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import com.huanying.framework.BaseController; import com.huanying.framework.PageBean; @Controller public class UserController extends BaseController { @Autowired private UserService userService; Logger logger = Logger.getLogger(UserController.class); @RequestMapping("/show_add_user.do") public String index(String name,String page_num,Model model) throws Exception { model.addAttribute("name", ""); if(page_num ==null){ page_num = "1"; } PageBean pageBean = userService.searchUsers(name, 3, Integer.valueOf(page_num)); model.addAttribute("users", pageBean.getList()); model.addAttribute("page",pageBean); model.addAttribute("name", name); return "user/add_user"; } }
992
0.768145
0.765121
36
26.555555
24.254948
82
false
false
0
0
0
0
0
0
1.583333
false
false
12
6706ecf414d91cec9f5e433989aa2a441fe00b10
22,196,391,020,585
ba5d97927a107f84a46135a193e48c0c238c5743
/src/main/java/org/wsd/agents/ConversationIdGenerator.java
ceba520e3ba179bbf8b2d1db11e8e81309d00962
[]
no_license
mstelmas/DeDoors
https://github.com/mstelmas/DeDoors
f101c89cdc4f14a6cade8e8c7054e9c62f0af518
fb5b5331ba68c55e53617ef1ae08bc7c749edcc3
refs/heads/master
2021-09-04T17:55:53.955000
2018-01-20T20:53:33
2018-01-20T20:53:33
113,734,872
0
1
null
false
2017-12-16T19:42:47
2017-12-10T08:34:23
2017-12-10T14:32:08
2017-12-16T19:42:47
186
0
0
0
Java
false
null
package org.wsd.agents; import org.apache.commons.lang3.RandomStringUtils; import java.sql.Timestamp; public class ConversationIdGenerator { public String generate() { return RandomStringUtils.randomAlphanumeric(16).concat(new Timestamp(System.currentTimeMillis()).toString()); } }
UTF-8
Java
302
java
ConversationIdGenerator.java
Java
[]
null
[]
package org.wsd.agents; import org.apache.commons.lang3.RandomStringUtils; import java.sql.Timestamp; public class ConversationIdGenerator { public String generate() { return RandomStringUtils.randomAlphanumeric(16).concat(new Timestamp(System.currentTimeMillis()).toString()); } }
302
0.764901
0.754967
12
24.166666
32.603256
117
false
false
0
0
0
0
0
0
0.333333
false
false
12
1c9adde8e3b29cb8ad92af9b57f87c4432b5e201
21,964,462,794,561
212eed18a2fb8aa9088cd80b3aec91772a7593bc
/trace/user-app-service/src/main/java/com/example/userappservice/entity/User.java
ccc8f82bf24c972e3afa271dff3782813da7913a
[]
no_license
lcc214321/foodie
https://github.com/lcc214321/foodie
9eddcdf57f7a765da8ce8ee3990dccef063bb6fc
132c0e4869209e8bb8578d874e8f06cfebf89535
refs/heads/master
2023-08-15T01:47:19.825000
2021-09-28T06:32:25
2021-09-28T06:32:25
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * 版权所有: 爱WiFi无线运营中心 * 创建日期: 2021/7/27 * 创建作者: 冯雪超 * 文件名称: User.java * 版本: v1.0 * 功能: * 修改记录: */ package com.example.userappservice.entity; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; /** * @author fengxuechao * @date 2021/7/27 */ @Data @AllArgsConstructor @NoArgsConstructor public class User { private Integer id; private String username; private String password; }
UTF-8
Java
511
java
User.java
Java
[ { "context": "\n * 版权所有: 爱WiFi无线运营中心\n * 创建日期: 2021/7/27\n * 创建作者: 冯雪超\n * 文件名称: User.java\n * 版本: v1.0\n * 功能:\n * 修改记录:\n *", "end": 55, "score": 0.9996763467788696, "start": 52, "tag": "NAME", "value": "冯雪超" }, { "context": ";\nimport lombok.NoArgsConstructor;\n\n/**\n * @author fengxuechao\n * @date 2021/7/27\n */\n@Data\n@AllArgsConstructor\n", "end": 265, "score": 0.9990053772926331, "start": 254, "tag": "USERNAME", "value": "fengxuechao" } ]
null
[]
/* * 版权所有: 爱WiFi无线运营中心 * 创建日期: 2021/7/27 * 创建作者: 冯雪超 * 文件名称: User.java * 版本: v1.0 * 功能: * 修改记录: */ package com.example.userappservice.entity; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; /** * @author fengxuechao * @date 2021/7/27 */ @Data @AllArgsConstructor @NoArgsConstructor public class User { private Integer id; private String username; private String password; }
511
0.698413
0.662132
30
13.7
11.587781
42
false
false
0
0
0
0
0
0
0.233333
false
false
12
b40d92485d012958fb75ee5000b84b16bf010ca9
8,615,704,437,006
80dab2663405c7a1e8c56331385dcaa60fa13e2c
/src/edson/web/shop/cart/CartItem.java
62e650d099914e9e1de008d0ffbc50b2c2b6eda2
[]
no_license
GreenFingerLow/SSH_Shop
https://github.com/GreenFingerLow/SSH_Shop
4edc46cb84b35a2ac5275f2f7b94a8b823fdc3c8
a5bb4d6e0e23065bd17f80ddb806654b492c1569
refs/heads/master
2020-04-16T14:00:33.605000
2017-10-23T13:25:18
2017-10-23T13:25:18
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edson.web.shop.cart; import edson.web.shop.product.Product; /** * 购物项实体 * @author edson * */ public class CartItem { private Product product; private int count;//商品数量 private double sum;//小计 public Product getProduct() { return product; } public void setProduct(Product product) { this.product = product; } public int getCount() { return count; } public void setCount(int count) { this.count = count; } public double getSum() { return count*product.getShop_price(); } }
UTF-8
Java
540
java
CartItem.java
Java
[ { "context": "web.shop.product.Product;\n\n/**\n * 购物项实体\n * @author edson\n *\n */\npublic class CartItem {\n\n\tprivate Product ", "end": 99, "score": 0.9961315989494324, "start": 94, "tag": "USERNAME", "value": "edson" } ]
null
[]
package edson.web.shop.cart; import edson.web.shop.product.Product; /** * 购物项实体 * @author edson * */ public class CartItem { private Product product; private int count;//商品数量 private double sum;//小计 public Product getProduct() { return product; } public void setProduct(Product product) { this.product = product; } public int getCount() { return count; } public void setCount(int count) { this.count = count; } public double getSum() { return count*product.getShop_price(); } }
540
0.679537
0.679537
35
13.8
13.530495
42
false
false
0
0
0
0
0
0
1.085714
false
false
12
13fe66bfdbf0c5d1e584048e9c43e4efc5a60649
31,593,779,486,346
514dcb5a5ae48ca8adb840c93028f03eff6605cd
/src/main/java/org/metricity/metric/service/impl/RelatedMetricChannel.java
90ecb8bae26617f1298d3b6ee66c372bb4b8b876
[ "Apache-2.0" ]
permissive
Updownquark/Metricity
https://github.com/Updownquark/Metricity
e3e960520f49d49bbe68095f8d58bfe1c18c142b
e303c0dc6b83d9f6c5eff963770b1d21911cb223
refs/heads/master
2020-08-05T02:39:51.600000
2019-10-03T22:13:05
2019-10-03T22:13:05
212,364,561
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.metricity.metric.service.impl; import java.util.Arrays; import java.util.Collections; import java.util.Objects; import java.util.Set; import java.util.function.Consumer; import org.metricity.anchor.Anchor; import org.metricity.metric.RelatedMetric; import org.metricity.metric.service.MetricChannel; import org.metricity.metric.service.MetricChannelService; import org.metricity.metric.service.MetricQueryOptions; import org.metricity.metric.service.MetricQueryResult; import org.metricity.metric.service.MetricQueryService; import org.metricity.metric.service.MetricTag; import org.metricity.metric.util.MetricTimelineWrapper; import org.metricity.metric.util.SingleValuedChannel; import org.metricity.metric.util.SmartMetricChannel; import org.metricity.metric.util.derived.ChannelTemplate; import org.metricity.metric.util.derived.DynamicDependencyResult; public class RelatedMetricChannel<T> implements SmartMetricChannel<T> { private final Anchor theAnchor; private final MetricChannel<? extends Anchor> theRelationChannel; /** This channel is only ever non-null if the relation channel is discovered to be immutable and timeless */ private MetricChannel<? extends T> theRelativeChannel; private final RelatedMetric<T> theRelatedMetric; private final int hashCode; private RelatedMetricChannel(Anchor anchor, MetricChannel<? extends Anchor> relationChannel, RelatedMetric<T> relatedMetric) { theAnchor = anchor; theRelationChannel = relationChannel; theRelatedMetric = relatedMetric; hashCode = Objects.hash(theRelationChannel, theRelatedMetric); } @Override public Anchor getAnchor() { return theAnchor; } @Override public RelatedMetric<T> getMetric() { return theRelatedMetric; } public MetricChannel<? extends Anchor> getRelationChannel() { return theRelationChannel; } /** * If this channel's {@link #getRelationChannel() relation channel} is both {@link MetricQueryService#IMMUTABLE immutable} and * {@link MetricQueryService#TIMELESS timeless}, the channel for the actual relation values can be discovered and cached. * * @param depends The channels service to get the channel from * @return The relative channels for the relation value, or null if this is not static */ public MetricChannel<? extends T> getStaticRelativeChannelIfPossible(MetricChannelService depends) { if (theRelativeChannel == null) { if (depends.isConstant(theRelationChannel)) { MetricQueryResult<? extends Anchor> anchorRes = depends.query(theRelationChannel, null); anchorRes.waitFor(1000); Anchor anchor = anchorRes.getValue(MetricQueryOptions.get()); MetricChannel<? extends T> relativeChannel; if (anchor == null) { relativeChannel = null; } else { relativeChannel = depends.getChannel(anchor, theRelatedMetric.getRelativeMetric(), null); theRelativeChannel = relativeChannel; } } } return theRelativeChannel; } @Override public double getCost(MetricChannelService depends) { double anchorCost = depends.getCost(theRelationChannel); // Resolution doesn't matter MetricQueryResult<? extends Anchor> anchorRes = depends.query(theRelationChannel, null); Anchor anchor = anchorRes.getValue(MetricQueryOptions.get()); if (anchor == null) { return anchorCost; } MetricChannel<T> channel = depends.getChannel(anchor, theRelatedMetric.getRelativeMetric(), null); if (channel == null) { return anchorCost; } return anchorCost + depends.getCost(channel); } @Override public Set<MetricTag> getTags(MetricChannelService depends) { Anchor anchor; if (theRelationChannel instanceof SingleValuedChannel) { anchor = ((SingleValuedChannel<? extends Anchor>) theRelationChannel).getCurrentValue(); } else { // Resolution doesn't matter MetricQueryResult<? extends Anchor> anchorRes = depends.query(theRelationChannel, null); anchor = anchorRes.getValue(MetricQueryOptions.get()); } if (anchor == null) { return Collections.emptySet(); } MetricChannel<T> channel = depends.getChannel(anchor, theRelatedMetric, null); if (channel == null) { return Collections.emptySet(); } return depends.getTags(channel); } @Override public boolean isConstant(MetricChannelService depends) { MetricChannel<? extends T> relChannel = getStaticRelativeChannelIfPossible(depends); if (relChannel == null) { // If the relation cannot be resolved statically, we can't know anything about whether we'll be timeless or mutable return false; } // Don't need to query the relation properties because the static relative channel is only available for timeless|immutable return depends.isConstant(relChannel); } @Override public MetricQueryResult<T> query(MetricChannelService depends, Consumer<Object> updateReceiver) { if (getStaticRelativeChannelIfPossible(depends) != null) { return MetricTimelineWrapper.wrap(this, (MetricQueryResult<T>) depends.query(getStaticRelativeChannelIfPossible(depends), updateReceiver), v -> v); } if (updateReceiver == null) { return new RelatedMetricTimeline<>(this, // depends.<Anchor> query((MetricChannel<Anchor>) theRelationChannel, null), // depends, null); } class RelatedUpdater implements Consumer<Object> { RelatedMetricTimeline<T> timeline; @Override public void accept(Object update) { if (timeline != null) { timeline.updateRelation(update); } } } RelatedUpdater updater = new RelatedUpdater(); MetricQueryResult<Anchor> relationRes = depends.<Anchor> query((MetricChannel<Anchor>) theRelationChannel, updater); updater.timeline = new RelatedMetricTimeline<>(this, relationRes, depends, updateReceiver); return updater.timeline; } @Override public int hashCode() { return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof RelatedMetricChannel)) { return false; } RelatedMetricChannel<?> other = (RelatedMetricChannel<?>) obj; return theRelationChannel.equals(other.theRelationChannel) && theRelatedMetric.equals(other.theRelatedMetric); } @Override public String toString() { return theAnchor + "." + theRelatedMetric; } public static <T> RelatedMetricChannel<T> createRelatedChannel(Anchor anchor, MetricChannel<? extends Anchor> relationChannel, RelatedMetric<T> relatedMetric) { return new RelatedMetricChannel<>(anchor, relationChannel, relatedMetric); } private static class RelatedMetricTimeline<T> extends DynamicDependencyResult<Anchor, T, T> { RelatedMetricTimeline(RelatedMetricChannel<T> channel, MetricQueryResult<Anchor> relationResults, MetricChannelService depends, Consumer<Object> updates) { super(a -> Arrays.asList(a == null ? null : new ChannelTemplate<>(a, channel.getMetric().getRelativeMetric(), true)), // ds -> ds.get(0), channel, relationResults, depends, updates); } @Override protected void updateRelation(Object update) { super.updateRelation(update); } } }
UTF-8
Java
7,181
java
RelatedMetricChannel.java
Java
[]
null
[]
package org.metricity.metric.service.impl; import java.util.Arrays; import java.util.Collections; import java.util.Objects; import java.util.Set; import java.util.function.Consumer; import org.metricity.anchor.Anchor; import org.metricity.metric.RelatedMetric; import org.metricity.metric.service.MetricChannel; import org.metricity.metric.service.MetricChannelService; import org.metricity.metric.service.MetricQueryOptions; import org.metricity.metric.service.MetricQueryResult; import org.metricity.metric.service.MetricQueryService; import org.metricity.metric.service.MetricTag; import org.metricity.metric.util.MetricTimelineWrapper; import org.metricity.metric.util.SingleValuedChannel; import org.metricity.metric.util.SmartMetricChannel; import org.metricity.metric.util.derived.ChannelTemplate; import org.metricity.metric.util.derived.DynamicDependencyResult; public class RelatedMetricChannel<T> implements SmartMetricChannel<T> { private final Anchor theAnchor; private final MetricChannel<? extends Anchor> theRelationChannel; /** This channel is only ever non-null if the relation channel is discovered to be immutable and timeless */ private MetricChannel<? extends T> theRelativeChannel; private final RelatedMetric<T> theRelatedMetric; private final int hashCode; private RelatedMetricChannel(Anchor anchor, MetricChannel<? extends Anchor> relationChannel, RelatedMetric<T> relatedMetric) { theAnchor = anchor; theRelationChannel = relationChannel; theRelatedMetric = relatedMetric; hashCode = Objects.hash(theRelationChannel, theRelatedMetric); } @Override public Anchor getAnchor() { return theAnchor; } @Override public RelatedMetric<T> getMetric() { return theRelatedMetric; } public MetricChannel<? extends Anchor> getRelationChannel() { return theRelationChannel; } /** * If this channel's {@link #getRelationChannel() relation channel} is both {@link MetricQueryService#IMMUTABLE immutable} and * {@link MetricQueryService#TIMELESS timeless}, the channel for the actual relation values can be discovered and cached. * * @param depends The channels service to get the channel from * @return The relative channels for the relation value, or null if this is not static */ public MetricChannel<? extends T> getStaticRelativeChannelIfPossible(MetricChannelService depends) { if (theRelativeChannel == null) { if (depends.isConstant(theRelationChannel)) { MetricQueryResult<? extends Anchor> anchorRes = depends.query(theRelationChannel, null); anchorRes.waitFor(1000); Anchor anchor = anchorRes.getValue(MetricQueryOptions.get()); MetricChannel<? extends T> relativeChannel; if (anchor == null) { relativeChannel = null; } else { relativeChannel = depends.getChannel(anchor, theRelatedMetric.getRelativeMetric(), null); theRelativeChannel = relativeChannel; } } } return theRelativeChannel; } @Override public double getCost(MetricChannelService depends) { double anchorCost = depends.getCost(theRelationChannel); // Resolution doesn't matter MetricQueryResult<? extends Anchor> anchorRes = depends.query(theRelationChannel, null); Anchor anchor = anchorRes.getValue(MetricQueryOptions.get()); if (anchor == null) { return anchorCost; } MetricChannel<T> channel = depends.getChannel(anchor, theRelatedMetric.getRelativeMetric(), null); if (channel == null) { return anchorCost; } return anchorCost + depends.getCost(channel); } @Override public Set<MetricTag> getTags(MetricChannelService depends) { Anchor anchor; if (theRelationChannel instanceof SingleValuedChannel) { anchor = ((SingleValuedChannel<? extends Anchor>) theRelationChannel).getCurrentValue(); } else { // Resolution doesn't matter MetricQueryResult<? extends Anchor> anchorRes = depends.query(theRelationChannel, null); anchor = anchorRes.getValue(MetricQueryOptions.get()); } if (anchor == null) { return Collections.emptySet(); } MetricChannel<T> channel = depends.getChannel(anchor, theRelatedMetric, null); if (channel == null) { return Collections.emptySet(); } return depends.getTags(channel); } @Override public boolean isConstant(MetricChannelService depends) { MetricChannel<? extends T> relChannel = getStaticRelativeChannelIfPossible(depends); if (relChannel == null) { // If the relation cannot be resolved statically, we can't know anything about whether we'll be timeless or mutable return false; } // Don't need to query the relation properties because the static relative channel is only available for timeless|immutable return depends.isConstant(relChannel); } @Override public MetricQueryResult<T> query(MetricChannelService depends, Consumer<Object> updateReceiver) { if (getStaticRelativeChannelIfPossible(depends) != null) { return MetricTimelineWrapper.wrap(this, (MetricQueryResult<T>) depends.query(getStaticRelativeChannelIfPossible(depends), updateReceiver), v -> v); } if (updateReceiver == null) { return new RelatedMetricTimeline<>(this, // depends.<Anchor> query((MetricChannel<Anchor>) theRelationChannel, null), // depends, null); } class RelatedUpdater implements Consumer<Object> { RelatedMetricTimeline<T> timeline; @Override public void accept(Object update) { if (timeline != null) { timeline.updateRelation(update); } } } RelatedUpdater updater = new RelatedUpdater(); MetricQueryResult<Anchor> relationRes = depends.<Anchor> query((MetricChannel<Anchor>) theRelationChannel, updater); updater.timeline = new RelatedMetricTimeline<>(this, relationRes, depends, updateReceiver); return updater.timeline; } @Override public int hashCode() { return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof RelatedMetricChannel)) { return false; } RelatedMetricChannel<?> other = (RelatedMetricChannel<?>) obj; return theRelationChannel.equals(other.theRelationChannel) && theRelatedMetric.equals(other.theRelatedMetric); } @Override public String toString() { return theAnchor + "." + theRelatedMetric; } public static <T> RelatedMetricChannel<T> createRelatedChannel(Anchor anchor, MetricChannel<? extends Anchor> relationChannel, RelatedMetric<T> relatedMetric) { return new RelatedMetricChannel<>(anchor, relationChannel, relatedMetric); } private static class RelatedMetricTimeline<T> extends DynamicDependencyResult<Anchor, T, T> { RelatedMetricTimeline(RelatedMetricChannel<T> channel, MetricQueryResult<Anchor> relationResults, MetricChannelService depends, Consumer<Object> updates) { super(a -> Arrays.asList(a == null ? null : new ChannelTemplate<>(a, channel.getMetric().getRelativeMetric(), true)), // ds -> ds.get(0), channel, relationResults, depends, updates); } @Override protected void updateRelation(Object update) { super.updateRelation(update); } } }
7,181
0.743351
0.742654
190
35.794735
34.606281
129
false
false
0
0
0
0
0
0
2.247368
false
false
12
00b31c9a3d4157db41dc31e0dc3d5844090159d9
4,707,284,203,817
3d337b3d0c9945b29d7e2410705a675ffb8d8004
/Helium/src/si/matjazcerkvenik/helium/tools/TableBuilder.java
67bf6e31a070cef17731247d05641affea6364de
[]
no_license
matjaz99/Helium
https://github.com/matjaz99/Helium
ba63735ebb4aa0512ef206b35e418fcb71f7bcad
fd3fb44fdbd7f7863c1ea6bf76806e6f0a9b9b12
refs/heads/master
2020-05-16T13:21:32.856000
2013-12-10T19:49:15
2013-12-10T19:49:15
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package si.matjazcerkvenik.helium.tools; import si.matjazcerkvenik.helium.HtmlElement; import si.matjazcerkvenik.helium.html.StringElement; /** * Fixed size TableBuilder. * * @author Matjaz Cerkvenik * */ public class TableBuilder { private HtmlElement[][] table = null; public TableBuilder() { } public TableBuilder(int x, int y) { table = new StringElement[x][y]; } public void addTableElement(int x, int y, HtmlElement e) { table[x][y] = e; } public HtmlElement[][] getTable() { return table; } public void setTable(HtmlElement[][] table) { this.table = table; } @Override public String toString() { if (table.length == 0 && table[0].length == 0) { return ""; } StringBuilder sb = new StringBuilder(); sb.append("<table>"); int rows = table.length; int cols = table[0].length; // for each row for (int row = 0; row < rows; row++) { sb.append("<tr>"); // for each column in the row for (int col = 0; col < cols; col++) { // if (col > 0) // System.out.print(", "); // System.out.print(tb.getTable()[row][col]); sb.append("<td>"); sb.append(table[row][col]); sb.append("</td>"); } sb.append("</tr>"); } sb.append("</table>\n"); return sb.toString(); } public static void main(String[] args) { TableBuilder tb = new TableBuilder(2, 3); tb.addTableElement(0, 0, new StringElement("A")); tb.addTableElement(0, 1, new StringElement("B")); tb.addTableElement(0, 2, new StringElement("C")); tb.addTableElement(1, 0, new StringElement("D")); tb.addTableElement(1, 1, new StringElement("E")); tb.addTableElement(1, 2, new StringElement("F")); int rows = tb.getTable().length; int cols = tb.getTable()[0].length; for (int row = 0; row < rows; row++) { for (int col = 0; col < cols; col++) { if (col > 0) System.out.print(", "); System.out.print(tb.getTable()[row][col]); } System.out.println(); } System.out.println(tb.toString()); } }
UTF-8
Java
1,982
java
TableBuilder.java
Java
[ { "context": "t;\n\n/**\n * Fixed size TableBuilder.\n * \n * @author Matjaz Cerkvenik\n *\n */\npublic class TableBuilder {\n\n\tprivate Html", "end": 205, "score": 0.9998821020126343, "start": 189, "tag": "NAME", "value": "Matjaz Cerkvenik" } ]
null
[]
package si.matjazcerkvenik.helium.tools; import si.matjazcerkvenik.helium.HtmlElement; import si.matjazcerkvenik.helium.html.StringElement; /** * Fixed size TableBuilder. * * @author <NAME> * */ public class TableBuilder { private HtmlElement[][] table = null; public TableBuilder() { } public TableBuilder(int x, int y) { table = new StringElement[x][y]; } public void addTableElement(int x, int y, HtmlElement e) { table[x][y] = e; } public HtmlElement[][] getTable() { return table; } public void setTable(HtmlElement[][] table) { this.table = table; } @Override public String toString() { if (table.length == 0 && table[0].length == 0) { return ""; } StringBuilder sb = new StringBuilder(); sb.append("<table>"); int rows = table.length; int cols = table[0].length; // for each row for (int row = 0; row < rows; row++) { sb.append("<tr>"); // for each column in the row for (int col = 0; col < cols; col++) { // if (col > 0) // System.out.print(", "); // System.out.print(tb.getTable()[row][col]); sb.append("<td>"); sb.append(table[row][col]); sb.append("</td>"); } sb.append("</tr>"); } sb.append("</table>\n"); return sb.toString(); } public static void main(String[] args) { TableBuilder tb = new TableBuilder(2, 3); tb.addTableElement(0, 0, new StringElement("A")); tb.addTableElement(0, 1, new StringElement("B")); tb.addTableElement(0, 2, new StringElement("C")); tb.addTableElement(1, 0, new StringElement("D")); tb.addTableElement(1, 1, new StringElement("E")); tb.addTableElement(1, 2, new StringElement("F")); int rows = tb.getTable().length; int cols = tb.getTable()[0].length; for (int row = 0; row < rows; row++) { for (int col = 0; col < cols; col++) { if (col > 0) System.out.print(", "); System.out.print(tb.getTable()[row][col]); } System.out.println(); } System.out.println(tb.toString()); } }
1,972
0.618063
0.605449
89
21.269663
18.404789
59
false
false
0
0
0
0
0
0
2.202247
false
false
12
20771317530aef34ac0eb410c2d5597f20924e2c
17,008,070,558,817
dc695faa549865250b95ab64ad37f60a033d9533
/hackerrank/java/introduction/JavaIntToString.java
91334cf188de783b225bcd097d2be4871dc51238
[ "MIT" ]
permissive
viatsko/hack
https://github.com/viatsko/hack
c1035ed4894770cb6ce4b3096a527e19ab4f516a
e720f1c618561bf03f17ebb065eee5ebcc81aef0
refs/heads/master
2018-10-13T11:32:25.584000
2018-10-06T07:22:52
2018-10-06T07:22:52
106,967,228
67
27
MIT
false
2019-10-07T13:27:37
2017-10-14T22:26:07
2019-09-26T05:31:51
2019-10-07T13:21:03
46,670
61
24
0
Java
false
false
import java.security.Permission; import java.util.Scanner; public class JavaIntToString { static class DoNotTerminate { static class ExitTrappedException extends SecurityException { private static final long serialVersionUID = 1; } static void forbidExit() { final SecurityManager securityManager = new SecurityManager() { @Override public void checkPermission(Permission permission) { if (permission.getName().contains("exitVM")) { throw new ExitTrappedException(); } } }; System.setSecurityManager(securityManager); } } public static void main(String[] args) { DoNotTerminate.forbidExit(); try { Scanner in = new Scanner(System.in); int n = in.nextInt(); in.close(); String s = String.valueOf(n); if (n == Integer.parseInt(s)) { System.out.println("Good job"); } else { System.out.println("Wrong answer."); } } catch (DoNotTerminate.ExitTrappedException e) { System.out.println("Unsuccessful Termination!!"); } } }
UTF-8
Java
1,295
java
JavaIntToString.java
Java
[]
null
[]
import java.security.Permission; import java.util.Scanner; public class JavaIntToString { static class DoNotTerminate { static class ExitTrappedException extends SecurityException { private static final long serialVersionUID = 1; } static void forbidExit() { final SecurityManager securityManager = new SecurityManager() { @Override public void checkPermission(Permission permission) { if (permission.getName().contains("exitVM")) { throw new ExitTrappedException(); } } }; System.setSecurityManager(securityManager); } } public static void main(String[] args) { DoNotTerminate.forbidExit(); try { Scanner in = new Scanner(System.in); int n = in.nextInt(); in.close(); String s = String.valueOf(n); if (n == Integer.parseInt(s)) { System.out.println("Good job"); } else { System.out.println("Wrong answer."); } } catch (DoNotTerminate.ExitTrappedException e) { System.out.println("Unsuccessful Termination!!"); } } }
1,295
0.538224
0.537452
46
27.152174
23.383352
75
false
false
0
0
0
0
0
0
0.304348
false
false
12
0f42b06c51ab7e327fed437dff752bc1e148d45f
17,428,977,339,070
b5b155569e112e24e3db52cec3bf6fde0a59888c
/src/main/java/br/com/waterclock/api/initialize/InitialDataLoader.java
c8ac8df158099f985364e3a5e1a0a07780b8e2d7
[]
no_license
FiapWaterClock/WaterClockAPI
https://github.com/FiapWaterClock/WaterClockAPI
605acb44ef7598aaeb3d9b9ee01fdd40573557c4
99a6733fd58b1fe1dc9e87a2aaed2f30824a5b3a
refs/heads/master
2022-10-01T03:02:56.935000
2019-10-16T16:14:34
2019-10-16T16:14:34
206,146,887
1
0
null
false
2022-09-08T01:03:13
2019-09-03T18:35:42
2019-10-16T16:14:37
2022-09-08T01:03:11
219
1
0
2
Java
false
false
package br.com.waterclock.api.initialize; import br.com.waterclock.api.entity.Privilege; import br.com.waterclock.api.entity.Role; import br.com.waterclock.api.entity.User; import br.com.waterclock.api.repository.PrivilegeRepository; import br.com.waterclock.api.repository.RoleRepository; import br.com.waterclock.api.repository.UserRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; import java.util.Collection; import java.util.List; @Component public class InitialDataLoader implements ApplicationListener<ContextRefreshedEvent> { private boolean alreadySetup = false; @Autowired private UserRepository userRepository; @Autowired private RoleRepository roleRepository; @Autowired private PrivilegeRepository privilegeRepository; @Value("${waterclock.admin.username}") private String adminUsername; @Value("${waterclock.admin.password}") private String adminPassword; PasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); @Override @Transactional public void onApplicationEvent(ContextRefreshedEvent event) { if (alreadySetup) return; Privilege readPrivilege = createPrivilegeIfNotFound("READ_PRIVILEGE"); Privilege writePrivilege = createPrivilegeIfNotFound("WRITE_PRIVILEGE"); List<Privilege> adminPrivileges = Arrays.asList(readPrivilege, writePrivilege); createRoleIfNotFound("ROLE_ADMIN", adminPrivileges); createRoleIfNotFound("ROLE_USER", Arrays.asList(readPrivilege)); createAdminUserIfNotFound(); alreadySetup = true; } @Transactional void createAdminUserIfNotFound() { User user = userRepository.findByEmail(adminUsername); if (user == null) { Role adminRole = roleRepository.findByName("ROLE_ADMIN"); user = new User(); user.setFirstName("Admin"); user.setLastName("Admin"); user.setPassword(passwordEncoder.encode(adminPassword)); user.setEmail(adminUsername); user.setRoles(Arrays.asList(adminRole)); user.setEnabled(true); userRepository.save(user); } } @Transactional Privilege createPrivilegeIfNotFound(String name) { Privilege privilege = privilegeRepository.findByName(name); if (privilege == null) { privilege = new Privilege(name); privilegeRepository.save(privilege); } return privilege; } @Transactional Role createRoleIfNotFound( String name, Collection<Privilege> privileges) { Role role = roleRepository.findByName(name); if (role == null) { role = new Role(name); role.setPrivileges(privileges); roleRepository.save(role); } return role; } }
UTF-8
Java
3,319
java
InitialDataLoader.java
Java
[ { "context": "\"${waterclock.admin.username}\")\n private String adminUsername;\n\n @Value(\"${waterclock.admin.password", "end": 1328, "score": 0.5682100057601929, "start": 1323, "tag": "USERNAME", "value": "admin" }, { "context": " {\n User user = userRepository.findByEmail(adminUsername);\n if (user == null) {\n Role ad", "end": 2191, "score": 0.9626941680908203, "start": 2178, "tag": "USERNAME", "value": "adminUsername" }, { "context": "user = new User();\n user.setFirstName(\"Admin\");\n user.setLastName(\"Admin\");\n ", "end": 2359, "score": 0.9599236845970154, "start": 2354, "tag": "NAME", "value": "Admin" }, { "context": "FirstName(\"Admin\");\n user.setLastName(\"Admin\");\n user.setPassword(passwordEncoder.e", "end": 2398, "score": 0.9591883420944214, "start": 2393, "tag": "NAME", "value": "Admin" }, { "context": " user.setPassword(passwordEncoder.encode(adminPassword));\n user.setEmail(adminUsernam", "end": 2459, "score": 0.5104261636734009, "start": 2454, "tag": "PASSWORD", "value": "admin" }, { "context": "encode(adminPassword));\n user.setEmail(adminUsername);\n user.setRoles(Arrays.asList(adminRo", "end": 2510, "score": 0.7785860896110535, "start": 2497, "tag": "USERNAME", "value": "adminUsername" } ]
null
[]
package br.com.waterclock.api.initialize; import br.com.waterclock.api.entity.Privilege; import br.com.waterclock.api.entity.Role; import br.com.waterclock.api.entity.User; import br.com.waterclock.api.repository.PrivilegeRepository; import br.com.waterclock.api.repository.RoleRepository; import br.com.waterclock.api.repository.UserRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; import java.util.Collection; import java.util.List; @Component public class InitialDataLoader implements ApplicationListener<ContextRefreshedEvent> { private boolean alreadySetup = false; @Autowired private UserRepository userRepository; @Autowired private RoleRepository roleRepository; @Autowired private PrivilegeRepository privilegeRepository; @Value("${waterclock.admin.username}") private String adminUsername; @Value("${waterclock.admin.password}") private String adminPassword; PasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); @Override @Transactional public void onApplicationEvent(ContextRefreshedEvent event) { if (alreadySetup) return; Privilege readPrivilege = createPrivilegeIfNotFound("READ_PRIVILEGE"); Privilege writePrivilege = createPrivilegeIfNotFound("WRITE_PRIVILEGE"); List<Privilege> adminPrivileges = Arrays.asList(readPrivilege, writePrivilege); createRoleIfNotFound("ROLE_ADMIN", adminPrivileges); createRoleIfNotFound("ROLE_USER", Arrays.asList(readPrivilege)); createAdminUserIfNotFound(); alreadySetup = true; } @Transactional void createAdminUserIfNotFound() { User user = userRepository.findByEmail(adminUsername); if (user == null) { Role adminRole = roleRepository.findByName("ROLE_ADMIN"); user = new User(); user.setFirstName("Admin"); user.setLastName("Admin"); user.setPassword(passwordEncoder.encode(<PASSWORD>Password)); user.setEmail(adminUsername); user.setRoles(Arrays.asList(adminRole)); user.setEnabled(true); userRepository.save(user); } } @Transactional Privilege createPrivilegeIfNotFound(String name) { Privilege privilege = privilegeRepository.findByName(name); if (privilege == null) { privilege = new Privilege(name); privilegeRepository.save(privilege); } return privilege; } @Transactional Role createRoleIfNotFound( String name, Collection<Privilege> privileges) { Role role = roleRepository.findByName(name); if (role == null) { role = new Role(name); role.setPrivileges(privileges); roleRepository.save(role); } return role; } }
3,324
0.714372
0.714372
97
33.226803
23.89604
87
false
false
0
0
0
0
0
0
0.57732
false
false
12
1dd96f499694c6782e4c61b3436c4af5389bc220
4,389,456,642,667
63ccd398103c0f5ac114cde7fff646d5f4557a75
/src/date/DateRangeVO.java
2fe64369a719e6e95f9e9c38c79d8320f7178f52
[]
no_license
shibicr93/Practise
https://github.com/shibicr93/Practise
8dd1b68582391b6a0ef4e3ef7f959b5077033972
87bfcb958a6fc7e15b747f48378a5123515e5235
refs/heads/master
2021-01-23T00:10:02.555000
2017-03-31T05:00:54
2017-03-31T05:00:54
85,703,993
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package date; import java.util.Date; /** * Created by sramachandran on 3/29/17 **/ public class DateRangeVO { private Date startDt; private Date endDt; private String startTimeId; private String endTimeId; public DateRangeVO() { } public DateRangeVO(Date startDt, Date endDt) { this.startDt = startDt; this.endDt = endDt; } public Date getStartDt() { return startDt; } public void setStartDt(final Date startDt) { this.startDt = startDt; } public Date getEndDt() { return endDt; } public void setEndDt(final Date endDt) { this.endDt = endDt; } public String getStartTimeId() { return startTimeId; } public void setStartTimeId(final String startTimeId) { this.startTimeId = startTimeId; } public String getEndTimeId() { return endTimeId; } public void setEndTimeId(final String endTimeId) { this.endTimeId = endTimeId; } }
UTF-8
Java
1,012
java
DateRangeVO.java
Java
[ { "context": "e date;\n\nimport java.util.Date;\n\n/**\n * Created by sramachandran on 3/29/17\n **/\npublic class DateRangeVO {\n pr", "end": 70, "score": 0.9995789527893066, "start": 57, "tag": "USERNAME", "value": "sramachandran" } ]
null
[]
package date; import java.util.Date; /** * Created by sramachandran on 3/29/17 **/ public class DateRangeVO { private Date startDt; private Date endDt; private String startTimeId; private String endTimeId; public DateRangeVO() { } public DateRangeVO(Date startDt, Date endDt) { this.startDt = startDt; this.endDt = endDt; } public Date getStartDt() { return startDt; } public void setStartDt(final Date startDt) { this.startDt = startDt; } public Date getEndDt() { return endDt; } public void setEndDt(final Date endDt) { this.endDt = endDt; } public String getStartTimeId() { return startTimeId; } public void setStartTimeId(final String startTimeId) { this.startTimeId = startTimeId; } public String getEndTimeId() { return endTimeId; } public void setEndTimeId(final String endTimeId) { this.endTimeId = endTimeId; } }
1,012
0.618577
0.613636
53
18.094339
16.786409
58
false
false
0
0
0
0
0
0
0.320755
false
false
12
6b2fbe313d09070ab598cd6fc468dccb71ef0b9d
4,002,909,583,117
0d641811411e64c647e63af6f1ebe08682941c59
/plugins/entando-plugin-jpimagemap/src/main/java/com/agiletec/plugins/jpimagemap/apsadmin/content/attribute/action/imagemap/ImageMapAttributeAction.java
c97df8e0f649122cfc90cf15a88043a5869d65e4
[]
no_license
gcasari/entando-components
https://github.com/gcasari/entando-components
35bf89aa58a137cac8dce9b47d2438c5328f1a2c
21b52588d2855e2ac599c7efab092b95cc6c11d3
refs/heads/master
2020-12-27T01:57:28.748000
2015-01-16T16:35:14
2015-01-16T16:35:14
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2013-Present Entando Corporation (http://www.entando.com) All rights reserved. * * 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.agiletec.plugins.jpimagemap.apsadmin.content.attribute.action.imagemap; import com.agiletec.aps.system.ApsSystemUtils; import com.agiletec.plugins.jacms.apsadmin.content.AbstractContentAction; import com.agiletec.plugins.jpimagemap.aps.system.services.content.model.attribute.ImageMapAttribute; import com.agiletec.plugins.jpimagemap.aps.system.services.content.model.attribute.util.LinkedArea; import org.slf4j.Logger; public class ImageMapAttributeAction extends AbstractContentAction implements IImageMapAttributeAction { @Override public String removeImage() { this.getContentActionHelper().updateEntity(this.getContent(), this.getRequest()); Logger log = ApsSystemUtils.getLogger(); try { ImageMapAttribute currentAttribute = this.getAttribute(); currentAttribute.getImage().getResources().clear(); currentAttribute.getImage().getTextMap().clear(); currentAttribute.getAreas().clear(); log.trace("Removed Image element from ImageMap " + currentAttribute.getName()); } catch (Throwable t) { ApsSystemUtils.logThrowable(t, this, "removeImage"); return FAILURE; } return SUCCESS; } @Override public String addArea() { this.getContentActionHelper().updateEntity(this.getContent(), this.getRequest()); Logger log = ApsSystemUtils.getLogger(); try { ImageMapAttribute currentAttribute = this.getAttribute(); currentAttribute.addArea(); log.trace("Added LinkedArea element to ImageMap " + currentAttribute.getName()); } catch (Throwable t) { ApsSystemUtils.logThrowable(t, this, "addArea"); return FAILURE; } return SUCCESS; } @Override public String removeArea() { this.getContentActionHelper().updateEntity(this.getContent(), this.getRequest()); Logger log = ApsSystemUtils.getLogger(); try { int elementIndex = this.getElementIndex(); ImageMapAttribute currentAttribute = this.getAttribute(); if (elementIndex>=0 && elementIndex<currentAttribute.getAreas().size()) { currentAttribute.removeArea(elementIndex); log.trace("Removed LinkedArea element from ImageMap " + currentAttribute.getName()); } } catch (Throwable t) { ApsSystemUtils.logThrowable(t, this, "removeArea"); return FAILURE; } return SUCCESS; } @Override public String defineArea() { this.getContentActionHelper().updateEntity(this.getContent(), this.getRequest()); return SUCCESS; } @Override public String saveArea() { Logger log = ApsSystemUtils.getLogger(); try { ImageMapAttribute currentAttribute = this.getAttribute(); LinkedArea area = currentAttribute.getArea(this.getElementIndex()); area.setCoords(this.concatCoords()); log.trace("SAVED Area " + this.getElementIndex() + " for ImageMap " + currentAttribute.getName()); } catch (Throwable t) { ApsSystemUtils.logThrowable(t, this, "saveArea"); return FAILURE; } return SUCCESS; } protected String concatCoords() { // FIXME Campi String (invece di int) per problema in jsp int left = (int) Float.parseFloat(this.getLeft()); int top = (int) Float.parseFloat(this.getTop()); int right = left + (int) Float.parseFloat(this.getWidth()); int down = top + (int) Float.parseFloat(this.getHeight()); String coords = left + "," + top + "," + right + "," + down; return coords; } public ImageMapAttribute getAttribute() { if (this._attribute==null) { this._attribute = (ImageMapAttribute) this.getContent().getAttribute(this.getAttributeName()); } return _attribute; } public String getAttributeName() { return _attributeName; } public void setAttributeName(String attributeName) { this._attributeName = attributeName; } public int getElementIndex() { return _elementIndex; } public void setElementIndex(int elementIndex) { this._elementIndex = elementIndex; } public String getLangCode() { return _langCode; } public void setLangCode(String resourceLangCode) { this._langCode = resourceLangCode; } public String getLeft() { return _left; } public void setLeft(String left) { this._left = left; } public String getTop() { return _top; } public void setTop(String top) { this._top = top; } public String getWidth() { return _width; } public void setWidth(String width) { this._width = width; } public String getHeight() { return _height; } public void setHeight(String height) { this._height = height; } private ImageMapAttribute _attribute; private String _attributeName; private int _elementIndex; private String _langCode; private String _left; private String _top; private String _width; private String _height; }
UTF-8
Java
5,773
java
ImageMapAttributeAction.java
Java
[]
null
[]
/* * Copyright 2013-Present Entando Corporation (http://www.entando.com) All rights reserved. * * 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.agiletec.plugins.jpimagemap.apsadmin.content.attribute.action.imagemap; import com.agiletec.aps.system.ApsSystemUtils; import com.agiletec.plugins.jacms.apsadmin.content.AbstractContentAction; import com.agiletec.plugins.jpimagemap.aps.system.services.content.model.attribute.ImageMapAttribute; import com.agiletec.plugins.jpimagemap.aps.system.services.content.model.attribute.util.LinkedArea; import org.slf4j.Logger; public class ImageMapAttributeAction extends AbstractContentAction implements IImageMapAttributeAction { @Override public String removeImage() { this.getContentActionHelper().updateEntity(this.getContent(), this.getRequest()); Logger log = ApsSystemUtils.getLogger(); try { ImageMapAttribute currentAttribute = this.getAttribute(); currentAttribute.getImage().getResources().clear(); currentAttribute.getImage().getTextMap().clear(); currentAttribute.getAreas().clear(); log.trace("Removed Image element from ImageMap " + currentAttribute.getName()); } catch (Throwable t) { ApsSystemUtils.logThrowable(t, this, "removeImage"); return FAILURE; } return SUCCESS; } @Override public String addArea() { this.getContentActionHelper().updateEntity(this.getContent(), this.getRequest()); Logger log = ApsSystemUtils.getLogger(); try { ImageMapAttribute currentAttribute = this.getAttribute(); currentAttribute.addArea(); log.trace("Added LinkedArea element to ImageMap " + currentAttribute.getName()); } catch (Throwable t) { ApsSystemUtils.logThrowable(t, this, "addArea"); return FAILURE; } return SUCCESS; } @Override public String removeArea() { this.getContentActionHelper().updateEntity(this.getContent(), this.getRequest()); Logger log = ApsSystemUtils.getLogger(); try { int elementIndex = this.getElementIndex(); ImageMapAttribute currentAttribute = this.getAttribute(); if (elementIndex>=0 && elementIndex<currentAttribute.getAreas().size()) { currentAttribute.removeArea(elementIndex); log.trace("Removed LinkedArea element from ImageMap " + currentAttribute.getName()); } } catch (Throwable t) { ApsSystemUtils.logThrowable(t, this, "removeArea"); return FAILURE; } return SUCCESS; } @Override public String defineArea() { this.getContentActionHelper().updateEntity(this.getContent(), this.getRequest()); return SUCCESS; } @Override public String saveArea() { Logger log = ApsSystemUtils.getLogger(); try { ImageMapAttribute currentAttribute = this.getAttribute(); LinkedArea area = currentAttribute.getArea(this.getElementIndex()); area.setCoords(this.concatCoords()); log.trace("SAVED Area " + this.getElementIndex() + " for ImageMap " + currentAttribute.getName()); } catch (Throwable t) { ApsSystemUtils.logThrowable(t, this, "saveArea"); return FAILURE; } return SUCCESS; } protected String concatCoords() { // FIXME Campi String (invece di int) per problema in jsp int left = (int) Float.parseFloat(this.getLeft()); int top = (int) Float.parseFloat(this.getTop()); int right = left + (int) Float.parseFloat(this.getWidth()); int down = top + (int) Float.parseFloat(this.getHeight()); String coords = left + "," + top + "," + right + "," + down; return coords; } public ImageMapAttribute getAttribute() { if (this._attribute==null) { this._attribute = (ImageMapAttribute) this.getContent().getAttribute(this.getAttributeName()); } return _attribute; } public String getAttributeName() { return _attributeName; } public void setAttributeName(String attributeName) { this._attributeName = attributeName; } public int getElementIndex() { return _elementIndex; } public void setElementIndex(int elementIndex) { this._elementIndex = elementIndex; } public String getLangCode() { return _langCode; } public void setLangCode(String resourceLangCode) { this._langCode = resourceLangCode; } public String getLeft() { return _left; } public void setLeft(String left) { this._left = left; } public String getTop() { return _top; } public void setTop(String top) { this._top = top; } public String getWidth() { return _width; } public void setWidth(String width) { this._width = width; } public String getHeight() { return _height; } public void setHeight(String height) { this._height = height; } private ImageMapAttribute _attribute; private String _attributeName; private int _elementIndex; private String _langCode; private String _left; private String _top; private String _width; private String _height; }
5,773
0.737918
0.736879
181
30.900553
28.948822
104
false
false
0
0
0
0
0
0
1.911602
false
false
12
8f1b15576216950ea52d654c3d6110e5582cc3ea
17,858,474,085,577
69bd72771f5f7ecd675c0b38c542fcb5af7dc287
/src/VisionMain.java
6f16e24914207dd19cee0a9091d2f857792fa5df
[ "MIT" ]
permissive
lakeheck/sandbox
https://github.com/lakeheck/sandbox
85ede9867535da842b6d48b224859720dbc0c4d3
175f902f662b2a99d76a1d2b1f56b0f06b203d6b
refs/heads/main
2023-04-11T20:36:44.534000
2021-04-03T23:53:31
2021-04-03T23:53:31
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import processing.core.PApplet; import processing.core.PGraphics; import processing.core.PImage; import sketch.Sketch; import sketch.vision.MisinterpretSketch; import util.geometry.Rectangle; public class VisionMain extends PApplet { // Sketch settings private int desiredSize = 1000; private int windowWidth; private int windowHeight; private Sketch sketch; private PGraphics canvas; public void settings() { size(10, 10); smooth(4); } public void setup() { // Create sketch sketch = new MisinterpretSketch(this); // Set screen Rectangle bounds = sketch.getBounds(); // Calculate dimensions double imageDivider = bounds.getWidth() / desiredSize; windowWidth = desiredSize; windowHeight = (int) (bounds.getHeight() / imageDivider); surface.setSize(windowWidth, windowHeight); // Create canvas canvas = createGraphics((int)bounds.getWidth(), (int)bounds.getHeight()); sketch.draw(canvas); } PImage toDraw = null; public void draw() { if(toDraw == null) { toDraw = canvas.copy(); toDraw.resize(windowWidth, windowHeight); } image(toDraw, 0, 0); } public static void main(String[] args) { PApplet.main("VisionMain"); } private void reset() { sketch.draw(canvas); toDraw = null; } public void mousePressed() { //reset(); String name = "output/vision/" + System.currentTimeMillis() + ".png"; canvas.save(name); System.out.println("saved " + name); } public void keyPressed() { switch(key) { case 'r': { reset(); } break; case 's': { String name = "output/vision/" + System.currentTimeMillis() + ".png"; canvas.save(name); System.out.println("saved " + name); } break; } } }
UTF-8
Java
2,032
java
VisionMain.java
Java
[]
null
[]
import processing.core.PApplet; import processing.core.PGraphics; import processing.core.PImage; import sketch.Sketch; import sketch.vision.MisinterpretSketch; import util.geometry.Rectangle; public class VisionMain extends PApplet { // Sketch settings private int desiredSize = 1000; private int windowWidth; private int windowHeight; private Sketch sketch; private PGraphics canvas; public void settings() { size(10, 10); smooth(4); } public void setup() { // Create sketch sketch = new MisinterpretSketch(this); // Set screen Rectangle bounds = sketch.getBounds(); // Calculate dimensions double imageDivider = bounds.getWidth() / desiredSize; windowWidth = desiredSize; windowHeight = (int) (bounds.getHeight() / imageDivider); surface.setSize(windowWidth, windowHeight); // Create canvas canvas = createGraphics((int)bounds.getWidth(), (int)bounds.getHeight()); sketch.draw(canvas); } PImage toDraw = null; public void draw() { if(toDraw == null) { toDraw = canvas.copy(); toDraw.resize(windowWidth, windowHeight); } image(toDraw, 0, 0); } public static void main(String[] args) { PApplet.main("VisionMain"); } private void reset() { sketch.draw(canvas); toDraw = null; } public void mousePressed() { //reset(); String name = "output/vision/" + System.currentTimeMillis() + ".png"; canvas.save(name); System.out.println("saved " + name); } public void keyPressed() { switch(key) { case 'r': { reset(); } break; case 's': { String name = "output/vision/" + System.currentTimeMillis() + ".png"; canvas.save(name); System.out.println("saved " + name); } break; } } }
2,032
0.566437
0.561024
85
22.905882
19.756533
85
false
false
0
0
0
0
0
0
0.517647
false
false
12
d7c4b8ef454a8afcbf3cdda4f7164537e4bf4b08
12,721,693,144,283
041e1122b51d9e6557a30264fe7ae0dfbffa0879
/samples/server/petstore/helidon/se-default/src/main/java/org/openapitools/server/api/PetService.java
06762d4d4a45719bb5302b469ce7403cfc361b67
[ "Apache-2.0" ]
permissive
shibayan/openapi-generator
https://github.com/shibayan/openapi-generator
59ca5dea4313a72f7a8d68e78420332b14ea619f
8b26d81163fa4cd069425c23957f16a8286ec732
refs/heads/master
2023-08-03T12:25:23.705000
2023-06-20T09:11:33
2023-06-20T09:11:33
234,938,986
2
0
Apache-2.0
true
2021-08-11T15:23:32
2020-01-19T17:38:17
2021-06-24T06:11:13
2021-08-11T15:23:31
125,598
2
0
6
Java
false
false
package org.openapitools.server.api; import java.util.ArrayList; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import io.helidon.common.http.DataChunk; import java.io.File; import io.helidon.webserver.Handler; import java.util.HashMap; import java.io.IOException; import java.io.InputStream; import java.util.List; import java.util.Map; import org.openapitools.server.model.ModelApiResponse; import com.fasterxml.jackson.databind.ObjectMapper; import org.openapitools.server.model.Pet; import io.helidon.media.multipart.ReadableBodyPart; import java.util.Set; import java.io.UncheckedIOException; import java.util.Optional; import java.util.logging.Logger; import io.helidon.common.GenericType; import io.helidon.common.reactive.Single; import io.helidon.config.Config; import io.helidon.webserver.Routing; import io.helidon.webserver.ServerRequest; import io.helidon.webserver.ServerResponse; import io.helidon.webserver.Service; public abstract class PetService implements Service { protected static final Logger LOGGER = Logger.getLogger(PetService.class.getName()); private static final ObjectMapper MAPPER = JsonProvider.objectMapper(); protected final Config config; public PetService(Config config) { this.config = config; } /** * A service registers itself by updating the routing rules. * @param rules the routing rules. */ @Override public void update(Routing.Rules rules) { rules.post("/pet", Handler.create(Pet.class, this::addPet)); rules.delete("/pet/{petId}", this::deletePet); rules.get("/pet/findByStatus", this::findPetsByStatus); rules.get("/pet/findByTags", this::findPetsByTags); rules.get("/pet/{petId}", this::getPetById); rules.put("/pet", Handler.create(Pet.class, this::updatePet)); rules.post("/pet/{petId}", this::updatePetWithForm); rules.post("/pet/{petId}/uploadImage", this::uploadFile); rules.post("/fake/{petId}/uploadImageWithRequiredFile", this::uploadFileWithRequiredFile); } private void processNonFileFormField(String name, Map<String, List<String>> nonFileFormContent, ReadableBodyPart part) { List<String> content = nonFileFormContent.computeIfAbsent(name, key -> new ArrayList<>()); part.content().as(String.class).thenAccept(content::add); } private void processFileFormField(String name, Map<String, List<InputStream>> fileFormContent, ReadableBodyPart part) { List<InputStream> content = fileFormContent.computeIfAbsent(name, key -> new ArrayList<>()); part.content().map(DataChunk::bytes) .collect(ByteArrayOutputStream::new, (stream, bytes) -> { try { stream.write(bytes); } catch (IOException e) { throw new UncheckedIOException(e); } }) .thenAccept(byteStream -> content.add(new ByteArrayInputStream(byteStream.toByteArray()))); } /** * POST /pet : Add a new pet to the store. * @param request the server request * @param response the server response * @param pet Pet object that needs to be added to the store */ void addPet(ServerRequest request, ServerResponse response, Pet pet) { Single.create(Single.empty()) .thenAccept(val -> { ValidatorUtils.checkNonNull(pet); handleAddPet(request, response, pet); }) .exceptionally(throwable -> handleError(request, response, throwable)); } /** * Handle POST /pet : Add a new pet to the store. * @param request the server request * @param response the server response * @param pet Pet object that needs to be added to the store */ abstract void handleAddPet(ServerRequest request, ServerResponse response, Pet pet); /** * DELETE /pet/{petId} : Deletes a pet. * @param request the server request * @param response the server response */ void deletePet(ServerRequest request, ServerResponse response) { Single.create(Single.empty()) .thenAccept(val -> { Long petId = Optional.ofNullable(request.path().param("petId")).map(Long::valueOf).orElse(null); ValidatorUtils.checkNonNull(petId); String apiKey = request.headers().value("api_key").orElse(null); handleDeletePet(request, response, petId, apiKey); }) .exceptionally(throwable -> handleError(request, response, throwable)); } /** * Handle DELETE /pet/{petId} : Deletes a pet. * @param request the server request * @param response the server response * @param petId Pet id to delete * @param apiKey apiKey */ abstract void handleDeletePet(ServerRequest request, ServerResponse response, Long petId, String apiKey); /** * GET /pet/findByStatus : Finds Pets by status. * @param request the server request * @param response the server response */ void findPetsByStatus(ServerRequest request, ServerResponse response) { Single.create(Single.empty()) .thenAccept(val -> { List<String> status = Optional.ofNullable(request.queryParams().toMap().get("status")).orElse(null); ValidatorUtils.checkNonNull(status); handleFindPetsByStatus(request, response, status); }) .exceptionally(throwable -> handleError(request, response, throwable)); } /** * Handle GET /pet/findByStatus : Finds Pets by status. * @param request the server request * @param response the server response * @param status Status values that need to be considered for filter */ abstract void handleFindPetsByStatus(ServerRequest request, ServerResponse response, List<String> status); /** * GET /pet/findByTags : Finds Pets by tags. * @param request the server request * @param response the server response */ void findPetsByTags(ServerRequest request, ServerResponse response) { Single.create(Single.empty()) .thenAccept(val -> { List<String> tags = Optional.ofNullable(request.queryParams().toMap().get("tags")).orElse(null); ValidatorUtils.checkNonNull(tags); handleFindPetsByTags(request, response, tags); }) .exceptionally(throwable -> handleError(request, response, throwable)); } /** * Handle GET /pet/findByTags : Finds Pets by tags. * @param request the server request * @param response the server response * @param tags Tags to filter by */ abstract void handleFindPetsByTags(ServerRequest request, ServerResponse response, List<String> tags); /** * GET /pet/{petId} : Find pet by ID. * @param request the server request * @param response the server response */ void getPetById(ServerRequest request, ServerResponse response) { Single.create(Single.empty()) .thenAccept(val -> { Long petId = Optional.ofNullable(request.path().param("petId")).map(Long::valueOf).orElse(null); ValidatorUtils.checkNonNull(petId); handleGetPetById(request, response, petId); }) .exceptionally(throwable -> handleError(request, response, throwable)); } /** * Handle GET /pet/{petId} : Find pet by ID. * @param request the server request * @param response the server response * @param petId ID of pet to return */ abstract void handleGetPetById(ServerRequest request, ServerResponse response, Long petId); /** * PUT /pet : Update an existing pet. * @param request the server request * @param response the server response * @param pet Pet object that needs to be added to the store */ void updatePet(ServerRequest request, ServerResponse response, Pet pet) { Single.create(Single.empty()) .thenAccept(val -> { ValidatorUtils.checkNonNull(pet); handleUpdatePet(request, response, pet); }) .exceptionally(throwable -> handleError(request, response, throwable)); } /** * Handle PUT /pet : Update an existing pet. * @param request the server request * @param response the server response * @param pet Pet object that needs to be added to the store */ abstract void handleUpdatePet(ServerRequest request, ServerResponse response, Pet pet); /** * POST /pet/{petId} : Updates a pet in the store with form data. * @param request the server request * @param response the server response */ void updatePetWithForm(ServerRequest request, ServerResponse response) { Map<String, List<String>> nonFileFormContent = new HashMap<>(); Map<String, List<InputStream>> fileFormContent = new HashMap<>(); Single<Void> formSingle = request.content().asStream(ReadableBodyPart.class) .forEach(part -> { String name = part.name(); if ("name".equals(name)) { processNonFileFormField(name, nonFileFormContent, part); } if ("status".equals(name)) { processNonFileFormField(name, nonFileFormContent, part); } part.drain(); }); Single.create(formSingle) .thenAccept(val -> { Long petId = Optional.ofNullable(request.path().param("petId")).map(Long::valueOf).orElse(null); ValidatorUtils.checkNonNull(petId); String name = Optional.ofNullable(nonFileFormContent.get("name")).flatMap(list->list.stream().findFirst()).orElse(null); String status = Optional.ofNullable(nonFileFormContent.get("status")).flatMap(list->list.stream().findFirst()).orElse(null); handleUpdatePetWithForm(request, response, petId, name, status); }) .exceptionally(throwable -> handleError(request, response, throwable)); } /** * Handle POST /pet/{petId} : Updates a pet in the store with form data. * @param request the server request * @param response the server response * @param petId ID of pet that needs to be updated * @param name Updated name of the pet * @param status Updated status of the pet */ abstract void handleUpdatePetWithForm(ServerRequest request, ServerResponse response, Long petId, String name, String status); /** * POST /pet/{petId}/uploadImage : uploads an image. * @param request the server request * @param response the server response */ void uploadFile(ServerRequest request, ServerResponse response) { Map<String, List<String>> nonFileFormContent = new HashMap<>(); Map<String, List<InputStream>> fileFormContent = new HashMap<>(); Single<Void> formSingle = request.content().asStream(ReadableBodyPart.class) .forEach(part -> { String name = part.name(); if ("additionalMetadata".equals(name)) { processNonFileFormField(name, nonFileFormContent, part); } if ("file".equals(name)) { processFileFormField(name, fileFormContent, part); } part.drain(); }); Single.create(formSingle) .thenAccept(val -> { Long petId = Optional.ofNullable(request.path().param("petId")).map(Long::valueOf).orElse(null); ValidatorUtils.checkNonNull(petId); String additionalMetadata = Optional.ofNullable(nonFileFormContent.get("additionalMetadata")).flatMap(list->list.stream().findFirst()).orElse(null); InputStream _file = Optional.ofNullable(fileFormContent.get("file")).flatMap(list->list.stream().findFirst()).orElse(null); handleUploadFile(request, response, petId, additionalMetadata, _file); }) .exceptionally(throwable -> handleError(request, response, throwable)); } /** * Handle POST /pet/{petId}/uploadImage : uploads an image. * @param request the server request * @param response the server response * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server * @param _file file to upload */ abstract void handleUploadFile(ServerRequest request, ServerResponse response, Long petId, String additionalMetadata, InputStream _file); /** * POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required). * @param request the server request * @param response the server response */ void uploadFileWithRequiredFile(ServerRequest request, ServerResponse response) { Map<String, List<String>> nonFileFormContent = new HashMap<>(); Map<String, List<InputStream>> fileFormContent = new HashMap<>(); Single<Void> formSingle = request.content().asStream(ReadableBodyPart.class) .forEach(part -> { String name = part.name(); if ("additionalMetadata".equals(name)) { processNonFileFormField(name, nonFileFormContent, part); } if ("requiredFile".equals(name)) { processFileFormField(name, fileFormContent, part); } part.drain(); }); Single.create(formSingle) .thenAccept(val -> { Long petId = Optional.ofNullable(request.path().param("petId")).map(Long::valueOf).orElse(null); ValidatorUtils.checkNonNull(petId); InputStream requiredFile = Optional.ofNullable(fileFormContent.get("requiredFile")).flatMap(list->list.stream().findFirst()).orElse(null); ValidatorUtils.checkNonNull(requiredFile); String additionalMetadata = Optional.ofNullable(nonFileFormContent.get("additionalMetadata")).flatMap(list->list.stream().findFirst()).orElse(null); handleUploadFileWithRequiredFile(request, response, petId, requiredFile, additionalMetadata); }) .exceptionally(throwable -> handleError(request, response, throwable)); } /** * Handle POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required). * @param request the server request * @param response the server response * @param petId ID of pet to update * @param requiredFile file to upload * @param additionalMetadata Additional data to pass to server */ abstract void handleUploadFileWithRequiredFile(ServerRequest request, ServerResponse response, Long petId, InputStream requiredFile, String additionalMetadata); abstract Void handleError(ServerRequest request, ServerResponse response, Throwable throwable); }
UTF-8
Java
16,062
java
PetService.java
Java
[]
null
[]
package org.openapitools.server.api; import java.util.ArrayList; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import io.helidon.common.http.DataChunk; import java.io.File; import io.helidon.webserver.Handler; import java.util.HashMap; import java.io.IOException; import java.io.InputStream; import java.util.List; import java.util.Map; import org.openapitools.server.model.ModelApiResponse; import com.fasterxml.jackson.databind.ObjectMapper; import org.openapitools.server.model.Pet; import io.helidon.media.multipart.ReadableBodyPart; import java.util.Set; import java.io.UncheckedIOException; import java.util.Optional; import java.util.logging.Logger; import io.helidon.common.GenericType; import io.helidon.common.reactive.Single; import io.helidon.config.Config; import io.helidon.webserver.Routing; import io.helidon.webserver.ServerRequest; import io.helidon.webserver.ServerResponse; import io.helidon.webserver.Service; public abstract class PetService implements Service { protected static final Logger LOGGER = Logger.getLogger(PetService.class.getName()); private static final ObjectMapper MAPPER = JsonProvider.objectMapper(); protected final Config config; public PetService(Config config) { this.config = config; } /** * A service registers itself by updating the routing rules. * @param rules the routing rules. */ @Override public void update(Routing.Rules rules) { rules.post("/pet", Handler.create(Pet.class, this::addPet)); rules.delete("/pet/{petId}", this::deletePet); rules.get("/pet/findByStatus", this::findPetsByStatus); rules.get("/pet/findByTags", this::findPetsByTags); rules.get("/pet/{petId}", this::getPetById); rules.put("/pet", Handler.create(Pet.class, this::updatePet)); rules.post("/pet/{petId}", this::updatePetWithForm); rules.post("/pet/{petId}/uploadImage", this::uploadFile); rules.post("/fake/{petId}/uploadImageWithRequiredFile", this::uploadFileWithRequiredFile); } private void processNonFileFormField(String name, Map<String, List<String>> nonFileFormContent, ReadableBodyPart part) { List<String> content = nonFileFormContent.computeIfAbsent(name, key -> new ArrayList<>()); part.content().as(String.class).thenAccept(content::add); } private void processFileFormField(String name, Map<String, List<InputStream>> fileFormContent, ReadableBodyPart part) { List<InputStream> content = fileFormContent.computeIfAbsent(name, key -> new ArrayList<>()); part.content().map(DataChunk::bytes) .collect(ByteArrayOutputStream::new, (stream, bytes) -> { try { stream.write(bytes); } catch (IOException e) { throw new UncheckedIOException(e); } }) .thenAccept(byteStream -> content.add(new ByteArrayInputStream(byteStream.toByteArray()))); } /** * POST /pet : Add a new pet to the store. * @param request the server request * @param response the server response * @param pet Pet object that needs to be added to the store */ void addPet(ServerRequest request, ServerResponse response, Pet pet) { Single.create(Single.empty()) .thenAccept(val -> { ValidatorUtils.checkNonNull(pet); handleAddPet(request, response, pet); }) .exceptionally(throwable -> handleError(request, response, throwable)); } /** * Handle POST /pet : Add a new pet to the store. * @param request the server request * @param response the server response * @param pet Pet object that needs to be added to the store */ abstract void handleAddPet(ServerRequest request, ServerResponse response, Pet pet); /** * DELETE /pet/{petId} : Deletes a pet. * @param request the server request * @param response the server response */ void deletePet(ServerRequest request, ServerResponse response) { Single.create(Single.empty()) .thenAccept(val -> { Long petId = Optional.ofNullable(request.path().param("petId")).map(Long::valueOf).orElse(null); ValidatorUtils.checkNonNull(petId); String apiKey = request.headers().value("api_key").orElse(null); handleDeletePet(request, response, petId, apiKey); }) .exceptionally(throwable -> handleError(request, response, throwable)); } /** * Handle DELETE /pet/{petId} : Deletes a pet. * @param request the server request * @param response the server response * @param petId Pet id to delete * @param apiKey apiKey */ abstract void handleDeletePet(ServerRequest request, ServerResponse response, Long petId, String apiKey); /** * GET /pet/findByStatus : Finds Pets by status. * @param request the server request * @param response the server response */ void findPetsByStatus(ServerRequest request, ServerResponse response) { Single.create(Single.empty()) .thenAccept(val -> { List<String> status = Optional.ofNullable(request.queryParams().toMap().get("status")).orElse(null); ValidatorUtils.checkNonNull(status); handleFindPetsByStatus(request, response, status); }) .exceptionally(throwable -> handleError(request, response, throwable)); } /** * Handle GET /pet/findByStatus : Finds Pets by status. * @param request the server request * @param response the server response * @param status Status values that need to be considered for filter */ abstract void handleFindPetsByStatus(ServerRequest request, ServerResponse response, List<String> status); /** * GET /pet/findByTags : Finds Pets by tags. * @param request the server request * @param response the server response */ void findPetsByTags(ServerRequest request, ServerResponse response) { Single.create(Single.empty()) .thenAccept(val -> { List<String> tags = Optional.ofNullable(request.queryParams().toMap().get("tags")).orElse(null); ValidatorUtils.checkNonNull(tags); handleFindPetsByTags(request, response, tags); }) .exceptionally(throwable -> handleError(request, response, throwable)); } /** * Handle GET /pet/findByTags : Finds Pets by tags. * @param request the server request * @param response the server response * @param tags Tags to filter by */ abstract void handleFindPetsByTags(ServerRequest request, ServerResponse response, List<String> tags); /** * GET /pet/{petId} : Find pet by ID. * @param request the server request * @param response the server response */ void getPetById(ServerRequest request, ServerResponse response) { Single.create(Single.empty()) .thenAccept(val -> { Long petId = Optional.ofNullable(request.path().param("petId")).map(Long::valueOf).orElse(null); ValidatorUtils.checkNonNull(petId); handleGetPetById(request, response, petId); }) .exceptionally(throwable -> handleError(request, response, throwable)); } /** * Handle GET /pet/{petId} : Find pet by ID. * @param request the server request * @param response the server response * @param petId ID of pet to return */ abstract void handleGetPetById(ServerRequest request, ServerResponse response, Long petId); /** * PUT /pet : Update an existing pet. * @param request the server request * @param response the server response * @param pet Pet object that needs to be added to the store */ void updatePet(ServerRequest request, ServerResponse response, Pet pet) { Single.create(Single.empty()) .thenAccept(val -> { ValidatorUtils.checkNonNull(pet); handleUpdatePet(request, response, pet); }) .exceptionally(throwable -> handleError(request, response, throwable)); } /** * Handle PUT /pet : Update an existing pet. * @param request the server request * @param response the server response * @param pet Pet object that needs to be added to the store */ abstract void handleUpdatePet(ServerRequest request, ServerResponse response, Pet pet); /** * POST /pet/{petId} : Updates a pet in the store with form data. * @param request the server request * @param response the server response */ void updatePetWithForm(ServerRequest request, ServerResponse response) { Map<String, List<String>> nonFileFormContent = new HashMap<>(); Map<String, List<InputStream>> fileFormContent = new HashMap<>(); Single<Void> formSingle = request.content().asStream(ReadableBodyPart.class) .forEach(part -> { String name = part.name(); if ("name".equals(name)) { processNonFileFormField(name, nonFileFormContent, part); } if ("status".equals(name)) { processNonFileFormField(name, nonFileFormContent, part); } part.drain(); }); Single.create(formSingle) .thenAccept(val -> { Long petId = Optional.ofNullable(request.path().param("petId")).map(Long::valueOf).orElse(null); ValidatorUtils.checkNonNull(petId); String name = Optional.ofNullable(nonFileFormContent.get("name")).flatMap(list->list.stream().findFirst()).orElse(null); String status = Optional.ofNullable(nonFileFormContent.get("status")).flatMap(list->list.stream().findFirst()).orElse(null); handleUpdatePetWithForm(request, response, petId, name, status); }) .exceptionally(throwable -> handleError(request, response, throwable)); } /** * Handle POST /pet/{petId} : Updates a pet in the store with form data. * @param request the server request * @param response the server response * @param petId ID of pet that needs to be updated * @param name Updated name of the pet * @param status Updated status of the pet */ abstract void handleUpdatePetWithForm(ServerRequest request, ServerResponse response, Long petId, String name, String status); /** * POST /pet/{petId}/uploadImage : uploads an image. * @param request the server request * @param response the server response */ void uploadFile(ServerRequest request, ServerResponse response) { Map<String, List<String>> nonFileFormContent = new HashMap<>(); Map<String, List<InputStream>> fileFormContent = new HashMap<>(); Single<Void> formSingle = request.content().asStream(ReadableBodyPart.class) .forEach(part -> { String name = part.name(); if ("additionalMetadata".equals(name)) { processNonFileFormField(name, nonFileFormContent, part); } if ("file".equals(name)) { processFileFormField(name, fileFormContent, part); } part.drain(); }); Single.create(formSingle) .thenAccept(val -> { Long petId = Optional.ofNullable(request.path().param("petId")).map(Long::valueOf).orElse(null); ValidatorUtils.checkNonNull(petId); String additionalMetadata = Optional.ofNullable(nonFileFormContent.get("additionalMetadata")).flatMap(list->list.stream().findFirst()).orElse(null); InputStream _file = Optional.ofNullable(fileFormContent.get("file")).flatMap(list->list.stream().findFirst()).orElse(null); handleUploadFile(request, response, petId, additionalMetadata, _file); }) .exceptionally(throwable -> handleError(request, response, throwable)); } /** * Handle POST /pet/{petId}/uploadImage : uploads an image. * @param request the server request * @param response the server response * @param petId ID of pet to update * @param additionalMetadata Additional data to pass to server * @param _file file to upload */ abstract void handleUploadFile(ServerRequest request, ServerResponse response, Long petId, String additionalMetadata, InputStream _file); /** * POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required). * @param request the server request * @param response the server response */ void uploadFileWithRequiredFile(ServerRequest request, ServerResponse response) { Map<String, List<String>> nonFileFormContent = new HashMap<>(); Map<String, List<InputStream>> fileFormContent = new HashMap<>(); Single<Void> formSingle = request.content().asStream(ReadableBodyPart.class) .forEach(part -> { String name = part.name(); if ("additionalMetadata".equals(name)) { processNonFileFormField(name, nonFileFormContent, part); } if ("requiredFile".equals(name)) { processFileFormField(name, fileFormContent, part); } part.drain(); }); Single.create(formSingle) .thenAccept(val -> { Long petId = Optional.ofNullable(request.path().param("petId")).map(Long::valueOf).orElse(null); ValidatorUtils.checkNonNull(petId); InputStream requiredFile = Optional.ofNullable(fileFormContent.get("requiredFile")).flatMap(list->list.stream().findFirst()).orElse(null); ValidatorUtils.checkNonNull(requiredFile); String additionalMetadata = Optional.ofNullable(nonFileFormContent.get("additionalMetadata")).flatMap(list->list.stream().findFirst()).orElse(null); handleUploadFileWithRequiredFile(request, response, petId, requiredFile, additionalMetadata); }) .exceptionally(throwable -> handleError(request, response, throwable)); } /** * Handle POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required). * @param request the server request * @param response the server response * @param petId ID of pet to update * @param requiredFile file to upload * @param additionalMetadata Additional data to pass to server */ abstract void handleUploadFileWithRequiredFile(ServerRequest request, ServerResponse response, Long petId, InputStream requiredFile, String additionalMetadata); abstract Void handleError(ServerRequest request, ServerResponse response, Throwable throwable); }
16,062
0.605964
0.605964
352
44.63068
34.991718
164
false
false
0
0
0
0
0
0
0.678977
false
false
7
ac2357b6d083af6f405bf6f59fec36e297115e63
11,527,692,235,017
1fdfac56b6d1093ad03e0ea93be236acdd6d53cf
/app/src/main/java/com/adhdriver/work/entity/driver/thirdauth/AuthParam.java
a15d87aee2b8166e4d2ec4e417710c23aee9c1a7
[]
no_license
AliesYangpai/ADHDriverApp
https://github.com/AliesYangpai/ADHDriverApp
b97a6f2a0db3f7c5ae63acb58f6f5b98f118ab60
ab9d270034ed08f94c118f9e8d366a8308b78bf3
refs/heads/master
2020-03-29T22:42:37.545000
2019-08-07T12:34:11
2019-08-07T12:34:11
150,436,522
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.adhdriver.work.entity.driver.thirdauth; import java.io.Serializable; /** * Created by Administrator on 2017/11/28. * 类描述 * 版本 */ public class AuthParam implements Serializable{ // expires_in=7200 // openid=oES9tw6bLje2oBQfihFEpQ7Oguko // refresh_token=4_qiYHmGAihKEuUHbp75f2g_rbSpjcXqAJJp7jVAXzEZZwiBq_MpFhUPAxr26iSUi4KExXvBFJao8Ve3F3F9tJrU2q4sxcWcYYwVrMAxmSE70 // scope=snsapi_userinfo // unionid=ozphN09TsX5OKqqV1hqPI77-ibfM private String expires_in; private String openid; private String refresh_token; private String scope; private String unionid; private String access_token; public AuthParam() { } public String getAccess_token() { return access_token; } public void setAccess_token(String access_token) { this.access_token = access_token; } public String getExpires_in() { return expires_in; } public void setExpires_in(String expires_in) { this.expires_in = expires_in; } public String getOpenid() { return openid; } public void setOpenid(String openid) { this.openid = openid; } public String getRefresh_token() { return refresh_token; } public void setRefresh_token(String refresh_token) { this.refresh_token = refresh_token; } public String getScope() { return scope; } public void setScope(String scope) { this.scope = scope; } public String getUnionid() { return unionid; } public void setUnionid(String unionid) { this.unionid = unionid; } @Override public String toString() { return "AuthParam{" + "expires_in='" + expires_in + '\'' + ", openid='" + openid + '\'' + ", refresh_token='" + refresh_token + '\'' + ", scope='" + scope + '\'' + ", unionid='" + unionid + '\'' + '}'; } }
UTF-8
Java
2,016
java
AuthParam.java
Java
[ { "context": ";\n\nimport java.io.Serializable;\n\n/**\n * Created by Administrator on 2017/11/28.\n * 类描述\n * 版本\n */\n\npublic class Aut", "end": 114, "score": 0.5517593622207642, "start": 101, "tag": "NAME", "value": "Administrator" }, { "context": "bLje2oBQfihFEpQ7Oguko\n// refresh_token=4_qiYHmGAihKEuUHbp75f2g_rbSpjcXqAJJp7jVAXzEZZwiBq_MpFhUPAxr26iSUi4KExXvBFJao8Ve3F3F9tJrU2q4sxcWcYYwVrMAxmSE70\n// scope=snsapi_userinfo\n// unionid", "end": 398, "score": 0.9848172068595886, "start": 289, "tag": "KEY", "value": "4_qiYHmGAihKEuUHbp75f2g_rbSpjcXqAJJp7jVAXzEZZwiBq_MpFhUPAxr26iSUi4KExXvBFJao8Ve3F3F9tJrU2q4sxcWcYYwVrMAxmSE70" } ]
null
[]
package com.adhdriver.work.entity.driver.thirdauth; import java.io.Serializable; /** * Created by Administrator on 2017/11/28. * 类描述 * 版本 */ public class AuthParam implements Serializable{ // expires_in=7200 // openid=oES9tw6bLje2oBQfihFEpQ7Oguko // refresh_token=<KEY> // scope=snsapi_userinfo // unionid=ozphN09TsX5OKqqV1hqPI77-ibfM private String expires_in; private String openid; private String refresh_token; private String scope; private String unionid; private String access_token; public AuthParam() { } public String getAccess_token() { return access_token; } public void setAccess_token(String access_token) { this.access_token = access_token; } public String getExpires_in() { return expires_in; } public void setExpires_in(String expires_in) { this.expires_in = expires_in; } public String getOpenid() { return openid; } public void setOpenid(String openid) { this.openid = openid; } public String getRefresh_token() { return refresh_token; } public void setRefresh_token(String refresh_token) { this.refresh_token = refresh_token; } public String getScope() { return scope; } public void setScope(String scope) { this.scope = scope; } public String getUnionid() { return unionid; } public void setUnionid(String unionid) { this.unionid = unionid; } @Override public String toString() { return "AuthParam{" + "expires_in='" + expires_in + '\'' + ", openid='" + openid + '\'' + ", refresh_token='" + refresh_token + '\'' + ", scope='" + scope + '\'' + ", unionid='" + unionid + '\'' + '}'; } }
1,912
0.594716
0.575773
89
21.539326
21.961691
137
false
false
0
0
0
0
0
0
0.280899
false
false
7
07613ee8c0b0f9e8a895a85865f12d264702f99f
5,050,881,554,383
12bf8935ca0977fe4f80ad35220f5881b6ff9a11
/src/main/java/com/huang/util/DomXml.java
de3da8c83bc529affb3f455e892b8cda4901c43e
[]
no_license
babysinan/location
https://github.com/babysinan/location
c3c3a299c9c11057b1a83534183c90daf878f3f7
850b1ddb2bec6a3273be6cf3718d3917a378496b
refs/heads/master
2020-03-13T18:44:19.900000
2018-04-27T10:53:32
2018-04-27T10:53:32
131,241,311
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.huang.util; import com.huang.entity.Location; import org.dom4j.Attribute; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.Element; import org.dom4j.io.SAXReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.*; import java.util.stream.Collectors; /** * @author timkobe */ public class DomXml { public static void main(String[] args) { try { SAXReader reader = new SAXReader(); // URL url=new URL("C:/Users/timkobe/Downloads/英文.xml"); // URL url1=new URL("C:\\Users\\timkobe\\Downloads\\中文.xml"); // 创建saxReader对象 // 通过read方法读取一个文件 转换成Document对象 Document en = reader.read(new File("E:\\location\\英文源文件.xml")); Document cn = reader.read(new File("E:\\location\\中文所有多一个层级.xml")); // Document document = reader.read(url); System.out.println(cn); Element enode = en.getRootElement(); List<Location> enlocations = new ArrayList<>(); listNodes(enode, enlocations); // toJson(enlocations, Lang.EN_US); Element cnode = cn.getRootElement(); List<Location> cnlocations = new ArrayList<>(); listNodes(cnode, cnlocations); // elementMethod(enode); // toJson(cnlocations,Lang.ZH_CN); // toJson(cnlocations); System.out.println(enlocations); System.out.println(cnlocations); /* 写入Txt文件 */ File writename = new File("C:\\Users\\admin\\Desktop\\location_sql_new.txt"); // 相对路径,如果没有则要建立一个新的output。txt文件 writename.createNewFile(); // 创建新文件 BufferedWriter out = new BufferedWriter(new FileWriter(writename)); out.write("insert into location \r\n"); // \r\n即为换行 out.write("(code,parent_code,name,full_name,lang,data_status,create_time) \r\n"); // \r\n即为换行 out.write("values \r\n"); // \r\n即为换行 for (Location location : cnlocations) { location.setDataStatus(1); String fullName = location.getFullName(); if(fullName.indexOf("直辖市")>0){ fullName=fullName.replace("直辖市,",""); } if(fullName.indexOf("特别行政区")>0){ fullName=fullName.replace("特别行政区,",""); } if (fullName.indexOf("台湾省")>0){ fullName=fullName.replace("台湾省,",""); } out.write("(\""+location.getCode()+"\",\""+location.getParentCode()+"\",\""+location.getName()+"\",\""+fullName+"\",\"zh-cn\",1,UNIX_TIMESTAMP(now(6))), \r\n"); // \r\n即为换行 } for (Location location : enlocations) { location.setDataStatus(1); //全地址显示 String fullName = location.getFullName(); String[] split = fullName.split(","); String afterFullName=location.getFullName(); if(split!=null && split.length>1){ afterFullName=""; for (int i = split.length-1; i>=0; i--) { if(i==split.length-1){ afterFullName=split[i]; }else{ afterFullName=afterFullName+","+split[i]; } } System.out.println(afterFullName); } out.write("(\""+location.getCode()+"\",\""+location.getParentCode()+"\",\""+location.getName()+"\",\""+afterFullName+"\",\"en-us\",1,UNIX_TIMESTAMP(now(6))), \r\n"); // \r\n即为换行 // break; } out.flush(); // 把缓存区内容压入文件 out.close(); // 最后记得关闭文件 } catch (DocumentException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } /** * 介绍Element中的element方法和elements方法的使用 * * @param node */ public static void elementMethod(Element node) { // 获取node节点中,子节点的元素名称为supercars的元素节点。 Element Location = node.element("Location"); Element CountryRegion = node.element("CountryRegion"); // 获取supercars元素节点中,子节点为carname的元素节点(可以看到只能获取第一个carname元素节点) Element carname = CountryRegion.element("State"); System.out.println(CountryRegion.getName() + "----" + carname.getText()); // 获取supercars这个元素节点 中,所有子节点名称为carname元素的节点 。 List<Element> carnames = CountryRegion.elements("carname"); for (Element cname : carnames) { System.out.println(cname.getText()); } // 获取supercars这个元素节点 所有元素的子节点。 List<Element> elements = CountryRegion.elements(); for (Element el : elements) { System.out.println(el.getText()); } } /** * 遍历当前节点元素下面的所有(元素的)子节点 * * @param node */ public static List<Location> listNodes(Element node, List<Location> locations) { Location location = new Location(); location.setCode(""); location.setParentCode(""); location.setLang(""); location.setName(""); System.out.println("当前节点的名称::" + node.getName()); // 获取当前节点的所有属性节点 List<Attribute> list = node.attributes(); // 遍历属性节点 //name getParent(node, location); getParentCode(node.getParent(), location); String name=""; for (Attribute attr : list) { System.out.println(attr.getText() + "-----" + attr.getName() + "---" + attr.getValue()); if (attr.getName().equals("Name")) { name = attr.getValue(); location.setName(name); } } if (location.getCode() != null && !location.getCode().equals("") && list.size()>0) { locations.add(location); System.out.println("code:" + location.getCode()); System.out.println("fullName:" + location.getFullName()); System.out.println("parentCode:" + location.getParentCode()); } // List content = node.content(); // QName qName = node.getQName(); // if (!(node.getTextTrim().equals(""))) { // System.out.println("文本内容::::" + node.getText()); // } // // // 当前节点下面子节点迭代器 Iterator<Element> it = node.elementIterator(); // // 遍历 while (it.hasNext()) { // 获取某个子节点对象 Element e = it.next(); // 对子节点进行遍历 listNodes(e, locations); } // // iterate through child elements of root // for (Iterator<Element> its = node.elementIterator(); it.hasNext(); ) { // Element element = its.next(); // // do something // } // // // iterate through child elements of root with element name "foo" // for (Iterator<Element> its = node.elementIterator("foo"); it.hasNext(); ) { // Element foo = its.next(); // // do something // } // // // iterate through attributes of root // for (Iterator<Attribute> its = node.attributeIterator(); it.hasNext(); ) { // Attribute attribute = its.next(); // // do something // } return locations; } public static Location getParent(Element node, Location location) { if(node==null){ return location; } String code = location.getCode() == null ? "" : location.getCode(); String fullName = location.getFullName() == null ? "" : location.getFullName(); Element parent = node.getParent(); List<Attribute> attributes = node.attributes(); // if (parent != null) { for (Attribute attr : attributes) {//追加name code if (attr.getName().equals("Name")) { if (fullName.equals("")) { fullName = attr.getValue(); } else { fullName = attr.getValue() + "," + fullName; } } if (attr.getName().equals("Code")) { if (code.equals("")) { code = attr.getValue(); } else { code = attr.getValue() + "_" + code; } } } location.setFullName(fullName); location.setCode(code); getParent(parent, location); // } return location; } public static Location getParentCode(Element parentNode, Location location) { if(parentNode==null){ return location; } String code = location.getParentCode() == null ? "" : location.getParentCode(); Element parent = parentNode.getParent(); List<Attribute> attributes = parentNode.attributes(); // if (parent != null) { for (Attribute attr : attributes) {//追加name code if (attr.getName().equals("Code")) { if (code.equals("")) { code = attr.getValue(); } else { code = attr.getValue() + "_" + code; } } } location.setParentCode(code); getParentCode(parent, location); // } return location; } public static void toJson(List<Location> locations ,String lang){ List<LocationDto> locationDtos=new ArrayList<>(11049); LocationDto dto; for (Location location : locations) { dto=new LocationDto(); BeanUtils.copyProperties(location,dto); locationDtos.add(dto); } for (LocationDto locationDto : locationDtos) { locationDto.setLang(null); List<Location> childs = locationDto.getChilds(); if(childs==null){ childs=new ArrayList<>(); locationDto.setChilds(childs); } for (LocationDto locationDto1 : locationDtos) { if(locationDto1.getParentCode().equals(locationDto.getCode())){ childs.add(locationDto1); } } } List<LocationDto> collect = locationDtos.stream().filter(p -> StrUtil.isEmptyOrBlank(p.getParentCode())).collect(Collectors.toList()); Map<String,Object> map=new HashMap<>(); map.put(lang,collect); Gson gson=new Gson(); String s = gson.toJson(map); try { File writename = new File("C:\\Users\\admin\\Desktop\\"+lang+".txt"); // 相对路径,如果没有则要建立一个新的output。txt文件 writename.createNewFile(); // 创建新文件 BufferedWriter out = new BufferedWriter(new FileWriter(writename)); out.write(s); out.flush(); // 把缓存区内容压入文件 out.close(); // 最后记得关闭文件 } catch (IOException e) { e.printStackTrace(); } } public static void toJson(List<Location> locations){ Gson gson=new Gson(); for (Location location : locations) { location.setLang(null); location.setFullName(null); } List<Location> collect = locations.stream().filter(p -> !StrUtil.isEmptyOrBlank(p.getParentCode())).collect(Collectors.toList()); for (Location location : collect) { if(location.getParentCode().equals("1")){ location.setParentCode(null); } } String s = gson.toJson(collect); try { File writename = new File("C:\\Users\\admin\\Desktop\\duoyiji.txt"); // 相对路径,如果没有则要建立一个新的output。txt文件 writename.createNewFile(); // 创建新文件 BufferedWriter out = new BufferedWriter(new FileWriter(writename)); out.write(s); out.flush(); // 把缓存区内容压入文件 out.close(); // 最后记得关闭文件 } catch (IOException e) { e.printStackTrace(); } } }
UTF-8
Java
12,928
java
DomXml.java
Java
[ { "context": "mport java.util.stream.Collectors;\n\n/**\n * @author timkobe\n */\npublic class DomXml {\n public static void ", "end": 394, "score": 0.9997045397758484, "start": 387, "tag": "USERNAME", "value": "timkobe" }, { "context": "Reader();\n// URL url=new URL(\"C:/Users/timkobe/Downloads/英文.xml\");\n// URL url1=new UR", "end": 577, "score": 0.9664621353149414, "start": 570, "tag": "USERNAME", "value": "timkobe" }, { "context": "\");\n// URL url1=new URL(\"C:\\\\Users\\\\timkobe\\\\Downloads\\\\中文.xml\");\n // 创建saxReade", "end": 646, "score": 0.6272535920143127, "start": 644, "tag": "USERNAME", "value": "ko" } ]
null
[]
package com.huang.util; import com.huang.entity.Location; import org.dom4j.Attribute; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.Element; import org.dom4j.io.SAXReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.*; import java.util.stream.Collectors; /** * @author timkobe */ public class DomXml { public static void main(String[] args) { try { SAXReader reader = new SAXReader(); // URL url=new URL("C:/Users/timkobe/Downloads/英文.xml"); // URL url1=new URL("C:\\Users\\timkobe\\Downloads\\中文.xml"); // 创建saxReader对象 // 通过read方法读取一个文件 转换成Document对象 Document en = reader.read(new File("E:\\location\\英文源文件.xml")); Document cn = reader.read(new File("E:\\location\\中文所有多一个层级.xml")); // Document document = reader.read(url); System.out.println(cn); Element enode = en.getRootElement(); List<Location> enlocations = new ArrayList<>(); listNodes(enode, enlocations); // toJson(enlocations, Lang.EN_US); Element cnode = cn.getRootElement(); List<Location> cnlocations = new ArrayList<>(); listNodes(cnode, cnlocations); // elementMethod(enode); // toJson(cnlocations,Lang.ZH_CN); // toJson(cnlocations); System.out.println(enlocations); System.out.println(cnlocations); /* 写入Txt文件 */ File writename = new File("C:\\Users\\admin\\Desktop\\location_sql_new.txt"); // 相对路径,如果没有则要建立一个新的output。txt文件 writename.createNewFile(); // 创建新文件 BufferedWriter out = new BufferedWriter(new FileWriter(writename)); out.write("insert into location \r\n"); // \r\n即为换行 out.write("(code,parent_code,name,full_name,lang,data_status,create_time) \r\n"); // \r\n即为换行 out.write("values \r\n"); // \r\n即为换行 for (Location location : cnlocations) { location.setDataStatus(1); String fullName = location.getFullName(); if(fullName.indexOf("直辖市")>0){ fullName=fullName.replace("直辖市,",""); } if(fullName.indexOf("特别行政区")>0){ fullName=fullName.replace("特别行政区,",""); } if (fullName.indexOf("台湾省")>0){ fullName=fullName.replace("台湾省,",""); } out.write("(\""+location.getCode()+"\",\""+location.getParentCode()+"\",\""+location.getName()+"\",\""+fullName+"\",\"zh-cn\",1,UNIX_TIMESTAMP(now(6))), \r\n"); // \r\n即为换行 } for (Location location : enlocations) { location.setDataStatus(1); //全地址显示 String fullName = location.getFullName(); String[] split = fullName.split(","); String afterFullName=location.getFullName(); if(split!=null && split.length>1){ afterFullName=""; for (int i = split.length-1; i>=0; i--) { if(i==split.length-1){ afterFullName=split[i]; }else{ afterFullName=afterFullName+","+split[i]; } } System.out.println(afterFullName); } out.write("(\""+location.getCode()+"\",\""+location.getParentCode()+"\",\""+location.getName()+"\",\""+afterFullName+"\",\"en-us\",1,UNIX_TIMESTAMP(now(6))), \r\n"); // \r\n即为换行 // break; } out.flush(); // 把缓存区内容压入文件 out.close(); // 最后记得关闭文件 } catch (DocumentException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } /** * 介绍Element中的element方法和elements方法的使用 * * @param node */ public static void elementMethod(Element node) { // 获取node节点中,子节点的元素名称为supercars的元素节点。 Element Location = node.element("Location"); Element CountryRegion = node.element("CountryRegion"); // 获取supercars元素节点中,子节点为carname的元素节点(可以看到只能获取第一个carname元素节点) Element carname = CountryRegion.element("State"); System.out.println(CountryRegion.getName() + "----" + carname.getText()); // 获取supercars这个元素节点 中,所有子节点名称为carname元素的节点 。 List<Element> carnames = CountryRegion.elements("carname"); for (Element cname : carnames) { System.out.println(cname.getText()); } // 获取supercars这个元素节点 所有元素的子节点。 List<Element> elements = CountryRegion.elements(); for (Element el : elements) { System.out.println(el.getText()); } } /** * 遍历当前节点元素下面的所有(元素的)子节点 * * @param node */ public static List<Location> listNodes(Element node, List<Location> locations) { Location location = new Location(); location.setCode(""); location.setParentCode(""); location.setLang(""); location.setName(""); System.out.println("当前节点的名称::" + node.getName()); // 获取当前节点的所有属性节点 List<Attribute> list = node.attributes(); // 遍历属性节点 //name getParent(node, location); getParentCode(node.getParent(), location); String name=""; for (Attribute attr : list) { System.out.println(attr.getText() + "-----" + attr.getName() + "---" + attr.getValue()); if (attr.getName().equals("Name")) { name = attr.getValue(); location.setName(name); } } if (location.getCode() != null && !location.getCode().equals("") && list.size()>0) { locations.add(location); System.out.println("code:" + location.getCode()); System.out.println("fullName:" + location.getFullName()); System.out.println("parentCode:" + location.getParentCode()); } // List content = node.content(); // QName qName = node.getQName(); // if (!(node.getTextTrim().equals(""))) { // System.out.println("文本内容::::" + node.getText()); // } // // // 当前节点下面子节点迭代器 Iterator<Element> it = node.elementIterator(); // // 遍历 while (it.hasNext()) { // 获取某个子节点对象 Element e = it.next(); // 对子节点进行遍历 listNodes(e, locations); } // // iterate through child elements of root // for (Iterator<Element> its = node.elementIterator(); it.hasNext(); ) { // Element element = its.next(); // // do something // } // // // iterate through child elements of root with element name "foo" // for (Iterator<Element> its = node.elementIterator("foo"); it.hasNext(); ) { // Element foo = its.next(); // // do something // } // // // iterate through attributes of root // for (Iterator<Attribute> its = node.attributeIterator(); it.hasNext(); ) { // Attribute attribute = its.next(); // // do something // } return locations; } public static Location getParent(Element node, Location location) { if(node==null){ return location; } String code = location.getCode() == null ? "" : location.getCode(); String fullName = location.getFullName() == null ? "" : location.getFullName(); Element parent = node.getParent(); List<Attribute> attributes = node.attributes(); // if (parent != null) { for (Attribute attr : attributes) {//追加name code if (attr.getName().equals("Name")) { if (fullName.equals("")) { fullName = attr.getValue(); } else { fullName = attr.getValue() + "," + fullName; } } if (attr.getName().equals("Code")) { if (code.equals("")) { code = attr.getValue(); } else { code = attr.getValue() + "_" + code; } } } location.setFullName(fullName); location.setCode(code); getParent(parent, location); // } return location; } public static Location getParentCode(Element parentNode, Location location) { if(parentNode==null){ return location; } String code = location.getParentCode() == null ? "" : location.getParentCode(); Element parent = parentNode.getParent(); List<Attribute> attributes = parentNode.attributes(); // if (parent != null) { for (Attribute attr : attributes) {//追加name code if (attr.getName().equals("Code")) { if (code.equals("")) { code = attr.getValue(); } else { code = attr.getValue() + "_" + code; } } } location.setParentCode(code); getParentCode(parent, location); // } return location; } public static void toJson(List<Location> locations ,String lang){ List<LocationDto> locationDtos=new ArrayList<>(11049); LocationDto dto; for (Location location : locations) { dto=new LocationDto(); BeanUtils.copyProperties(location,dto); locationDtos.add(dto); } for (LocationDto locationDto : locationDtos) { locationDto.setLang(null); List<Location> childs = locationDto.getChilds(); if(childs==null){ childs=new ArrayList<>(); locationDto.setChilds(childs); } for (LocationDto locationDto1 : locationDtos) { if(locationDto1.getParentCode().equals(locationDto.getCode())){ childs.add(locationDto1); } } } List<LocationDto> collect = locationDtos.stream().filter(p -> StrUtil.isEmptyOrBlank(p.getParentCode())).collect(Collectors.toList()); Map<String,Object> map=new HashMap<>(); map.put(lang,collect); Gson gson=new Gson(); String s = gson.toJson(map); try { File writename = new File("C:\\Users\\admin\\Desktop\\"+lang+".txt"); // 相对路径,如果没有则要建立一个新的output。txt文件 writename.createNewFile(); // 创建新文件 BufferedWriter out = new BufferedWriter(new FileWriter(writename)); out.write(s); out.flush(); // 把缓存区内容压入文件 out.close(); // 最后记得关闭文件 } catch (IOException e) { e.printStackTrace(); } } public static void toJson(List<Location> locations){ Gson gson=new Gson(); for (Location location : locations) { location.setLang(null); location.setFullName(null); } List<Location> collect = locations.stream().filter(p -> !StrUtil.isEmptyOrBlank(p.getParentCode())).collect(Collectors.toList()); for (Location location : collect) { if(location.getParentCode().equals("1")){ location.setParentCode(null); } } String s = gson.toJson(collect); try { File writename = new File("C:\\Users\\admin\\Desktop\\duoyiji.txt"); // 相对路径,如果没有则要建立一个新的output。txt文件 writename.createNewFile(); // 创建新文件 BufferedWriter out = new BufferedWriter(new FileWriter(writename)); out.write(s); out.flush(); // 把缓存区内容压入文件 out.close(); // 最后记得关闭文件 } catch (IOException e) { e.printStackTrace(); } } }
12,928
0.525285
0.522889
333
35.342342
28.353674
193
false
false
0
0
0
0
0
0
0.60961
false
false
7
e52e8021429572bc7df1d03a0ce5463d4327a0fa
27,384,711,497,631
7398714c498444374047497fe2e9c9ad51239034
/okhttp3/internal/cache/CacheStrategy.java
433baade377d525d62cafd8e249c3d7dbe0533a0
[]
no_license
CheatBoss/InnerCore-horizon-sources
https://github.com/CheatBoss/InnerCore-horizon-sources
b3609694df499ccac5f133d64be03962f9f767ef
84b72431e7cb702b7d929c61c340a8db07d6ece1
refs/heads/main
2023-04-07T07:30:19.725000
2021-04-10T01:23:04
2021-04-10T01:23:04
356,437,521
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package okhttp3.internal.cache; import javax.annotation.*; import java.util.*; import okhttp3.internal.http.*; import java.util.concurrent.*; import okhttp3.*; import okhttp3.internal.*; public final class CacheStrategy { @Nullable public final Response cacheResponse; @Nullable public final Request networkRequest; CacheStrategy(final Request networkRequest, final Response cacheResponse) { this.networkRequest = networkRequest; this.cacheResponse = cacheResponse; } public static boolean isCacheable(final Response response, final Request request) { final int code = response.code(); final boolean b = false; Label_0151: { if (code != 200 && code != 410 && code != 414 && code != 501 && code != 203 && code != 204) { if (code != 307) { if (code == 308 || code == 404 || code == 405) { break Label_0151; } switch (code) { default: { return false; } case 302: { break; } case 300: case 301: { break Label_0151; } } } if (response.header("Expires") == null && response.cacheControl().maxAgeSeconds() == -1 && !response.cacheControl().isPublic()) { if (!response.cacheControl().isPrivate()) { return false; } } } } boolean b2 = b; if (!response.cacheControl().noStore()) { b2 = b; if (!request.cacheControl().noStore()) { b2 = true; } } return b2; } public static class Factory { private int ageSeconds; final Response cacheResponse; private String etag; private Date expires; private Date lastModified; private String lastModifiedString; final long nowMillis; private long receivedResponseMillis; final Request request; private long sentRequestMillis; private Date servedDate; private String servedDateString; public Factory(final long nowMillis, final Request request, final Response cacheResponse) { this.ageSeconds = -1; this.nowMillis = nowMillis; this.request = request; this.cacheResponse = cacheResponse; if (cacheResponse != null) { this.sentRequestMillis = cacheResponse.sentRequestAtMillis(); this.receivedResponseMillis = cacheResponse.receivedResponseAtMillis(); final Headers headers = cacheResponse.headers(); for (int i = 0; i < headers.size(); ++i) { final String name = headers.name(i); final String value = headers.value(i); if ("Date".equalsIgnoreCase(name)) { this.servedDate = HttpDate.parse(value); this.servedDateString = value; } else if ("Expires".equalsIgnoreCase(name)) { this.expires = HttpDate.parse(value); } else if ("Last-Modified".equalsIgnoreCase(name)) { this.lastModified = HttpDate.parse(value); this.lastModifiedString = value; } else if ("ETag".equalsIgnoreCase(name)) { this.etag = value; } else if ("Age".equalsIgnoreCase(name)) { this.ageSeconds = HttpHeaders.parseSeconds(value, -1); } } } } private long cacheResponseAge() { final Date servedDate = this.servedDate; long max = 0L; if (servedDate != null) { max = Math.max(0L, this.receivedResponseMillis - servedDate.getTime()); } long max2 = max; if (this.ageSeconds != -1) { max2 = Math.max(max, TimeUnit.SECONDS.toMillis(this.ageSeconds)); } final long receivedResponseMillis = this.receivedResponseMillis; return max2 + (receivedResponseMillis - this.sentRequestMillis) + (this.nowMillis - receivedResponseMillis); } private long computeFreshnessLifetime() { final CacheControl cacheControl = this.cacheResponse.cacheControl(); if (cacheControl.maxAgeSeconds() != -1) { return TimeUnit.SECONDS.toMillis(cacheControl.maxAgeSeconds()); } final Date expires = this.expires; long n = 0L; if (expires != null) { final Date servedDate = this.servedDate; long n2; if (servedDate != null) { n2 = servedDate.getTime(); } else { n2 = this.receivedResponseMillis; } final long n3 = this.expires.getTime() - n2; if (n3 > 0L) { n = n3; } return n; } long n4 = n; if (this.lastModified != null) { n4 = n; if (this.cacheResponse.request().url().query() == null) { final Date servedDate2 = this.servedDate; long n5; if (servedDate2 != null) { n5 = servedDate2.getTime(); } else { n5 = this.sentRequestMillis; } final long n6 = n5 - this.lastModified.getTime(); n4 = n; if (n6 > 0L) { n4 = n6 / 10L; } } } return n4; } private CacheStrategy getCandidate() { if (this.cacheResponse == null) { return new CacheStrategy(this.request, null); } if (this.request.isHttps() && this.cacheResponse.handshake() == null) { return new CacheStrategy(this.request, null); } if (!CacheStrategy.isCacheable(this.cacheResponse, this.request)) { return new CacheStrategy(this.request, null); } final CacheControl cacheControl = this.request.cacheControl(); if (cacheControl.noCache() || hasConditions(this.request)) { return new CacheStrategy(this.request, null); } final CacheControl cacheControl2 = this.cacheResponse.cacheControl(); if (cacheControl2.immutable()) { return new CacheStrategy(null, this.cacheResponse); } final long cacheResponseAge = this.cacheResponseAge(); long n2; final long n = n2 = this.computeFreshnessLifetime(); if (cacheControl.maxAgeSeconds() != -1) { n2 = Math.min(n, TimeUnit.SECONDS.toMillis(cacheControl.maxAgeSeconds())); } final int minFreshSeconds = cacheControl.minFreshSeconds(); final long n3 = 0L; long millis; if (minFreshSeconds != -1) { millis = TimeUnit.SECONDS.toMillis(cacheControl.minFreshSeconds()); } else { millis = 0L; } long millis2 = n3; if (!cacheControl2.mustRevalidate()) { millis2 = n3; if (cacheControl.maxStaleSeconds() != -1) { millis2 = TimeUnit.SECONDS.toMillis(cacheControl.maxStaleSeconds()); } } if (!cacheControl2.noCache()) { final long n4 = millis + cacheResponseAge; if (n4 < millis2 + n2) { final Response.Builder builder = this.cacheResponse.newBuilder(); if (n4 >= n2) { builder.addHeader("Warning", "110 HttpURLConnection \"Response is stale\""); } if (cacheResponseAge > 86400000L && this.isFreshnessLifetimeHeuristic()) { builder.addHeader("Warning", "113 HttpURLConnection \"Heuristic expiration\""); } return new CacheStrategy(null, builder.build()); } } String s = this.etag; String s2 = "If-Modified-Since"; if (s != null) { s2 = "If-None-Match"; } else if (this.lastModified != null) { s = this.lastModifiedString; } else { if (this.servedDate == null) { return new CacheStrategy(this.request, null); } s = this.servedDateString; } final Headers.Builder builder2 = this.request.headers().newBuilder(); Internal.instance.addLenient(builder2, s2, s); return new CacheStrategy(this.request.newBuilder().headers(builder2.build()).build(), this.cacheResponse); } private static boolean hasConditions(final Request request) { return request.header("If-Modified-Since") != null || request.header("If-None-Match") != null; } private boolean isFreshnessLifetimeHeuristic() { return this.cacheResponse.cacheControl().maxAgeSeconds() == -1 && this.expires == null; } public CacheStrategy get() { CacheStrategy candidate; final CacheStrategy cacheStrategy = candidate = this.getCandidate(); if (cacheStrategy.networkRequest != null) { candidate = cacheStrategy; if (this.request.cacheControl().onlyIfCached()) { candidate = new CacheStrategy(null, null); } } return candidate; } } }
UTF-8
Java
10,418
java
CacheStrategy.java
Java
[]
null
[]
package okhttp3.internal.cache; import javax.annotation.*; import java.util.*; import okhttp3.internal.http.*; import java.util.concurrent.*; import okhttp3.*; import okhttp3.internal.*; public final class CacheStrategy { @Nullable public final Response cacheResponse; @Nullable public final Request networkRequest; CacheStrategy(final Request networkRequest, final Response cacheResponse) { this.networkRequest = networkRequest; this.cacheResponse = cacheResponse; } public static boolean isCacheable(final Response response, final Request request) { final int code = response.code(); final boolean b = false; Label_0151: { if (code != 200 && code != 410 && code != 414 && code != 501 && code != 203 && code != 204) { if (code != 307) { if (code == 308 || code == 404 || code == 405) { break Label_0151; } switch (code) { default: { return false; } case 302: { break; } case 300: case 301: { break Label_0151; } } } if (response.header("Expires") == null && response.cacheControl().maxAgeSeconds() == -1 && !response.cacheControl().isPublic()) { if (!response.cacheControl().isPrivate()) { return false; } } } } boolean b2 = b; if (!response.cacheControl().noStore()) { b2 = b; if (!request.cacheControl().noStore()) { b2 = true; } } return b2; } public static class Factory { private int ageSeconds; final Response cacheResponse; private String etag; private Date expires; private Date lastModified; private String lastModifiedString; final long nowMillis; private long receivedResponseMillis; final Request request; private long sentRequestMillis; private Date servedDate; private String servedDateString; public Factory(final long nowMillis, final Request request, final Response cacheResponse) { this.ageSeconds = -1; this.nowMillis = nowMillis; this.request = request; this.cacheResponse = cacheResponse; if (cacheResponse != null) { this.sentRequestMillis = cacheResponse.sentRequestAtMillis(); this.receivedResponseMillis = cacheResponse.receivedResponseAtMillis(); final Headers headers = cacheResponse.headers(); for (int i = 0; i < headers.size(); ++i) { final String name = headers.name(i); final String value = headers.value(i); if ("Date".equalsIgnoreCase(name)) { this.servedDate = HttpDate.parse(value); this.servedDateString = value; } else if ("Expires".equalsIgnoreCase(name)) { this.expires = HttpDate.parse(value); } else if ("Last-Modified".equalsIgnoreCase(name)) { this.lastModified = HttpDate.parse(value); this.lastModifiedString = value; } else if ("ETag".equalsIgnoreCase(name)) { this.etag = value; } else if ("Age".equalsIgnoreCase(name)) { this.ageSeconds = HttpHeaders.parseSeconds(value, -1); } } } } private long cacheResponseAge() { final Date servedDate = this.servedDate; long max = 0L; if (servedDate != null) { max = Math.max(0L, this.receivedResponseMillis - servedDate.getTime()); } long max2 = max; if (this.ageSeconds != -1) { max2 = Math.max(max, TimeUnit.SECONDS.toMillis(this.ageSeconds)); } final long receivedResponseMillis = this.receivedResponseMillis; return max2 + (receivedResponseMillis - this.sentRequestMillis) + (this.nowMillis - receivedResponseMillis); } private long computeFreshnessLifetime() { final CacheControl cacheControl = this.cacheResponse.cacheControl(); if (cacheControl.maxAgeSeconds() != -1) { return TimeUnit.SECONDS.toMillis(cacheControl.maxAgeSeconds()); } final Date expires = this.expires; long n = 0L; if (expires != null) { final Date servedDate = this.servedDate; long n2; if (servedDate != null) { n2 = servedDate.getTime(); } else { n2 = this.receivedResponseMillis; } final long n3 = this.expires.getTime() - n2; if (n3 > 0L) { n = n3; } return n; } long n4 = n; if (this.lastModified != null) { n4 = n; if (this.cacheResponse.request().url().query() == null) { final Date servedDate2 = this.servedDate; long n5; if (servedDate2 != null) { n5 = servedDate2.getTime(); } else { n5 = this.sentRequestMillis; } final long n6 = n5 - this.lastModified.getTime(); n4 = n; if (n6 > 0L) { n4 = n6 / 10L; } } } return n4; } private CacheStrategy getCandidate() { if (this.cacheResponse == null) { return new CacheStrategy(this.request, null); } if (this.request.isHttps() && this.cacheResponse.handshake() == null) { return new CacheStrategy(this.request, null); } if (!CacheStrategy.isCacheable(this.cacheResponse, this.request)) { return new CacheStrategy(this.request, null); } final CacheControl cacheControl = this.request.cacheControl(); if (cacheControl.noCache() || hasConditions(this.request)) { return new CacheStrategy(this.request, null); } final CacheControl cacheControl2 = this.cacheResponse.cacheControl(); if (cacheControl2.immutable()) { return new CacheStrategy(null, this.cacheResponse); } final long cacheResponseAge = this.cacheResponseAge(); long n2; final long n = n2 = this.computeFreshnessLifetime(); if (cacheControl.maxAgeSeconds() != -1) { n2 = Math.min(n, TimeUnit.SECONDS.toMillis(cacheControl.maxAgeSeconds())); } final int minFreshSeconds = cacheControl.minFreshSeconds(); final long n3 = 0L; long millis; if (minFreshSeconds != -1) { millis = TimeUnit.SECONDS.toMillis(cacheControl.minFreshSeconds()); } else { millis = 0L; } long millis2 = n3; if (!cacheControl2.mustRevalidate()) { millis2 = n3; if (cacheControl.maxStaleSeconds() != -1) { millis2 = TimeUnit.SECONDS.toMillis(cacheControl.maxStaleSeconds()); } } if (!cacheControl2.noCache()) { final long n4 = millis + cacheResponseAge; if (n4 < millis2 + n2) { final Response.Builder builder = this.cacheResponse.newBuilder(); if (n4 >= n2) { builder.addHeader("Warning", "110 HttpURLConnection \"Response is stale\""); } if (cacheResponseAge > 86400000L && this.isFreshnessLifetimeHeuristic()) { builder.addHeader("Warning", "113 HttpURLConnection \"Heuristic expiration\""); } return new CacheStrategy(null, builder.build()); } } String s = this.etag; String s2 = "If-Modified-Since"; if (s != null) { s2 = "If-None-Match"; } else if (this.lastModified != null) { s = this.lastModifiedString; } else { if (this.servedDate == null) { return new CacheStrategy(this.request, null); } s = this.servedDateString; } final Headers.Builder builder2 = this.request.headers().newBuilder(); Internal.instance.addLenient(builder2, s2, s); return new CacheStrategy(this.request.newBuilder().headers(builder2.build()).build(), this.cacheResponse); } private static boolean hasConditions(final Request request) { return request.header("If-Modified-Since") != null || request.header("If-None-Match") != null; } private boolean isFreshnessLifetimeHeuristic() { return this.cacheResponse.cacheControl().maxAgeSeconds() == -1 && this.expires == null; } public CacheStrategy get() { CacheStrategy candidate; final CacheStrategy cacheStrategy = candidate = this.getCandidate(); if (cacheStrategy.networkRequest != null) { candidate = cacheStrategy; if (this.request.cacheControl().onlyIfCached()) { candidate = new CacheStrategy(null, null); } } return candidate; } } }
10,418
0.490017
0.476387
259
39.223938
26.160995
145
true
false
0
0
0
0
0
0
0.579151
false
false
7
11b54ce70701be634409284dbdb67dab81987ee0
30,983,894,130,448
e2fd23e72f0b3e287a3fbb8d0d97337e2eb345ca
/Exercise SIS/src/main/java/Course.java
dc939ab33f13ddddd9913d14724dcb0286da9e99
[]
no_license
KoenLippe/ADS
https://github.com/KoenLippe/ADS
a2b7a72a724dad32435fd810ea6f3f389fa7a84e
88eeb66cdb717d432c31101183262abcea693df9
refs/heads/master
2020-07-20T09:59:16.761000
2019-11-21T13:02:32
2019-11-21T13:02:32
206,620,537
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.time.LocalDate; import java.util.*; import java.util.function.Predicate; import java.util.stream.Collectors; public class Course { private String code; private String title; private int ects; private Set<Exam> exams; public Course(String code) { this.code = code; title = ""; ects = 0; exams = new HashSet<>(); } public Course(String code, String title, int ects) { this(code); this.title = title; this.ects = ects; } @Override public String toString() { return String.format("%s(%s)", title, code); } // DONE make sure courses can be printed. The format is 'title(code)' // TODO make sure Courses can be added to a HashMap, HashSet, TreeSet, HashMap and TreeMap // every course shall have a unique code @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Course course = (Course) o; return code.equals(course.code); } @Override public int hashCode() { return Objects.hash(code); } /** * Retrieves the Exam of the Course at a given date, if any * * @param date * @return returns null if no Exam has been scheduled for the given date */ public Exam getExamAt(LocalDate date) { // TODO-1 determine whether an exam has been scheduled for the given date, using a for-loop for(Exam exam : exams) { if(exam.getDate().equals(date)) { return exam; } } // TODO-2 determine whether an exam has been scheduled for the given date, using .stream() return null; } public Exam getExamAt(String dateString) { return getExamAt(LocalDate.parse(dateString)); } /** * Finds all Exams of the Course that match a given filter predicate * * @param filter * @return */ public Set<Exam> findExams(Predicate<Exam> filter) { Set<Exam> foundExams = new TreeSet<>(); // DONE-1 deliver the set of exams which match the filter using .forEach() exams.forEach(exam -> { if(filter.test(exam)) { foundExams.add(exam); } }); // TODO-2 deliver the set of exams which match the filter using .stream() return foundExams; } /** * calculates the average grade of all results of all exams of the Course * * @return */ public double getAverageGrade() { double gradeAverage = 0.0; // int studentcount = 0; // DONE-1a calculate gradeAverage using for-loop iteration // for(Exam exam : exams) { // for(Map.Entry<Student, Double> entry : exam.getResults().entrySet()) { // gradeAverage += entry.getValue(); // studentcount++; // } // } // // if(studentcount == 0) { // return 0; // } // // return gradeAverage/studentcount; // DONE-1b calculate gradeAverage using .forEach() and lambda expression var wrapper = new Object() {double gradeAverage = 0.0; int studentcount = 0;}; exams.forEach(exam -> { exam.getResults().entrySet().forEach(studentDoubleEntry -> { wrapper.gradeAverage += studentDoubleEntry.getValue(); wrapper.studentcount++; }); }); if(wrapper.studentcount == 0) { return 0; } return wrapper.gradeAverage / wrapper.studentcount; // TODO-2 calculate gradeAverage using .stream() // (can be done without need of gradeCount) } private static Random randomizer = new Random(); private static Course[] theCourses = { new Course("1019MAT", "ESK Mathematics", 2), new Course("1019DUT", "ESK Dutch", 2), new Course("1019ENG", "ESK English", 2), new Course("1019PER", "PSK Personal Skills", 2), new Course("1019COM", "PSK Communication", 2), new Course("1019COL", "PSK Collaboration", 2), new Course("1019RES", "PSK Research", 2), new Course("1019PRO", "Programming", 3), new Course("1019OP1", "Object Oriented Programming 1", 3), new Course("1019OP2", "Object Oriented Programming 2", 3), new Course("1019DAM", "Data Modelling", 3), new Course("1019DB2", "Databases 2", 3), new Course("1019WET", "Web Technology", 3), new Course("1019TES", "Testing", 3), new Course("1019UID", "User Interaction Design", 3), new Course("1019BUS", "Business", 3), new Course("1019INF", "Infrastructure", 3), new Course("2019WEF", "Web Frameworks", 6), new Course("2019ADS", "Algorithms and Data Structures", 8), new Course("3019ERP", "Enterprise Resource Processing", 4), new Course("3019NSO", "Simulation and Optimisation with MatLab", 4), new Course("3019LIA", "Linear Algebra", 4), new Course("3019LSC", "Logistics and Supply Chain Management", 4), new Course("3019PME", "Physics and Mechanical Engineering", 4), new Course("3019NLD", "Linear and non-linear dynamics", 4), new Course("3019NMC", "Numerical Methods with C++", 4), new Course("3019VVR", "3D visualisation and virtual reality", 4), new Course("4019AAD", "Architecture and Design", 4), new Course("4019RED", "Research Design", 3), new Course("4019RED", "Advisory Skills", 3), new Course("4019ASV", "Automated Software Validation", 4), new Course("4019PAC", "Parallel Computing", 4), new Course("4019DIM", "Discrete Mathematics", 4) }; public static Course getARandomCourse() { Course course = theCourses[randomizer.nextInt(theCourses.length)]; return new Course(course.code, course.title, course.ects); } public String getCode() { return code; } public String getTitle() { return title; } public int getEcts() { return ects; } public Set<Exam> getExams() { return exams; } }
UTF-8
Java
6,349
java
Course.java
Java
[]
null
[]
import java.time.LocalDate; import java.util.*; import java.util.function.Predicate; import java.util.stream.Collectors; public class Course { private String code; private String title; private int ects; private Set<Exam> exams; public Course(String code) { this.code = code; title = ""; ects = 0; exams = new HashSet<>(); } public Course(String code, String title, int ects) { this(code); this.title = title; this.ects = ects; } @Override public String toString() { return String.format("%s(%s)", title, code); } // DONE make sure courses can be printed. The format is 'title(code)' // TODO make sure Courses can be added to a HashMap, HashSet, TreeSet, HashMap and TreeMap // every course shall have a unique code @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Course course = (Course) o; return code.equals(course.code); } @Override public int hashCode() { return Objects.hash(code); } /** * Retrieves the Exam of the Course at a given date, if any * * @param date * @return returns null if no Exam has been scheduled for the given date */ public Exam getExamAt(LocalDate date) { // TODO-1 determine whether an exam has been scheduled for the given date, using a for-loop for(Exam exam : exams) { if(exam.getDate().equals(date)) { return exam; } } // TODO-2 determine whether an exam has been scheduled for the given date, using .stream() return null; } public Exam getExamAt(String dateString) { return getExamAt(LocalDate.parse(dateString)); } /** * Finds all Exams of the Course that match a given filter predicate * * @param filter * @return */ public Set<Exam> findExams(Predicate<Exam> filter) { Set<Exam> foundExams = new TreeSet<>(); // DONE-1 deliver the set of exams which match the filter using .forEach() exams.forEach(exam -> { if(filter.test(exam)) { foundExams.add(exam); } }); // TODO-2 deliver the set of exams which match the filter using .stream() return foundExams; } /** * calculates the average grade of all results of all exams of the Course * * @return */ public double getAverageGrade() { double gradeAverage = 0.0; // int studentcount = 0; // DONE-1a calculate gradeAverage using for-loop iteration // for(Exam exam : exams) { // for(Map.Entry<Student, Double> entry : exam.getResults().entrySet()) { // gradeAverage += entry.getValue(); // studentcount++; // } // } // // if(studentcount == 0) { // return 0; // } // // return gradeAverage/studentcount; // DONE-1b calculate gradeAverage using .forEach() and lambda expression var wrapper = new Object() {double gradeAverage = 0.0; int studentcount = 0;}; exams.forEach(exam -> { exam.getResults().entrySet().forEach(studentDoubleEntry -> { wrapper.gradeAverage += studentDoubleEntry.getValue(); wrapper.studentcount++; }); }); if(wrapper.studentcount == 0) { return 0; } return wrapper.gradeAverage / wrapper.studentcount; // TODO-2 calculate gradeAverage using .stream() // (can be done without need of gradeCount) } private static Random randomizer = new Random(); private static Course[] theCourses = { new Course("1019MAT", "ESK Mathematics", 2), new Course("1019DUT", "ESK Dutch", 2), new Course("1019ENG", "ESK English", 2), new Course("1019PER", "PSK Personal Skills", 2), new Course("1019COM", "PSK Communication", 2), new Course("1019COL", "PSK Collaboration", 2), new Course("1019RES", "PSK Research", 2), new Course("1019PRO", "Programming", 3), new Course("1019OP1", "Object Oriented Programming 1", 3), new Course("1019OP2", "Object Oriented Programming 2", 3), new Course("1019DAM", "Data Modelling", 3), new Course("1019DB2", "Databases 2", 3), new Course("1019WET", "Web Technology", 3), new Course("1019TES", "Testing", 3), new Course("1019UID", "User Interaction Design", 3), new Course("1019BUS", "Business", 3), new Course("1019INF", "Infrastructure", 3), new Course("2019WEF", "Web Frameworks", 6), new Course("2019ADS", "Algorithms and Data Structures", 8), new Course("3019ERP", "Enterprise Resource Processing", 4), new Course("3019NSO", "Simulation and Optimisation with MatLab", 4), new Course("3019LIA", "Linear Algebra", 4), new Course("3019LSC", "Logistics and Supply Chain Management", 4), new Course("3019PME", "Physics and Mechanical Engineering", 4), new Course("3019NLD", "Linear and non-linear dynamics", 4), new Course("3019NMC", "Numerical Methods with C++", 4), new Course("3019VVR", "3D visualisation and virtual reality", 4), new Course("4019AAD", "Architecture and Design", 4), new Course("4019RED", "Research Design", 3), new Course("4019RED", "Advisory Skills", 3), new Course("4019ASV", "Automated Software Validation", 4), new Course("4019PAC", "Parallel Computing", 4), new Course("4019DIM", "Discrete Mathematics", 4) }; public static Course getARandomCourse() { Course course = theCourses[randomizer.nextInt(theCourses.length)]; return new Course(course.code, course.title, course.ects); } public String getCode() { return code; } public String getTitle() { return title; } public int getEcts() { return ects; } public Set<Exam> getExams() { return exams; } }
6,349
0.572846
0.54292
199
30.904522
26.57342
99
false
false
0
0
0
0
0
0
0.824121
false
false
7
afe31fdbd799df9a8c8d1d6445840dcf265b1ad0
4,904,852,697,446
0496b3a9b6d9de9df8b6570b34e03c7ee234da3a
/algo/src/main/java/zty/practise/algo/leetcode700/LeetCode747.java
90b59516a5ad649bfea836d380e5e29fb3d50157
[]
no_license
zhangtianyi123/algo
https://github.com/zhangtianyi123/algo
3e411796a80747f3cdb68025aa188b7f7647b974
913302f935fbf6e450b055c1f3734c21d1afbca4
refs/heads/master
2020-11-27T07:35:10.919000
2020-02-27T12:45:52
2020-02-27T12:45:52
229,356,728
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package zty.practise.algo.leetcode700; /** * 能想到的最直接的方式就是桶计数 * * @author zhangtianyi * */ public class LeetCode747 { public int dominantIndex(int[] nums) { int[] bucket = new int[1001]; for (int num : nums) { bucket[num]++; } int max = -1; int smax = -1; for (int i = 1000; i >= 0; i--) { if (max == -1 && bucket[i] > 0) { if (bucket[i] > 1) return -1; max = i; continue; } if (max > -1 && bucket[i] > 0) { if (i == 0 || max / i > 1) break; else return -1; } } for (int i = 0; i < nums.length; i++) { if (nums[i] == max) return i; } return -1; } /** * 线性扫描 直接搜索法 */ public int dominantIndex2(int[] nums) { int maxIndex = 0; //找最大 for (int i = 0; i < nums.length; ++i) { if (nums[i] > nums[maxIndex]) maxIndex = i; } //找次大 for (int i = 0; i < nums.length; ++i) { if (maxIndex != i && nums[maxIndex] < 2 * nums[i]) return -1; } return maxIndex; } }
UTF-8
Java
1,141
java
LeetCode747.java
Java
[ { "context": "eetcode700;\n\n/**\n * 能想到的最直接的方式就是桶计数\n * \n * @author zhangtianyi\n *\n */\npublic class LeetCode747 {\n\n\tpublic in", "end": 85, "score": 0.5615459084510803, "start": 78, "tag": "USERNAME", "value": "zhangti" }, { "context": "00;\n\n/**\n * 能想到的最直接的方式就是桶计数\n * \n * @author zhangtianyi\n *\n */\npublic class LeetCode747 {\n\n\tpublic int do", "end": 89, "score": 0.7253600358963013, "start": 85, "tag": "NAME", "value": "anyi" } ]
null
[]
package zty.practise.algo.leetcode700; /** * 能想到的最直接的方式就是桶计数 * * @author zhangtianyi * */ public class LeetCode747 { public int dominantIndex(int[] nums) { int[] bucket = new int[1001]; for (int num : nums) { bucket[num]++; } int max = -1; int smax = -1; for (int i = 1000; i >= 0; i--) { if (max == -1 && bucket[i] > 0) { if (bucket[i] > 1) return -1; max = i; continue; } if (max > -1 && bucket[i] > 0) { if (i == 0 || max / i > 1) break; else return -1; } } for (int i = 0; i < nums.length; i++) { if (nums[i] == max) return i; } return -1; } /** * 线性扫描 直接搜索法 */ public int dominantIndex2(int[] nums) { int maxIndex = 0; //找最大 for (int i = 0; i < nums.length; ++i) { if (nums[i] > nums[maxIndex]) maxIndex = i; } //找次大 for (int i = 0; i < nums.length; ++i) { if (maxIndex != i && nums[maxIndex] < 2 * nums[i]) return -1; } return maxIndex; } }
1,141
0.450509
0.419056
63
16.15873
14.926494
62
false
false
0
0
0
0
0
0
1.746032
false
false
7
f2e15ace5f83a637546dc664352b7a5f5be1a13f
24,051,816,869,359
7cc0522604fb20416b5ff4057159d5b1bd3a99ce
/EmployeeWagePrograms/EmpWageUC2.java
724e90180170ca8d36186bec3e2138da896cdcf1
[]
no_license
shivani987/java-based-programs
https://github.com/shivani987/java-based-programs
aca12a6890038b39766e4564c5e589a8e56b3738
065407365bdb7c00e4ace7e2794fa0e3711817b8
refs/heads/master
2022-11-22T10:11:15.269000
2020-07-20T16:14:28
2020-07-20T16:14:28
279,345,610
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// Creating class for Calculating Daily Employee Wage public class EmpWageUC2 { private static final int IS_FULL_TIME=1; public static void main(String args[]) { // Calling function double wage= empCheck(); System.out.println("Total employee" +wage); } /** * Check employee is present * @return total employee wage. */ public static double empCheck() { final double ranNumber = Math.floor(Math.random() * 10) % 2; if(IS_FULL_TIME == ranNumber) { System.out.println("Employee is present"); final double totalWage = 20 * 8; return totalWage; } else { System.out.println("Employee is absent"); return 0.0; } } }
UTF-8
Java
814
java
EmpWageUC2.java
Java
[]
null
[]
// Creating class for Calculating Daily Employee Wage public class EmpWageUC2 { private static final int IS_FULL_TIME=1; public static void main(String args[]) { // Calling function double wage= empCheck(); System.out.println("Total employee" +wage); } /** * Check employee is present * @return total employee wage. */ public static double empCheck() { final double ranNumber = Math.floor(Math.random() * 10) % 2; if(IS_FULL_TIME == ranNumber) { System.out.println("Employee is present"); final double totalWage = 20 * 8; return totalWage; } else { System.out.println("Employee is absent"); return 0.0; } } }
814
0.542998
0.530713
31
25.258064
18.734077
69
false
false
0
0
0
0
0
0
0.290323
false
false
7
77f970daa9b38e771b51c752b977fb00368e56c4
23,252,953,004,321
9fae695ff52c7394b53fdbfd1068d369f664c1ba
/app/src/main/java/uci/develops/wiraenergimobile/fragment/FragmentProfileCustomerContactInfo.java
97c8ab18c2bbac03ff740bdf0c5fd1f8bb6cb01c
[]
no_license
uciarahito/ituitu
https://github.com/uciarahito/ituitu
9cba446eacc89ff58c0304d91ec194e5fa67f862
5a0df909ab897e7b756eda8425844e04cd3cadcb
refs/heads/master
2021-05-03T22:31:42.079000
2016-12-30T04:31:27
2016-12-30T04:31:27
71,607,696
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package uci.develops.wiraenergimobile.fragment; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; import butterknife.BindView; import butterknife.ButterKnife; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import uci.develops.wiraenergimobile.R; import uci.develops.wiraenergimobile.activity.FormCustomerActivity; import uci.develops.wiraenergimobile.helper.SharedPreferenceManager; import uci.develops.wiraenergimobile.model.CustomerModel; import uci.develops.wiraenergimobile.response.CustomerResponse; import uci.develops.wiraenergimobile.service.RestClient; /** * Created by user on 10/22/2016. */ public class FragmentProfileCustomerContactInfo extends Fragment { @BindView(R.id.textView_name1) TextView textView_name1; @BindView(R.id.textView_name2) TextView textView_name2; @BindView(R.id.textView_name3) TextView textView_name3; @BindView(R.id.textView_phone1) TextView textView_phone1; @BindView(R.id.textView_phone2) TextView textView_phone2; @BindView(R.id.textView_phone3) TextView textView_phone3; @BindView(R.id.textView_mobile1) TextView textView_mobile1; @BindView(R.id.textView_mobile2) TextView textView_mobile2; @BindView(R.id.textView_mobile3) TextView textView_mobile3; @BindView(R.id.textView_email1) TextView textView_email1; @BindView(R.id.textView_email2) TextView textView_email2; @BindView(R.id.textView_email3) TextView textView_email3; @BindView(R.id.textView_jabatan1) TextView textView_jabatan1; @BindView(R.id.textView_jabatan2) TextView textView_jabatan2; @BindView(R.id.textView_jabatan3) TextView textView_jabatan3; private String decode = "", token = ""; public FragmentProfileCustomerContactInfo() { // Required empty public constructor } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view; view = inflater.inflate(R.layout.fragment_profil_contact, container, false); ButterKnife.bind(this, view); decode = new SharedPreferenceManager().getPreferences(getActivity().getApplicationContext(), "customer_decode"); token = new SharedPreferenceManager().getPreferences(getActivity().getApplicationContext(), "token"); loadData(); return view; } private void loadData() { Call<CustomerResponse> customerResponseCall = RestClient.getRestClient().getCustomer("Bearer " + token, decode); customerResponseCall.enqueue(new Callback<CustomerResponse>() { @Override public void onResponse(Call<CustomerResponse> call, Response<CustomerResponse> response) { if (response.isSuccessful()) { if (response.body().getData().size() > 0) { CustomerModel customerModel = new CustomerModel(); customerModel = response.body().getData().get(0); textView_name1.setText(customerModel.getFirst_name() == null ? "" : customerModel.getFirst_name()+" "+customerModel.getLast_name()); textView_name2.setText(customerModel.getName2() == null ? "" : customerModel.getName2()); textView_name3.setText(customerModel.getName3() == null ? "" : customerModel.getName3()); textView_phone1.setText(customerModel.getPhone1() == null ? "" : customerModel.getPhone1()); textView_phone2.setText(customerModel.getPhone2() == null ? "" : customerModel.getPhone2()); textView_phone3.setText(customerModel.getPhone3() == null ? "" : customerModel.getPhone3()); textView_mobile1.setText(customerModel.getMobile1() == null ? "" : customerModel.getMobile1()); textView_mobile2.setText(customerModel.getMobile2() == null ? "" : customerModel.getMobile2()); textView_mobile3.setText(customerModel.getMobile3() == null ? "" : customerModel.getMobile3()); textView_email1.setText(customerModel.getEmail() == null ? "" : customerModel.getEmail()); textView_email2.setText(customerModel.getEmail2() == null ? "" : customerModel.getEmail2()); textView_email3.setText(customerModel.getEmail3() == null ? "" : customerModel.getEmail3()); textView_jabatan1.setText(customerModel.getJabatan1() == null ? "" : customerModel.getJabatan1()); textView_jabatan2.setText(customerModel.getJabatan2() == null ? "" : customerModel.getJabatan2()); textView_jabatan3.setText(customerModel.getJabatan3() == null ? "" : customerModel.getJabatan3()); } } } @Override public void onFailure(Call<CustomerResponse> call, Throwable t) { } }); } }
UTF-8
Java
5,352
java
FragmentProfileCustomerContactInfo.java
Java
[]
null
[]
package uci.develops.wiraenergimobile.fragment; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; import butterknife.BindView; import butterknife.ButterKnife; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import uci.develops.wiraenergimobile.R; import uci.develops.wiraenergimobile.activity.FormCustomerActivity; import uci.develops.wiraenergimobile.helper.SharedPreferenceManager; import uci.develops.wiraenergimobile.model.CustomerModel; import uci.develops.wiraenergimobile.response.CustomerResponse; import uci.develops.wiraenergimobile.service.RestClient; /** * Created by user on 10/22/2016. */ public class FragmentProfileCustomerContactInfo extends Fragment { @BindView(R.id.textView_name1) TextView textView_name1; @BindView(R.id.textView_name2) TextView textView_name2; @BindView(R.id.textView_name3) TextView textView_name3; @BindView(R.id.textView_phone1) TextView textView_phone1; @BindView(R.id.textView_phone2) TextView textView_phone2; @BindView(R.id.textView_phone3) TextView textView_phone3; @BindView(R.id.textView_mobile1) TextView textView_mobile1; @BindView(R.id.textView_mobile2) TextView textView_mobile2; @BindView(R.id.textView_mobile3) TextView textView_mobile3; @BindView(R.id.textView_email1) TextView textView_email1; @BindView(R.id.textView_email2) TextView textView_email2; @BindView(R.id.textView_email3) TextView textView_email3; @BindView(R.id.textView_jabatan1) TextView textView_jabatan1; @BindView(R.id.textView_jabatan2) TextView textView_jabatan2; @BindView(R.id.textView_jabatan3) TextView textView_jabatan3; private String decode = "", token = ""; public FragmentProfileCustomerContactInfo() { // Required empty public constructor } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view; view = inflater.inflate(R.layout.fragment_profil_contact, container, false); ButterKnife.bind(this, view); decode = new SharedPreferenceManager().getPreferences(getActivity().getApplicationContext(), "customer_decode"); token = new SharedPreferenceManager().getPreferences(getActivity().getApplicationContext(), "token"); loadData(); return view; } private void loadData() { Call<CustomerResponse> customerResponseCall = RestClient.getRestClient().getCustomer("Bearer " + token, decode); customerResponseCall.enqueue(new Callback<CustomerResponse>() { @Override public void onResponse(Call<CustomerResponse> call, Response<CustomerResponse> response) { if (response.isSuccessful()) { if (response.body().getData().size() > 0) { CustomerModel customerModel = new CustomerModel(); customerModel = response.body().getData().get(0); textView_name1.setText(customerModel.getFirst_name() == null ? "" : customerModel.getFirst_name()+" "+customerModel.getLast_name()); textView_name2.setText(customerModel.getName2() == null ? "" : customerModel.getName2()); textView_name3.setText(customerModel.getName3() == null ? "" : customerModel.getName3()); textView_phone1.setText(customerModel.getPhone1() == null ? "" : customerModel.getPhone1()); textView_phone2.setText(customerModel.getPhone2() == null ? "" : customerModel.getPhone2()); textView_phone3.setText(customerModel.getPhone3() == null ? "" : customerModel.getPhone3()); textView_mobile1.setText(customerModel.getMobile1() == null ? "" : customerModel.getMobile1()); textView_mobile2.setText(customerModel.getMobile2() == null ? "" : customerModel.getMobile2()); textView_mobile3.setText(customerModel.getMobile3() == null ? "" : customerModel.getMobile3()); textView_email1.setText(customerModel.getEmail() == null ? "" : customerModel.getEmail()); textView_email2.setText(customerModel.getEmail2() == null ? "" : customerModel.getEmail2()); textView_email3.setText(customerModel.getEmail3() == null ? "" : customerModel.getEmail3()); textView_jabatan1.setText(customerModel.getJabatan1() == null ? "" : customerModel.getJabatan1()); textView_jabatan2.setText(customerModel.getJabatan2() == null ? "" : customerModel.getJabatan2()); textView_jabatan3.setText(customerModel.getJabatan3() == null ? "" : customerModel.getJabatan3()); } } } @Override public void onFailure(Call<CustomerResponse> call, Throwable t) { } }); } }
5,352
0.671525
0.655643
104
50.46154
39.671955
156
false
false
0
0
0
0
0
0
0.711538
false
false
7
438f04a047d34687fa71cf1bd1f87fb7da25fc27
23,252,953,003,313
c54a89a9746c863a29b764b2194b091a6b6d582c
/blog-api/src/main/java/com/mszlu/blog/dao/dos/Archives.java
88d0dae3826a33c64522addbc2b37e8fb7b7da12
[]
no_license
mrlincai/myBlog
https://github.com/mrlincai/myBlog
9825a128be1d978f4c1abec298ddafddf18ccccd
3bb2e85e079bc1be59b8832e02307e6a4aef35cb
refs/heads/master
2023-08-21T12:27:49.098000
2021-10-01T02:43:59
2021-10-01T02:43:59
412,279,873
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mszlu.blog.dao.dos; import lombok.Data; /** * @author LinCai * @create 2021-09-23 14:28 * 包dos也是数据库里查出来的 不需要持久化的对象 */ @Data public class Archives { private Integer year; private Integer month; private Long count; }
UTF-8
Java
288
java
Archives.java
Java
[ { "context": "blog.dao.dos;\n\nimport lombok.Data;\n\n/**\n * @author LinCai\n * @create 2021-09-23 14:28\n * 包dos也是数据库里查出来的 不需要", "end": 75, "score": 0.9380181431770325, "start": 69, "tag": "NAME", "value": "LinCai" } ]
null
[]
package com.mszlu.blog.dao.dos; import lombok.Data; /** * @author LinCai * @create 2021-09-23 14:28 * 包dos也是数据库里查出来的 不需要持久化的对象 */ @Data public class Archives { private Integer year; private Integer month; private Long count; }
288
0.685484
0.637097
18
12.777778
11.8629
31
false
false
0
0
0
0
0
0
0.277778
false
false
7
822791efc7b67018ce1c29ce8bcfc90a96a0862b
19,782,619,426,948
62b2f10b849f862c20588e45e4d851d4a4ffdc37
/RichException/src/com/carlnaso/handler/CollectionHandler.java
5bb646c47f1a95211fa76556e5aad19d3562fda3
[]
no_license
cnaso/Java
https://github.com/cnaso/Java
319eb2896595a0f4d69ce6b838a8d1c05fea29ee
a3b2837617791381fea67083a06cc7d91640ed07
refs/heads/master
2016-09-05T10:44:12.892000
2016-01-03T22:49:57
2016-01-03T22:50:06
20,172,840
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.carlnaso.handler; import com.carlnaso.exception.ErrorCode; import com.carlnaso.exception.RichException; import java.util.ArrayList; import java.util.List; public class CollectionHandler implements ExceptionHandler { private final List<RichException> exceptions = new ArrayList<RichException>(); @Override public void handle(RichException e) { exceptions.add(e); } @Override public List<RichException> getExceptions() { return exceptions; } @Override public List<RichException> getExceptions(ErrorCode errorCode) { List<RichException> list = new ArrayList<RichException>(); for (RichException exception : exceptions) { if (exception.getErrorCode().getCode() == errorCode.getCode()) { list.add(exception); } } return list; } }
UTF-8
Java
873
java
CollectionHandler.java
Java
[]
null
[]
package com.carlnaso.handler; import com.carlnaso.exception.ErrorCode; import com.carlnaso.exception.RichException; import java.util.ArrayList; import java.util.List; public class CollectionHandler implements ExceptionHandler { private final List<RichException> exceptions = new ArrayList<RichException>(); @Override public void handle(RichException e) { exceptions.add(e); } @Override public List<RichException> getExceptions() { return exceptions; } @Override public List<RichException> getExceptions(ErrorCode errorCode) { List<RichException> list = new ArrayList<RichException>(); for (RichException exception : exceptions) { if (exception.getErrorCode().getCode() == errorCode.getCode()) { list.add(exception); } } return list; } }
873
0.670103
0.670103
34
24.67647
24.495762
82
false
false
0
0
0
0
0
0
0.323529
false
false
7
67f69c78a6238420c2f2965b699d6b4d62cae9ae
32,280,974,238,310
edc36c6dc5522dfd9703317b4beea9334c720f9c
/src/br/edu/univas/si/lab4/projeto/view/LoginFrame.java
d2892f9a3f9f126c2e1835732adf31b05407e366
[]
no_license
odhs/Controle-de-Estoque-LABIV
https://github.com/odhs/Controle-de-Estoque-LABIV
5ef750b106a8c1cd862c92fa7627ee67da705616
8ad6a84c37893b8fb17233a083fea95ac8f1073a
refs/heads/master
2021-01-23T07:16:30.631000
2013-11-16T01:02:14
2013-11-16T01:02:14
21,694,181
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.edu.univas.si.lab4.projeto.view; import java.awt.BorderLayout; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JDialog; import br.edu.univas.si.lab4.projeto.model.Usuario; public class LoginFrame extends JDialog{ private static final long serialVersionUID = 1L; private LoginPanel loginPanel; private MainFrame mainFrame; public LoginFrame(MainFrame mainFrame){ this.mainFrame = mainFrame; setTitle("Login Window"); initialize(); setSize(518, 496); this.setUndecorated(true); setModal(true); setLocationRelativeTo(null); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent arg0) { LoginFrame.this.mainFrame.dispose(); } }); } private void initialize() { add(getLoginPanel(), BorderLayout.CENTER); } public LoginPanel getLoginPanel() { if(loginPanel == null){ loginPanel = new LoginPanel(); } return loginPanel; } public Usuario getLoginData(){ Usuario usuario = new Usuario(); String userLogin = getLoginPanel().getLoginField().getText(); if(userLogin.isEmpty()) getLoginPanel().getLoginField().setBorder(getLoginPanel().getRedlineBorder()); usuario.setUserLogin(userLogin); String password = new String(getLoginPanel().getPasswordField().getPassword()); if(password.isEmpty()) getLoginPanel().getPasswordField().setBorder(getLoginPanel().getRedlineBorder()); usuario.setPassword(password); return usuario; } }
UTF-8
Java
1,506
java
LoginFrame.java
Java
[]
null
[]
package br.edu.univas.si.lab4.projeto.view; import java.awt.BorderLayout; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JDialog; import br.edu.univas.si.lab4.projeto.model.Usuario; public class LoginFrame extends JDialog{ private static final long serialVersionUID = 1L; private LoginPanel loginPanel; private MainFrame mainFrame; public LoginFrame(MainFrame mainFrame){ this.mainFrame = mainFrame; setTitle("Login Window"); initialize(); setSize(518, 496); this.setUndecorated(true); setModal(true); setLocationRelativeTo(null); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent arg0) { LoginFrame.this.mainFrame.dispose(); } }); } private void initialize() { add(getLoginPanel(), BorderLayout.CENTER); } public LoginPanel getLoginPanel() { if(loginPanel == null){ loginPanel = new LoginPanel(); } return loginPanel; } public Usuario getLoginData(){ Usuario usuario = new Usuario(); String userLogin = getLoginPanel().getLoginField().getText(); if(userLogin.isEmpty()) getLoginPanel().getLoginField().setBorder(getLoginPanel().getRedlineBorder()); usuario.setUserLogin(userLogin); String password = new String(getLoginPanel().getPasswordField().getPassword()); if(password.isEmpty()) getLoginPanel().getPasswordField().setBorder(getLoginPanel().getRedlineBorder()); usuario.setPassword(password); return usuario; } }
1,506
0.737052
0.730412
61
23.688524
21.314615
84
false
false
0
0
0
0
0
0
2
false
false
7
9e0ff0680682cc9417302b5d071cf701f68950f6
27,419,071,223,123
917c59198e9aebfbbab3308ea5e86dff5ad53275
/sdk/java/src/main/java/com/pulumi/alicloud/ga/BasicEndpointArgs.java
c1fbc95dedac81b5762b7462e1de9a31009c3af8
[ "Apache-2.0", "MPL-2.0", "BSD-3-Clause" ]
permissive
pulumi/pulumi-alicloud
https://github.com/pulumi/pulumi-alicloud
7dae47cc2c6e276d4264001ef361d71ed3a5ad29
ffddb9036f7893fbd58863d8364a4977eb1bee17
refs/heads/master
2023-09-01T10:57:34.824000
2023-08-31T05:34:31
2023-08-31T05:34:31
154,406,339
56
5
Apache-2.0
false
2023-09-11T17:22:49
2018-10-23T22:45:48
2023-09-01T07:43:51
2023-09-11T17:22:47
92,813
45
7
7
Java
false
false
// *** WARNING: this file was generated by pulumi-java-gen. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** package com.pulumi.alicloud.ga; import com.pulumi.core.Output; import com.pulumi.core.annotations.Import; import java.lang.String; import java.util.Objects; import java.util.Optional; import javax.annotation.Nullable; public final class BasicEndpointArgs extends com.pulumi.resources.ResourceArgs { public static final BasicEndpointArgs Empty = new BasicEndpointArgs(); /** * The ID of the Basic GA instance. * */ @Import(name="acceleratorId", required=true) private Output<String> acceleratorId; /** * @return The ID of the Basic GA instance. * */ public Output<String> acceleratorId() { return this.acceleratorId; } /** * The name of the Basic Endpoint. * */ @Import(name="basicEndpointName") private @Nullable Output<String> basicEndpointName; /** * @return The name of the Basic Endpoint. * */ public Optional<Output<String>> basicEndpointName() { return Optional.ofNullable(this.basicEndpointName); } /** * The address of the Basic Endpoint. * */ @Import(name="endpointAddress", required=true) private Output<String> endpointAddress; /** * @return The address of the Basic Endpoint. * */ public Output<String> endpointAddress() { return this.endpointAddress; } /** * The ID of the Basic Endpoint Group. * */ @Import(name="endpointGroupId", required=true) private Output<String> endpointGroupId; /** * @return The ID of the Basic Endpoint Group. * */ public Output<String> endpointGroupId() { return this.endpointGroupId; } /** * The sub address of the Basic Endpoint. * */ @Import(name="endpointSubAddress") private @Nullable Output<String> endpointSubAddress; /** * @return The sub address of the Basic Endpoint. * */ public Optional<Output<String>> endpointSubAddress() { return Optional.ofNullable(this.endpointSubAddress); } /** * The sub address type of the Basic Endpoint. Valid values: `primary`, `secondary`. * */ @Import(name="endpointSubAddressType") private @Nullable Output<String> endpointSubAddressType; /** * @return The sub address type of the Basic Endpoint. Valid values: `primary`, `secondary`. * */ public Optional<Output<String>> endpointSubAddressType() { return Optional.ofNullable(this.endpointSubAddressType); } /** * The type of the Basic Endpoint. Valid values: `ENI`, `SLB`, `ECS` and `NLB`. * */ @Import(name="endpointType", required=true) private Output<String> endpointType; /** * @return The type of the Basic Endpoint. Valid values: `ENI`, `SLB`, `ECS` and `NLB`. * */ public Output<String> endpointType() { return this.endpointType; } /** * The zone id of the Basic Endpoint. * */ @Import(name="endpointZoneId") private @Nullable Output<String> endpointZoneId; /** * @return The zone id of the Basic Endpoint. * */ public Optional<Output<String>> endpointZoneId() { return Optional.ofNullable(this.endpointZoneId); } private BasicEndpointArgs() {} private BasicEndpointArgs(BasicEndpointArgs $) { this.acceleratorId = $.acceleratorId; this.basicEndpointName = $.basicEndpointName; this.endpointAddress = $.endpointAddress; this.endpointGroupId = $.endpointGroupId; this.endpointSubAddress = $.endpointSubAddress; this.endpointSubAddressType = $.endpointSubAddressType; this.endpointType = $.endpointType; this.endpointZoneId = $.endpointZoneId; } public static Builder builder() { return new Builder(); } public static Builder builder(BasicEndpointArgs defaults) { return new Builder(defaults); } public static final class Builder { private BasicEndpointArgs $; public Builder() { $ = new BasicEndpointArgs(); } public Builder(BasicEndpointArgs defaults) { $ = new BasicEndpointArgs(Objects.requireNonNull(defaults)); } /** * @param acceleratorId The ID of the Basic GA instance. * * @return builder * */ public Builder acceleratorId(Output<String> acceleratorId) { $.acceleratorId = acceleratorId; return this; } /** * @param acceleratorId The ID of the Basic GA instance. * * @return builder * */ public Builder acceleratorId(String acceleratorId) { return acceleratorId(Output.of(acceleratorId)); } /** * @param basicEndpointName The name of the Basic Endpoint. * * @return builder * */ public Builder basicEndpointName(@Nullable Output<String> basicEndpointName) { $.basicEndpointName = basicEndpointName; return this; } /** * @param basicEndpointName The name of the Basic Endpoint. * * @return builder * */ public Builder basicEndpointName(String basicEndpointName) { return basicEndpointName(Output.of(basicEndpointName)); } /** * @param endpointAddress The address of the Basic Endpoint. * * @return builder * */ public Builder endpointAddress(Output<String> endpointAddress) { $.endpointAddress = endpointAddress; return this; } /** * @param endpointAddress The address of the Basic Endpoint. * * @return builder * */ public Builder endpointAddress(String endpointAddress) { return endpointAddress(Output.of(endpointAddress)); } /** * @param endpointGroupId The ID of the Basic Endpoint Group. * * @return builder * */ public Builder endpointGroupId(Output<String> endpointGroupId) { $.endpointGroupId = endpointGroupId; return this; } /** * @param endpointGroupId The ID of the Basic Endpoint Group. * * @return builder * */ public Builder endpointGroupId(String endpointGroupId) { return endpointGroupId(Output.of(endpointGroupId)); } /** * @param endpointSubAddress The sub address of the Basic Endpoint. * * @return builder * */ public Builder endpointSubAddress(@Nullable Output<String> endpointSubAddress) { $.endpointSubAddress = endpointSubAddress; return this; } /** * @param endpointSubAddress The sub address of the Basic Endpoint. * * @return builder * */ public Builder endpointSubAddress(String endpointSubAddress) { return endpointSubAddress(Output.of(endpointSubAddress)); } /** * @param endpointSubAddressType The sub address type of the Basic Endpoint. Valid values: `primary`, `secondary`. * * @return builder * */ public Builder endpointSubAddressType(@Nullable Output<String> endpointSubAddressType) { $.endpointSubAddressType = endpointSubAddressType; return this; } /** * @param endpointSubAddressType The sub address type of the Basic Endpoint. Valid values: `primary`, `secondary`. * * @return builder * */ public Builder endpointSubAddressType(String endpointSubAddressType) { return endpointSubAddressType(Output.of(endpointSubAddressType)); } /** * @param endpointType The type of the Basic Endpoint. Valid values: `ENI`, `SLB`, `ECS` and `NLB`. * * @return builder * */ public Builder endpointType(Output<String> endpointType) { $.endpointType = endpointType; return this; } /** * @param endpointType The type of the Basic Endpoint. Valid values: `ENI`, `SLB`, `ECS` and `NLB`. * * @return builder * */ public Builder endpointType(String endpointType) { return endpointType(Output.of(endpointType)); } /** * @param endpointZoneId The zone id of the Basic Endpoint. * * @return builder * */ public Builder endpointZoneId(@Nullable Output<String> endpointZoneId) { $.endpointZoneId = endpointZoneId; return this; } /** * @param endpointZoneId The zone id of the Basic Endpoint. * * @return builder * */ public Builder endpointZoneId(String endpointZoneId) { return endpointZoneId(Output.of(endpointZoneId)); } public BasicEndpointArgs build() { $.acceleratorId = Objects.requireNonNull($.acceleratorId, "expected parameter 'acceleratorId' to be non-null"); $.endpointAddress = Objects.requireNonNull($.endpointAddress, "expected parameter 'endpointAddress' to be non-null"); $.endpointGroupId = Objects.requireNonNull($.endpointGroupId, "expected parameter 'endpointGroupId' to be non-null"); $.endpointType = Objects.requireNonNull($.endpointType, "expected parameter 'endpointType' to be non-null"); return $; } } }
UTF-8
Java
9,980
java
BasicEndpointArgs.java
Java
[]
null
[]
// *** WARNING: this file was generated by pulumi-java-gen. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** package com.pulumi.alicloud.ga; import com.pulumi.core.Output; import com.pulumi.core.annotations.Import; import java.lang.String; import java.util.Objects; import java.util.Optional; import javax.annotation.Nullable; public final class BasicEndpointArgs extends com.pulumi.resources.ResourceArgs { public static final BasicEndpointArgs Empty = new BasicEndpointArgs(); /** * The ID of the Basic GA instance. * */ @Import(name="acceleratorId", required=true) private Output<String> acceleratorId; /** * @return The ID of the Basic GA instance. * */ public Output<String> acceleratorId() { return this.acceleratorId; } /** * The name of the Basic Endpoint. * */ @Import(name="basicEndpointName") private @Nullable Output<String> basicEndpointName; /** * @return The name of the Basic Endpoint. * */ public Optional<Output<String>> basicEndpointName() { return Optional.ofNullable(this.basicEndpointName); } /** * The address of the Basic Endpoint. * */ @Import(name="endpointAddress", required=true) private Output<String> endpointAddress; /** * @return The address of the Basic Endpoint. * */ public Output<String> endpointAddress() { return this.endpointAddress; } /** * The ID of the Basic Endpoint Group. * */ @Import(name="endpointGroupId", required=true) private Output<String> endpointGroupId; /** * @return The ID of the Basic Endpoint Group. * */ public Output<String> endpointGroupId() { return this.endpointGroupId; } /** * The sub address of the Basic Endpoint. * */ @Import(name="endpointSubAddress") private @Nullable Output<String> endpointSubAddress; /** * @return The sub address of the Basic Endpoint. * */ public Optional<Output<String>> endpointSubAddress() { return Optional.ofNullable(this.endpointSubAddress); } /** * The sub address type of the Basic Endpoint. Valid values: `primary`, `secondary`. * */ @Import(name="endpointSubAddressType") private @Nullable Output<String> endpointSubAddressType; /** * @return The sub address type of the Basic Endpoint. Valid values: `primary`, `secondary`. * */ public Optional<Output<String>> endpointSubAddressType() { return Optional.ofNullable(this.endpointSubAddressType); } /** * The type of the Basic Endpoint. Valid values: `ENI`, `SLB`, `ECS` and `NLB`. * */ @Import(name="endpointType", required=true) private Output<String> endpointType; /** * @return The type of the Basic Endpoint. Valid values: `ENI`, `SLB`, `ECS` and `NLB`. * */ public Output<String> endpointType() { return this.endpointType; } /** * The zone id of the Basic Endpoint. * */ @Import(name="endpointZoneId") private @Nullable Output<String> endpointZoneId; /** * @return The zone id of the Basic Endpoint. * */ public Optional<Output<String>> endpointZoneId() { return Optional.ofNullable(this.endpointZoneId); } private BasicEndpointArgs() {} private BasicEndpointArgs(BasicEndpointArgs $) { this.acceleratorId = $.acceleratorId; this.basicEndpointName = $.basicEndpointName; this.endpointAddress = $.endpointAddress; this.endpointGroupId = $.endpointGroupId; this.endpointSubAddress = $.endpointSubAddress; this.endpointSubAddressType = $.endpointSubAddressType; this.endpointType = $.endpointType; this.endpointZoneId = $.endpointZoneId; } public static Builder builder() { return new Builder(); } public static Builder builder(BasicEndpointArgs defaults) { return new Builder(defaults); } public static final class Builder { private BasicEndpointArgs $; public Builder() { $ = new BasicEndpointArgs(); } public Builder(BasicEndpointArgs defaults) { $ = new BasicEndpointArgs(Objects.requireNonNull(defaults)); } /** * @param acceleratorId The ID of the Basic GA instance. * * @return builder * */ public Builder acceleratorId(Output<String> acceleratorId) { $.acceleratorId = acceleratorId; return this; } /** * @param acceleratorId The ID of the Basic GA instance. * * @return builder * */ public Builder acceleratorId(String acceleratorId) { return acceleratorId(Output.of(acceleratorId)); } /** * @param basicEndpointName The name of the Basic Endpoint. * * @return builder * */ public Builder basicEndpointName(@Nullable Output<String> basicEndpointName) { $.basicEndpointName = basicEndpointName; return this; } /** * @param basicEndpointName The name of the Basic Endpoint. * * @return builder * */ public Builder basicEndpointName(String basicEndpointName) { return basicEndpointName(Output.of(basicEndpointName)); } /** * @param endpointAddress The address of the Basic Endpoint. * * @return builder * */ public Builder endpointAddress(Output<String> endpointAddress) { $.endpointAddress = endpointAddress; return this; } /** * @param endpointAddress The address of the Basic Endpoint. * * @return builder * */ public Builder endpointAddress(String endpointAddress) { return endpointAddress(Output.of(endpointAddress)); } /** * @param endpointGroupId The ID of the Basic Endpoint Group. * * @return builder * */ public Builder endpointGroupId(Output<String> endpointGroupId) { $.endpointGroupId = endpointGroupId; return this; } /** * @param endpointGroupId The ID of the Basic Endpoint Group. * * @return builder * */ public Builder endpointGroupId(String endpointGroupId) { return endpointGroupId(Output.of(endpointGroupId)); } /** * @param endpointSubAddress The sub address of the Basic Endpoint. * * @return builder * */ public Builder endpointSubAddress(@Nullable Output<String> endpointSubAddress) { $.endpointSubAddress = endpointSubAddress; return this; } /** * @param endpointSubAddress The sub address of the Basic Endpoint. * * @return builder * */ public Builder endpointSubAddress(String endpointSubAddress) { return endpointSubAddress(Output.of(endpointSubAddress)); } /** * @param endpointSubAddressType The sub address type of the Basic Endpoint. Valid values: `primary`, `secondary`. * * @return builder * */ public Builder endpointSubAddressType(@Nullable Output<String> endpointSubAddressType) { $.endpointSubAddressType = endpointSubAddressType; return this; } /** * @param endpointSubAddressType The sub address type of the Basic Endpoint. Valid values: `primary`, `secondary`. * * @return builder * */ public Builder endpointSubAddressType(String endpointSubAddressType) { return endpointSubAddressType(Output.of(endpointSubAddressType)); } /** * @param endpointType The type of the Basic Endpoint. Valid values: `ENI`, `SLB`, `ECS` and `NLB`. * * @return builder * */ public Builder endpointType(Output<String> endpointType) { $.endpointType = endpointType; return this; } /** * @param endpointType The type of the Basic Endpoint. Valid values: `ENI`, `SLB`, `ECS` and `NLB`. * * @return builder * */ public Builder endpointType(String endpointType) { return endpointType(Output.of(endpointType)); } /** * @param endpointZoneId The zone id of the Basic Endpoint. * * @return builder * */ public Builder endpointZoneId(@Nullable Output<String> endpointZoneId) { $.endpointZoneId = endpointZoneId; return this; } /** * @param endpointZoneId The zone id of the Basic Endpoint. * * @return builder * */ public Builder endpointZoneId(String endpointZoneId) { return endpointZoneId(Output.of(endpointZoneId)); } public BasicEndpointArgs build() { $.acceleratorId = Objects.requireNonNull($.acceleratorId, "expected parameter 'acceleratorId' to be non-null"); $.endpointAddress = Objects.requireNonNull($.endpointAddress, "expected parameter 'endpointAddress' to be non-null"); $.endpointGroupId = Objects.requireNonNull($.endpointGroupId, "expected parameter 'endpointGroupId' to be non-null"); $.endpointType = Objects.requireNonNull($.endpointType, "expected parameter 'endpointType' to be non-null"); return $; } } }
9,980
0.587475
0.587475
346
27.843931
28.282309
129
false
false
0
0
0
0
0
0
0.248555
false
false
7
837f22bdbf7ae9addab80b47a4ed99f4fde0a257
22,436,909,210,213
d9d8bf3702848435edeaf92e9f5b55a8a5ea8254
/solvers/java/src/main/java/com/analog/lyric/dimple/learning/BasicTrainingSet.java
da643f72eb8ca42fdccfa46197907fee76dad19d
[ "BSD-3-Clause", "Minpack", "Apache-2.0" ]
permissive
yujianyuanhaha/Co-Channel-Sig-Detection
https://github.com/yujianyuanhaha/Co-Channel-Sig-Detection
8fb79cfbbd560dcb3205c53fa57c2e19081a8ad7
5c6b4d203957fb043966ff17a2241555cf03e5fe
refs/heads/master
2022-01-22T23:20:18.052000
2019-06-17T04:38:11
2019-06-17T04:38:11
166,728,619
3
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/******************************************************************************* * Copyright 2014 Analog Devices, 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.analog.lyric.dimple.learning; import java.util.Iterator; import org.eclipse.jdt.annotation.Nullable; public class BasicTrainingSet implements ITrainingSet { /*------- * State */ private final @Nullable ITrainingSample _commonAssignments; private final Iterable<ITrainingSample> _samples; /*-------------- * Construction */ public BasicTrainingSet(@Nullable ITrainingSample commonAssignments, Iterable<ITrainingSample> samples) { _commonAssignments = commonAssignments; _samples = samples; } public BasicTrainingSet(Iterable<ITrainingSample> samples) { this(null, samples); } /*---------------------- * ITrainingSet methods */ @Override public Iterator<ITrainingSample> iterator() { return _samples.iterator(); } @Override public @Nullable ITrainingSample getCommonAssignments() { return _commonAssignments; } }
UTF-8
Java
1,646
java
BasicTrainingSet.java
Java
[]
null
[]
/******************************************************************************* * Copyright 2014 Analog Devices, 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.analog.lyric.dimple.learning; import java.util.Iterator; import org.eclipse.jdt.annotation.Nullable; public class BasicTrainingSet implements ITrainingSet { /*------- * State */ private final @Nullable ITrainingSample _commonAssignments; private final Iterable<ITrainingSample> _samples; /*-------------- * Construction */ public BasicTrainingSet(@Nullable ITrainingSample commonAssignments, Iterable<ITrainingSample> samples) { _commonAssignments = commonAssignments; _samples = samples; } public BasicTrainingSet(Iterable<ITrainingSample> samples) { this(null, samples); } /*---------------------- * ITrainingSet methods */ @Override public Iterator<ITrainingSample> iterator() { return _samples.iterator(); } @Override public @Nullable ITrainingSample getCommonAssignments() { return _commonAssignments; } }
1,646
0.650668
0.645808
62
25.548388
27.876848
104
false
false
0
0
0
0
0
0
0.919355
false
false
7
c03844067c28d7aadb23ea1a76f0a8c0104264df
9,586,367,073,649
90577e7daee3183e57a14c43f0a0e26c6616c6a6
/com.cssrc.ibms.system/src/main/java/com/cssrc/ibms/system/service/SysTypeKeyService.java
cbe54a1426a74d739f4bcdbec83be2284c47feee
[]
no_license
xeon-ye/8ddp
https://github.com/xeon-ye/8ddp
a0fec7e10182ab4728cafc3604b9d39cffe7687e
52c7440b471c6496f505e3ada0cf4fdeecce2815
refs/heads/master
2023-03-09T17:53:38.427000
2021-02-18T02:18:55
2021-02-18T02:18:55
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cssrc.ibms.system.service; import javax.annotation.Resource; import org.springframework.stereotype.Service; import com.cssrc.ibms.api.core.intf.BaseService; import com.cssrc.ibms.core.db.mybatis.dao.IEntityDao; import com.cssrc.ibms.system.dao.SysTypeKeyDao; import com.cssrc.ibms.system.model.SysTypeKey; @Service public class SysTypeKeyService extends BaseService<SysTypeKey>{ @Resource private SysTypeKeyDao dao; @Override protected IEntityDao<SysTypeKey, Long> getEntityDao() { return dao; } /** * 由typekey或catkey得出标识key列表 * 等同getSysTypeKeyByCat * @param catKey * @return */ public SysTypeKey getByKey(String catKey){ return dao.getByKey(catKey); } public boolean isExistKey(String typeKey) { typeKey = typeKey.toLowerCase(); return this.dao.isExistKey(typeKey); } public boolean isKeyExistForUpdate(String typeKey, Long typeKeyId) { typeKey = typeKey.toLowerCase(); return this.dao.isKeyExistForUpdate(typeKey, typeKeyId); } public void saveSequence(Long[] aryTypeId) { for (int i = 0; i < aryTypeId.length; i++) this.dao.updateSequence(aryTypeId[i], i); } }
UTF-8
Java
1,160
java
SysTypeKeyService.java
Java
[]
null
[]
package com.cssrc.ibms.system.service; import javax.annotation.Resource; import org.springframework.stereotype.Service; import com.cssrc.ibms.api.core.intf.BaseService; import com.cssrc.ibms.core.db.mybatis.dao.IEntityDao; import com.cssrc.ibms.system.dao.SysTypeKeyDao; import com.cssrc.ibms.system.model.SysTypeKey; @Service public class SysTypeKeyService extends BaseService<SysTypeKey>{ @Resource private SysTypeKeyDao dao; @Override protected IEntityDao<SysTypeKey, Long> getEntityDao() { return dao; } /** * 由typekey或catkey得出标识key列表 * 等同getSysTypeKeyByCat * @param catKey * @return */ public SysTypeKey getByKey(String catKey){ return dao.getByKey(catKey); } public boolean isExistKey(String typeKey) { typeKey = typeKey.toLowerCase(); return this.dao.isExistKey(typeKey); } public boolean isKeyExistForUpdate(String typeKey, Long typeKeyId) { typeKey = typeKey.toLowerCase(); return this.dao.isKeyExistForUpdate(typeKey, typeKeyId); } public void saveSequence(Long[] aryTypeId) { for (int i = 0; i < aryTypeId.length; i++) this.dao.updateSequence(aryTypeId[i], i); } }
1,160
0.75
0.749123
55
19.727272
21.231585
67
false
false
0
0
0
0
0
0
1.127273
false
false
7
a8e2244756f76a4c3f0183f9d8de3f55acc3330c
22,462,678,974,968
d34a0e8e170cdaac15162b5b21e78a5cd2a4b7a0
/src/test/java/de/uniluebeck/itm/nettyprotocols/tinyos/TinyOsSerialDecoderTest.java
3946e3c54101625e5caa1316c8e463826a0aab45
[ "BSD-3-Clause" ]
permissive
zjufish/netty-protocols
https://github.com/zjufish/netty-protocols
f08eaa8bd4fc3dfdae664ead44bad162f1d23b63
83625c48e948758883f5a8ef320b09054a4ab180
refs/heads/master
2020-05-29T12:21:43.243000
2014-06-19T12:06:09
2014-06-19T12:06:09
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.uniluebeck.itm.nettyprotocols.tinyos; import org.junit.After; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; public class TinyOsSerialDecoderTest implements TinyOsSerialTestConstants { private TinyOsSerialDecoder decoderTinyOs; @Before public void setUp() throws Exception { decoderTinyOs = new TinyOsSerialDecoder(); } @After public void tearDown() throws Exception { decoderTinyOs = null; } @Test public void testPacket1() throws Exception { assertEquals(DECODED_PACKET_1, decoderTinyOs.decode(null, null, ENCODED_PACKET_1)); } @Test public void testPacket2() throws Exception { assertEquals(DECODED_PACKET_2, decoderTinyOs.decode(null, null, ENCODED_PACKET_2)); } @Test public void testPacket3() throws Exception { assertEquals(DECODED_PACKET_3, decoderTinyOs.decode(null, null, ENCODED_PACKET_3)); } @Test public void testPacket4() throws Exception { assertEquals(DECODED_PACKET_4, decoderTinyOs.decode(null, null, ENCODED_PACKET_4)); } @Test public void testCrcInvalidPacket1() throws Exception { assertNull(decoderTinyOs.decode(null, null, CRC_INVALID_ENCODED_PACKET_1)); } @Test public void testCrcInvalidPacket2() throws Exception { assertNull(decoderTinyOs.decode(null, null, CRC_INVALID_ENCODED_PACKET_2)); } @Test public void testCrcInvalidPacket3() throws Exception { assertNull(decoderTinyOs.decode(null, null, CRC_INVALID_ENCODED_PACKET_3)); } @Test public void testCrcInvalidPacket4() throws Exception { assertNull(decoderTinyOs.decode(null, null, CRC_INVALID_ENCODED_PACKET_4)); } }
UTF-8
Java
1,664
java
TinyOsSerialDecoderTest.java
Java
[]
null
[]
package de.uniluebeck.itm.nettyprotocols.tinyos; import org.junit.After; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; public class TinyOsSerialDecoderTest implements TinyOsSerialTestConstants { private TinyOsSerialDecoder decoderTinyOs; @Before public void setUp() throws Exception { decoderTinyOs = new TinyOsSerialDecoder(); } @After public void tearDown() throws Exception { decoderTinyOs = null; } @Test public void testPacket1() throws Exception { assertEquals(DECODED_PACKET_1, decoderTinyOs.decode(null, null, ENCODED_PACKET_1)); } @Test public void testPacket2() throws Exception { assertEquals(DECODED_PACKET_2, decoderTinyOs.decode(null, null, ENCODED_PACKET_2)); } @Test public void testPacket3() throws Exception { assertEquals(DECODED_PACKET_3, decoderTinyOs.decode(null, null, ENCODED_PACKET_3)); } @Test public void testPacket4() throws Exception { assertEquals(DECODED_PACKET_4, decoderTinyOs.decode(null, null, ENCODED_PACKET_4)); } @Test public void testCrcInvalidPacket1() throws Exception { assertNull(decoderTinyOs.decode(null, null, CRC_INVALID_ENCODED_PACKET_1)); } @Test public void testCrcInvalidPacket2() throws Exception { assertNull(decoderTinyOs.decode(null, null, CRC_INVALID_ENCODED_PACKET_2)); } @Test public void testCrcInvalidPacket3() throws Exception { assertNull(decoderTinyOs.decode(null, null, CRC_INVALID_ENCODED_PACKET_3)); } @Test public void testCrcInvalidPacket4() throws Exception { assertNull(decoderTinyOs.decode(null, null, CRC_INVALID_ENCODED_PACKET_4)); } }
1,664
0.76863
0.756611
63
25.412699
29.110973
85
false
false
0
0
0
0
0
0
1.396825
false
false
7
1b1d7ecefdadb30a05d3ee289b0733ca983cb46f
19,696,720,035,685
b37e989e869e55b09b8983b236a6ab474a91daf8
/app/src/main/java/com/moyersoftware/contender/game/adapter/HostEventsAdapter.java
12801863cc060bf1ec4a969244fbcd7d33b20b7e
[]
no_license
sheyko-d/Contender
https://github.com/sheyko-d/Contender
2c75ea7442788fdc311d2e68611a1775649d3366
19c32a1d1e6ed460544d2adbc0b2c87aea97be49
refs/heads/master
2021-07-20T20:44:28.942000
2021-02-06T00:05:57
2021-02-06T00:05:57
61,744,985
0
3
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.moyersoftware.contender.game.adapter; import androidx.annotation.Nullable; import androidx.recyclerview.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.moyersoftware.contender.R; import com.moyersoftware.contender.game.HostActivity; import com.moyersoftware.contender.game.data.Event; import com.moyersoftware.contender.util.Util; import com.squareup.picasso.Callback; import com.squareup.picasso.NetworkPolicy; import com.squareup.picasso.Picasso; import java.util.ArrayList; import butterknife.BindView; import butterknife.ButterKnife; import static com.moyersoftware.contender.R.id.event_home_img; public class HostEventsAdapter extends RecyclerView.Adapter<HostEventsAdapter.ViewHolder> { // Constants public static final int TYPE_HEADER = 0; public static final int TYPE_DATE = 1; public static final int TYPE_ITEM = 2; // Usual variables private final HostActivity mActivity; private final ArrayList<Event> mEvents; public HostEventsAdapter(HostActivity activity, ArrayList<Event> events) { mActivity = activity; mEvents = events; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { return new ViewHolder(LayoutInflater.from(parent.getContext()).inflate(viewType == TYPE_ITEM ? R.layout.item_event : (viewType == TYPE_HEADER ? R.layout.item_event_header : R.layout.item_event_date), parent, false)); } @Override public int getItemViewType(int position) { return mEvents.get(position).getType(); } @Override public void onBindViewHolder(final ViewHolder holder, final int position) { final Event event = mEvents.get(position); if (getItemViewType(position) == TYPE_ITEM) { assert holder.homeNameTxt != null; assert holder.timeTxt != null; holder.awayNameTxt.setText(event.getTeamAway().getName()); Picasso.get().load(event.getTeamAway().getImage()).into(holder.awayImg); holder.homeNameTxt.setText(event.getTeamHome().getName()); Picasso.get() .load(event.getTeamHome().getImage()).networkPolicy(NetworkPolicy.OFFLINE) .into(holder.homeImg, new Callback() { @Override public void onSuccess() { } @Override public void onError(Exception e) { //Try again online if cache failed Picasso.get() .load(event.getTeamHome().getImage()) .error(R.color.red) .into(holder.homeImg, new Callback() { @Override public void onSuccess() { } @Override public void onError(Exception e) { Log.v("Picasso", "Could not fetch image"); } }); } }); holder.timeTxt.setText(Util.formatTime(event.getTime())); } else if (getItemViewType(position) == TYPE_DATE) { holder.awayNameTxt.setText(Util.formatDate(event.getTime())); } else { holder.awayNameTxt.setText(event.getWeek()); } } @Override public int getItemCount() { return mEvents.size(); } public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { @Nullable @BindView(R.id.event_away_img) ImageView awayImg; @BindView(R.id.event_away_name_txt) TextView awayNameTxt; @Nullable @BindView(event_home_img) ImageView homeImg; @Nullable @BindView(R.id.event_home_name_txt) TextView homeNameTxt; @Nullable @BindView(R.id.event_time_txt) TextView timeTxt; public ViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); itemView.setOnClickListener(this); } @Override public void onClick(View v) { mActivity.setSelectedEvent(mEvents.get(getAdapterPosition())); } } }
UTF-8
Java
4,682
java
HostEventsAdapter.java
Java
[]
null
[]
package com.moyersoftware.contender.game.adapter; import androidx.annotation.Nullable; import androidx.recyclerview.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.moyersoftware.contender.R; import com.moyersoftware.contender.game.HostActivity; import com.moyersoftware.contender.game.data.Event; import com.moyersoftware.contender.util.Util; import com.squareup.picasso.Callback; import com.squareup.picasso.NetworkPolicy; import com.squareup.picasso.Picasso; import java.util.ArrayList; import butterknife.BindView; import butterknife.ButterKnife; import static com.moyersoftware.contender.R.id.event_home_img; public class HostEventsAdapter extends RecyclerView.Adapter<HostEventsAdapter.ViewHolder> { // Constants public static final int TYPE_HEADER = 0; public static final int TYPE_DATE = 1; public static final int TYPE_ITEM = 2; // Usual variables private final HostActivity mActivity; private final ArrayList<Event> mEvents; public HostEventsAdapter(HostActivity activity, ArrayList<Event> events) { mActivity = activity; mEvents = events; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { return new ViewHolder(LayoutInflater.from(parent.getContext()).inflate(viewType == TYPE_ITEM ? R.layout.item_event : (viewType == TYPE_HEADER ? R.layout.item_event_header : R.layout.item_event_date), parent, false)); } @Override public int getItemViewType(int position) { return mEvents.get(position).getType(); } @Override public void onBindViewHolder(final ViewHolder holder, final int position) { final Event event = mEvents.get(position); if (getItemViewType(position) == TYPE_ITEM) { assert holder.homeNameTxt != null; assert holder.timeTxt != null; holder.awayNameTxt.setText(event.getTeamAway().getName()); Picasso.get().load(event.getTeamAway().getImage()).into(holder.awayImg); holder.homeNameTxt.setText(event.getTeamHome().getName()); Picasso.get() .load(event.getTeamHome().getImage()).networkPolicy(NetworkPolicy.OFFLINE) .into(holder.homeImg, new Callback() { @Override public void onSuccess() { } @Override public void onError(Exception e) { //Try again online if cache failed Picasso.get() .load(event.getTeamHome().getImage()) .error(R.color.red) .into(holder.homeImg, new Callback() { @Override public void onSuccess() { } @Override public void onError(Exception e) { Log.v("Picasso", "Could not fetch image"); } }); } }); holder.timeTxt.setText(Util.formatTime(event.getTime())); } else if (getItemViewType(position) == TYPE_DATE) { holder.awayNameTxt.setText(Util.formatDate(event.getTime())); } else { holder.awayNameTxt.setText(event.getWeek()); } } @Override public int getItemCount() { return mEvents.size(); } public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { @Nullable @BindView(R.id.event_away_img) ImageView awayImg; @BindView(R.id.event_away_name_txt) TextView awayNameTxt; @Nullable @BindView(event_home_img) ImageView homeImg; @Nullable @BindView(R.id.event_home_name_txt) TextView homeNameTxt; @Nullable @BindView(R.id.event_time_txt) TextView timeTxt; public ViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); itemView.setOnClickListener(this); } @Override public void onClick(View v) { mActivity.setSelectedEvent(mEvents.get(getAdapterPosition())); } } }
4,682
0.583084
0.582443
138
32.934784
26.124065
94
false
false
0
0
0
0
0
0
0.434783
false
false
7
4e5d91b8a4810ea266122302a87796fd67d1d56c
6,691,559,049,179
391011e69cce66f65bdebefd23c7d0fab19917e5
/DATAVIEW/src/dataview/models/DATAVIEW_MathVector.java
15641d5c23f766847fb9f9f9fe451e68c86fe7b4
[]
no_license
shiyonglu/DATAVIEW
https://github.com/shiyonglu/DATAVIEW
f6693c59cbf2de9213c4f4ab2050f52efb21f119
c29a1bfaae64799f5bd4b134a547151db2426560
refs/heads/master
2022-06-17T05:59:13.804000
2022-06-11T14:16:28
2022-06-11T14:16:28
176,992,952
15
7
null
false
2022-06-11T14:16:30
2019-03-21T17:24:54
2022-02-12T01:48:57
2022-06-11T14:16:28
178,542
11
5
6
Java
false
false
package dataview.models; import java.util.Vector; /* This MathVector is implemented based on the assumption that a lot of calculations and updates will be performed on this vector. */ public class DATAVIEW_MathVector { private final int n; // number of dimensions of the vector private double [] elements; // vector's elements public DATAVIEW_MathVector(int n) { this.n= n; this.elements = new double[n]; } public DATAVIEW_MathVector(double[] elements) // we copy the data to avoid update side-effect from the intput { this.n= elements.length; this.elements = new double[this.n]; for(int i=0; i<n; i++) { this.elements[i] = elements[i]; } } public DATAVIEW_MathVector(String vecstr){ String[] words = vecstr.split(","); this.n= words.length; this.elements = new double[this.n]; for(int i=0; i<n; i++) { this.elements[i] = Double.valueOf(words[i]); } } public int length() { return n; } public double get(int i) { return elements[i]; } public void set(int i, double v) { elements[i] = v; } public void add(DATAVIEW_MathVector newv) { if(n != newv.length()) { throw new IllegalArgumentException("Dimensions are not equal for the plus operation."); } for(int i=0; i<=n; i++) { elements[i] += newv.get(i); } // end for } // end public void add(int i, double val) { elements[i] += val; } public void add(double val) { for(int i=0; i<n; i++) elements[i] += val; } public void subtract(int i, double val) { elements[i] -= val; } public void subtract(double val) { for(int i=0; i<n; i++) elements[i] -= val; } public void multiply(int i, double val) { elements[i] *= val; } public void multiply(double val) { for(int i=0; i<n; i++) elements[i] *= val; } public void divide(int i, double val) { elements[i] /= val; } public void divide(double val) { for(int i=0; i<n; i++) elements[i] /= val; } @Override public String toString() { String str = this.elements[0]+""; for(int i = 1; i < n; i++) { str = str + ", " + this.elements[i]; } return str; } }
UTF-8
Java
2,478
java
DATAVIEW_MathVector.java
Java
[]
null
[]
package dataview.models; import java.util.Vector; /* This MathVector is implemented based on the assumption that a lot of calculations and updates will be performed on this vector. */ public class DATAVIEW_MathVector { private final int n; // number of dimensions of the vector private double [] elements; // vector's elements public DATAVIEW_MathVector(int n) { this.n= n; this.elements = new double[n]; } public DATAVIEW_MathVector(double[] elements) // we copy the data to avoid update side-effect from the intput { this.n= elements.length; this.elements = new double[this.n]; for(int i=0; i<n; i++) { this.elements[i] = elements[i]; } } public DATAVIEW_MathVector(String vecstr){ String[] words = vecstr.split(","); this.n= words.length; this.elements = new double[this.n]; for(int i=0; i<n; i++) { this.elements[i] = Double.valueOf(words[i]); } } public int length() { return n; } public double get(int i) { return elements[i]; } public void set(int i, double v) { elements[i] = v; } public void add(DATAVIEW_MathVector newv) { if(n != newv.length()) { throw new IllegalArgumentException("Dimensions are not equal for the plus operation."); } for(int i=0; i<=n; i++) { elements[i] += newv.get(i); } // end for } // end public void add(int i, double val) { elements[i] += val; } public void add(double val) { for(int i=0; i<n; i++) elements[i] += val; } public void subtract(int i, double val) { elements[i] -= val; } public void subtract(double val) { for(int i=0; i<n; i++) elements[i] -= val; } public void multiply(int i, double val) { elements[i] *= val; } public void multiply(double val) { for(int i=0; i<n; i++) elements[i] *= val; } public void divide(int i, double val) { elements[i] /= val; } public void divide(double val) { for(int i=0; i<n; i++) elements[i] /= val; } @Override public String toString() { String str = this.elements[0]+""; for(int i = 1; i < n; i++) { str = str + ", " + this.elements[i]; } return str; } }
2,478
0.53067
0.527038
125
17.823999
21.116463
130
false
false
0
0
0
0
0
0
1.28
false
false
7
348c4fc88bd43ae8750cd8eac9c4718ac364fa31
27,943,057,288,519
ce87f41bd3807eff1377574b986a06b5fed6f28c
/AAFWeb/AAFAdmin/src/com/teligent/controller/validator/UserThirdPartyAccountsValidator.java
08eeb2e03021b914fc9e6254a4318a05ba69d7fd
[]
no_license
teligent-systems/hats-pnb
https://github.com/teligent-systems/hats-pnb
a32ad043c80a304ef4447b56aa1668f25e81ad25
d90cae99406e85c66c2ffd526455c306e2a6b0c2
refs/heads/master
2016-08-07T15:25:26.176000
2015-02-02T01:18:29
2015-02-02T01:18:29
30,063,304
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.teligent.controller.validator; import java.io.Serializable; import org.springframework.validation.Errors; import org.springframework.validation.Validator; import com.teligent.managers.AafUserThirdManager; import com.teligent.pojo.forms.UserCompanyAccountsForm; public class UserThirdPartyAccountsValidator implements Validator, Serializable { /** * */ private static final long serialVersionUID = 5958670271279983390L; private AafUserThirdManager aafUserThirdManager; public void setAafUserThirdManager(AafUserThirdManager aafUserThirdManager) { this.aafUserThirdManager = aafUserThirdManager; } public boolean isTimeDepositAccount(String input){ String account=input.replaceAll("-","").trim(); if((account.charAt(3)=='8')||(account.charAt(3)=='7')){ return true; } else{ return false; } } public boolean supports(Class clazz) { return clazz.equals(UserCompanyAccountsForm.class); } public void validate(Object command, Errors errors) { UserCompanyAccountsForm form = (UserCompanyAccountsForm) command; if(form==null) { errors.rejectValue("accountnumber", "error.not-specified", null, "Value required"); } else{ if((form.getAccountnumber().trim().equals(""))||(form.getAccountnumber().trim().length()==0)){ errors.rejectValue("accountnumber", "error.not-specified", null, "Account number cannot be blank"); } else if(isTimeDepositAccount(form.getAccountnumber().trim())){ errors.rejectValue("accountnumber", "typeMismatch", null, "Time deposit accounts are not allowed"); } else{ if(!(aafUserThirdManager.getUserThirdsByDoubleCriteria("id.accountNum", form.getAccountnumber(),"id.username", form.getUsername()).isEmpty())){ errors.rejectValue("accountnumber", "error.not-specified", null, "Account number already enrolled"); } } } } }
UTF-8
Java
1,856
java
UserThirdPartyAccountsValidator.java
Java
[]
null
[]
package com.teligent.controller.validator; import java.io.Serializable; import org.springframework.validation.Errors; import org.springframework.validation.Validator; import com.teligent.managers.AafUserThirdManager; import com.teligent.pojo.forms.UserCompanyAccountsForm; public class UserThirdPartyAccountsValidator implements Validator, Serializable { /** * */ private static final long serialVersionUID = 5958670271279983390L; private AafUserThirdManager aafUserThirdManager; public void setAafUserThirdManager(AafUserThirdManager aafUserThirdManager) { this.aafUserThirdManager = aafUserThirdManager; } public boolean isTimeDepositAccount(String input){ String account=input.replaceAll("-","").trim(); if((account.charAt(3)=='8')||(account.charAt(3)=='7')){ return true; } else{ return false; } } public boolean supports(Class clazz) { return clazz.equals(UserCompanyAccountsForm.class); } public void validate(Object command, Errors errors) { UserCompanyAccountsForm form = (UserCompanyAccountsForm) command; if(form==null) { errors.rejectValue("accountnumber", "error.not-specified", null, "Value required"); } else{ if((form.getAccountnumber().trim().equals(""))||(form.getAccountnumber().trim().length()==0)){ errors.rejectValue("accountnumber", "error.not-specified", null, "Account number cannot be blank"); } else if(isTimeDepositAccount(form.getAccountnumber().trim())){ errors.rejectValue("accountnumber", "typeMismatch", null, "Time deposit accounts are not allowed"); } else{ if(!(aafUserThirdManager.getUserThirdsByDoubleCriteria("id.accountNum", form.getAccountnumber(),"id.username", form.getUsername()).isEmpty())){ errors.rejectValue("accountnumber", "error.not-specified", null, "Account number already enrolled"); } } } } }
1,856
0.741918
0.728987
59
30.457626
35.77108
147
false
false
0
0
0
0
0
0
2.288136
false
false
7
8f75e2f020ea59afbc9eab2234507d9ddcd1cc26
19,000,935,338,932
30ca7b397a5f9ad7da72c2b2405f9b1ec883547d
/GEAR/src/gear/subcommands/fastpca/FastPCACommandArguments.java
c17e096299e5c9568102b3709317a6f1c051bbcc
[]
no_license
gc5k/GEAR
https://github.com/gc5k/GEAR
eb6d3b06806c2b4713b42c551b12b85b5274f13c
ec61361b09b9ef6a50cc2684acdf3f794c12f1cc
refs/heads/master
2022-01-17T03:16:56.654000
2021-12-30T12:56:05
2021-12-30T12:56:05
37,571,127
17
9
null
null
null
null
null
null
null
null
null
null
null
null
null
package gear.subcommands.fastpca; import gear.subcommands.CommandArguments; import gear.util.Logger; public class FastPCACommandArguments extends CommandArguments { // public String getGrmBin() // { // return grmBin; // } // // public void setGrmBin(String grmBin) // { // this.grmBin = grmBin; // } // // public String getGrmText() // { // return grmText; // } // // public void setGrmText(String grmText) // { // this.grmText = grmText; // } // // private String grmText; // root name of the GRM files // // public String getGrmGZ() // { // return grmGZ; // } // // public void setGrmGZ(String grmGZ) // { // this.grmGZ = grmGZ; // } // // private String grmGZ; // root name of the GRM files // // public String getGrmID() // { // return grmID; // } // // public void setGrmID(String grmID) // { // this.grmID = grmID; // } public void setEV(String ev) { this.ev = Integer.parseInt(ev); } public int getEV() { return ev; } public void setProp(String p) { prop = Double.parseDouble(p); if (prop < 0 & prop > 1) { Logger.printUserLog("proption should be > 0 & <=1.\n"); Logger.printUserLog("GEAR quit."); System.exit(0); } } public double getProp() { return prop; } public void setAdjVar() { isAdjVar = true; } public boolean isAdjVar() { return isAdjVar; } private int ev = 10; private double prop = 1; private boolean isAdjVar = false; }
UTF-8
Java
1,432
java
FastPCACommandArguments.java
Java
[]
null
[]
package gear.subcommands.fastpca; import gear.subcommands.CommandArguments; import gear.util.Logger; public class FastPCACommandArguments extends CommandArguments { // public String getGrmBin() // { // return grmBin; // } // // public void setGrmBin(String grmBin) // { // this.grmBin = grmBin; // } // // public String getGrmText() // { // return grmText; // } // // public void setGrmText(String grmText) // { // this.grmText = grmText; // } // // private String grmText; // root name of the GRM files // // public String getGrmGZ() // { // return grmGZ; // } // // public void setGrmGZ(String grmGZ) // { // this.grmGZ = grmGZ; // } // // private String grmGZ; // root name of the GRM files // // public String getGrmID() // { // return grmID; // } // // public void setGrmID(String grmID) // { // this.grmID = grmID; // } public void setEV(String ev) { this.ev = Integer.parseInt(ev); } public int getEV() { return ev; } public void setProp(String p) { prop = Double.parseDouble(p); if (prop < 0 & prop > 1) { Logger.printUserLog("proption should be > 0 & <=1.\n"); Logger.printUserLog("GEAR quit."); System.exit(0); } } public double getProp() { return prop; } public void setAdjVar() { isAdjVar = true; } public boolean isAdjVar() { return isAdjVar; } private int ev = 10; private double prop = 1; private boolean isAdjVar = false; }
1,432
0.622207
0.61662
83
16.253012
15.935747
63
false
false
0
0
0
0
0
0
1.301205
false
false
7
61921375f22024779f0f0e05a397c2726b93d38c
3,418,793,969,388
6723c867c65988f3deb25562b672f1ee362bf65d
/app/src/main/java/com/destinyapp/e_businessprofile/Activity/ui/home/Healtcare/Hospital/CreditWorthiness/AnalisisLaporanKeuangan/AnalisisLaporanKeuanganActivity.java
670c2a68900abe7ddc32272d90f2b0b24aac29f0
[]
no_license
musupadi/TrialeBusinessProfile
https://github.com/musupadi/TrialeBusinessProfile
2625e174254bda8e8eb1ed9aec3b7955ec4be8c0
01fbf451b47595c59eaf25eb5397a4cbed7c8f91
refs/heads/master
2020-09-20T12:11:52.072000
2019-11-28T03:32:30
2019-11-28T03:32:30
224,472,248
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.destinyapp.e_businessprofile.Activity.ui.home.Healtcare.Hospital.CreditWorthiness.AnalisisLaporanKeuangan; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.LinearLayout; import com.destinyapp.e_businessprofile.Activity.ui.home.Healtcare.Hospital.CreditWorthiness.AnalisisKinerjaRS.AnalisisKinerjaRSActivity; import com.destinyapp.e_businessprofile.Activity.ui.home.Healtcare.Hospital.CreditWorthiness.AnalisisKinerjaRS.ParametersAnalisisKinerjaRSActivity; import com.destinyapp.e_businessprofile.R; import com.destinyapp.e_businessprofile.SharedPreferance.DB_Helper; public class AnalisisLaporanKeuanganActivity extends AppCompatActivity { LinearLayout parameters,simulation; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_analisis_laporan_keuangan); parameters = findViewById(R.id.linearParmeter); simulation = findViewById(R.id.linearSimulation); parameters.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(AnalisisLaporanKeuanganActivity.this, ParameterAnalisisLaporanKeuanganActivity.class); startActivity(intent); } }); simulation.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DB_Helper dbHelper = new DB_Helper(AnalisisLaporanKeuanganActivity.this); dbHelper.Hitung(); Intent intent = new Intent(AnalisisLaporanKeuanganActivity.this, InputAnalisisLaporanActivity.class); startActivity(intent); } }); } }
UTF-8
Java
1,873
java
AnalisisLaporanKeuanganActivity.java
Java
[]
null
[]
package com.destinyapp.e_businessprofile.Activity.ui.home.Healtcare.Hospital.CreditWorthiness.AnalisisLaporanKeuangan; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.LinearLayout; import com.destinyapp.e_businessprofile.Activity.ui.home.Healtcare.Hospital.CreditWorthiness.AnalisisKinerjaRS.AnalisisKinerjaRSActivity; import com.destinyapp.e_businessprofile.Activity.ui.home.Healtcare.Hospital.CreditWorthiness.AnalisisKinerjaRS.ParametersAnalisisKinerjaRSActivity; import com.destinyapp.e_businessprofile.R; import com.destinyapp.e_businessprofile.SharedPreferance.DB_Helper; public class AnalisisLaporanKeuanganActivity extends AppCompatActivity { LinearLayout parameters,simulation; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_analisis_laporan_keuangan); parameters = findViewById(R.id.linearParmeter); simulation = findViewById(R.id.linearSimulation); parameters.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(AnalisisLaporanKeuanganActivity.this, ParameterAnalisisLaporanKeuanganActivity.class); startActivity(intent); } }); simulation.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DB_Helper dbHelper = new DB_Helper(AnalisisLaporanKeuanganActivity.this); dbHelper.Hitung(); Intent intent = new Intent(AnalisisLaporanKeuanganActivity.this, InputAnalisisLaporanActivity.class); startActivity(intent); } }); } }
1,873
0.736252
0.736252
41
44.682926
39.195843
147
false
false
0
0
0
0
0
0
0.634146
false
false
7
16acd3792ac376762dc98fe65cce49c8a791a97e
17,162,689,315,241
33ec29039f2dd55daaaf5cdda57e9a4cee16d12c
/src/main/java/me/lctang/json/validation/Schema.java
ddcf966bc874fc2ef4ab5d4dd5677a23bab9245a
[]
no_license
mr-pajamas/json-validation
https://github.com/mr-pajamas/json-validation
cbe8d938c5d144a59fd682decaee8e6dba6dea38
9b26065c7f106c4f94e0778c37245eeaf43cb9f2
refs/heads/master
2021-08-08T03:24:20.577000
2017-11-09T13:04:46
2017-11-09T13:04:46
110,116,284
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * File Name: Schema.java * * File Desc: TODO * * Product AB: Spirit_1_0_0 * * Product Name: Spirit * * Module Name: TODO * * Module AB: TODO * * Author: 汤力丞 * * History: 6/20/12 created by 汤力丞 */ package me.lctang.json.validation; /** * <p>TODO</p> * * @author <a href="mailto:lctang@yahoo.cn">Michael Tang</a> * @version 1.0 */ public interface Schema { /** * 根据此Schema创建一个新的Validator实例 * * @return 总是返回一个非空实例 */ Validator newValidator(); Validator newValidator(ValidationMode validationMode); }
UTF-8
Java
634
java
Schema.java
Java
[ { "context": " TODO\n *\n * Module AB: TODO\n *\n * Author: 汤力丞\n *\n * History: 6/20/12 created by 汤力丞\n */\npa", "end": 191, "score": 0.999778687953949, "start": 188, "tag": "NAME", "value": "汤力丞" }, { "context": "\n/**\n * <p>TODO</p>\n *\n * @author <a href=\"mailto:lctang@yahoo.cn\">Michael Tang</a>\n * @version 1.0\n */\npublic inte", "end": 339, "score": 0.9998840689659119, "start": 324, "tag": "EMAIL", "value": "lctang@yahoo.cn" }, { "context": "p>\n *\n * @author <a href=\"mailto:lctang@yahoo.cn\">Michael Tang</a>\n * @version 1.0\n */\npublic interface Schema {", "end": 353, "score": 0.9998607635498047, "start": 341, "tag": "NAME", "value": "Michael Tang" } ]
null
[]
/** * File Name: Schema.java * * File Desc: TODO * * Product AB: Spirit_1_0_0 * * Product Name: Spirit * * Module Name: TODO * * Module AB: TODO * * Author: 汤力丞 * * History: 6/20/12 created by 汤力丞 */ package me.lctang.json.validation; /** * <p>TODO</p> * * @author <a href="mailto:<EMAIL>"><NAME></a> * @version 1.0 */ public interface Schema { /** * 根据此Schema创建一个新的Validator实例 * * @return 总是返回一个非空实例 */ Validator newValidator(); Validator newValidator(ValidationMode validationMode); }
620
0.591379
0.574138
36
15.111111
15.900346
60
false
false
0
0
0
0
0
0
0.083333
false
false
7
43f8a6d0a5cb6d3e5ced94ad548e4bc3c0835ee1
11,201,274,775,508
cac843aaa66938ba9c9ae179b54ddd0f8670d85c
/src/main/java/net/sf/jcommon/ui/RGBSwapColorSpace.java
95d083b9abede33e410829a0926de3582f35203d
[]
no_license
CarmenAp/jcommon
https://github.com/CarmenAp/jcommon
e4c384a304a22386a11600473ccc3ad32dfc27ed
513c1f0bb028de75d848f48c17831611552c21f3
refs/heads/master
2021-01-15T14:23:18.760000
2016-10-10T18:01:55
2016-10-10T18:01:55
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.sf.jcommon.ui; import java.awt.color.ColorSpace; import java.awt.Color; /** * * @author Adrian BER */ @SuppressWarnings("serial") public class RGBSwapColorSpace extends ColorSpace { private int[] indices; /** Constructs a color space where RGB are swaped according to the given parameter. * @param order any combination of the characters RGB (uppercase, lowercase or mixed) that will * dictate the order of the RGB channels * @throws IllegalArgumentException if order contains invalid characters or if the length is * not equal to 3 */ public RGBSwapColorSpace(String order) { super(ColorSpace.TYPE_RGB, 3); if (order.length() != 3) throw new IllegalArgumentException("The order parameter must contain exactly 3 characters."); indices = new int[3]; for (int i = 0; i < 3; i++) { char c = order.charAt(i); switch(c) { case 'r': case 'R': indices[i] = 0; break; case 'g': case 'G': indices[i] = 1; break; case 'b': case 'B': indices[i] = 2; break; default: throw new IllegalArgumentException("The order parameter must contain only 'r', 'R', 'g', 'G', 'b', 'B' characters."); } } } public float[] toRGB(float[] colorvalue) { float[] x = new float[colorvalue.length]; for (int i = 0; i < 3; i++) { x[indices[i]] = colorvalue[i]; } System.arraycopy(colorvalue, 3, x, 3, colorvalue.length - 3); return x; } public float[] fromRGB(float[] colorvalue) { float[] x = new float[colorvalue.length]; for (int i = 0; i < 3; i++) { x[i] = colorvalue[indices[i]]; } System.arraycopy(colorvalue, 3, x, 3, colorvalue.length - 3); return x; } public float[] toCIEXYZ(float[] colorvalue) { // swap RGB and create the color Color c = new Color(colorvalue[indices[0]], colorvalue[indices[1]], colorvalue[indices[2]]); return c.getColorComponents(ColorSpace.getInstance(ColorSpace.CS_CIEXYZ), null); } public float[] fromCIEXYZ(float[] colorvalue) { Color c = new Color(ColorSpace.getInstance(ColorSpace.CS_CIEXYZ), colorvalue, 0); // get the RGB values float[] rgbValues = c.getRGBColorComponents(null); // swap them float[] x = new float[3]; for (int i = 0; i < 3; i++) { x[indices[i]] = rgbValues[i]; } return x; } }
UTF-8
Java
2,823
java
RGBSwapColorSpace.java
Java
[ { "context": "e;\r\nimport java.awt.Color;\r\n\r\n/**\r\n * \r\n * @author Adrian BER\r\n */\r\n@SuppressWarnings(\"serial\")\r\npublic class R", "end": 122, "score": 0.9998576641082764, "start": 112, "tag": "NAME", "value": "Adrian BER" } ]
null
[]
package net.sf.jcommon.ui; import java.awt.color.ColorSpace; import java.awt.Color; /** * * @author <NAME> */ @SuppressWarnings("serial") public class RGBSwapColorSpace extends ColorSpace { private int[] indices; /** Constructs a color space where RGB are swaped according to the given parameter. * @param order any combination of the characters RGB (uppercase, lowercase or mixed) that will * dictate the order of the RGB channels * @throws IllegalArgumentException if order contains invalid characters or if the length is * not equal to 3 */ public RGBSwapColorSpace(String order) { super(ColorSpace.TYPE_RGB, 3); if (order.length() != 3) throw new IllegalArgumentException("The order parameter must contain exactly 3 characters."); indices = new int[3]; for (int i = 0; i < 3; i++) { char c = order.charAt(i); switch(c) { case 'r': case 'R': indices[i] = 0; break; case 'g': case 'G': indices[i] = 1; break; case 'b': case 'B': indices[i] = 2; break; default: throw new IllegalArgumentException("The order parameter must contain only 'r', 'R', 'g', 'G', 'b', 'B' characters."); } } } public float[] toRGB(float[] colorvalue) { float[] x = new float[colorvalue.length]; for (int i = 0; i < 3; i++) { x[indices[i]] = colorvalue[i]; } System.arraycopy(colorvalue, 3, x, 3, colorvalue.length - 3); return x; } public float[] fromRGB(float[] colorvalue) { float[] x = new float[colorvalue.length]; for (int i = 0; i < 3; i++) { x[i] = colorvalue[indices[i]]; } System.arraycopy(colorvalue, 3, x, 3, colorvalue.length - 3); return x; } public float[] toCIEXYZ(float[] colorvalue) { // swap RGB and create the color Color c = new Color(colorvalue[indices[0]], colorvalue[indices[1]], colorvalue[indices[2]]); return c.getColorComponents(ColorSpace.getInstance(ColorSpace.CS_CIEXYZ), null); } public float[] fromCIEXYZ(float[] colorvalue) { Color c = new Color(ColorSpace.getInstance(ColorSpace.CS_CIEXYZ), colorvalue, 0); // get the RGB values float[] rgbValues = c.getRGBColorComponents(null); // swap them float[] x = new float[3]; for (int i = 0; i < 3; i++) { x[indices[i]] = rgbValues[i]; } return x; } }
2,819
0.524973
0.515409
83
32.012047
28.310028
137
false
false
0
0
0
0
0
0
0.698795
false
false
7
6a1f05aae6fcb5ecc957182cf24036a47d8a36b2
24,962,349,945,424
8a194f761d43c0573259595ade0e1583cea8984a
/src/com/tianyi/util/DBUtil.java
c9e86a7307800dd2053b2299eff69f28f8e48731
[]
no_license
tianyi-cong/Online-User-Manage-System
https://github.com/tianyi-cong/Online-User-Manage-System
3d68d99e4871122bea4c2a4d8641887ae19d981f
fb34dda46bf79a432a2e33b3839e07fd37359cbf
refs/heads/master
2021-01-22T03:13:49.826000
2013-09-12T19:49:06
2013-09-12T19:49:06
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tianyi.util; import java.io.*; import java.sql.*; import java.util.Properties; public class DBUtil { //Define things needed by SQL private static PreparedStatement ps = null; private static Connection ct = null; private static ResultSet rs = null; private static String url = ""; private static String username = ""; private static String password = ""; private static String driver = ""; static { try { Properties p = new Properties(); // For java web project, use classloader to read resource, default path is src folder InputStream is = DBUtil.class.getClassLoader().getResourceAsStream("dbInfo.properties"); p.load(is); driver = p.getProperty("driver"); url = p.getProperty("url"); password = p.getProperty("password"); username = p.getProperty("username"); } catch (Exception e) { e.printStackTrace(); System.exit(-1); } } public static Connection getConnection() { try { Class.forName(driver); ct = DriverManager.getConnection(url,username,password); } catch (Exception e) { e.printStackTrace(); } return ct; } public static void close(ResultSet rs, Statement ps, Connection ct) { if(rs!=null) { try { rs.close(); } catch (SQLException e) { e.printStackTrace(); } rs=null; } if(ps!=null) { try { ps.close(); } catch (SQLException e) { e.printStackTrace(); } ps=null; } if(ct!=null) { try { ct.close(); } catch (SQLException e) { e.printStackTrace(); } ct=null; } } public static void main(String[] args) { System.out.println(driver); System.out.println(url); System.out.println(username); System.out.println(password); } }
UTF-8
Java
1,701
java
DBUtil.java
Java
[ { "context": "er\");\n\t\t\turl = p.getProperty(\"url\");\n\t\t\tpassword = p.getProperty(\"password\");\n\t\t\tusername = p.getProperty(\"usernam", "end": 759, "score": 0.98195481300354, "start": 746, "tag": "PASSWORD", "value": "p.getProperty" }, { "context": ".getProperty(\"url\");\n\t\t\tpassword = p.getProperty(\"password\");\n\t\t\tusername = p.getProperty(\"username\");\n\t\t} c", "end": 769, "score": 0.4420814514160156, "start": 761, "tag": "PASSWORD", "value": "password" }, { "context": "roperty(\"password\");\n\t\t\tusername = p.getProperty(\"username\");\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace", "end": 810, "score": 0.9510045647621155, "start": 802, "tag": "USERNAME", "value": "username" } ]
null
[]
package com.tianyi.util; import java.io.*; import java.sql.*; import java.util.Properties; public class DBUtil { //Define things needed by SQL private static PreparedStatement ps = null; private static Connection ct = null; private static ResultSet rs = null; private static String url = ""; private static String username = ""; private static String password = ""; private static String driver = ""; static { try { Properties p = new Properties(); // For java web project, use classloader to read resource, default path is src folder InputStream is = DBUtil.class.getClassLoader().getResourceAsStream("dbInfo.properties"); p.load(is); driver = p.getProperty("driver"); url = p.getProperty("url"); password = <PASSWORD>("<PASSWORD>"); username = p.getProperty("username"); } catch (Exception e) { e.printStackTrace(); System.exit(-1); } } public static Connection getConnection() { try { Class.forName(driver); ct = DriverManager.getConnection(url,username,password); } catch (Exception e) { e.printStackTrace(); } return ct; } public static void close(ResultSet rs, Statement ps, Connection ct) { if(rs!=null) { try { rs.close(); } catch (SQLException e) { e.printStackTrace(); } rs=null; } if(ps!=null) { try { ps.close(); } catch (SQLException e) { e.printStackTrace(); } ps=null; } if(ct!=null) { try { ct.close(); } catch (SQLException e) { e.printStackTrace(); } ct=null; } } public static void main(String[] args) { System.out.println(driver); System.out.println(url); System.out.println(username); System.out.println(password); } }
1,700
0.654321
0.653733
76
21.381578
18.613073
91
false
false
0
0
0
0
0
0
2.592105
false
false
7
0d1da69b2f2ee15b6b0a7570910141b2be020b61
8,349,416,447,414
3da8c57452aa4765945544ac45e417294f210828
/src/main/java/jm/task/core/jdbc/service/UserHBServiceImpl.java
64eef59b6cbc16e0cca757794e692313646b85a3
[]
no_license
STOUNER/TastJDBC
https://github.com/STOUNER/TastJDBC
f8bd01da65ef14a37300fd2ac95aaa678494023d
87a13f0fbf97dd06cd37baccaeb20b134645f7e4
refs/heads/master
2023-02-15T03:01:05.683000
2020-12-24T22:23:49
2020-12-24T22:23:49
323,401,465
0
0
null
false
2020-12-24T22:23:50
2020-12-21T17:16:27
2020-12-24T22:03:46
2020-12-24T22:23:50
9
0
0
0
Java
false
false
package jm.task.core.jdbc.service; import jm.task.core.jdbc.dao.UserDaoHibernateImpl; import jm.task.core.jdbc.dao.UserDaoJDBCImpl; import jm.task.core.jdbc.model.User; import java.util.List; public class UserHBServiceImpl implements UserService { //Настраиваю композицию между DAO и Service UserDaoHibernateImpl dataObjectAccess; public UserHBServiceImpl() { dataObjectAccess = new UserDaoHibernateImpl(); } public void createUsersTable() { dataObjectAccess.createUsersTable(); } public void dropUsersTable() { dataObjectAccess.dropUsersTable(); } public void saveUser(String name, String lastName, byte age) { dataObjectAccess.saveUser(name, lastName, age); } public void removeUserById(long id) { dataObjectAccess.removeUserById(id); } public List<User> getAllUsers() { return dataObjectAccess.getAllUsers(); } public void cleanUsersTable() { dataObjectAccess.cleanUsersTable(); } }
UTF-8
Java
1,043
java
UserHBServiceImpl.java
Java
[]
null
[]
package jm.task.core.jdbc.service; import jm.task.core.jdbc.dao.UserDaoHibernateImpl; import jm.task.core.jdbc.dao.UserDaoJDBCImpl; import jm.task.core.jdbc.model.User; import java.util.List; public class UserHBServiceImpl implements UserService { //Настраиваю композицию между DAO и Service UserDaoHibernateImpl dataObjectAccess; public UserHBServiceImpl() { dataObjectAccess = new UserDaoHibernateImpl(); } public void createUsersTable() { dataObjectAccess.createUsersTable(); } public void dropUsersTable() { dataObjectAccess.dropUsersTable(); } public void saveUser(String name, String lastName, byte age) { dataObjectAccess.saveUser(name, lastName, age); } public void removeUserById(long id) { dataObjectAccess.removeUserById(id); } public List<User> getAllUsers() { return dataObjectAccess.getAllUsers(); } public void cleanUsersTable() { dataObjectAccess.cleanUsersTable(); } }
1,043
0.703048
0.703048
41
23.804878
21.555622
66
false
false
0
0
0
0
0
0
0.414634
false
false
7
169973f16339ce8d06881619ad2bdca6b987bac8
1,941,325,241,748
624117c40c6032a9a12c223d176518b7aec46f49
/src/com/nationwide/chapter7/williams/Assignment7_5.java
54ded807c71a63f2f6f3cdd42f8772e871edc081
[]
no_license
Bravo2017/JavaForEveryone
https://github.com/Bravo2017/JavaForEveryone
dd8de35419e815334d0c7d857d7349f97b3b9f39
aee14a0ce520f5e89084e2bad971811ec2448bf8
refs/heads/master
2021-05-05T23:08:38.393000
2016-08-05T01:09:03
2016-08-05T01:09:03
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.nationwide.chapter7.williams; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class Assignment7_5 { public static void main(String[] args) { int lineCounter = 0; int wordCounter = 0; int characterCounter = 0; String line = ""; String word = ""; char character; Scanner console = new Scanner(System.in); System.out.print("Input file: "); String inputFileName = console.next(); File inputFile = new File("C:/JavaForEveryone/files/" + inputFileName); // File fileForLines = new File("C:/JavaForEveryone/files/" + // inputFileName); console.close(); try { Scanner lines = new Scanner(inputFile); while (lines.hasNextLine()) { line = lines.nextLine(); lineCounter = lineCounter + 1; } if (lineCounter > 1) { System.out.println("File has " + lineCounter + " lines."); } else { System.out.println("File has " + lineCounter + " line."); } Scanner words = new Scanner(inputFile); while (words.hasNext()) { word = words.next(); wordCounter = wordCounter + 1; } if (wordCounter > 1) { System.out.println("File has " + wordCounter + " words."); } else { System.out.println("File has " + wordCounter + " word."); } Scanner characters = new Scanner(inputFile); characters.useDelimiter(""); while (characters.hasNext()) { character = characters.next().charAt(0); characterCounter = characterCounter + 1; } if (characterCounter > 1) { System.out.println("File has " + characterCounter + " characters."); } else { System.out.println("File has " + characterCounter + " character."); } lines.close(); // words.close(); characters.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } } }
UTF-8
Java
1,811
java
Assignment7_5.java
Java
[]
null
[]
package com.nationwide.chapter7.williams; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class Assignment7_5 { public static void main(String[] args) { int lineCounter = 0; int wordCounter = 0; int characterCounter = 0; String line = ""; String word = ""; char character; Scanner console = new Scanner(System.in); System.out.print("Input file: "); String inputFileName = console.next(); File inputFile = new File("C:/JavaForEveryone/files/" + inputFileName); // File fileForLines = new File("C:/JavaForEveryone/files/" + // inputFileName); console.close(); try { Scanner lines = new Scanner(inputFile); while (lines.hasNextLine()) { line = lines.nextLine(); lineCounter = lineCounter + 1; } if (lineCounter > 1) { System.out.println("File has " + lineCounter + " lines."); } else { System.out.println("File has " + lineCounter + " line."); } Scanner words = new Scanner(inputFile); while (words.hasNext()) { word = words.next(); wordCounter = wordCounter + 1; } if (wordCounter > 1) { System.out.println("File has " + wordCounter + " words."); } else { System.out.println("File has " + wordCounter + " word."); } Scanner characters = new Scanner(inputFile); characters.useDelimiter(""); while (characters.hasNext()) { character = characters.next().charAt(0); characterCounter = characterCounter + 1; } if (characterCounter > 1) { System.out.println("File has " + characterCounter + " characters."); } else { System.out.println("File has " + characterCounter + " character."); } lines.close(); // words.close(); characters.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } } }
1,811
0.64053
0.633352
69
25.246376
18.947224
73
false
false
0
0
0
0
0
0
2.884058
false
false
7
290064f8af74872637c5fddfb267fc83b647b5e6
30,262,339,582,402
2d374085fedcaef491d657e5beaf8a7d17e185fd
/spartacus-dao/src/main/java/com/tepizzaiola/spartacus/dao/cdi/annotations/ConfigurationValue.java
7384b728c560cdddc1b550086b476ab6151159ea
[ "Apache-2.0" ]
permissive
ajaydeshwal/spartacus
https://github.com/ajaydeshwal/spartacus
b8d32e9c75b0b92e450b3785b573bbcd95f14739
1ee009ca72914eccf2238804a2ea838ed69b34f5
refs/heads/master
2016-09-17T19:49:17.778000
2016-09-12T10:05:55
2016-09-12T10:05:55
66,132,148
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tepizzaiola.spartacus.dao.cdi.annotations; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.enterprise.util.Nonbinding; import javax.inject.Qualifier; /** * Defines method / variable that should be injected with value read from some arbitrary resource (e.g. from * <code>properties</code> file.) * * @author <a href="mailto:ajay.deshwal@gmail.com">Ajay Deshwal</a> * */ @Qualifier @Retention(RUNTIME) @Target({ TYPE, METHOD, FIELD, PARAMETER }) public @interface ConfigurationValue { /** * Key that will be searched when injecting the value. */ @Nonbinding String value() default ""; /** * Defines if value for the given key must be defined. */ @Nonbinding boolean required() default true; }
UTF-8
Java
1,079
java
ConfigurationValue.java
Java
[ { "context": "ties</code> file.)\n * \n * @author <a href=\"mailto:ajay.deshwal@gmail.com\">Ajay Deshwal</a>\n * \n */\n@Qualifier\n@Retention(R", "end": 686, "score": 0.9998876452445984, "start": 664, "tag": "EMAIL", "value": "ajay.deshwal@gmail.com" }, { "context": "* @author <a href=\"mailto:ajay.deshwal@gmail.com\">Ajay Deshwal</a>\n * \n */\n@Qualifier\n@Retention(RUNTIME)\n@Targe", "end": 700, "score": 0.9998841285705566, "start": 688, "tag": "NAME", "value": "Ajay Deshwal" } ]
null
[]
package com.tepizzaiola.spartacus.dao.cdi.annotations; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.enterprise.util.Nonbinding; import javax.inject.Qualifier; /** * Defines method / variable that should be injected with value read from some arbitrary resource (e.g. from * <code>properties</code> file.) * * @author <a href="mailto:<EMAIL>"><NAME></a> * */ @Qualifier @Retention(RUNTIME) @Target({ TYPE, METHOD, FIELD, PARAMETER }) public @interface ConfigurationValue { /** * Key that will be searched when injecting the value. */ @Nonbinding String value() default ""; /** * Defines if value for the given key must be defined. */ @Nonbinding boolean required() default true; }
1,058
0.742354
0.742354
37
28.18919
25.703968
108
false
false
0
0
0
0
0
0
0.405405
false
false
7
3f12fdbd558d6028660b11196756efa9ebb1e80f
18,588,618,510,137
d81ce16a58de23e2a8d6ce9f3c724948bab0ce19
/Ch4 Servlet开发基础/例程4-14/LogTest.java
9b87693f402735a0ea8358ebd52e80356e24db69
[]
no_license
MarsForever/DeepJavaWebDevelopment
https://github.com/MarsForever/DeepJavaWebDevelopment
260bb0a392645cec1abca79a2bd953252150046d
9fbdda707fefdde4a485d6ba7ad43d3bde9704d8
refs/heads/master
2021-03-27T08:35:52.206000
2017-10-06T17:12:01
2017-10-06T17:12:01
106,030,737
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.it315; import java.util.logging.Logger; public class LogTest { private static Logger log = Logger.getLogger("org.it315.xxx"); public static void main(String args[]) { log.finest("the finest message"); log.finer("finer message"); log.fine("a fine message"); log.config("some configuration message"); log.info("a little bit of information"); log.warning("a warning message"); log.severe("a severe message"); } }
UTF-8
Java
440
java
LogTest.java
Java
[]
null
[]
package org.it315; import java.util.logging.Logger; public class LogTest { private static Logger log = Logger.getLogger("org.it315.xxx"); public static void main(String args[]) { log.finest("the finest message"); log.finer("finer message"); log.fine("a fine message"); log.config("some configuration message"); log.info("a little bit of information"); log.warning("a warning message"); log.severe("a severe message"); } }
440
0.711364
0.697727
16
26.5625
17.456978
63
false
false
0
0
0
0
0
0
1.75
false
false
7
578e548c1524a4acc5a5aeb60971fc69379c4265
4,939,212,450,859
c47e9c435b1bd04c10b1ce6a84e2b74c4736c929
/Question.java
556d59bc94a60989f091ccbe08da1c7b732f6a7c
[]
no_license
viet16/viet-railway07
https://github.com/viet16/viet-railway07
2639a7d265e99816b8f602bb873aa3a17dd2ab60
c22d1412ba2a42f092fa1d56816feb87a3739d58
refs/heads/main
2023-02-28T02:44:39.819000
2021-01-31T09:13:06
2021-01-31T09:13:06
327,310,131
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package entities; import java.time.LocalDate; public class Question { int questionId ; String content ; CategoryQuestion categoryId ; TypeQuestion typeId ; Account creatorId ; LocalDate createDate ; }
UTF-8
Java
219
java
Question.java
Java
[]
null
[]
package entities; import java.time.LocalDate; public class Question { int questionId ; String content ; CategoryQuestion categoryId ; TypeQuestion typeId ; Account creatorId ; LocalDate createDate ; }
219
0.739726
0.739726
11
17.90909
9.099996
30
false
false
0
0
0
0
0
0
0.727273
false
false
7
38c2b307916ee973942c013977b03f7a7094a1b8
37,684,043,065,317
49e1480db9169bc646abbb8ea27e6ca457d42dec
/service/src/main/java/org/openo/sdnhub/overlayvpndriver/http/OverlayDriverHttpClient.java
fe7cebb765a4692521fc9c72c48841800c5b158f
[ "CC-BY-4.0", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
permissive
openov2/sdnhub-driver-huawei-overlay
https://github.com/openov2/sdnhub-driver-huawei-overlay
173f8acd254fc5b939c502a2d14ddd37a531935d
2ec13980918811681e53a2457ba9ffd4461aa1af
refs/heads/master
2021-09-01T00:02:32.713000
2017-05-03T09:29:00
2017-05-04T03:28:24
115,208,670
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2017 Huawei Technologies Co., Ltd. * * 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.openo.sdnhub.overlayvpndriver.http; import java.security.cert.X509Certificate; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; import org.apache.http.client.HttpClient; import org.apache.http.config.Registry; import org.apache.http.config.RegistryBuilder; import org.apache.http.conn.HttpClientConnectionManager; import org.apache.http.conn.socket.ConnectionSocketFactory; import org.apache.http.conn.socket.PlainConnectionSocketFactory; import org.apache.http.conn.ssl.AllowAllHostnameVerifier; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.conn.ssl.X509HostnameVerifier; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.LaxRedirectStrategy; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.slf4j.LoggerFactory; /** * <br/> * <p> * </p> * * @author * @version SDNHUB 0.5 02-Feb-2017 */ public class OverlayDriverHttpClient { private static final String SSLCONTEST_TLS = "TLSV1.2"; private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(OverlayDriverHttpClient.class); private HttpClient httpClient; private static class TrustAllX509TrustManager implements X509TrustManager { @Override public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[0]; } @Override public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) { // Do Nothing } @Override public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) { // Do Nothing } } /** * <br/> * * @since SDNHUB 0.5 */ public void login() { try { SSLContext sslcontext = SSLContext.getInstance(SSLCONTEST_TLS); sslcontext.init(null, new TrustManager[] {new TrustAllX509TrustManager()}, new java.security.SecureRandom()); X509HostnameVerifier hostnameVerifier = new AllowAllHostnameVerifier(); Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory> create() .register("http", PlainConnectionSocketFactory.INSTANCE) .register("https", new SSLConnectionSocketFactory(sslcontext, hostnameVerifier)).build(); HttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry); httpClient = HttpClients.custom().setConnectionManager(connManager) .setRedirectStrategy(new LaxRedirectStrategy()).build(); } catch(Exception e) { LOGGER.error("Exception in http client", e); } } public HttpClient getHttpClient() { return httpClient; } public void setHttpClient(HttpClient httpClient) { this.httpClient = httpClient; } }
UTF-8
Java
3,627
java
OverlayDriverHttpClient.java
Java
[]
null
[]
/* * Copyright 2017 Huawei Technologies Co., Ltd. * * 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.openo.sdnhub.overlayvpndriver.http; import java.security.cert.X509Certificate; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; import org.apache.http.client.HttpClient; import org.apache.http.config.Registry; import org.apache.http.config.RegistryBuilder; import org.apache.http.conn.HttpClientConnectionManager; import org.apache.http.conn.socket.ConnectionSocketFactory; import org.apache.http.conn.socket.PlainConnectionSocketFactory; import org.apache.http.conn.ssl.AllowAllHostnameVerifier; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.conn.ssl.X509HostnameVerifier; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.client.LaxRedirectStrategy; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.slf4j.LoggerFactory; /** * <br/> * <p> * </p> * * @author * @version SDNHUB 0.5 02-Feb-2017 */ public class OverlayDriverHttpClient { private static final String SSLCONTEST_TLS = "TLSV1.2"; private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(OverlayDriverHttpClient.class); private HttpClient httpClient; private static class TrustAllX509TrustManager implements X509TrustManager { @Override public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[0]; } @Override public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) { // Do Nothing } @Override public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) { // Do Nothing } } /** * <br/> * * @since SDNHUB 0.5 */ public void login() { try { SSLContext sslcontext = SSLContext.getInstance(SSLCONTEST_TLS); sslcontext.init(null, new TrustManager[] {new TrustAllX509TrustManager()}, new java.security.SecureRandom()); X509HostnameVerifier hostnameVerifier = new AllowAllHostnameVerifier(); Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory> create() .register("http", PlainConnectionSocketFactory.INSTANCE) .register("https", new SSLConnectionSocketFactory(sslcontext, hostnameVerifier)).build(); HttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager(socketFactoryRegistry); httpClient = HttpClients.custom().setConnectionManager(connManager) .setRedirectStrategy(new LaxRedirectStrategy()).build(); } catch(Exception e) { LOGGER.error("Exception in http client", e); } } public HttpClient getHttpClient() { return httpClient; } public void setHttpClient(HttpClient httpClient) { this.httpClient = httpClient; } }
3,627
0.711332
0.695892
105
33.542858
31.992567
120
false
false
0
0
0
0
0
0
0.428571
false
false
7
9d371d1c891f1695d037c24a68a6f42c05801643
37,684,043,067,175
d0d46b8881e81fc914898ac920699e4a0636bce1
/transaction-mulitdb2/src/main/java/com/transaction/controller/BaseController.java
cc496e3e5d19b6a5b3729c243b6bde9c8cd2ae26
[]
no_license
MasterLiuZhao/transaction
https://github.com/MasterLiuZhao/transaction
b06b2af95ee967966ee5cacee71fdd5a52584e04
3e330ba69764193d30373c355b0fea361b5df0d3
refs/heads/master
2020-04-04T00:28:01.102000
2018-11-01T03:25:09
2018-11-01T03:25:09
155,650,821
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.transaction.controller; public class BaseController { }
UTF-8
Java
69
java
BaseController.java
Java
[]
null
[]
package com.transaction.controller; public class BaseController { }
69
0.811594
0.811594
4
16.25
15.896148
35
false
false
0
0
0
0
0
0
0.25
false
false
7
1afcdb59d48dcb44ce63c27665ef767df8ddab09
35,313,221,141,712
e2c60cf8ff24c50e56799de820b60effd2634342
/JavaAssessmentProductManager/src/productManager/ProductList.java
66732b5965e69f02a87c4096f53d0a420788b9f8
[]
no_license
MohamedGhareeb933/JavaAssessment
https://github.com/MohamedGhareeb933/JavaAssessment
d524980158c7170e2ed96a17d275edc1f95085ce
9ffe248e9a53312e90aa7bf44a45ed1e98c17814
refs/heads/main
2023-02-13T18:07:24.515000
2021-01-09T04:48:21
2021-01-09T04:48:21
328,074,978
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package productManager; import java.util.ArrayList; import java.util.List; public class ProductList { // Container to Hold the list of the Products private List<Products> productList; public ProductList() { // initilize Product List in Constructor productList = new ArrayList<>(); } // add product Funtion public void AddProduct(Products products) { if(productList != null) productList.add(products); } // return Product size function public int CountProductsSize() { return productList.size(); } // Get Product Index public Products getProduct(int index) { if(index < 0 || index > CountProductsSize()) { return null; } return productList.get(index); } }
UTF-8
Java
711
java
ProductList.java
Java
[]
null
[]
package productManager; import java.util.ArrayList; import java.util.List; public class ProductList { // Container to Hold the list of the Products private List<Products> productList; public ProductList() { // initilize Product List in Constructor productList = new ArrayList<>(); } // add product Funtion public void AddProduct(Products products) { if(productList != null) productList.add(products); } // return Product size function public int CountProductsSize() { return productList.size(); } // Get Product Index public Products getProduct(int index) { if(index < 0 || index > CountProductsSize()) { return null; } return productList.get(index); } }
711
0.700422
0.699015
38
17.710526
16.109671
48
false
false
0
0
0
0
0
0
1.447368
false
false
7
6f34956ec9c1063eb48487dc0e4f70ae06fc2151
36,799,279,819,467
db259c83544761afd5e5bb7936c7dad0439e95fe
/src/main/java/io/github/oliviercailloux/y2018/jbiblio/j_biblio/javaobjectsfrommods/RelatedItemTypeAttributeDefinition.java
68cf3d5fdaac5fe57316e63f81738100feb553e2
[ "MIT" ]
permissive
Pangkevin/J-Biblio
https://github.com/Pangkevin/J-Biblio
c60ba9141caa525b123c124cb575a06e9416a811
fdb3e5f421e5e82652cb9033330a6fb76196e77d
refs/heads/master
2021-06-11T15:18:04.993000
2019-08-01T18:28:20
2019-08-01T18:28:20
161,239,625
0
1
null
false
2019-04-07T17:46:28
2018-12-10T21:37:44
2019-04-03T20:52:46
2019-04-07T17:46:28
324
0
0
3
Java
false
false
// // Ce fichier a été généré par l'implémentation de référence JavaTM Architecture for XML Binding (JAXB), v2.2.8-b130911.1802 // Voir <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Toute modification apportée à ce fichier sera perdue lors de la recompilation du schéma source. // Généré le : 2019.03.31 à 09:33:29 AM CEST // package io.github.oliviercailloux.y2018.jbiblio.j_biblio.javaobjectsfrommods; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnumValue; import javax.xml.bind.annotation.XmlType; /** * <p>Classe Java pour relatedItemTypeAttributeDefinition. * * <p>Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe. * <p> * <pre> * &lt;simpleType name="relatedItemTypeAttributeDefinition"> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"> * &lt;enumeration value="preceding"/> * &lt;enumeration value="succeeding"/> * &lt;enumeration value="original"/> * &lt;enumeration value="host"/> * &lt;enumeration value="constituent"/> * &lt;enumeration value="series"/> * &lt;enumeration value="otherVersion"/> * &lt;enumeration value="otherFormat"/> * &lt;enumeration value="isReferencedBy"/> * &lt;enumeration value="references"/> * &lt;enumeration value="reviewOf"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlType(name = "relatedItemTypeAttributeDefinition") @XmlEnum public enum RelatedItemTypeAttributeDefinition { @XmlEnumValue("preceding") PRECEDING("preceding"), @XmlEnumValue("succeeding") SUCCEEDING("succeeding"), @XmlEnumValue("original") ORIGINAL("original"), @XmlEnumValue("host") HOST("host"), @XmlEnumValue("constituent") CONSTITUENT("constituent"), @XmlEnumValue("series") SERIES("series"), @XmlEnumValue("otherVersion") OTHER_VERSION("otherVersion"), @XmlEnumValue("otherFormat") OTHER_FORMAT("otherFormat"), @XmlEnumValue("isReferencedBy") IS_REFERENCED_BY("isReferencedBy"), @XmlEnumValue("references") REFERENCES("references"), @XmlEnumValue("reviewOf") REVIEW_OF("reviewOf"); private final String value; RelatedItemTypeAttributeDefinition(String v) { value = v; } public String value() { return value; } public static RelatedItemTypeAttributeDefinition fromValue(String v) { for (RelatedItemTypeAttributeDefinition c: RelatedItemTypeAttributeDefinition.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); } }
UTF-8
Java
2,694
java
RelatedItemTypeAttributeDefinition.java
Java
[ { "context": ".03.31 à 09:33:29 AM CEST \n//\n\n\npackage io.github.oliviercailloux.y2018.jbiblio.j_biblio.javaobjectsfrommods;\n\nimpo", "end": 394, "score": 0.7971382141113281, "start": 379, "tag": "USERNAME", "value": "oliviercailloux" } ]
null
[]
// // Ce fichier a été généré par l'implémentation de référence JavaTM Architecture for XML Binding (JAXB), v2.2.8-b130911.1802 // Voir <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Toute modification apportée à ce fichier sera perdue lors de la recompilation du schéma source. // Généré le : 2019.03.31 à 09:33:29 AM CEST // package io.github.oliviercailloux.y2018.jbiblio.j_biblio.javaobjectsfrommods; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnumValue; import javax.xml.bind.annotation.XmlType; /** * <p>Classe Java pour relatedItemTypeAttributeDefinition. * * <p>Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe. * <p> * <pre> * &lt;simpleType name="relatedItemTypeAttributeDefinition"> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"> * &lt;enumeration value="preceding"/> * &lt;enumeration value="succeeding"/> * &lt;enumeration value="original"/> * &lt;enumeration value="host"/> * &lt;enumeration value="constituent"/> * &lt;enumeration value="series"/> * &lt;enumeration value="otherVersion"/> * &lt;enumeration value="otherFormat"/> * &lt;enumeration value="isReferencedBy"/> * &lt;enumeration value="references"/> * &lt;enumeration value="reviewOf"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlType(name = "relatedItemTypeAttributeDefinition") @XmlEnum public enum RelatedItemTypeAttributeDefinition { @XmlEnumValue("preceding") PRECEDING("preceding"), @XmlEnumValue("succeeding") SUCCEEDING("succeeding"), @XmlEnumValue("original") ORIGINAL("original"), @XmlEnumValue("host") HOST("host"), @XmlEnumValue("constituent") CONSTITUENT("constituent"), @XmlEnumValue("series") SERIES("series"), @XmlEnumValue("otherVersion") OTHER_VERSION("otherVersion"), @XmlEnumValue("otherFormat") OTHER_FORMAT("otherFormat"), @XmlEnumValue("isReferencedBy") IS_REFERENCED_BY("isReferencedBy"), @XmlEnumValue("references") REFERENCES("references"), @XmlEnumValue("reviewOf") REVIEW_OF("reviewOf"); private final String value; RelatedItemTypeAttributeDefinition(String v) { value = v; } public String value() { return value; } public static RelatedItemTypeAttributeDefinition fromValue(String v) { for (RelatedItemTypeAttributeDefinition c: RelatedItemTypeAttributeDefinition.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); } }
2,694
0.679238
0.665795
85
30.505882
25.57003
125
false
false
0
0
0
0
0
0
0.423529
false
false
7
4bb5563db3aa0d81ebc448c867268a6da3281bdd
36,799,279,818,788
01cd615fa9e9b531db59d45cd83c03a309118831
/baby-server/smart-service/src/main/java/cn/smart/bo/GroupCourseBO.java
96b7af596b3133b624ffce8fbf5afe2980b46260
[]
no_license
willpyshan13/baby-learn
https://github.com/willpyshan13/baby-learn
5945b3934de368672feeffee5ed75ebf68142a24
faf9a7b031dc65ca6d7d7c98d26067a4f0140c69
refs/heads/main
2023-08-01T13:48:12.105000
2021-09-23T05:29:37
2021-09-23T05:29:37
409,460,025
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
//package cn.smart.bo; // ///** // * 课程签到页 课程信息类 // * @author Ye // */ //public class GroupCourseBO { // // /** // * 课程编号 // */ // private Long courseId; // // /** // * 课程阶段编号 // */ // private Long stageId; // // /** // * 单元编号 // */ // private Integer groupCode; // // /** // * 课程名称 // */ // private String courseName; // // /** // * 课程图片 // */ // private String imageUrl; // // /** // * 课程得分 // */ // private Integer score; // // /** // * 是否签到 // */ // private Boolean clockedIn; // // public String getCourseName() { // return courseName; // } // // public void setCourseName(String courseName) { // this.courseName = courseName; // } // // public String getImageUrl() { // return imageUrl; // } // // public void setImageUrl(String imageUrl) { // this.imageUrl = imageUrl; // } // // public Integer getScore() { // return score; // } // // public void setScore(Integer score) { // this.score = score; // } // // public Boolean getClockedIn() { // return clockedIn; // } // // public void setClockedIn(Boolean clockedIn) { // this.clockedIn = clockedIn; // } // // public Integer getGroupCode() { // return groupCode; // } // // public void setGroupCode(Integer groupCode) { // this.groupCode = groupCode; // } // // public Long getCourseId() { // return courseId; // } // // public void setCourseId(Long courseId) { // this.courseId = courseId; // } // // public Long getStageId() { // return stageId; // } // // public void setStageId(Long stageId) { // this.stageId = stageId; // } //}
UTF-8
Java
1,851
java
GroupCourseBO.java
Java
[ { "context": "n.smart.bo;\n//\n///**\n// * 课程签到页 课程信息类\n// * @author Ye\n// */\n//public class GroupCourseBO {\n//\n// /**", "end": 64, "score": 0.9952049851417542, "start": 62, "tag": "NAME", "value": "Ye" } ]
null
[]
//package cn.smart.bo; // ///** // * 课程签到页 课程信息类 // * @author Ye // */ //public class GroupCourseBO { // // /** // * 课程编号 // */ // private Long courseId; // // /** // * 课程阶段编号 // */ // private Long stageId; // // /** // * 单元编号 // */ // private Integer groupCode; // // /** // * 课程名称 // */ // private String courseName; // // /** // * 课程图片 // */ // private String imageUrl; // // /** // * 课程得分 // */ // private Integer score; // // /** // * 是否签到 // */ // private Boolean clockedIn; // // public String getCourseName() { // return courseName; // } // // public void setCourseName(String courseName) { // this.courseName = courseName; // } // // public String getImageUrl() { // return imageUrl; // } // // public void setImageUrl(String imageUrl) { // this.imageUrl = imageUrl; // } // // public Integer getScore() { // return score; // } // // public void setScore(Integer score) { // this.score = score; // } // // public Boolean getClockedIn() { // return clockedIn; // } // // public void setClockedIn(Boolean clockedIn) { // this.clockedIn = clockedIn; // } // // public Integer getGroupCode() { // return groupCode; // } // // public void setGroupCode(Integer groupCode) { // this.groupCode = groupCode; // } // // public Long getCourseId() { // return courseId; // } // // public void setCourseId(Long courseId) { // this.courseId = courseId; // } // // public Long getStageId() { // return stageId; // } // // public void setStageId(Long stageId) { // this.stageId = stageId; // } //}
1,851
0.494636
0.494636
99
16.888889
14.610699
52
false
false
0
0
0
0
0
0
0.222222
false
false
7
0cae52358cb1159a8f5f797e2d67682631e6f56c
39,359,080,318,746
131ba0582a6e41716510f4d9de3411c77045c839
/app/src/main/java/pawan/example/com/splitthebill/activity/SplitTheBillFragment.java
d7cce5159083793992d8ba875fcdbf0abde393b4
[]
no_license
pawankumarbaranwal/SplitTheBill
https://github.com/pawankumarbaranwal/SplitTheBill
4ca8713b2c75257820fb200f4d3f76c7d20be773
d9a9f21c36a7185a5ed63dd1179a41b3a9427482
refs/heads/master
2021-01-21T13:33:40.881000
2016-05-03T19:12:21
2016-05-03T19:12:21
55,788,304
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pawan.example.com.splitthebill.activity; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.Locale; import java.util.TreeSet; import pawan.example.com.splitthebill.dto.Friend; /** * Created by Pawan on 29/03/16. */ public class SplitTheBillFragment extends Fragment implements View.OnClickListener { private SQLiteDatabase db; private Cursor c; protected List<Friend> friendList = new ArrayList<>(); String[] mDataset; AutoCompleteTextView tvAutocompleteFriendEmail; EditText etDescription; EditText etMoney; Button btnSplitSubmit; TreeSet<String> uniqueName; List<String> listEmailId = new ArrayList<String>(); TextView tvCalculation; public SplitTheBillFragment() { } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); initDataset(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_split, container, false); tvAutocompleteFriendEmail = (AutoCompleteTextView) rootView.findViewById(R.id.tvAutocompleteFriendEmail); etDescription = (EditText) rootView.findViewById(R.id.etDescription); etMoney = (EditText) rootView.findViewById(R.id.etMoney); tvCalculation = (TextView) rootView.findViewById(R.id.tvCalculation); btnSplitSubmit = (Button) rootView.findViewById(R.id.btnSplitSubmit); ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, uniqueName.toArray(new String[uniqueName.size()])); tvAutocompleteFriendEmail.setAdapter(adapter); tvCalculation.setOnClickListener(this); btnSplitSubmit.setOnClickListener(this); // Inflate the layout for this fragment return rootView; } @Override public void onAttach(Activity activity) { super.onAttach(activity); } @Override public void onDetach() { super.onDetach(); } private void initDataset() { Log.d("Coming", "x"); db = getActivity().openOrCreateDatabase("SplitTheBill", Context.MODE_PRIVATE, null); c = db.rawQuery("SELECT * FROM FRIENDS", null); if (c.moveToFirst()) { Friend friend = new Friend(); friend.setFriendName(c.getString(1)); friend.setFriendEmailId(c.getString(2)); friend.setDescription(c.getString(3)); friend.setSplittedAmount(c.getInt(4)); //friend.setSpentDate((Date)c.getString(3)); //friend.setSign((Character)c.getString(5)); friendList.add(friend); String name = c.getString(1); //mDataset[i]=name; while (!c.isLast()) { c.moveToNext(); friend = new Friend(); friend.setFriendName(c.getString(1)); friend.setFriendEmailId(c.getString(2)); friend.setDescription(c.getString(3)); friend.setSplittedAmount(Integer.parseInt(c.getString(4))); //friend.setSpentDate((Date)c.getString(3)); //friend.setSign((Character)c.getString(5)); friendList.add(friend); name = c.getString(1); // mDataset[i]=name; } } mDataset = new String[friendList.size()]; for (int j = 0; j < friendList.size(); j++) { mDataset[j] = friendList.get(j).getFriendEmailId(); } listEmailId = Arrays.asList(mDataset); uniqueName = new TreeSet<String>(listEmailId); } @Override public void onClick(View view) { if (view == tvCalculation) { final CharSequence[] scienarios = { "Paid by You and Split Equally", "Paid by You and Other Owe the full amount", "Paid by Other and Split Equally", "Paid by Other and You Owe the full amount"}; AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext()); builder.setTitle("Split the Bill"); builder.setItems(scienarios, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Toast.makeText(getActivity(), "You have selected " + scienarios[which], Toast.LENGTH_LONG).show(); tvCalculation.setText(scienarios[which]); } }); builder.setInverseBackgroundForced(true); builder.create(); builder.show(); } if (view == btnSplitSubmit) { insertIntoDB(tvCalculation.getText() + ""); } } protected void insertIntoDB(String splitScienario) { String query = ""; String friendEmail = tvAutocompleteFriendEmail.getText() + ""; String description = etDescription.getText() + ""; String money = etMoney.getText() + ""; String friendName = getFriendName(friendEmail); if (friendEmail.equals("") || description.equals("") || money.equals("")) { Toast.makeText(getActivity(), "Please fill all fields", Toast.LENGTH_LONG).show(); } else if (!listEmailId.contains(friendEmail)) { Toast.makeText(getActivity(), "Friend Name is incorrect", Toast.LENGTH_LONG).show(); } else { if (splitScienario.equals("Paid by You and Split Equally")) { query = "INSERT INTO FRIENDS (FriendName,FriendEmailId,Description,SplittedAmount,TotalAmount,SpentDate,PaidBy) " + "VALUES('" +friendName+ "','" + friendEmail + "', '" + description + "', '" + Integer.parseInt(money) / 2 + "', '" + money + "', '" + Calendar.getInstance().getTimeInMillis() + "', '" + "You" + "');"; } else if (splitScienario.equals("Paid by You and Other Owe the full amount")) { query = "INSERT INTO FRIENDS (FriendName,FriendEmailId,Description,SplittedAmount,TotalAmount,SpentDate,PaidBy)" + " VALUES('" +friendName+ "','" + friendEmail + "', '" + description + "', '" + money + "', '" + money + "', '" + Calendar.getInstance().getTimeInMillis() + "', '" + "You" + "');"; } else if (splitScienario.equals("Paid by Other and Split Equally")) { query = "INSERT INTO FRIENDS (FriendName,FriendEmailId,Description,SplittedAmount,TotalAmount,SpentDate,PaidBy)" + " VALUES('" +friendName+ "','" + friendEmail + "', '" + description + "', '" + "-" + Integer.parseInt(money) / 2 + "', '" + money + "', '" + Calendar.getInstance().getTimeInMillis() + "', '" + friendEmail + "');"; } else if (splitScienario.equals("Paid by Other and You Owe the full amount")) { query = "INSERT INTO FRIENDS (FriendName,FriendEmailId,Description,SplittedAmount,TotalAmount,SpentDate,PaidBy) " + "VALUES('" +friendName+ "','" + friendEmail + "', '" + description + "', '" + "-" + Integer.parseInt(money) + "', '" + money + "', '" + Calendar.getInstance().getTimeInMillis() + "', '" + friendEmail + "');"; } else { query = "INSERT INTO FRIENDS (FriendName,FriendEmailId,Description,SplittedAmount,TotalAmount,SpentDate,PaidBy)" + " VALUES('" +friendName+ "','" + friendEmail + "', '" + description + "', '" + Integer.parseInt(money) / 2 + "', '" + money + "', '" + Calendar.getInstance().getTimeInMillis() + "', '" + "You" + "');"; } db.execSQL(query); Toast.makeText(getActivity(), "Saved Successfully", Toast.LENGTH_LONG).show(); } } private String getFriendName(String friendEmailId) { c = db.rawQuery("SELECT * FROM FRIENDS WHERE FRIENDEMAILID ='" + friendEmailId + "' AND DESCRIPTION IS NULL ", null); Log.i("testttttt","11"); if (c.moveToFirst()) { Log.i("testttttt","11"+c.getString(1)); return c.getString(1) + ""; } else { Log.i("testttttt","11"+c.getString(1)); return null; } } }
UTF-8
Java
9,004
java
SplitTheBillFragment.java
Java
[ { "context": "le.com.splitthebill.dto.Friend;\n\n/**\n * Created by Pawan on 29/03/16.\n */\npublic class SplitTheBillFra", "end": 933, "score": 0.6556252837181091, "start": 932, "tag": "USERNAME", "value": "P" }, { "context": ".com.splitthebill.dto.Friend;\n\n/**\n * Created by Pawan on 29/03/16.\n */\npublic class SplitTheBillFragmen", "end": 937, "score": 0.5746344327926636, "start": 933, "tag": "NAME", "value": "awan" } ]
null
[]
package pawan.example.com.splitthebill.activity; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.Locale; import java.util.TreeSet; import pawan.example.com.splitthebill.dto.Friend; /** * Created by Pawan on 29/03/16. */ public class SplitTheBillFragment extends Fragment implements View.OnClickListener { private SQLiteDatabase db; private Cursor c; protected List<Friend> friendList = new ArrayList<>(); String[] mDataset; AutoCompleteTextView tvAutocompleteFriendEmail; EditText etDescription; EditText etMoney; Button btnSplitSubmit; TreeSet<String> uniqueName; List<String> listEmailId = new ArrayList<String>(); TextView tvCalculation; public SplitTheBillFragment() { } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); initDataset(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_split, container, false); tvAutocompleteFriendEmail = (AutoCompleteTextView) rootView.findViewById(R.id.tvAutocompleteFriendEmail); etDescription = (EditText) rootView.findViewById(R.id.etDescription); etMoney = (EditText) rootView.findViewById(R.id.etMoney); tvCalculation = (TextView) rootView.findViewById(R.id.tvCalculation); btnSplitSubmit = (Button) rootView.findViewById(R.id.btnSplitSubmit); ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, uniqueName.toArray(new String[uniqueName.size()])); tvAutocompleteFriendEmail.setAdapter(adapter); tvCalculation.setOnClickListener(this); btnSplitSubmit.setOnClickListener(this); // Inflate the layout for this fragment return rootView; } @Override public void onAttach(Activity activity) { super.onAttach(activity); } @Override public void onDetach() { super.onDetach(); } private void initDataset() { Log.d("Coming", "x"); db = getActivity().openOrCreateDatabase("SplitTheBill", Context.MODE_PRIVATE, null); c = db.rawQuery("SELECT * FROM FRIENDS", null); if (c.moveToFirst()) { Friend friend = new Friend(); friend.setFriendName(c.getString(1)); friend.setFriendEmailId(c.getString(2)); friend.setDescription(c.getString(3)); friend.setSplittedAmount(c.getInt(4)); //friend.setSpentDate((Date)c.getString(3)); //friend.setSign((Character)c.getString(5)); friendList.add(friend); String name = c.getString(1); //mDataset[i]=name; while (!c.isLast()) { c.moveToNext(); friend = new Friend(); friend.setFriendName(c.getString(1)); friend.setFriendEmailId(c.getString(2)); friend.setDescription(c.getString(3)); friend.setSplittedAmount(Integer.parseInt(c.getString(4))); //friend.setSpentDate((Date)c.getString(3)); //friend.setSign((Character)c.getString(5)); friendList.add(friend); name = c.getString(1); // mDataset[i]=name; } } mDataset = new String[friendList.size()]; for (int j = 0; j < friendList.size(); j++) { mDataset[j] = friendList.get(j).getFriendEmailId(); } listEmailId = Arrays.asList(mDataset); uniqueName = new TreeSet<String>(listEmailId); } @Override public void onClick(View view) { if (view == tvCalculation) { final CharSequence[] scienarios = { "Paid by You and Split Equally", "Paid by You and Other Owe the full amount", "Paid by Other and Split Equally", "Paid by Other and You Owe the full amount"}; AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext()); builder.setTitle("Split the Bill"); builder.setItems(scienarios, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Toast.makeText(getActivity(), "You have selected " + scienarios[which], Toast.LENGTH_LONG).show(); tvCalculation.setText(scienarios[which]); } }); builder.setInverseBackgroundForced(true); builder.create(); builder.show(); } if (view == btnSplitSubmit) { insertIntoDB(tvCalculation.getText() + ""); } } protected void insertIntoDB(String splitScienario) { String query = ""; String friendEmail = tvAutocompleteFriendEmail.getText() + ""; String description = etDescription.getText() + ""; String money = etMoney.getText() + ""; String friendName = getFriendName(friendEmail); if (friendEmail.equals("") || description.equals("") || money.equals("")) { Toast.makeText(getActivity(), "Please fill all fields", Toast.LENGTH_LONG).show(); } else if (!listEmailId.contains(friendEmail)) { Toast.makeText(getActivity(), "Friend Name is incorrect", Toast.LENGTH_LONG).show(); } else { if (splitScienario.equals("Paid by You and Split Equally")) { query = "INSERT INTO FRIENDS (FriendName,FriendEmailId,Description,SplittedAmount,TotalAmount,SpentDate,PaidBy) " + "VALUES('" +friendName+ "','" + friendEmail + "', '" + description + "', '" + Integer.parseInt(money) / 2 + "', '" + money + "', '" + Calendar.getInstance().getTimeInMillis() + "', '" + "You" + "');"; } else if (splitScienario.equals("Paid by You and Other Owe the full amount")) { query = "INSERT INTO FRIENDS (FriendName,FriendEmailId,Description,SplittedAmount,TotalAmount,SpentDate,PaidBy)" + " VALUES('" +friendName+ "','" + friendEmail + "', '" + description + "', '" + money + "', '" + money + "', '" + Calendar.getInstance().getTimeInMillis() + "', '" + "You" + "');"; } else if (splitScienario.equals("Paid by Other and Split Equally")) { query = "INSERT INTO FRIENDS (FriendName,FriendEmailId,Description,SplittedAmount,TotalAmount,SpentDate,PaidBy)" + " VALUES('" +friendName+ "','" + friendEmail + "', '" + description + "', '" + "-" + Integer.parseInt(money) / 2 + "', '" + money + "', '" + Calendar.getInstance().getTimeInMillis() + "', '" + friendEmail + "');"; } else if (splitScienario.equals("Paid by Other and You Owe the full amount")) { query = "INSERT INTO FRIENDS (FriendName,FriendEmailId,Description,SplittedAmount,TotalAmount,SpentDate,PaidBy) " + "VALUES('" +friendName+ "','" + friendEmail + "', '" + description + "', '" + "-" + Integer.parseInt(money) + "', '" + money + "', '" + Calendar.getInstance().getTimeInMillis() + "', '" + friendEmail + "');"; } else { query = "INSERT INTO FRIENDS (FriendName,FriendEmailId,Description,SplittedAmount,TotalAmount,SpentDate,PaidBy)" + " VALUES('" +friendName+ "','" + friendEmail + "', '" + description + "', '" + Integer.parseInt(money) / 2 + "', '" + money + "', '" + Calendar.getInstance().getTimeInMillis() + "', '" + "You" + "');"; } db.execSQL(query); Toast.makeText(getActivity(), "Saved Successfully", Toast.LENGTH_LONG).show(); } } private String getFriendName(String friendEmailId) { c = db.rawQuery("SELECT * FROM FRIENDS WHERE FRIENDEMAILID ='" + friendEmailId + "' AND DESCRIPTION IS NULL ", null); Log.i("testttttt","11"); if (c.moveToFirst()) { Log.i("testttttt","11"+c.getString(1)); return c.getString(1) + ""; } else { Log.i("testttttt","11"+c.getString(1)); return null; } } }
9,004
0.612506
0.608618
201
43.791046
42.564159
237
false
false
0
0
0
0
0
0
1.044776
false
false
7
9f823647c623944fa69f45bfff7c53cb955243c0
36,996,848,307,505
66e991d532562efaada1a60b6a4f95fb3baa9c2f
/server/my-saloon/my-saloon/src/main/java/com/rmaciel/mysaloon/controllers/forms/AuthenticationForm.java
b14686f01330e30607e58a09856776f74174547d
[]
no_license
rafa-maciel/mysalon
https://github.com/rafa-maciel/mysalon
eddc51358579fdcd96c6fdf025224adf270707d8
82942a48f832864afc4a0b20c8a8fa7031d73eab
refs/heads/master
2023-01-13T22:33:02.853000
2020-07-04T16:20:19
2020-07-04T16:20:19
250,639,502
0
0
null
false
2023-01-07T17:02:53
2020-03-27T20:27:12
2021-09-02T13:10:12
2023-01-07T17:02:52
13,892
0
0
21
JavaScript
false
false
package com.rmaciel.mysaloon.controllers.forms; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; public class AuthenticationForm { private String email; private String password; public AuthenticationForm(String email, String password) { this.email = email; this.password = password; } public UsernamePasswordAuthenticationToken convert() { return new UsernamePasswordAuthenticationToken(this.email, this.password); } public String getEmail() { return this.email; } public String getPassword() { return this.password; } }
UTF-8
Java
647
java
AuthenticationForm.java
Java
[]
null
[]
package com.rmaciel.mysaloon.controllers.forms; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; public class AuthenticationForm { private String email; private String password; public AuthenticationForm(String email, String password) { this.email = email; this.password = password; } public UsernamePasswordAuthenticationToken convert() { return new UsernamePasswordAuthenticationToken(this.email, this.password); } public String getEmail() { return this.email; } public String getPassword() { return this.password; } }
647
0.714065
0.714065
26
23.884615
25.420052
87
false
false
0
0
0
0
0
0
0.423077
false
false
7
cdfcd71a903f64fc20a87df6948c0e3f6e645cea
35,046,933,183,183
7576dad8a5322c0fafc1625ccf377fac2dbad7cf
/src/main/java/com/java/userapi/controller/UserController.java
88663f6687a9af601cf20a5556ec578d6a8d145a
[]
no_license
shrirang-kadale/userapi
https://github.com/shrirang-kadale/userapi
42ac2ac4d1999bded6c17061be9966b2bcc4e983
76cb274ccd92496ca6251b9d884ffb3c1be49ad6
refs/heads/master
2023-08-07T14:17:57.799000
2021-09-16T05:15:10
2021-09-16T05:15:10
405,848,524
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.java.userapi.controller; import com.java.userapi.Model.UserModel; import com.java.userapi.exception.UserAlreadyExistsException; import com.java.userapi.service.UserService; import java.util.List; import java.util.Optional; import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; /** * Provide CRUD operations for Users */ @Log4j2 @RestController @RequestMapping("/api/users") public class UserController { @Autowired private UserService userService; /** * User Registration API to register a valid user * @param user * @return UserModel * @throws UserAlreadyExistsException */ @PostMapping(value = "/register") public UserModel userRegistration(@Validated @RequestBody UserModel user) throws UserAlreadyExistsException { log.info("User Registration API"); return userService.registerUser(user); } /** * API to get all users by their firstName * @param firstName * @return List<UserModel> */ @GetMapping(value = "/getUser") public List<UserModel> getUserByName(@RequestParam(name = "firstName") String firstName) { log.info("API to get all users by their firstName"); return userService.getUserByFirstName(firstName); } /** * API to get user details by userId * @param userId * @return Optional<UserModel> */ @GetMapping(value = "/getById") public Optional<UserModel> getUserById(@RequestParam(name = "userId") String userId) { log.info("API to get all users by userId"); return userService.getUserById(userId); } @PutMapping(value = "/update") public void updateUser(@RequestParam(name = "userId") String userId) { log.info("API to update user by userId"); userService.updateUser(userId); } /** * API to delete the user by userId * @param userId */ @DeleteMapping(value = "/delete/{userId}") public void deleteUser(@PathVariable String userId) { log.info("API to delete user by userId"); userService.deleteUser(userId); } }
UTF-8
Java
2,236
java
UserController.java
Java
[]
null
[]
package com.java.userapi.controller; import com.java.userapi.Model.UserModel; import com.java.userapi.exception.UserAlreadyExistsException; import com.java.userapi.service.UserService; import java.util.List; import java.util.Optional; import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; /** * Provide CRUD operations for Users */ @Log4j2 @RestController @RequestMapping("/api/users") public class UserController { @Autowired private UserService userService; /** * User Registration API to register a valid user * @param user * @return UserModel * @throws UserAlreadyExistsException */ @PostMapping(value = "/register") public UserModel userRegistration(@Validated @RequestBody UserModel user) throws UserAlreadyExistsException { log.info("User Registration API"); return userService.registerUser(user); } /** * API to get all users by their firstName * @param firstName * @return List<UserModel> */ @GetMapping(value = "/getUser") public List<UserModel> getUserByName(@RequestParam(name = "firstName") String firstName) { log.info("API to get all users by their firstName"); return userService.getUserByFirstName(firstName); } /** * API to get user details by userId * @param userId * @return Optional<UserModel> */ @GetMapping(value = "/getById") public Optional<UserModel> getUserById(@RequestParam(name = "userId") String userId) { log.info("API to get all users by userId"); return userService.getUserById(userId); } @PutMapping(value = "/update") public void updateUser(@RequestParam(name = "userId") String userId) { log.info("API to update user by userId"); userService.updateUser(userId); } /** * API to delete the user by userId * @param userId */ @DeleteMapping(value = "/delete/{userId}") public void deleteUser(@PathVariable String userId) { log.info("API to delete user by userId"); userService.deleteUser(userId); } }
2,236
0.689624
0.687388
75
28.813334
24.726068
113
false
false
0
0
0
0
0
0
0.28
false
false
7
a48543d44980f94377c36e9f003c38ce4e971740
39,496,519,254,761
929d434d5fd13eacd3da9cb59e03cb98e5687066
/rpc-provider-spring-boot-starter/src/main/java/org/ray/rpc/provider/context/SpringApplicationContext.java
3a77040b9ee60194e935cd681723b6e390ecdfca
[ "LicenseRef-scancode-mulanpsl-2.0-en", "MulanPSL-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
longsailer/mydemo
https://github.com/longsailer/mydemo
164c5d1f25eb002f2727dd647370a1f2a497c231
8658713ba458e24fa21f19af4685568ee7b2d87a
refs/heads/master
2023-03-25T11:18:12.956000
2021-01-12T01:19:40
2021-01-12T01:19:40
328,851,488
0
0
NOASSERTION
false
2021-03-12T22:01:43
2021-01-12T02:39:18
2021-01-12T02:39:44
2021-03-12T22:01:42
92
0
0
1
Java
false
false
package org.ray.rpc.provider.context; import java.util.Map; import org.ray.rpc.provider.annotation.Provider; import org.springframework.context.ApplicationContext; /** * SpringApplicationContext.java * <br><br> * 利用spring容器缓存,提供基于{@link Provider }过滤后的服务库的精准查询 * @author: ray * @date: 2020年12月23日 */ public class SpringApplicationContext { private ApplicationContext applicationContext; private static SpringApplicationContext context = new SpringApplicationContext(); private int port; private String applicationName; private SpringApplicationContext(){} public static SpringApplicationContext getInstance(){ return context; } public void setApplicationContext(ApplicationContext applicationContext){ this.applicationContext = applicationContext; } public Object getBean(String clazzName){ Map<String, Object> map = applicationContext.getBeansWithAnnotation(Provider.class); if(map.containsKey(clazzName)){ return map.get(clazzName); } return null; } public int getPort() { return port; } public void setPort(int port) { this.port = port; } public String getApplicationName() { return applicationName; } public void setApplicationName(String applicationName) { this.applicationName = applicationName; } }
UTF-8
Java
1,327
java
SpringApplicationContext.java
Java
[ { "context": "容器缓存,提供基于{@link Provider }过滤后的服务库的精准查询\n * @author: ray\n * @date: 2020年12月23日\n */\npublic class SpringAppl", "end": 281, "score": 0.9328323602676392, "start": 278, "tag": "USERNAME", "value": "ray" } ]
null
[]
package org.ray.rpc.provider.context; import java.util.Map; import org.ray.rpc.provider.annotation.Provider; import org.springframework.context.ApplicationContext; /** * SpringApplicationContext.java * <br><br> * 利用spring容器缓存,提供基于{@link Provider }过滤后的服务库的精准查询 * @author: ray * @date: 2020年12月23日 */ public class SpringApplicationContext { private ApplicationContext applicationContext; private static SpringApplicationContext context = new SpringApplicationContext(); private int port; private String applicationName; private SpringApplicationContext(){} public static SpringApplicationContext getInstance(){ return context; } public void setApplicationContext(ApplicationContext applicationContext){ this.applicationContext = applicationContext; } public Object getBean(String clazzName){ Map<String, Object> map = applicationContext.getBeansWithAnnotation(Provider.class); if(map.containsKey(clazzName)){ return map.get(clazzName); } return null; } public int getPort() { return port; } public void setPort(int port) { this.port = port; } public String getApplicationName() { return applicationName; } public void setApplicationName(String applicationName) { this.applicationName = applicationName; } }
1,327
0.768627
0.762353
57
21.350878
22.831566
86
false
false
0
0
0
0
0
0
1.157895
false
false
7
2ef2e1264bc11fab43c2956e7049e17533a557e9
27,487,790,754,260
624f147eae1545c371993d1843d5fbf5912f8777
/src/main/java/com/cedar/designpattern/proxy/dynamic/Teach.java
e319347e950296f35d4945709122a526acc374f0
[]
no_license
cedarjo/DesignPattern
https://github.com/cedarjo/DesignPattern
0d9e4b6dab6c5910d3aff607d9458357de6ec4a3
7bac90e2406ae875c991879be7b6963d1ba3f7f9
refs/heads/master
2022-07-30T00:38:07.973000
2020-04-11T15:30:12
2020-04-11T15:30:12
245,625,149
0
0
null
false
2020-10-13T20:09:02
2020-03-07T12:02:52
2020-04-11T15:30:09
2020-10-13T20:09:01
297
0
0
1
Java
false
false
package com.cedar.designpattern.proxy.dynamic; public class Teach implements ITeach { @Override public void teach() { System.out.println(" 老师授课中... "); } }
UTF-8
Java
189
java
Teach.java
Java
[]
null
[]
package com.cedar.designpattern.proxy.dynamic; public class Teach implements ITeach { @Override public void teach() { System.out.println(" 老师授课中... "); } }
189
0.648045
0.648045
10
16.9
17.902235
46
false
false
0
0
0
0
0
0
0.2
false
false
7
499618218e20b2c6e8fa1b954ce7dbe5366d7e9c
6,536,940,279,563
7844d726fa121edb1d1a63ad108aa9eb2ab383ed
/src/submit/MySolver.java
e6a207fba473956a8962a4baac2f8f9ef9b01901
[]
no_license
craberger/cs243_lab2
https://github.com/craberger/cs243_lab2
38766e37464145c3604426b3a0a73ffe05b67de4
35e062fbc356a6d6496e6e0af2a3a8d694799ac4
refs/heads/master
2015-08-10T11:39:06
2014-02-24T18:28:14
2014-02-24T18:28:14
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package submit; // some useful things to import. add any additional imports you need. import joeq.Compiler.Quad.*; import flow.Flow; import java.util.*; /** * Skeleton class for implementing the Flow.Solver interface. */ public class MySolver implements Flow.Solver { public static final boolean DEBUG=false; protected Flow.Analysis analysis; /** * Sets the analysis. When visitCFG is called, it will * perform this analysis on a given CFG. * * @param analyzer The analysis to run */ public void registerAnalysis(Flow.Analysis analyzer) { this.analysis = analyzer; } /** * Runs the solver over a given control flow graph. Prior * to calling this, an analysis must be registered using * registerAnalysis * * @param cfg The control flow graph to analyze. */ public void visitCFG(ControlFlowGraph cfg) { // this needs to come first. analysis.preprocess(cfg); if(analysis.isForward()) traverseForward(cfg); else traverseBackward(cfg); // this needs to come last. analysis.postprocess(cfg); } private void traverseForward(ControlFlowGraph cfg){ boolean change = true; while(change){ QuadIterator qit = new QuadIterator(cfg, analysis.isForward()); change = false; while(qit.hasNext()){ //special case for 1st quad: assign entry to its in Quad q = qit.next(); Iterator<Quad> pred = qit.predecessors(); Flow.DataflowObject prevOut = analysis.getOut(q); Flow.DataflowObject in = analysis.newTempVar(); in.setToTop(); while(pred.hasNext()){ Quad curPred = pred.next(); if(null != curPred) in.meetWith(analysis.getOut(curPred)); else in.meetWith(analysis.getEntry()); } analysis.setIn(q,in); analysis.processQuad(q); if(DEBUG){ System.out.println(" meet " + in.toString()); System.out.println(" prevOut " + prevOut.toString()); System.out.println(" in" + q.getID() + ": " + analysis.getIn(q).toString()); System.out.println(" out" + q.getID() + ": " + analysis.getOut(q).toString()); } if(!prevOut.equals(analysis.getOut(q))) change = true; } } QuadIterator qit = new QuadIterator(cfg, true); Flow.DataflowObject exit = analysis.newTempVar(); while(qit.hasNext()){ Quad q = qit.next(); Iterator<Quad> succ = qit.successors(); while(succ.hasNext()){ Quad curSucc = succ.next(); if(curSucc == null){ exit.meetWith(analysis.getOut(q)); } } } analysis.setExit(exit); } private void traverseBackward(ControlFlowGraph cfg){ boolean change = true; while(change){ QuadIterator qit = new QuadIterator(cfg, analysis.isForward()); change = false; while(qit.hasPrevious()){ //special case for 1st quad: assign entry to its in Quad q = qit.previous(); Iterator<Quad> succ = qit.successors(); Flow.DataflowObject prevIn = analysis.getIn(q); Flow.DataflowObject out = analysis.getExit(); while(succ.hasNext()){ Quad curSucc = succ.next(); if(null != curSucc) out.meetWith(analysis.getIn(curSucc)); } analysis.setOut(q,out); analysis.processQuad(q); if(DEBUG){ System.out.println(" meet " + out.toString()); System.out.println(" prevIn " + prevIn.toString()); System.out.println(" out" + q.getID() + ": " + analysis.getOut(q).toString()); System.out.println(" in" + q.getID() + ": " + analysis.getIn(q).toString()); } if(!prevIn.equals(analysis.getIn(q))) change = true; if(!change && !qit.hasPrevious()) analysis.setEntry(analysis.getIn(q)); } } } }
UTF-8
Java
4,399
java
MySolver.java
Java
[]
null
[]
package submit; // some useful things to import. add any additional imports you need. import joeq.Compiler.Quad.*; import flow.Flow; import java.util.*; /** * Skeleton class for implementing the Flow.Solver interface. */ public class MySolver implements Flow.Solver { public static final boolean DEBUG=false; protected Flow.Analysis analysis; /** * Sets the analysis. When visitCFG is called, it will * perform this analysis on a given CFG. * * @param analyzer The analysis to run */ public void registerAnalysis(Flow.Analysis analyzer) { this.analysis = analyzer; } /** * Runs the solver over a given control flow graph. Prior * to calling this, an analysis must be registered using * registerAnalysis * * @param cfg The control flow graph to analyze. */ public void visitCFG(ControlFlowGraph cfg) { // this needs to come first. analysis.preprocess(cfg); if(analysis.isForward()) traverseForward(cfg); else traverseBackward(cfg); // this needs to come last. analysis.postprocess(cfg); } private void traverseForward(ControlFlowGraph cfg){ boolean change = true; while(change){ QuadIterator qit = new QuadIterator(cfg, analysis.isForward()); change = false; while(qit.hasNext()){ //special case for 1st quad: assign entry to its in Quad q = qit.next(); Iterator<Quad> pred = qit.predecessors(); Flow.DataflowObject prevOut = analysis.getOut(q); Flow.DataflowObject in = analysis.newTempVar(); in.setToTop(); while(pred.hasNext()){ Quad curPred = pred.next(); if(null != curPred) in.meetWith(analysis.getOut(curPred)); else in.meetWith(analysis.getEntry()); } analysis.setIn(q,in); analysis.processQuad(q); if(DEBUG){ System.out.println(" meet " + in.toString()); System.out.println(" prevOut " + prevOut.toString()); System.out.println(" in" + q.getID() + ": " + analysis.getIn(q).toString()); System.out.println(" out" + q.getID() + ": " + analysis.getOut(q).toString()); } if(!prevOut.equals(analysis.getOut(q))) change = true; } } QuadIterator qit = new QuadIterator(cfg, true); Flow.DataflowObject exit = analysis.newTempVar(); while(qit.hasNext()){ Quad q = qit.next(); Iterator<Quad> succ = qit.successors(); while(succ.hasNext()){ Quad curSucc = succ.next(); if(curSucc == null){ exit.meetWith(analysis.getOut(q)); } } } analysis.setExit(exit); } private void traverseBackward(ControlFlowGraph cfg){ boolean change = true; while(change){ QuadIterator qit = new QuadIterator(cfg, analysis.isForward()); change = false; while(qit.hasPrevious()){ //special case for 1st quad: assign entry to its in Quad q = qit.previous(); Iterator<Quad> succ = qit.successors(); Flow.DataflowObject prevIn = analysis.getIn(q); Flow.DataflowObject out = analysis.getExit(); while(succ.hasNext()){ Quad curSucc = succ.next(); if(null != curSucc) out.meetWith(analysis.getIn(curSucc)); } analysis.setOut(q,out); analysis.processQuad(q); if(DEBUG){ System.out.println(" meet " + out.toString()); System.out.println(" prevIn " + prevIn.toString()); System.out.println(" out" + q.getID() + ": " + analysis.getOut(q).toString()); System.out.println(" in" + q.getID() + ": " + analysis.getIn(q).toString()); } if(!prevIn.equals(analysis.getIn(q))) change = true; if(!change && !qit.hasPrevious()) analysis.setEntry(analysis.getIn(q)); } } } }
4,399
0.532166
0.531712
112
38.276787
25.275345
98
false
false
0
0
0
0
0
0
0.535714
false
false
7
6238ebf0d695782f48fd46fab8268923f2eec36e
25,056,839,268,148
8e445c29f8aa2b7def02dd0ce731202ad56c57f5
/app/src/main/java/com/fallout/android/voyage2/ProfileFragment.java
ba668b752652038531d96d97525adbcf301e69f7
[]
no_license
bikki123/Voyage2
https://github.com/bikki123/Voyage2
79183b8586e918227f1e1ef17dfad3d7fc3f3249
b3b7974a2314dc3c1630213ee9e4d033af3bafba
refs/heads/master
2022-06-18T08:58:45.770000
2018-03-25T08:30:15
2018-03-25T08:30:15
126,678,174
0
0
null
false
2022-05-28T22:15:54
2018-03-25T08:29:16
2018-03-25T08:30:44
2022-05-28T22:15:54
918
0
0
1
Java
false
false
package com.fallout.android.voyage2; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ProgressBar; import android.widget.TextView; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; /** * A simple {@link Fragment} subclass. */ public class ProfileFragment extends Fragment { private FirebaseUser mUser; private FirebaseAuth mAuth; private TextView nameTextView; private TextView emailTextView; private Button logoutButton; private TextView noScTextView; private String Uid; private TextView memIdTextView; private ProgressBar progressBar; public ProfileFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_profile, container, false); mAuth = FirebaseAuth.getInstance(); mUser = mAuth.getCurrentUser(); Uid = mUser.getUid(); progressBar = view.findViewById(R.id.story_progress); nameTextView = view.findViewById(R.id.pf_name); emailTextView = view.findViewById(R.id.pf_email); logoutButton = view.findViewById(R.id.pf_logout); noScTextView = view.findViewById(R.id.pf_nosc); memIdTextView = view.findViewById(R.id.pf_memid); return view; } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); String name = mUser.getDisplayName(); String email = mUser.getEmail(); nameTextView.setText(name); emailTextView.setText(email); //listens for logout button click to log out user logoutButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { //creating a dialog to confirm sign out.... AlertDialog.Builder builder; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { builder = new AlertDialog.Builder(getActivity(), android.R.style.Theme_Material_Dialog_Alert); } else { builder = new AlertDialog.Builder(getActivity()); } builder.setTitle("Sign Out?") .setMessage("NOTE: Your Progress will be lost!") .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { mAuth.signOut(); startActivity(new Intent(getActivity(), LoginActivity.class)); getActivity().finish(); } }) .setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // do nothing } }) .setIcon(android.R.drawable.ic_dialog_alert) .show(); } }); //displaying member id memIdTextView.setText(Uid); memIdTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { android.support.v7.app.AlertDialog.Builder dialogBuilder = new android.support.v7.app.AlertDialog.Builder(getActivity()); dialogBuilder.setTitle(Uid); android.support.v7.app.AlertDialog alertDialog = dialogBuilder.create(); alertDialog.setButton(android.support.v7.app.AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alertDialog.show(); } }); //set the scanned qr final String PREFS_NAME = "MyPref"; final SharedPreferences prefs = getActivity().getSharedPreferences(PREFS_NAME, getActivity().MODE_PRIVATE); int scans = prefs.getInt("my_checkpoint", 0); noScTextView.setText(String.valueOf(scans - 1)); //set progress for progress bar if (scans > 1) { progressBar.setProgress((scans - 1) * 10); } } }
UTF-8
Java
5,089
java
ProfileFragment.java
Java
[]
null
[]
package com.fallout.android.voyage2; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ProgressBar; import android.widget.TextView; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; /** * A simple {@link Fragment} subclass. */ public class ProfileFragment extends Fragment { private FirebaseUser mUser; private FirebaseAuth mAuth; private TextView nameTextView; private TextView emailTextView; private Button logoutButton; private TextView noScTextView; private String Uid; private TextView memIdTextView; private ProgressBar progressBar; public ProfileFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_profile, container, false); mAuth = FirebaseAuth.getInstance(); mUser = mAuth.getCurrentUser(); Uid = mUser.getUid(); progressBar = view.findViewById(R.id.story_progress); nameTextView = view.findViewById(R.id.pf_name); emailTextView = view.findViewById(R.id.pf_email); logoutButton = view.findViewById(R.id.pf_logout); noScTextView = view.findViewById(R.id.pf_nosc); memIdTextView = view.findViewById(R.id.pf_memid); return view; } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); String name = mUser.getDisplayName(); String email = mUser.getEmail(); nameTextView.setText(name); emailTextView.setText(email); //listens for logout button click to log out user logoutButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { //creating a dialog to confirm sign out.... AlertDialog.Builder builder; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { builder = new AlertDialog.Builder(getActivity(), android.R.style.Theme_Material_Dialog_Alert); } else { builder = new AlertDialog.Builder(getActivity()); } builder.setTitle("Sign Out?") .setMessage("NOTE: Your Progress will be lost!") .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { mAuth.signOut(); startActivity(new Intent(getActivity(), LoginActivity.class)); getActivity().finish(); } }) .setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // do nothing } }) .setIcon(android.R.drawable.ic_dialog_alert) .show(); } }); //displaying member id memIdTextView.setText(Uid); memIdTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { android.support.v7.app.AlertDialog.Builder dialogBuilder = new android.support.v7.app.AlertDialog.Builder(getActivity()); dialogBuilder.setTitle(Uid); android.support.v7.app.AlertDialog alertDialog = dialogBuilder.create(); alertDialog.setButton(android.support.v7.app.AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alertDialog.show(); } }); //set the scanned qr final String PREFS_NAME = "MyPref"; final SharedPreferences prefs = getActivity().getSharedPreferences(PREFS_NAME, getActivity().MODE_PRIVATE); int scans = prefs.getInt("my_checkpoint", 0); noScTextView.setText(String.valueOf(scans - 1)); //set progress for progress bar if (scans > 1) { progressBar.setProgress((scans - 1) * 10); } } }
5,089
0.60169
0.599332
131
37.847328
28.255507
137
false
false
0
0
0
0
0
0
0.610687
false
false
7
5ddf0e46a51ad93bb2717a2f19df65782cfcf790
25,056,839,268,068
ae73c3c5add6b3744b9951f10b838caae4f7bb40
/src/s2/gestion/model/compras/DocumentoCompraDetalleBase.java
9b72101dd3b3655845db3f9a1659ffd33e87bce3
[]
no_license
s2informatica/Gestion
https://github.com/s2informatica/Gestion
577140665572f60cbb543a548375dc231d1743a4
d1d5d960f4f91ca3d56dbce9418707e494f5d6fd
refs/heads/master
2021-06-22T03:21:43.672000
2017-08-30T10:01:30
2017-08-30T10:01:30
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package s2.gestion.model.compras; import java.math.*; import javax.persistence.*; import org.openxava.annotations.Depends; import org.openxava.annotations.DescriptionsList; import org.openxava.annotations.OnChange; import lombok.*; import s2.gestion.actions.ficheros.OnChangeArticuloDocumentoDetalleBaseAction; import s2.gestion.model.base.*; import s2.gestion.model.ficheros.*; /** * @author Alberto Modelo para los detalles de los documentos de compra * */ @MappedSuperclass // @Table(name = "documento_compra_detalle") public abstract @Getter @Setter class DocumentoCompraDetalleBase extends Documentable { @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(foreignKey=@ForeignKey(name="fk_articulo")) @DescriptionsList(descriptionProperties="codigo, nombre") @OnChange(value=OnChangeArticuloDocumentoDetalleBaseAction.class) private Articulo articulo; private String nombre; private String codigo; private BigDecimal unidades; private BigDecimal precio; private BigDecimal importe; private BigDecimal dto1; private BigDecimal dto2; private BigDecimal dto3; private BigDecimal dto4; public void setArticulo(Articulo articulo){ if (articulo!=null){ setNombre(articulo.getNombre()); setCodigo(articulo.getCodigo()); } } @Depends("unidades, precio") public BigDecimal getTotal(){ BigDecimal multiply; try{ multiply=unidades.multiply(precio); }catch(Exception e){ multiply = BigDecimal.ZERO; } return multiply; } }
UTF-8
Java
1,605
java
DocumentoCompraDetalleBase.java
Java
[ { "context": "rt s2.gestion.model.ficheros.*;\r\n\r\n/**\r\n * @author Alberto Modelo para los detalles de los documentos de compra\r\n *", "end": 429, "score": 0.9998468160629272, "start": 415, "tag": "NAME", "value": "Alberto Modelo" } ]
null
[]
package s2.gestion.model.compras; import java.math.*; import javax.persistence.*; import org.openxava.annotations.Depends; import org.openxava.annotations.DescriptionsList; import org.openxava.annotations.OnChange; import lombok.*; import s2.gestion.actions.ficheros.OnChangeArticuloDocumentoDetalleBaseAction; import s2.gestion.model.base.*; import s2.gestion.model.ficheros.*; /** * @author <NAME> para los detalles de los documentos de compra * */ @MappedSuperclass // @Table(name = "documento_compra_detalle") public abstract @Getter @Setter class DocumentoCompraDetalleBase extends Documentable { @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(foreignKey=@ForeignKey(name="fk_articulo")) @DescriptionsList(descriptionProperties="codigo, nombre") @OnChange(value=OnChangeArticuloDocumentoDetalleBaseAction.class) private Articulo articulo; private String nombre; private String codigo; private BigDecimal unidades; private BigDecimal precio; private BigDecimal importe; private BigDecimal dto1; private BigDecimal dto2; private BigDecimal dto3; private BigDecimal dto4; public void setArticulo(Articulo articulo){ if (articulo!=null){ setNombre(articulo.getNombre()); setCodigo(articulo.getCodigo()); } } @Depends("unidades, precio") public BigDecimal getTotal(){ BigDecimal multiply; try{ multiply=unidades.multiply(precio); }catch(Exception e){ multiply = BigDecimal.ZERO; } return multiply; } }
1,597
0.711526
0.706542
60
24.75
21.456642
87
false
false
0
0
0
0
0
0
0.666667
false
false
7
e4b58e096f02f51a8ebc4e9c00c89397541bf4cd
14,714,557,988,583
db33daeeac18e038cf0820e01ffba9d675ab036f
/src/main/java/anacom/shared/exceptions/phone/invalidState/InvalidStateMakeVideo.java
dd9a1ef944aa714d1f373071f672be9eed6f1a0f
[]
no_license
alex-quiterio/quoruns-protocol
https://github.com/alex-quiterio/quoruns-protocol
46a57e3683b34ff0f06d6b796d2b4cb35555710f
f8047bdc3150c059b6ff0934247402f1fa2aa87b
refs/heads/master
2020-03-28T18:57:52.645000
2013-02-13T23:13:32
2013-02-13T23:13:32
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package anacom.shared.exceptions.phone.invalidState; public class InvalidStateMakeVideo extends InvalidState { private static final long serialVersionUID = 1L; public InvalidStateMakeVideo() {} /** * Constructor * @param number the number of the Phone that made the video call * @param state a String representation of the state the Phone was in * when he tried to make the call */ public InvalidStateMakeVideo(String number, String state) { super(number, state); } }
UTF-8
Java
499
java
InvalidStateMakeVideo.java
Java
[]
null
[]
package anacom.shared.exceptions.phone.invalidState; public class InvalidStateMakeVideo extends InvalidState { private static final long serialVersionUID = 1L; public InvalidStateMakeVideo() {} /** * Constructor * @param number the number of the Phone that made the video call * @param state a String representation of the state the Phone was in * when he tried to make the call */ public InvalidStateMakeVideo(String number, String state) { super(number, state); } }
499
0.739479
0.737475
19
25.263159
25.971325
71
false
false
0
0
0
0
0
0
1.421053
false
false
7
266434fb54bd9dd37e27bc9f75e39d9632c19be6
36,266,703,849,996
89409c58188b5360933bae73020f2e584c65b65b
/app/src/main/java/com/sung/databinding/model/Image.java
8bc9925a33b28ea583909fe4cdf84bc785e60429
[]
no_license
ssccbb/DataBinding
https://github.com/ssccbb/DataBinding
b669e07927e11e2f8ee36baa0876590cc3a37b57
90d761ff8ada6b657a86014ab32c0fe48d9e0d85
refs/heads/master
2022-12-12T13:37:49.167000
2020-08-27T05:34:47
2020-08-27T05:34:47
290,105,211
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sung.databinding.model; import com.sung.databinding.BR; import androidx.databinding.BaseObservable; import androidx.databinding.Bindable; /** * Create by sung at 2020/8/27 * * @desc: * @notice:åœ */ public class Image extends BaseObservable { private String url; public Image(String url) { setUrl(url); } @Bindable public String getUrl() { return url; } public void setUrl(String url) { this.url = url; notifyPropertyChanged(BR.url); } }
UTF-8
Java
527
java
Image.java
Java
[ { "context": "t androidx.databinding.Bindable;\n\n/**\n * Create by sung at 2020/8/27\n *\n * @desc:\n * @notice:åœ\n */\npubli", "end": 174, "score": 0.9983922243118286, "start": 170, "tag": "USERNAME", "value": "sung" } ]
null
[]
package com.sung.databinding.model; import com.sung.databinding.BR; import androidx.databinding.BaseObservable; import androidx.databinding.Bindable; /** * Create by sung at 2020/8/27 * * @desc: * @notice:åœ */ public class Image extends BaseObservable { private String url; public Image(String url) { setUrl(url); } @Bindable public String getUrl() { return url; } public void setUrl(String url) { this.url = url; notifyPropertyChanged(BR.url); } }
527
0.645714
0.632381
30
16.5
14.994999
43
false
false
0
0
0
0
0
0
0.3
false
false
7
0a4d1f7864e5eab2638ee63a82d7cfb11346114b
39,676,907,896,264
2ee114fc512aae883235413b9ba1d77f8d4c5171
/src/battleship/Ship.java
2149d9a0ca84ebfba7d6c439decba5401e1d4d84
[]
no_license
jhartmayer-vt/BattleshipGame
https://github.com/jhartmayer-vt/BattleshipGame
db16ed058119c66189951acc230662a5cfe977f6
a8edf3544a3b4c636772db9f042d962934342468
refs/heads/master
2021-10-09T20:13:33.772000
2019-01-03T02:32:51
2019-01-03T02:32:51
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * 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 battleship; /** * * @author Jonathan */ public abstract class Ship extends Entity { public String name; public boolean isHit = false; public Ship() { super('#'); } public void hitShip(int row, int col) { } public void createShip(int row1, int col1, int row2, int col2) { if (col1 - col2 == 0) { for (int i = 0; i < Math.abs(row1 - row2); i++) { if (player1Map[i+1][col1].symbol == '#') } } } }
UTF-8
Java
712
java
Ship.java
Java
[ { "context": "editor.\n */\npackage battleship;\n\n/**\n *\n * @author Jonathan\n */\npublic abstract class Ship extends Entity {\n ", "end": 232, "score": 0.9996562600135803, "start": 224, "tag": "NAME", "value": "Jonathan" } ]
null
[]
/* * 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 battleship; /** * * @author Jonathan */ public abstract class Ship extends Entity { public String name; public boolean isHit = false; public Ship() { super('#'); } public void hitShip(int row, int col) { } public void createShip(int row1, int col1, int row2, int col2) { if (col1 - col2 == 0) { for (int i = 0; i < Math.abs(row1 - row2); i++) { if (player1Map[i+1][col1].symbol == '#') } } } }
712
0.554775
0.536517
31
21.967741
22.536686
79
false
false
0
0
0
0
0
0
0.419355
false
false
7
10589b1057b055aacdb5fe24c0bf4af03105fc6e
38,130,719,681,364
8bd176766f65207985d8ce338c0f268e62522830
/app/src/main/java/cn/sibat/sanyatrafficoperation/model/homedata/HomeReturnData.java
1df4180013b12bb0500a68c715f342937ccc370f
[]
no_license
johnsensjr/SanYaTrafficOperation
https://github.com/johnsensjr/SanYaTrafficOperation
e796932d2fb249f5060a4b4ecaab9be0c4434bec
2f3be6990da6985a701c246bfcf5c5365a4f37c0
refs/heads/master
2018-10-26T23:54:36.869000
2018-08-23T09:54:18
2018-08-23T09:54:18
145,504,066
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.sibat.sanyatrafficoperation.model.homedata; public class HomeReturnData { private String status; private HomeData data; public HomeReturnData() { } public HomeReturnData(String status, HomeData data) { this.status = status; this.data = data; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public HomeData getData() { return data; } public void setData(HomeData data) { this.data = data; } }
UTF-8
Java
576
java
HomeReturnData.java
Java
[]
null
[]
package cn.sibat.sanyatrafficoperation.model.homedata; public class HomeReturnData { private String status; private HomeData data; public HomeReturnData() { } public HomeReturnData(String status, HomeData data) { this.status = status; this.data = data; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public HomeData getData() { return data; } public void setData(HomeData data) { this.data = data; } }
576
0.616319
0.616319
30
18.200001
16.847157
57
false
false
0
0
0
0
0
0
0.333333
false
false
7
d5caf2fbfb3c879eb5d6825b653a21da5bc55d90
36,971,078,526,130
e249ce0a84fec756084c9f0260410ce7aef4ce5b
/src/main/java/dao/jdbc/query/supply/DtoValueSupplier.java
f8bffd0f18cd8e9ecf0eda05cd0cdb300deb6b03
[]
no_license
Koshlatyi-ML/Hospital
https://github.com/Koshlatyi-ML/Hospital
2b962d1ba9ea6f7c3d659308f564eaebefb5c51c
68585d755079d0438fcd6c2fc0b1d11d5326c0a0
refs/heads/master
2021-01-21T17:17:02.101000
2017-05-10T21:29:59
2017-05-10T21:29:59
85,123,002
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dao.jdbc.query.supply; import domain.AbstractDTO; import java.sql.PreparedStatement; import java.sql.SQLException; @FunctionalInterface public interface DtoValueSupplier<T extends AbstractDTO> { int supplyValues(PreparedStatement statement, T dto) throws SQLException; }
UTF-8
Java
286
java
DtoValueSupplier.java
Java
[]
null
[]
package dao.jdbc.query.supply; import domain.AbstractDTO; import java.sql.PreparedStatement; import java.sql.SQLException; @FunctionalInterface public interface DtoValueSupplier<T extends AbstractDTO> { int supplyValues(PreparedStatement statement, T dto) throws SQLException; }
286
0.821678
0.821678
11
25
24.105827
77
false
false
0
0
0
0
0
0
0.545455
false
false
7
7b32b27128756008de365a3d029bfb8d09ffa2ba
34,969,623,779,328
0e2dd5edc4b5ba5838ec686b2fd047ea35ed4584
/src/main/java/de/aelpecyem/besmirchment/client/renderer/InfectiousSpitEntityRenderer.java
0a8db5101a36dc44219549e29bc752eca3c9e924
[ "CC0-1.0" ]
permissive
Budgo/Besmirchment
https://github.com/Budgo/Besmirchment
5f7761cc82c35d6883fb79d365b240d1173f98a2
ad759ec9d63f74eea6a1ee4b14aa765e27b8ff71
refs/heads/master
2023-05-14T11:36:14.866000
2021-06-01T17:16:19
2021-06-01T17:16:19
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.aelpecyem.besmirchment.client.renderer; import de.aelpecyem.besmirchment.common.entity.InfectiousSpitEntity; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.render.OverlayTexture; import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.EntityRenderer; import net.minecraft.client.render.entity.model.LlamaSpitEntityModel; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.Vector3f; import net.minecraft.util.Identifier; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; @Environment(EnvType.CLIENT) public class InfectiousSpitEntityRenderer extends EntityRenderer<InfectiousSpitEntity> { private static final Identifier TEXTURE = new Identifier("textures/entity/llama/spit.png"); private final LlamaSpitEntityModel<InfectiousSpitEntity> model = new LlamaSpitEntityModel<>(); public InfectiousSpitEntityRenderer(EntityRenderDispatcher entityRenderDispatcher) { super(entityRenderDispatcher); } public void render(InfectiousSpitEntity llamaSpitEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i) { matrixStack.push(); matrixStack.translate(0.0D, 0.15, 0.0D); matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(MathHelper.lerp(g, llamaSpitEntity.prevYaw, llamaSpitEntity.yaw) - 90.0F)); matrixStack.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(MathHelper.lerp(g, llamaSpitEntity.prevPitch, llamaSpitEntity.pitch))); this.model.setAngles(llamaSpitEntity, g, 0.0F, -0.1F, 0.0F, 0.0F); VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(this.model.getLayer(TEXTURE)); Vec3d rgb = Vec3d.unpackRgb(llamaSpitEntity.getColor()); this.model.render(matrixStack, vertexConsumer, i, OverlayTexture.DEFAULT_UV, (float) rgb.x, (float) rgb.y, (float) rgb.z, 1.0F); matrixStack.pop(); super.render(llamaSpitEntity, f, g, matrixStack, vertexConsumerProvider, i); } public Identifier getTexture(InfectiousSpitEntity llamaSpitEntity) { return TEXTURE; } }
UTF-8
Java
2,343
java
InfectiousSpitEntityRenderer.java
Java
[]
null
[]
package de.aelpecyem.besmirchment.client.renderer; import de.aelpecyem.besmirchment.common.entity.InfectiousSpitEntity; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.render.OverlayTexture; import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.EntityRenderer; import net.minecraft.client.render.entity.model.LlamaSpitEntityModel; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.Vector3f; import net.minecraft.util.Identifier; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; @Environment(EnvType.CLIENT) public class InfectiousSpitEntityRenderer extends EntityRenderer<InfectiousSpitEntity> { private static final Identifier TEXTURE = new Identifier("textures/entity/llama/spit.png"); private final LlamaSpitEntityModel<InfectiousSpitEntity> model = new LlamaSpitEntityModel<>(); public InfectiousSpitEntityRenderer(EntityRenderDispatcher entityRenderDispatcher) { super(entityRenderDispatcher); } public void render(InfectiousSpitEntity llamaSpitEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i) { matrixStack.push(); matrixStack.translate(0.0D, 0.15, 0.0D); matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(MathHelper.lerp(g, llamaSpitEntity.prevYaw, llamaSpitEntity.yaw) - 90.0F)); matrixStack.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(MathHelper.lerp(g, llamaSpitEntity.prevPitch, llamaSpitEntity.pitch))); this.model.setAngles(llamaSpitEntity, g, 0.0F, -0.1F, 0.0F, 0.0F); VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(this.model.getLayer(TEXTURE)); Vec3d rgb = Vec3d.unpackRgb(llamaSpitEntity.getColor()); this.model.render(matrixStack, vertexConsumer, i, OverlayTexture.DEFAULT_UV, (float) rgb.x, (float) rgb.y, (float) rgb.z, 1.0F); matrixStack.pop(); super.render(llamaSpitEntity, f, g, matrixStack, vertexConsumerProvider, i); } public Identifier getTexture(InfectiousSpitEntity llamaSpitEntity) { return TEXTURE; } }
2,343
0.786172
0.775075
43
53.511627
41.452339
159
false
false
0
0
0
0
0
0
1.325581
false
false
7
4285e28ac0dbfb43aacde7792c9f082c87f065bb
36,077,725,330,948
5a2a43dc860f949e02d57a045e6571d98551400a
/jdk8/src/main/java/com/lotbyte/def/method/A.java
6224cdce73bad0a7b20be05ecd43afb976d8e0fa
[]
no_license
i-jesus/jdk5-12
https://github.com/i-jesus/jdk5-12
fcb5b99be95256b3acd1d0541171fb5fcdcf4647
4602dd7e757ea82bba687ce57cff541db7f7825c
refs/heads/master
2020-04-30T14:19:14.738000
2019-04-04T13:46:23
2019-04-04T13:46:23
176,887,555
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lotbyte.def.method; @FunctionalInterface public interface A { int add(int a,int b); }
UTF-8
Java
103
java
A.java
Java
[]
null
[]
package com.lotbyte.def.method; @FunctionalInterface public interface A { int add(int a,int b); }
103
0.728155
0.728155
6
16.166666
11.682133
31
false
false
0
0
0
0
0
0
0.5
false
false
7
8bdbffc1120c004f29ce2471cc144f86e7293cfd
28,595,892,286,890
90404ff9e174511c098b50f9b466ca0c45f33711
/HW2/ClassInfo.java
006c5c1cdec38731ee4b9fe5920feeac99232ea6
[]
no_license
teomandi/Compilers-final-project-
https://github.com/teomandi/Compilers-final-project-
22426bb165b175425b6ba66a9421bc32c74fe35b
20db2949ff50abe2f5ee1ced5d965497a1d57e83
refs/heads/master
2021-08-24T02:41:28.894000
2017-12-07T18:10:54
2017-12-07T18:10:54
112,517,157
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.*; class variable { String type; String name; variable(String t, String n){ this.type = t; this.name = n; } public boolean equal(variable x){ if(this.type == x.type && this.name == x.name) return true; else return false; } //variable(String t) } class Method { String name; String type; Set<variable> arguments = new HashSet<variable>(); Set<variable> localvars = new HashSet<variable>(); Method(String T, String N){ this.type=T; this.name=N; } public void addarguments(variable var){ arguments.add(var); } public void addlocalvars(variable var){ localvars.add(var); } public boolean checkSameArgu(variable x){ for (Iterator<variable> it = arguments.iterator(); it.hasNext(); ) { variable v = it.next(); if(v.equal(x)) return true; } return false; } public variable arguExist(String id){ //if exists return the variable else null for (Iterator<variable> it = arguments.iterator(); it.hasNext(); ) { variable v = it.next(); if(v.name == id ) return v; } return null; } public boolean typeExist(String tp){ for (Iterator<variable> it = arguments.iterator(); it.hasNext(); ) { variable vt = it.next(); if(vt.type == tp ) return true; } return false; } public variable lvExist(String id){ //if exists return the variable else null for (Iterator<variable> it = localvars.iterator(); it.hasNext(); ) { variable v = it.next(); if(v.name == id ) return v; } return null; } } class ClassMembers{ Set<variable> var = new HashSet<variable>(); Map <String, Method> meth = new HashMap <String, Method>(); public void printvar(){ for (Iterator<variable> it = var.iterator(); it.hasNext(); ) { variable v = it.next(); System.out.print(" " + v.type+"-"+v.name+" "); } } public boolean checkSameVar(variable x){ for (Iterator<variable> it = var.iterator(); it.hasNext(); ) { variable v = it.next(); if(v.equal(x)) return true; } return false; } public variable varExist(String id){ //if exists return the variable else null for (Iterator<variable> it = var.iterator(); it.hasNext(); ) { variable v = it.next(); if(v.name == id ) return v; } return null; } } public class ClassInfo{ String name; String extend; Set <String> objects = new HashSet<String>(); ClassInfo(String N, String E){ this.name = N; this.extend = E; } };
UTF-8
Java
2,625
java
ClassInfo.java
Java
[]
null
[]
import java.util.*; class variable { String type; String name; variable(String t, String n){ this.type = t; this.name = n; } public boolean equal(variable x){ if(this.type == x.type && this.name == x.name) return true; else return false; } //variable(String t) } class Method { String name; String type; Set<variable> arguments = new HashSet<variable>(); Set<variable> localvars = new HashSet<variable>(); Method(String T, String N){ this.type=T; this.name=N; } public void addarguments(variable var){ arguments.add(var); } public void addlocalvars(variable var){ localvars.add(var); } public boolean checkSameArgu(variable x){ for (Iterator<variable> it = arguments.iterator(); it.hasNext(); ) { variable v = it.next(); if(v.equal(x)) return true; } return false; } public variable arguExist(String id){ //if exists return the variable else null for (Iterator<variable> it = arguments.iterator(); it.hasNext(); ) { variable v = it.next(); if(v.name == id ) return v; } return null; } public boolean typeExist(String tp){ for (Iterator<variable> it = arguments.iterator(); it.hasNext(); ) { variable vt = it.next(); if(vt.type == tp ) return true; } return false; } public variable lvExist(String id){ //if exists return the variable else null for (Iterator<variable> it = localvars.iterator(); it.hasNext(); ) { variable v = it.next(); if(v.name == id ) return v; } return null; } } class ClassMembers{ Set<variable> var = new HashSet<variable>(); Map <String, Method> meth = new HashMap <String, Method>(); public void printvar(){ for (Iterator<variable> it = var.iterator(); it.hasNext(); ) { variable v = it.next(); System.out.print(" " + v.type+"-"+v.name+" "); } } public boolean checkSameVar(variable x){ for (Iterator<variable> it = var.iterator(); it.hasNext(); ) { variable v = it.next(); if(v.equal(x)) return true; } return false; } public variable varExist(String id){ //if exists return the variable else null for (Iterator<variable> it = var.iterator(); it.hasNext(); ) { variable v = it.next(); if(v.name == id ) return v; } return null; } } public class ClassInfo{ String name; String extend; Set <String> objects = new HashSet<String>(); ClassInfo(String N, String E){ this.name = N; this.extend = E; } };
2,625
0.588952
0.588952
120
20.858334
20.99337
82
false
false
0
0
0
0
0
0
1.483333
false
false
7
580d4882f94ff9e52a10f8ff1db42cfc2fb35f58
33,268,816,690,527
6397be9885ae79a4cae94607385b99f8cfcccdee
/TFC_PROY_BETA/src/procesos/Ruido.java
01f0ac3838e795bb2f62ee54966bf1d81cbd3f35
[]
no_license
Lschasoy/SSIT
https://github.com/Lschasoy/SSIT
7cfd3b08214069ef02e6dcc432603a937f89de2f
b8a195b66d9c40e82ca1607c1b56593babf2b5b1
refs/heads/master
2016-09-08T02:34:02.703000
2014-07-23T10:40:22
2014-07-23T10:40:22
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package procesos; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ButtonGroup; import javax.swing.SpinnerNumberModel; import dialogs.RuidoDialog; import images.Image; import images.Tracer; import main.MainWindow; public class Ruido { public static void run(){ final Image image = MainWindow.getCurrentImage(); final RuidoDialog dialog = new RuidoDialog(); ButtonGroup funcionDist = new ButtonGroup(); funcionDist.add(dialog.rdbtnGaussiano); funcionDist.add(dialog.rdbtnImpulsivo); funcionDist.add(dialog.rdbtnUniforme); dialog.rdbtnUniforme.setSelected(true); dialog.contaminacionMin.setModel(new SpinnerNumberModel(-100, -255, 255, 3)); dialog.contaminacionMax.setModel(new SpinnerNumberModel(100, -255, 255, 3)); dialog.porcentajeRuido.setModel(new SpinnerNumberModel(20.0, 0.0, 100.0, 1.0)); dialog.rdbtnImpulsivo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (dialog.rdbtnImpulsivo.isSelected()){ dialog.contaminacionMin.setValue(-255); dialog.contaminacionMax.setValue(255); dialog.contaminacionMin.setEnabled(false); dialog.contaminacionMax.setEnabled(false); } } }); dialog.rdbtnGaussiano.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.contaminacionMin.setEnabled(true); dialog.contaminacionMax.setEnabled(true); } }); dialog.rdbtnUniforme.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.contaminacionMin.setEnabled(true); dialog.contaminacionMax.setEnabled(true); } }); dialog.cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { dialog.setVisible(false); } }); dialog.okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { dialog.setVisible(false); double p = (Double) dialog.porcentajeRuido.getValue(); int minVal = (Integer) dialog.contaminacionMin.getValue(); int maxVal = (Integer) dialog.contaminacionMax.getValue(); if (minVal > maxVal){ int temp = maxVal; maxVal = minVal; minVal = temp; } if (dialog.rdbtnUniforme.isSelected()){ uniforme(image, p, minVal, maxVal); } if (dialog.rdbtnImpulsivo.isSelected()){ impulsivo(image, p); } if (dialog.rdbtnGaussiano.isSelected()){ gaussiano(image, p, minVal, maxVal); } } }); dialog.setVisible(true); } private static void uniforme(Image image, double p, int minVal, int maxVal){ int n = (int) ((p / 100.0) * (image.widthRoi() * image.heightRoi())); int f = Math.round(n / (maxVal - minVal + 1)); Image ruidosa = Image.crearImagen(image.widthRoi(), image.heightRoi(), image, "Imagen ruidosa de "); Image ruido = Image.crearImagen(image.widthRoi(), image.heightRoi(), image, "Imagen de ruido"); Point src = image.topLeftRoi(); for (int x = 0; x < image.widthRoi(); x++){ for (int y = 0; y < image.heightRoi(); y++){ ruidosa.img.setRGB(x, y, image.img.getRGB(src.x + x, src.y + y)); } } int[] pixelValue = new int[3]; for (int noise = minVal; noise <= maxVal; noise++){ for (int count = 0; count < f; count++){ int x; int y; do{ x = (int) Math.floor(Math.random() * image.widthRoi()); y = (int) Math.floor(Math.random() * image.heightRoi()); } while (Image.red(ruido.img.getRGB(x, y)) != 0 || Image.green(ruido.img.getRGB(x, y)) != 0); Image.rgb2array(image.img.getRGB(src.x + x, src.y + y), pixelValue); for (int i = 0; i < 3; i++){ pixelValue[i] += noise; if (pixelValue[i] > 255){ pixelValue[i] = 255; } if (pixelValue[i] < 0){ pixelValue[i] = 0; } } ruidosa.img.setRGB(x, y, Image.array2rgb(pixelValue)); if (noise < 0){ ruido.img.setRGB(x, y, Image.rgb(-noise, 0, 0)); } if (noise > 0){ ruido.img.setRGB(x, y, Image.rgb(0, noise, 0)); } } } //MainWindow.insertAndListenImage(ruidosa); //MainWindow.insertAndListenImage(ruido); Tracer.insert("Ruido", "ruidosa", ruidosa.img); Tracer.insert("Ruido", "ruido", ruido.img); } private static void impulsivo(Image image, double p){ int n = (int) ((p / 100.0) * (image.widthRoi() * image.heightRoi())); int f = Math.round(n / 2); Image ruidosa = Image.crearImagen(image.widthRoi(), image.heightRoi(), image, "Imagen ruidosa de "); Image ruido = Image.crearImagen(image.widthRoi(), image.heightRoi(), image, "Imagen de ruido"); Point src = image.topLeftRoi(); for (int x = 0; x < image.widthRoi(); x++){ for (int y = 0; y < image.heightRoi(); y++){ ruidosa.img.setRGB(x, y, image.img.getRGB(src.x + x, src.y + y)); } } int black = Image.rgb(0, 0, 0); for (int count = 0; count < f; count++){ int x; int y; do{ x = (int) Math.floor(Math.random() * image.widthRoi()); y = (int) Math.floor(Math.random() * image.heightRoi()); } while (Image.red(ruido.img.getRGB(x, y)) != 0 || Image.green(ruido.img.getRGB(x, y)) != 0); ruidosa.img.setRGB(x, y, black); ruido.img.setRGB(x, y, Image.rgb(255, 0, 0)); } int white = Image.rgb(255, 255, 255); for (int count = 0; count < f; count++){ int x; int y; do{ x = (int) Math.floor(Math.random() * image.widthRoi()); y = (int) Math.floor(Math.random() * image.heightRoi()); } while (Image.red(ruido.img.getRGB(x, y)) != 0 || Image.green(ruido.img.getRGB(x, y)) != 0); ruidosa.img.setRGB(x, y, white); ruido.img.setRGB(x, y, Image.rgb(0, 255, 0)); } //MainWindow.insertAndListenImage(ruidosa); //MainWindow.insertAndListenImage(ruido); Tracer.insert("Ruido", "ruidosa", ruidosa.img); Tracer.insert("Ruido", "ruido", ruido.img); } private static void gaussiano(Image image, double p, int minVal, int maxVal){ int n = (int) ((p / 100.0) * (image.widthRoi() * image.heightRoi())); int media = image.getInfo().brillo; int desviacion = image.getInfo().contraste; double s = 0.0; for (int noise = minVal; noise <= maxVal; noise++){ s += fx(noise, media, desviacion); } Image ruidosa = Image.crearImagen(image.widthRoi(), image.heightRoi(), image, "Imagen ruidosa de "); Image ruido = Image.crearImagen(image.widthRoi(), image.heightRoi(), image, "Imagen de ruido"); Point src = image.topLeftRoi(); for (int x = 0; x < image.widthRoi(); x++){ for (int y = 0; y < image.heightRoi(); y++){ ruidosa.img.setRGB(x, y, image.img.getRGB(src.x + x, src.y + y)); } } int[] pixelValue = new int[3]; for (int noise = minVal; noise <= maxVal; noise++){ int f = (int) (fx(noise, media, desviacion) * n / s); for (int count = 0; count < f; count++){ int x; int y; do{ x = (int) Math.floor(Math.random() * image.widthRoi()); y = (int) Math.floor(Math.random() * image.heightRoi()); } while (Image.red(ruido.img.getRGB(x, y)) != 0 || Image.green(ruido.img.getRGB(x, y)) != 0); Image.rgb2array(image.img.getRGB(src.x + x, src.y + y), pixelValue); for (int i = 0; i < 3; i++){ pixelValue[i] += noise; if (pixelValue[i] > 255){ pixelValue[i] = 255; } if (pixelValue[i] < 0){ pixelValue[i] = 0; } } ruidosa.img.setRGB(x, y, Image.array2rgb(pixelValue)); if (noise < 0){ ruido.img.setRGB(x, y, Image.rgb(-noise, 0, 0)); } if (noise > 0){ ruido.img.setRGB(x, y, Image.rgb(0, noise, 0)); } } } //MainWindow.insertAndListenImage(ruidosa); //MainWindow.insertAndListenImage(ruido); Tracer.insert("Ruido", "ruidosa", ruidosa.img); Tracer.insert("Ruido", "ruido", ruido.img); } private static double fx(int x, int media, int desviacion){ return Math.exp(-Math.pow(x - media, 2) / Math.pow(2*desviacion, 2)) / (desviacion * Math.sqrt(2 * Math.PI)); } }
UTF-8
Java
8,172
java
Ruido.java
Java
[]
null
[]
package procesos; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ButtonGroup; import javax.swing.SpinnerNumberModel; import dialogs.RuidoDialog; import images.Image; import images.Tracer; import main.MainWindow; public class Ruido { public static void run(){ final Image image = MainWindow.getCurrentImage(); final RuidoDialog dialog = new RuidoDialog(); ButtonGroup funcionDist = new ButtonGroup(); funcionDist.add(dialog.rdbtnGaussiano); funcionDist.add(dialog.rdbtnImpulsivo); funcionDist.add(dialog.rdbtnUniforme); dialog.rdbtnUniforme.setSelected(true); dialog.contaminacionMin.setModel(new SpinnerNumberModel(-100, -255, 255, 3)); dialog.contaminacionMax.setModel(new SpinnerNumberModel(100, -255, 255, 3)); dialog.porcentajeRuido.setModel(new SpinnerNumberModel(20.0, 0.0, 100.0, 1.0)); dialog.rdbtnImpulsivo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (dialog.rdbtnImpulsivo.isSelected()){ dialog.contaminacionMin.setValue(-255); dialog.contaminacionMax.setValue(255); dialog.contaminacionMin.setEnabled(false); dialog.contaminacionMax.setEnabled(false); } } }); dialog.rdbtnGaussiano.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.contaminacionMin.setEnabled(true); dialog.contaminacionMax.setEnabled(true); } }); dialog.rdbtnUniforme.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.contaminacionMin.setEnabled(true); dialog.contaminacionMax.setEnabled(true); } }); dialog.cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { dialog.setVisible(false); } }); dialog.okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { dialog.setVisible(false); double p = (Double) dialog.porcentajeRuido.getValue(); int minVal = (Integer) dialog.contaminacionMin.getValue(); int maxVal = (Integer) dialog.contaminacionMax.getValue(); if (minVal > maxVal){ int temp = maxVal; maxVal = minVal; minVal = temp; } if (dialog.rdbtnUniforme.isSelected()){ uniforme(image, p, minVal, maxVal); } if (dialog.rdbtnImpulsivo.isSelected()){ impulsivo(image, p); } if (dialog.rdbtnGaussiano.isSelected()){ gaussiano(image, p, minVal, maxVal); } } }); dialog.setVisible(true); } private static void uniforme(Image image, double p, int minVal, int maxVal){ int n = (int) ((p / 100.0) * (image.widthRoi() * image.heightRoi())); int f = Math.round(n / (maxVal - minVal + 1)); Image ruidosa = Image.crearImagen(image.widthRoi(), image.heightRoi(), image, "Imagen ruidosa de "); Image ruido = Image.crearImagen(image.widthRoi(), image.heightRoi(), image, "Imagen de ruido"); Point src = image.topLeftRoi(); for (int x = 0; x < image.widthRoi(); x++){ for (int y = 0; y < image.heightRoi(); y++){ ruidosa.img.setRGB(x, y, image.img.getRGB(src.x + x, src.y + y)); } } int[] pixelValue = new int[3]; for (int noise = minVal; noise <= maxVal; noise++){ for (int count = 0; count < f; count++){ int x; int y; do{ x = (int) Math.floor(Math.random() * image.widthRoi()); y = (int) Math.floor(Math.random() * image.heightRoi()); } while (Image.red(ruido.img.getRGB(x, y)) != 0 || Image.green(ruido.img.getRGB(x, y)) != 0); Image.rgb2array(image.img.getRGB(src.x + x, src.y + y), pixelValue); for (int i = 0; i < 3; i++){ pixelValue[i] += noise; if (pixelValue[i] > 255){ pixelValue[i] = 255; } if (pixelValue[i] < 0){ pixelValue[i] = 0; } } ruidosa.img.setRGB(x, y, Image.array2rgb(pixelValue)); if (noise < 0){ ruido.img.setRGB(x, y, Image.rgb(-noise, 0, 0)); } if (noise > 0){ ruido.img.setRGB(x, y, Image.rgb(0, noise, 0)); } } } //MainWindow.insertAndListenImage(ruidosa); //MainWindow.insertAndListenImage(ruido); Tracer.insert("Ruido", "ruidosa", ruidosa.img); Tracer.insert("Ruido", "ruido", ruido.img); } private static void impulsivo(Image image, double p){ int n = (int) ((p / 100.0) * (image.widthRoi() * image.heightRoi())); int f = Math.round(n / 2); Image ruidosa = Image.crearImagen(image.widthRoi(), image.heightRoi(), image, "Imagen ruidosa de "); Image ruido = Image.crearImagen(image.widthRoi(), image.heightRoi(), image, "Imagen de ruido"); Point src = image.topLeftRoi(); for (int x = 0; x < image.widthRoi(); x++){ for (int y = 0; y < image.heightRoi(); y++){ ruidosa.img.setRGB(x, y, image.img.getRGB(src.x + x, src.y + y)); } } int black = Image.rgb(0, 0, 0); for (int count = 0; count < f; count++){ int x; int y; do{ x = (int) Math.floor(Math.random() * image.widthRoi()); y = (int) Math.floor(Math.random() * image.heightRoi()); } while (Image.red(ruido.img.getRGB(x, y)) != 0 || Image.green(ruido.img.getRGB(x, y)) != 0); ruidosa.img.setRGB(x, y, black); ruido.img.setRGB(x, y, Image.rgb(255, 0, 0)); } int white = Image.rgb(255, 255, 255); for (int count = 0; count < f; count++){ int x; int y; do{ x = (int) Math.floor(Math.random() * image.widthRoi()); y = (int) Math.floor(Math.random() * image.heightRoi()); } while (Image.red(ruido.img.getRGB(x, y)) != 0 || Image.green(ruido.img.getRGB(x, y)) != 0); ruidosa.img.setRGB(x, y, white); ruido.img.setRGB(x, y, Image.rgb(0, 255, 0)); } //MainWindow.insertAndListenImage(ruidosa); //MainWindow.insertAndListenImage(ruido); Tracer.insert("Ruido", "ruidosa", ruidosa.img); Tracer.insert("Ruido", "ruido", ruido.img); } private static void gaussiano(Image image, double p, int minVal, int maxVal){ int n = (int) ((p / 100.0) * (image.widthRoi() * image.heightRoi())); int media = image.getInfo().brillo; int desviacion = image.getInfo().contraste; double s = 0.0; for (int noise = minVal; noise <= maxVal; noise++){ s += fx(noise, media, desviacion); } Image ruidosa = Image.crearImagen(image.widthRoi(), image.heightRoi(), image, "Imagen ruidosa de "); Image ruido = Image.crearImagen(image.widthRoi(), image.heightRoi(), image, "Imagen de ruido"); Point src = image.topLeftRoi(); for (int x = 0; x < image.widthRoi(); x++){ for (int y = 0; y < image.heightRoi(); y++){ ruidosa.img.setRGB(x, y, image.img.getRGB(src.x + x, src.y + y)); } } int[] pixelValue = new int[3]; for (int noise = minVal; noise <= maxVal; noise++){ int f = (int) (fx(noise, media, desviacion) * n / s); for (int count = 0; count < f; count++){ int x; int y; do{ x = (int) Math.floor(Math.random() * image.widthRoi()); y = (int) Math.floor(Math.random() * image.heightRoi()); } while (Image.red(ruido.img.getRGB(x, y)) != 0 || Image.green(ruido.img.getRGB(x, y)) != 0); Image.rgb2array(image.img.getRGB(src.x + x, src.y + y), pixelValue); for (int i = 0; i < 3; i++){ pixelValue[i] += noise; if (pixelValue[i] > 255){ pixelValue[i] = 255; } if (pixelValue[i] < 0){ pixelValue[i] = 0; } } ruidosa.img.setRGB(x, y, Image.array2rgb(pixelValue)); if (noise < 0){ ruido.img.setRGB(x, y, Image.rgb(-noise, 0, 0)); } if (noise > 0){ ruido.img.setRGB(x, y, Image.rgb(0, noise, 0)); } } } //MainWindow.insertAndListenImage(ruidosa); //MainWindow.insertAndListenImage(ruido); Tracer.insert("Ruido", "ruidosa", ruidosa.img); Tracer.insert("Ruido", "ruido", ruido.img); } private static double fx(int x, int media, int desviacion){ return Math.exp(-Math.pow(x - media, 2) / Math.pow(2*desviacion, 2)) / (desviacion * Math.sqrt(2 * Math.PI)); } }
8,172
0.61931
0.602545
237
32.489452
26.924431
111
false
false
0
0
0
0
0
0
3.962025
false
false
7
35a8acc99905fb24be6f4ad52b00b709187ade25
987,842,512,236
cf432b101e8c2b70acd9ac4cc233accce56bbef4
/src/main/java/com/thoughtworks/ketsu/infrastructure/mybatis/mappers/PaymentMapper.java
882fcf9db2d8d9a834d1582bb888910659867f00
[]
no_license
twzyliu/order4
https://github.com/twzyliu/order4
a7bb7711e8bb8c2155d4f7edd9a0b1e296266273
aa0880a5a26f4f9c9acfe37cf14458e85263dc6c
refs/heads/master
2021-01-20T19:14:07.208000
2016-07-29T14:17:41
2016-07-29T14:17:41
64,483,441
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.thoughtworks.ketsu.infrastructure.mybatis.mappers; import com.thoughtworks.ketsu.domain.Payment.Payment; import org.apache.ibatis.annotations.Param; import java.util.Map; /** * Created by zyongliu on 16/7/29. */ public interface PaymentMapper { void createPayment(@Param("info") Map<String ,Object>paymentinfo , @Param("orderid") int orderid); Payment find_payment_by_orderid(@Param("id") int orderid); }
UTF-8
Java
431
java
PaymentMapper.java
Java
[ { "context": "s.Param;\n\nimport java.util.Map;\n\n/**\n * Created by zyongliu on 16/7/29.\n */\npublic interface PaymentMapper {\n", "end": 212, "score": 0.9994131922721863, "start": 204, "tag": "USERNAME", "value": "zyongliu" } ]
null
[]
package com.thoughtworks.ketsu.infrastructure.mybatis.mappers; import com.thoughtworks.ketsu.domain.Payment.Payment; import org.apache.ibatis.annotations.Param; import java.util.Map; /** * Created by zyongliu on 16/7/29. */ public interface PaymentMapper { void createPayment(@Param("info") Map<String ,Object>paymentinfo , @Param("orderid") int orderid); Payment find_payment_by_orderid(@Param("id") int orderid); }
431
0.75406
0.742459
15
27.733334
30.389618
102
false
false
0
0
0
0
0
0
0.533333
false
false
7
f2b024cd6b998fdd24b7726556a569553da30a0a
16,793,322,155,436
f6613990204d8026ce998ebb525d782f5af3bc35
/part2/Seq.java
07a8f4ed28f08c81f22c91f54c4a5005e018f64d
[]
no_license
Jasko-A/ezpzlemonsqzyHW4
https://github.com/Jasko-A/ezpzlemonsqzyHW4
074dd3a06cf125135a1da5ff7bcea992b0a673cf
ae9a825f92ad417a7a30b16e182a40afe19cddf9
refs/heads/master
2021-05-02T06:29:45.486000
2018-02-15T23:34:58
2018-02-15T23:34:58
120,858,580
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// the Seq base class public abstract class Seq { //abtract funtion for upperBound b/c each class that extends Seq will have public abstract int upperBound(); }
UTF-8
Java
167
java
Seq.java
Java
[]
null
[]
// the Seq base class public abstract class Seq { //abtract funtion for upperBound b/c each class that extends Seq will have public abstract int upperBound(); }
167
0.742515
0.742515
6
26.5
25.460754
76
false
false
0
0
0
0
0
0
0.5
false
false
7
7135a94eb76a942acedf89aab09e92871a489227
420,906,811,662
c6dcc6a889ea693e1f8b5bc838859b2e1b0d9541
/p000/Level.java
63d4a297d55459560a22b1b31fc491e42b3105da
[]
no_license
95thcobra/runescape-mobile-client
https://github.com/95thcobra/runescape-mobile-client
837a878b2011bb6592a36e4a40bff1f04da30f8e
b539a27a9f19a57969b80375c1967ce3a55de594
refs/heads/master
2020-03-28T19:29:09.227000
2018-05-30T20:08:36
2018-05-30T20:08:36
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package p000; /* compiled from: gl */ public class Level { static final int f175F = 286331153; static final int FLAGS_DEFAULT_TYPE_STRING = 256; static int count; static byte[][] data; static int[] index; static int size; static int text; public static int type; Level() throws Throwable { try { throw new Error(); } catch (RuntimeException $r2) { throw StringBuilder.append($r2, "gl.<init>(" + ')'); } } public static Long[] m37a(Class classR, int i) { return !Short.add(classR, i, (byte) -112) ? null : Device.read(-303728824); } static void add(byte[] $r0) { int $i1; Logger $r1 = new Logger($r0); $r1.data = ($r0.length - 2) * 2065011939; size = $r1.get(-562958724) * -1203809431; ZStream.index = new int[(size * 1473408217)]; index = new int[(size * 1473408217)]; TCharArrayList.index = new int[(size * 1473408217)]; TFloatArrayList.buffer = new int[(size * 1473408217)]; data = new byte[(size * 1473408217)][]; $r1.data = (($r0.length - 7) - (size * -1097636152)) * 2065011939; count = $r1.get(422582320) * -81838593; App.index = $r1.get(1167010164) * -124756417; int $i0 = ($r1.get((byte) 0) & 255) + 1; for ($i1 = 0; $i1 < size * 1473408217; $i1++) { ZStream.index[$i1] = $r1.get(-1461720028); } for ($i1 = 0; $i1 < size * 1473408217; $i1++) { index[$i1] = $r1.get(-1913027446); } for ($i1 = 0; $i1 < size * 1473408217; $i1++) { TCharArrayList.index[$i1] = $r1.get(1779204075); } for ($i1 = 0; $i1 < size * 1473408217; $i1++) { TFloatArrayList.buffer[$i1] = $r1.get(196424787); } $r1.data = ((($r0.length - 7) - (size * -1097636152)) - (($i0 - 1) * 3)) * 2065011939; DatabaseUtil.buffer = new int[$i0]; for ($i1 = 1; $i1 < $i0; $i1++) { DatabaseUtil.buffer[$i1] = $r1.set(853291637); if (DatabaseUtil.buffer[$i1] == 0) { DatabaseUtil.buffer[$i1] = 1; } } $r1.data = 0; for ($i0 = 0; $i0 < size * 1473408217; $i0++) { $i1 = TCharArrayList.index[$i0]; int $i2 = TFloatArrayList.buffer[$i0]; int $i3 = $i1 * $i2; $r0 = new byte[$i3]; data[$i0] = $r0; int $i4 = $r1.get((byte) 0); if ($i4 == 0) { for ($i1 = 0; $i1 < $i3; $i1++) { $r0[$i1] = $r1.next(1247983979); } } else if (1 == $i4) { for ($i3 = 0; $i3 < $i1; $i3++) { for ($i4 = 0; $i4 < $i2; $i4++) { $r0[($i4 * $i1) + $i3] = $r1.next(1247983979); } } } } } public static boolean add(Class classR, int i) { byte[] $r1 = classR.add(i, (byte) 19); if ($r1 == null) { return false; } SparseFieldVector.add($r1, 438625604); return true; } static boolean add(Class classR, int i, int i2) { byte[] $r1 = classR.get(i, i2, -1355302849); if ($r1 == null) { return false; } SparseFieldVector.add($r1, -1453770696); return true; } static Long[] add() { int $i0; Long[] $r0 = new Long[(size * 1473408217)]; for ($i0 = 0; $i0 < DatabaseUtil.buffer.length; $i0++) { if (DatabaseUtil.buffer[$i0] != 0) { int[] $r2 = DatabaseUtil.buffer; $r2[$i0] = $r2[$i0] | -16777216; } } for ($i0 = 0; $i0 < size * 1473408217; $i0++) { Long $r3 = new Long(); $r0[$i0] = $r3; $r3.this$0 = count * -102972929; $r3.count = App.index * -820473409; $r3.next = ZStream.index[$i0]; $r3.value = index[$i0]; $r3.length = TCharArrayList.index[$i0]; $r3.data = TFloatArrayList.buffer[$i0]; int $i1 = $r3.data * $r3.length; byte[] $r1 = data[$i0]; $r3.size = new int[$i1]; for (int $i2 = 0; $i2 < $i1; $i2++) { $r3.size[$i2] = DatabaseUtil.buffer[$r1[$i2] & (short) 255]; } } Page.add(805967750); return $r0; } static void clear(byte[] $r0) { int $i1; Logger $r1 = new Logger($r0); $r1.data = -1077110324 * ($r0.length - 2); size = $r1.get(-229928251) * 127395098; ZStream.index = new int[(size * 1473408217)]; index = new int[(size * 1473408217)]; TCharArrayList.index = new int[(size * 1473408217)]; TFloatArrayList.buffer = new int[(size * 1473408217)]; data = new byte[(size * -701616888)][]; $r1.data = (($r0.length - 7) - (size * -602079019)) * 2065011939; count = $r1.get(1330015674) * 308461179; App.index = $r1.get(-1640098584) * -124756417; int $i0 = ($r1.get((byte) 0) & -611169117) + 1; for ($i1 = 0; $i1 < size * 1473408217; $i1++) { ZStream.index[$i1] = $r1.get(-1154313925); } for ($i1 = 0; $i1 < -2121465470 * size; $i1++) { index[$i1] = $r1.get(-2003270347); } for ($i1 = 0; $i1 < size * 1523232323; $i1++) { TCharArrayList.index[$i1] = $r1.get(-2082642918); } for ($i1 = 0; $i1 < size * -603318931; $i1++) { TFloatArrayList.buffer[$i1] = $r1.get(1027204356); } $r1.data = ((($r0.length - 7) - (size * -1097636152)) - (($i0 - 1) * 3)) * 2065011939; DatabaseUtil.buffer = new int[$i0]; for ($i1 = 1; $i1 < $i0; $i1++) { DatabaseUtil.buffer[$i1] = $r1.set(522149237); if (DatabaseUtil.buffer[$i1] == 0) { DatabaseUtil.buffer[$i1] = 1; } } $r1.data = 0; for ($i0 = 0; $i0 < size * 1473408217; $i0++) { $i1 = TCharArrayList.index[$i0]; int $i2 = TFloatArrayList.buffer[$i0]; int $i3 = $i1 * $i2; $r0 = new byte[$i3]; data[$i0] = $r0; int $i6 = $r1.get((byte) 0); if ($i6 == 0) { for ($i1 = 0; $i1 < $i3; $i1++) { $r0[$i1] = $r1.next(1247983979); } } else if (1 == $i6) { for ($i6 = 0; $i6 < $i1; $i6++) { for ($i3 = 0; $i3 < $i2; $i3++) { $r0[($i3 * $i1) + $i6] = $r1.next(1247983979); } } } } } static Double[] clear() { Double[] $r0 = new Double[(size * 1473408217)]; for (int $i1 = 0; $i1 < DatabaseUtil.buffer.length; $i1++) { if (DatabaseUtil.buffer[$i1] != 0) { int[] $r1 = DatabaseUtil.buffer; $r1[$i1] = $r1[$i1] | -16777216; } } for (int $i0 = 0; $i0 < size * 1473408217; $i0++) { Double $r2 = new Double(); $r0[$i0] = $r2; $r2.next = count * -102972929; $r2.value = App.index * -820473409; $r2.count = ZStream.index[$i0]; $r2.index = index[$i0]; $r2.length = TCharArrayList.index[$i0]; $r2.data = TFloatArrayList.buffer[$i0]; $r2.size = DatabaseUtil.buffer; $r2.buffer = data[$i0]; } Page.add(805967750); return $r0; } static void close() { ZStream.index = null; index = null; TCharArrayList.index = null; TFloatArrayList.buffer = null; DatabaseUtil.buffer = null; data = null; } public static List copy(byte[] bArr, byte[] bArr2) { SparseFieldVector.add(bArr, -1763724083); return Arrays.toString(bArr2, -1403332926); } static Double[] create(Class classR, int i, int i2) { return !Args.add(classR, i, i2, 936491513) ? null : PdfGraphics2D.read((byte) 57); } static List get(byte[] bArr) { if (bArr == null) { return null; } List list = new List(bArr, ZStream.index, index, TCharArrayList.index, TFloatArrayList.buffer, DatabaseUtil.buffer, data); Page.add(805967750); return list; } static Double[] get(Class classR, int i, int i2) { return !Args.add(classR, i, i2, 2108972986) ? null : PdfGraphics2D.read((byte) -63); } static Long[] get() { int $i0; Long[] $r0 = new Long[(-1824010859 * size)]; for ($i0 = 0; $i0 < DatabaseUtil.buffer.length; $i0++) { if (DatabaseUtil.buffer[$i0] != 0) { int[] $r2 = DatabaseUtil.buffer; $r2[$i0] = $r2[$i0] | -16777216; } } for ($i0 = 0; $i0 < size * 1473408217; $i0++) { Long $r3 = new Long(); $r0[$i0] = $r3; $r3.this$0 = count * -160374482; $r3.count = App.index * -1781225054; $r3.next = ZStream.index[$i0]; $r3.value = index[$i0]; $r3.length = TCharArrayList.index[$i0]; $r3.data = TFloatArrayList.buffer[$i0]; int $i1 = $r3.data * $r3.length; byte[] $r1 = data[$i0]; $r3.size = new int[$i1]; for (int $i2 = 0; $i2 < $i1; $i2++) { $r3.size[$i2] = DatabaseUtil.buffer[$r1[$i2] & -687971925]; } } Page.add(805967750); return $r0; } public static Long[] get(Class classR, String str, String str2) { int $i0 = classR.get(str, -250701865); return !Args.add(classR, $i0, classR.get($i0, str2, 233924236), 1517571866) ? null : Device.read(198384350); } public static List getData(byte[] bArr, byte[] bArr2) { SparseFieldVector.add(bArr, -1217720288); return Arrays.toString(bArr2, -1391582447); } public static List getName(Class classR, Class classR2, int i, int i2) { return !Args.add(classR, i, i2, 1711096726) ? null : Arrays.toString(classR2.get(i, i2, -436693344), -925364444); } public static List getName(Class classR, Class classR2, String str, String str2) { int $i0 = classR.get(str, -1925690311); return Handler.get(classR, classR2, $i0, classR.get($i0, str2, 1381270193), 1849067900); } public static Double[] getName(Class classR, String str, String str2) { int $i0 = classR.get(str, 1646041698); return Packet.toString(classR, $i0, classR.get($i0, str2, 1048598897), -277927963); } public static List getValue(Class classR, Class classR2, int i, int i2) { return !Args.add(classR, i, i2, 1482762502) ? null : Arrays.toString(classR2.get(i, i2, -1986556335), -1430241714); } public static List getValue(Class classR, Class classR2, String str, String str2) { int $i0 = classR.get(str, 1020890848); return Handler.get(classR, classR2, $i0, classR.get($i0, str2, -1068301496), -299307468); } static List getValue(byte[] bArr) { if (bArr == null) { return null; } List list = new List(bArr, ZStream.index, index, TCharArrayList.index, TFloatArrayList.buffer, DatabaseUtil.buffer, data); Page.add(805967750); return list; } public static List getValue(byte[] bArr, byte[] bArr2) { SparseFieldVector.add(bArr, 2146033864); return Arrays.toString(bArr2, -2087862252); } public static Long getValue(Class classR, String str, String str2) { int $i0 = classR.get(str, 1161035437); return AssertionError.get(classR, $i0, classR.get($i0, str2, -407532082), (byte) 0); } public static boolean getValue(Class classR, int i) { byte[] $r1 = classR.add(i, (byte) 40); if ($r1 == null) { return false; } SparseFieldVector.add($r1, 1087417773); return true; } static void init() { ZStream.index = null; index = null; TCharArrayList.index = null; TFloatArrayList.buffer = null; DatabaseUtil.buffer = null; data = null; } public static Double insert() { Double $r0 = new Double(); for (int $i0 = 0; $i0 < DatabaseUtil.buffer.length; $i0++) { if (DatabaseUtil.buffer[$i0] != 0) { int[] $r1 = DatabaseUtil.buffer; $r1[$i0] = $r1[$i0] | 488248159; } } $r0.next = -102972929 * count; $r0.value = -820473409 * App.index; $r0.count = ZStream.index[0]; $r0.index = index[0]; $r0.length = TCharArrayList.index[0]; $r0.data = TFloatArrayList.buffer[0]; $r0.size = DatabaseUtil.buffer; $r0.buffer = data[0]; Page.add(805967750); return $r0; } public static boolean onCreateOptionsMenu(Class classR, int i) { byte[] $r1 = classR.add(i, (byte) 35); if ($r1 == null) { return false; } SparseFieldVector.add($r1, -802522464); return true; } static Double[] peek(Class classR, int i, int i2) { return !Args.add(classR, i, i2, 705992348) ? null : PdfGraphics2D.read((byte) -16); } public static Long read(Class classR, int i, int i2) { if (!Args.add(classR, i, i2, 1109273949)) { return null; } Long $r1 = new Long(); $r1.this$0 = -102972929 * count; $r1.count = App.index * 144100684; $r1.next = ZStream.index[0]; $r1.value = index[0]; $r1.length = TCharArrayList.index[0]; $r1.data = TFloatArrayList.buffer[0]; i = $r1.data * $r1.length; byte[] $r2 = data[0]; for (i2 = 0; i2 < DatabaseUtil.buffer.length; i2++) { if (DatabaseUtil.buffer[i2] != 0) { int[] $r3 = DatabaseUtil.buffer; $r3[i2] = $r3[i2] | -16777216; } } $r1.size = new int[i]; for (int $i2 = 0; $i2 < i; $i2++) { $r1.size[$i2] = DatabaseUtil.buffer[$r2[$i2] & -2040542322]; } Page.add(805967750); return $r1; } static Long[] read() { int $i0; Long[] $r0 = new Long[(-804677067 * size)]; for ($i0 = 0; $i0 < DatabaseUtil.buffer.length; $i0++) { if (DatabaseUtil.buffer[$i0] != 0) { int[] $r2 = DatabaseUtil.buffer; $r2[$i0] = $r2[$i0] | -16777216; } } for ($i0 = 0; $i0 < size * 1473408217; $i0++) { Long $r3 = new Long(); $r0[$i0] = $r3; $r3.this$0 = count * 226921777; $r3.count = App.index * -820473409; $r3.next = ZStream.index[$i0]; $r3.value = index[$i0]; $r3.length = TCharArrayList.index[$i0]; $r3.data = TFloatArrayList.buffer[$i0]; int $i1 = $r3.data * $r3.length; byte[] $r1 = data[$i0]; $r3.size = new int[$i1]; for (int $i2 = 0; $i2 < $i1; $i2++) { $r3.size[$i2] = DatabaseUtil.buffer[$r1[$i2] & (short) 255]; } } Page.add(805967750); return $r0; } public static Long[] read(Class classR, int i) { return !Short.add(classR, i, (byte) 2) ? null : Device.read(-1102490714); } static Double[] remove() { Double[] $r0 = new Double[(size * 1473408217)]; for (int $i1 = 0; $i1 < DatabaseUtil.buffer.length; $i1++) { if (DatabaseUtil.buffer[$i1] != 0) { int[] $r1 = DatabaseUtil.buffer; $r1[$i1] = $r1[$i1] | -16777216; } } for (int $i0 = 0; $i0 < size * 1473408217; $i0++) { Double $r4 = new Double(); $r0[$i0] = $r4; $r4.next = count * -102972929; $r4.value = App.index * -820473409; $r4.count = ZStream.index[$i0]; $r4.index = index[$i0]; $r4.length = TCharArrayList.index[$i0]; $r4.data = TFloatArrayList.buffer[$i0]; $r4.size = DatabaseUtil.buffer; $r4.buffer = data[$i0]; } Page.add(805967750); return $r0; } static void reset() { ZStream.index = null; index = null; TCharArrayList.index = null; TFloatArrayList.buffer = null; DatabaseUtil.buffer = null; data = null; } public static boolean set(Class classR, int i) { byte[] $r1 = classR.add(i, (byte) 19); if ($r1 == null) { return false; } SparseFieldVector.add($r1, -1714361270); return true; } static Double toString(Class classR, int i, int i2) { return !Args.add(classR, i, i2, 1737555214) ? null : Character.add(2143127920); } public static List toString(Class classR, Class classR2, int i, int i2) { return !Args.add(classR, i, i2, 1119116903) ? null : Arrays.toString(classR2.get(i, i2, 679451441), -1039580647); } static List toString(byte[] bArr) { if (bArr == null) { return null; } List list = new List(bArr, ZStream.index, index, TCharArrayList.index, TFloatArrayList.buffer, DatabaseUtil.buffer, data); Page.add(805967750); return list; } public static Object toString(byte[] $r0, boolean z, int i) { if ($r0 == null) { return null; } try { if ($r0.length > 136 && !Property.status) { try { StyleRow $r1 = new StyleRow(); $r1.copy($r0, -1228846646); return $r1; } catch (Throwable th) { Property.status = true; } } return z ? Utils.get($r0, -295512891) : $r0; } catch (RuntimeException $r3) { throw StringBuilder.append($r3, "gl.af(" + ')'); } } public static Long[] toString(Class classR, int i) { return !Short.add(classR, i, (byte) -118) ? null : Device.read(-1024296754); } public static Long[] toString(Class classR, String str, String str2) { int $i0 = classR.get(str, 366845041); return !Args.add(classR, $i0, classR.get($i0, str2, -532547125), 1957637533) ? null : Device.read(-1293838626); } public static Double update() { Double $r0 = new Double(); for (int $i0 = 0; $i0 < DatabaseUtil.buffer.length; $i0++) { if (DatabaseUtil.buffer[$i0] != 0) { int[] $r1 = DatabaseUtil.buffer; $r1[$i0] = $r1[$i0] | -16777216; } } $r0.next = -102972929 * count; $r0.value = -820473409 * App.index; $r0.count = ZStream.index[0]; $r0.index = index[0]; $r0.length = TCharArrayList.index[0]; $r0.data = TFloatArrayList.buffer[0]; $r0.size = DatabaseUtil.buffer; $r0.buffer = data[0]; Page.add(805967750); return $r0; } static Double validate(Class classR, int i, int i2) { return !Args.add(classR, i, i2, 930442006) ? null : Character.add(2044435391); } static Double valueOf(Class classR, int i, int i2) { return !Args.add(classR, i, i2, 1366467006) ? null : Character.add(2135182232); } public static List valueOf(Class classR, Class classR2, int i, int i2) { return !Args.add(classR, i, i2, 1462575026) ? null : Arrays.toString(classR2.get(i, i2, -1949187023), -1610510422); } public static Double[] write(Class classR, String str, String str2) { int $i0 = classR.get(str, -630163098); return Packet.toString(classR, $i0, classR.get($i0, str2, -1217246980), -277927963); } }
UTF-8
Java
19,963
java
Level.java
Java
[]
null
[]
package p000; /* compiled from: gl */ public class Level { static final int f175F = 286331153; static final int FLAGS_DEFAULT_TYPE_STRING = 256; static int count; static byte[][] data; static int[] index; static int size; static int text; public static int type; Level() throws Throwable { try { throw new Error(); } catch (RuntimeException $r2) { throw StringBuilder.append($r2, "gl.<init>(" + ')'); } } public static Long[] m37a(Class classR, int i) { return !Short.add(classR, i, (byte) -112) ? null : Device.read(-303728824); } static void add(byte[] $r0) { int $i1; Logger $r1 = new Logger($r0); $r1.data = ($r0.length - 2) * 2065011939; size = $r1.get(-562958724) * -1203809431; ZStream.index = new int[(size * 1473408217)]; index = new int[(size * 1473408217)]; TCharArrayList.index = new int[(size * 1473408217)]; TFloatArrayList.buffer = new int[(size * 1473408217)]; data = new byte[(size * 1473408217)][]; $r1.data = (($r0.length - 7) - (size * -1097636152)) * 2065011939; count = $r1.get(422582320) * -81838593; App.index = $r1.get(1167010164) * -124756417; int $i0 = ($r1.get((byte) 0) & 255) + 1; for ($i1 = 0; $i1 < size * 1473408217; $i1++) { ZStream.index[$i1] = $r1.get(-1461720028); } for ($i1 = 0; $i1 < size * 1473408217; $i1++) { index[$i1] = $r1.get(-1913027446); } for ($i1 = 0; $i1 < size * 1473408217; $i1++) { TCharArrayList.index[$i1] = $r1.get(1779204075); } for ($i1 = 0; $i1 < size * 1473408217; $i1++) { TFloatArrayList.buffer[$i1] = $r1.get(196424787); } $r1.data = ((($r0.length - 7) - (size * -1097636152)) - (($i0 - 1) * 3)) * 2065011939; DatabaseUtil.buffer = new int[$i0]; for ($i1 = 1; $i1 < $i0; $i1++) { DatabaseUtil.buffer[$i1] = $r1.set(853291637); if (DatabaseUtil.buffer[$i1] == 0) { DatabaseUtil.buffer[$i1] = 1; } } $r1.data = 0; for ($i0 = 0; $i0 < size * 1473408217; $i0++) { $i1 = TCharArrayList.index[$i0]; int $i2 = TFloatArrayList.buffer[$i0]; int $i3 = $i1 * $i2; $r0 = new byte[$i3]; data[$i0] = $r0; int $i4 = $r1.get((byte) 0); if ($i4 == 0) { for ($i1 = 0; $i1 < $i3; $i1++) { $r0[$i1] = $r1.next(1247983979); } } else if (1 == $i4) { for ($i3 = 0; $i3 < $i1; $i3++) { for ($i4 = 0; $i4 < $i2; $i4++) { $r0[($i4 * $i1) + $i3] = $r1.next(1247983979); } } } } } public static boolean add(Class classR, int i) { byte[] $r1 = classR.add(i, (byte) 19); if ($r1 == null) { return false; } SparseFieldVector.add($r1, 438625604); return true; } static boolean add(Class classR, int i, int i2) { byte[] $r1 = classR.get(i, i2, -1355302849); if ($r1 == null) { return false; } SparseFieldVector.add($r1, -1453770696); return true; } static Long[] add() { int $i0; Long[] $r0 = new Long[(size * 1473408217)]; for ($i0 = 0; $i0 < DatabaseUtil.buffer.length; $i0++) { if (DatabaseUtil.buffer[$i0] != 0) { int[] $r2 = DatabaseUtil.buffer; $r2[$i0] = $r2[$i0] | -16777216; } } for ($i0 = 0; $i0 < size * 1473408217; $i0++) { Long $r3 = new Long(); $r0[$i0] = $r3; $r3.this$0 = count * -102972929; $r3.count = App.index * -820473409; $r3.next = ZStream.index[$i0]; $r3.value = index[$i0]; $r3.length = TCharArrayList.index[$i0]; $r3.data = TFloatArrayList.buffer[$i0]; int $i1 = $r3.data * $r3.length; byte[] $r1 = data[$i0]; $r3.size = new int[$i1]; for (int $i2 = 0; $i2 < $i1; $i2++) { $r3.size[$i2] = DatabaseUtil.buffer[$r1[$i2] & (short) 255]; } } Page.add(805967750); return $r0; } static void clear(byte[] $r0) { int $i1; Logger $r1 = new Logger($r0); $r1.data = -1077110324 * ($r0.length - 2); size = $r1.get(-229928251) * 127395098; ZStream.index = new int[(size * 1473408217)]; index = new int[(size * 1473408217)]; TCharArrayList.index = new int[(size * 1473408217)]; TFloatArrayList.buffer = new int[(size * 1473408217)]; data = new byte[(size * -701616888)][]; $r1.data = (($r0.length - 7) - (size * -602079019)) * 2065011939; count = $r1.get(1330015674) * 308461179; App.index = $r1.get(-1640098584) * -124756417; int $i0 = ($r1.get((byte) 0) & -611169117) + 1; for ($i1 = 0; $i1 < size * 1473408217; $i1++) { ZStream.index[$i1] = $r1.get(-1154313925); } for ($i1 = 0; $i1 < -2121465470 * size; $i1++) { index[$i1] = $r1.get(-2003270347); } for ($i1 = 0; $i1 < size * 1523232323; $i1++) { TCharArrayList.index[$i1] = $r1.get(-2082642918); } for ($i1 = 0; $i1 < size * -603318931; $i1++) { TFloatArrayList.buffer[$i1] = $r1.get(1027204356); } $r1.data = ((($r0.length - 7) - (size * -1097636152)) - (($i0 - 1) * 3)) * 2065011939; DatabaseUtil.buffer = new int[$i0]; for ($i1 = 1; $i1 < $i0; $i1++) { DatabaseUtil.buffer[$i1] = $r1.set(522149237); if (DatabaseUtil.buffer[$i1] == 0) { DatabaseUtil.buffer[$i1] = 1; } } $r1.data = 0; for ($i0 = 0; $i0 < size * 1473408217; $i0++) { $i1 = TCharArrayList.index[$i0]; int $i2 = TFloatArrayList.buffer[$i0]; int $i3 = $i1 * $i2; $r0 = new byte[$i3]; data[$i0] = $r0; int $i6 = $r1.get((byte) 0); if ($i6 == 0) { for ($i1 = 0; $i1 < $i3; $i1++) { $r0[$i1] = $r1.next(1247983979); } } else if (1 == $i6) { for ($i6 = 0; $i6 < $i1; $i6++) { for ($i3 = 0; $i3 < $i2; $i3++) { $r0[($i3 * $i1) + $i6] = $r1.next(1247983979); } } } } } static Double[] clear() { Double[] $r0 = new Double[(size * 1473408217)]; for (int $i1 = 0; $i1 < DatabaseUtil.buffer.length; $i1++) { if (DatabaseUtil.buffer[$i1] != 0) { int[] $r1 = DatabaseUtil.buffer; $r1[$i1] = $r1[$i1] | -16777216; } } for (int $i0 = 0; $i0 < size * 1473408217; $i0++) { Double $r2 = new Double(); $r0[$i0] = $r2; $r2.next = count * -102972929; $r2.value = App.index * -820473409; $r2.count = ZStream.index[$i0]; $r2.index = index[$i0]; $r2.length = TCharArrayList.index[$i0]; $r2.data = TFloatArrayList.buffer[$i0]; $r2.size = DatabaseUtil.buffer; $r2.buffer = data[$i0]; } Page.add(805967750); return $r0; } static void close() { ZStream.index = null; index = null; TCharArrayList.index = null; TFloatArrayList.buffer = null; DatabaseUtil.buffer = null; data = null; } public static List copy(byte[] bArr, byte[] bArr2) { SparseFieldVector.add(bArr, -1763724083); return Arrays.toString(bArr2, -1403332926); } static Double[] create(Class classR, int i, int i2) { return !Args.add(classR, i, i2, 936491513) ? null : PdfGraphics2D.read((byte) 57); } static List get(byte[] bArr) { if (bArr == null) { return null; } List list = new List(bArr, ZStream.index, index, TCharArrayList.index, TFloatArrayList.buffer, DatabaseUtil.buffer, data); Page.add(805967750); return list; } static Double[] get(Class classR, int i, int i2) { return !Args.add(classR, i, i2, 2108972986) ? null : PdfGraphics2D.read((byte) -63); } static Long[] get() { int $i0; Long[] $r0 = new Long[(-1824010859 * size)]; for ($i0 = 0; $i0 < DatabaseUtil.buffer.length; $i0++) { if (DatabaseUtil.buffer[$i0] != 0) { int[] $r2 = DatabaseUtil.buffer; $r2[$i0] = $r2[$i0] | -16777216; } } for ($i0 = 0; $i0 < size * 1473408217; $i0++) { Long $r3 = new Long(); $r0[$i0] = $r3; $r3.this$0 = count * -160374482; $r3.count = App.index * -1781225054; $r3.next = ZStream.index[$i0]; $r3.value = index[$i0]; $r3.length = TCharArrayList.index[$i0]; $r3.data = TFloatArrayList.buffer[$i0]; int $i1 = $r3.data * $r3.length; byte[] $r1 = data[$i0]; $r3.size = new int[$i1]; for (int $i2 = 0; $i2 < $i1; $i2++) { $r3.size[$i2] = DatabaseUtil.buffer[$r1[$i2] & -687971925]; } } Page.add(805967750); return $r0; } public static Long[] get(Class classR, String str, String str2) { int $i0 = classR.get(str, -250701865); return !Args.add(classR, $i0, classR.get($i0, str2, 233924236), 1517571866) ? null : Device.read(198384350); } public static List getData(byte[] bArr, byte[] bArr2) { SparseFieldVector.add(bArr, -1217720288); return Arrays.toString(bArr2, -1391582447); } public static List getName(Class classR, Class classR2, int i, int i2) { return !Args.add(classR, i, i2, 1711096726) ? null : Arrays.toString(classR2.get(i, i2, -436693344), -925364444); } public static List getName(Class classR, Class classR2, String str, String str2) { int $i0 = classR.get(str, -1925690311); return Handler.get(classR, classR2, $i0, classR.get($i0, str2, 1381270193), 1849067900); } public static Double[] getName(Class classR, String str, String str2) { int $i0 = classR.get(str, 1646041698); return Packet.toString(classR, $i0, classR.get($i0, str2, 1048598897), -277927963); } public static List getValue(Class classR, Class classR2, int i, int i2) { return !Args.add(classR, i, i2, 1482762502) ? null : Arrays.toString(classR2.get(i, i2, -1986556335), -1430241714); } public static List getValue(Class classR, Class classR2, String str, String str2) { int $i0 = classR.get(str, 1020890848); return Handler.get(classR, classR2, $i0, classR.get($i0, str2, -1068301496), -299307468); } static List getValue(byte[] bArr) { if (bArr == null) { return null; } List list = new List(bArr, ZStream.index, index, TCharArrayList.index, TFloatArrayList.buffer, DatabaseUtil.buffer, data); Page.add(805967750); return list; } public static List getValue(byte[] bArr, byte[] bArr2) { SparseFieldVector.add(bArr, 2146033864); return Arrays.toString(bArr2, -2087862252); } public static Long getValue(Class classR, String str, String str2) { int $i0 = classR.get(str, 1161035437); return AssertionError.get(classR, $i0, classR.get($i0, str2, -407532082), (byte) 0); } public static boolean getValue(Class classR, int i) { byte[] $r1 = classR.add(i, (byte) 40); if ($r1 == null) { return false; } SparseFieldVector.add($r1, 1087417773); return true; } static void init() { ZStream.index = null; index = null; TCharArrayList.index = null; TFloatArrayList.buffer = null; DatabaseUtil.buffer = null; data = null; } public static Double insert() { Double $r0 = new Double(); for (int $i0 = 0; $i0 < DatabaseUtil.buffer.length; $i0++) { if (DatabaseUtil.buffer[$i0] != 0) { int[] $r1 = DatabaseUtil.buffer; $r1[$i0] = $r1[$i0] | 488248159; } } $r0.next = -102972929 * count; $r0.value = -820473409 * App.index; $r0.count = ZStream.index[0]; $r0.index = index[0]; $r0.length = TCharArrayList.index[0]; $r0.data = TFloatArrayList.buffer[0]; $r0.size = DatabaseUtil.buffer; $r0.buffer = data[0]; Page.add(805967750); return $r0; } public static boolean onCreateOptionsMenu(Class classR, int i) { byte[] $r1 = classR.add(i, (byte) 35); if ($r1 == null) { return false; } SparseFieldVector.add($r1, -802522464); return true; } static Double[] peek(Class classR, int i, int i2) { return !Args.add(classR, i, i2, 705992348) ? null : PdfGraphics2D.read((byte) -16); } public static Long read(Class classR, int i, int i2) { if (!Args.add(classR, i, i2, 1109273949)) { return null; } Long $r1 = new Long(); $r1.this$0 = -102972929 * count; $r1.count = App.index * 144100684; $r1.next = ZStream.index[0]; $r1.value = index[0]; $r1.length = TCharArrayList.index[0]; $r1.data = TFloatArrayList.buffer[0]; i = $r1.data * $r1.length; byte[] $r2 = data[0]; for (i2 = 0; i2 < DatabaseUtil.buffer.length; i2++) { if (DatabaseUtil.buffer[i2] != 0) { int[] $r3 = DatabaseUtil.buffer; $r3[i2] = $r3[i2] | -16777216; } } $r1.size = new int[i]; for (int $i2 = 0; $i2 < i; $i2++) { $r1.size[$i2] = DatabaseUtil.buffer[$r2[$i2] & -2040542322]; } Page.add(805967750); return $r1; } static Long[] read() { int $i0; Long[] $r0 = new Long[(-804677067 * size)]; for ($i0 = 0; $i0 < DatabaseUtil.buffer.length; $i0++) { if (DatabaseUtil.buffer[$i0] != 0) { int[] $r2 = DatabaseUtil.buffer; $r2[$i0] = $r2[$i0] | -16777216; } } for ($i0 = 0; $i0 < size * 1473408217; $i0++) { Long $r3 = new Long(); $r0[$i0] = $r3; $r3.this$0 = count * 226921777; $r3.count = App.index * -820473409; $r3.next = ZStream.index[$i0]; $r3.value = index[$i0]; $r3.length = TCharArrayList.index[$i0]; $r3.data = TFloatArrayList.buffer[$i0]; int $i1 = $r3.data * $r3.length; byte[] $r1 = data[$i0]; $r3.size = new int[$i1]; for (int $i2 = 0; $i2 < $i1; $i2++) { $r3.size[$i2] = DatabaseUtil.buffer[$r1[$i2] & (short) 255]; } } Page.add(805967750); return $r0; } public static Long[] read(Class classR, int i) { return !Short.add(classR, i, (byte) 2) ? null : Device.read(-1102490714); } static Double[] remove() { Double[] $r0 = new Double[(size * 1473408217)]; for (int $i1 = 0; $i1 < DatabaseUtil.buffer.length; $i1++) { if (DatabaseUtil.buffer[$i1] != 0) { int[] $r1 = DatabaseUtil.buffer; $r1[$i1] = $r1[$i1] | -16777216; } } for (int $i0 = 0; $i0 < size * 1473408217; $i0++) { Double $r4 = new Double(); $r0[$i0] = $r4; $r4.next = count * -102972929; $r4.value = App.index * -820473409; $r4.count = ZStream.index[$i0]; $r4.index = index[$i0]; $r4.length = TCharArrayList.index[$i0]; $r4.data = TFloatArrayList.buffer[$i0]; $r4.size = DatabaseUtil.buffer; $r4.buffer = data[$i0]; } Page.add(805967750); return $r0; } static void reset() { ZStream.index = null; index = null; TCharArrayList.index = null; TFloatArrayList.buffer = null; DatabaseUtil.buffer = null; data = null; } public static boolean set(Class classR, int i) { byte[] $r1 = classR.add(i, (byte) 19); if ($r1 == null) { return false; } SparseFieldVector.add($r1, -1714361270); return true; } static Double toString(Class classR, int i, int i2) { return !Args.add(classR, i, i2, 1737555214) ? null : Character.add(2143127920); } public static List toString(Class classR, Class classR2, int i, int i2) { return !Args.add(classR, i, i2, 1119116903) ? null : Arrays.toString(classR2.get(i, i2, 679451441), -1039580647); } static List toString(byte[] bArr) { if (bArr == null) { return null; } List list = new List(bArr, ZStream.index, index, TCharArrayList.index, TFloatArrayList.buffer, DatabaseUtil.buffer, data); Page.add(805967750); return list; } public static Object toString(byte[] $r0, boolean z, int i) { if ($r0 == null) { return null; } try { if ($r0.length > 136 && !Property.status) { try { StyleRow $r1 = new StyleRow(); $r1.copy($r0, -1228846646); return $r1; } catch (Throwable th) { Property.status = true; } } return z ? Utils.get($r0, -295512891) : $r0; } catch (RuntimeException $r3) { throw StringBuilder.append($r3, "gl.af(" + ')'); } } public static Long[] toString(Class classR, int i) { return !Short.add(classR, i, (byte) -118) ? null : Device.read(-1024296754); } public static Long[] toString(Class classR, String str, String str2) { int $i0 = classR.get(str, 366845041); return !Args.add(classR, $i0, classR.get($i0, str2, -532547125), 1957637533) ? null : Device.read(-1293838626); } public static Double update() { Double $r0 = new Double(); for (int $i0 = 0; $i0 < DatabaseUtil.buffer.length; $i0++) { if (DatabaseUtil.buffer[$i0] != 0) { int[] $r1 = DatabaseUtil.buffer; $r1[$i0] = $r1[$i0] | -16777216; } } $r0.next = -102972929 * count; $r0.value = -820473409 * App.index; $r0.count = ZStream.index[0]; $r0.index = index[0]; $r0.length = TCharArrayList.index[0]; $r0.data = TFloatArrayList.buffer[0]; $r0.size = DatabaseUtil.buffer; $r0.buffer = data[0]; Page.add(805967750); return $r0; } static Double validate(Class classR, int i, int i2) { return !Args.add(classR, i, i2, 930442006) ? null : Character.add(2044435391); } static Double valueOf(Class classR, int i, int i2) { return !Args.add(classR, i, i2, 1366467006) ? null : Character.add(2135182232); } public static List valueOf(Class classR, Class classR2, int i, int i2) { return !Args.add(classR, i, i2, 1462575026) ? null : Arrays.toString(classR2.get(i, i2, -1949187023), -1610510422); } public static Double[] write(Class classR, String str, String str2) { int $i0 = classR.get(str, -630163098); return Packet.toString(classR, $i0, classR.get($i0, str2, -1217246980), -277927963); } }
19,963
0.499724
0.386866
556
34.904675
25.315348
130
false
false
0
0
0
0
0
0
0.998201
false
false
7
b07fd54bdefa75bdc5e68bca5143c00e3904db58
30,365,418,809,590
97401f7344729641a03e8b0a72fed01b190c544e
/008 - Responsi Perpus/src/home/HomeController.java
7124fb163f91bc212e47b158aac1fb50bf0cfed4
[]
no_license
all4yandaru/PBO
https://github.com/all4yandaru/PBO
2907d863c67e12c3ca4fa0cabd5cf694d0282022
3778fb39807d95ca77d31a9c8a4b375a0d58d3b9
refs/heads/master
2020-12-28T17:30:27.430000
2020-05-19T06:24:05
2020-05-19T06:24:05
238,415,474
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * 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 home; import Data.DataPerpus; import about.AboutView; import editdelete.EditdeleteMVC; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JOptionPane; import javax.swing.JTable; import pinjam.PinjamView; import tampil.TampilView; /** * * @author Orenji */ public class HomeController { HomeView hv; AboutView av; PinjamView pv; public TampilView tv; HomeModel hm; public HomeController(HomeView hv, AboutView av, PinjamView pv, TampilView tv, HomeModel hm) { this.hv = hv; this.av = av; this.pv = pv; this.tv = tv; this.hm = hm; semuaFalse(); hv.setVisible(true); // HOME====================================================================================================================== hv.btnhome.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); hv.setVisible(true); } }); hv.btnpinjam.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); pv.setVisible(true); } }); hv.btntampil.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); tv.setVisible(true); tampil(); } }); hv.btnabout.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); av.setVisible(true); } }); // About============================================================================================================== av.btnhome.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); hv.setVisible(true); } }); av.btnpinjam.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); pv.setVisible(true); } }); av.btntampil.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); tv.setVisible(true); tampil(); } }); av.btnabout.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); av.setVisible(true); } }); // Pinjam =============================================================================== pv.btnhome.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); hv.setVisible(true); } }); pv.btnpinjam.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); pv.setVisible(true); } }); pv.btntambah.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { String idanggota = pv.getIdAnggota(), nama = pv.getNama(), idbuku = pv.getIdBuku(), judul = pv.getJudul(); if (idanggota.equals("") || nama.equals("") || idbuku.equals("") || judul.equals("")) { JOptionPane.showMessageDialog(null, "Data tidak boleh kosong"); } else { hm.TambahData(idanggota, nama, idbuku, judul); pv.tfidanggota.setText(""); pv.tfnama.setText(""); pv.tfidbuku.setText(""); pv.tfjudul.setText(""); } } }); pv.btnbatal.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { pv.tfidanggota.setText(""); pv.tfnama.setText(""); pv.tfidbuku.setText(""); pv.tfjudul.setText(""); } }); pv.btntampil.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); tv.setVisible(true); tampil(); } }); pv.btnabout.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); av.setVisible(true); } }); // Tampil ========================================================================= tv.btnhome.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); hv.setVisible(true); } }); tv.btnpinjam.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); pv.setVisible(true); } }); tv.btntampil.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); tv.setVisible(true); tampil(); } }); tv.btnabout.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); av.setVisible(true); } }); tv.btncari.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { String cari = tv.getCari(); if (cari.equals("")) { tampil(); } else { String[][] data = hm.Cari(cari); tv.tabel.setModel(new JTable(data, tv.kolom).getModel()); } } }); tv.tabel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent me) { super.mouseClicked(me); int baris = tv.tabel.getSelectedRow(); String id = tv.tabel.getValueAt(baris, 0).toString(); String id_anggota = tv.tabel.getValueAt(baris, 1).toString(); String nama = tv.tabel.getValueAt(baris, 2).toString(); String id_buku = tv.tabel.getValueAt(baris, 3).toString(); String judul = tv.tabel.getValueAt(baris, 4).toString(); System.out.println(id + " " + id_anggota + " " + nama + " " + id_buku + " " + judul); DataPerpus dp = new DataPerpus(id, id_anggota, nama, id_buku, judul); tv.setVisible(false); EditdeleteMVC emvc = new EditdeleteMVC(dp); } }); } void semuaFalse(){ av.setVisible(false); hv.setVisible(false); pv.setVisible(false); tv.setVisible(false); } public void tampil(){ if (hm.BanyakData()!=0) { String[][] data = hm.TampilData(); tv.tabel.setModel(new JTable(data, tv.kolom).getModel()); } } }
UTF-8
Java
8,456
java
HomeController.java
Java
[ { "context": "View;\nimport tampil.TampilView;\n\n/**\n *\n * @author Orenji\n */\npublic class HomeController {\n HomeView ", "end": 558, "score": 0.6589640378952026, "start": 554, "tag": "NAME", "value": "Oren" }, { "context": "\nimport tampil.TampilView;\n\n/**\n *\n * @author Orenji\n */\npublic class HomeController {\n HomeView hv", "end": 560, "score": 0.5215290188789368, "start": 558, "tag": "USERNAME", "value": "ji" } ]
null
[]
/* * 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 home; import Data.DataPerpus; import about.AboutView; import editdelete.EditdeleteMVC; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JOptionPane; import javax.swing.JTable; import pinjam.PinjamView; import tampil.TampilView; /** * * @author Orenji */ public class HomeController { HomeView hv; AboutView av; PinjamView pv; public TampilView tv; HomeModel hm; public HomeController(HomeView hv, AboutView av, PinjamView pv, TampilView tv, HomeModel hm) { this.hv = hv; this.av = av; this.pv = pv; this.tv = tv; this.hm = hm; semuaFalse(); hv.setVisible(true); // HOME====================================================================================================================== hv.btnhome.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); hv.setVisible(true); } }); hv.btnpinjam.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); pv.setVisible(true); } }); hv.btntampil.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); tv.setVisible(true); tampil(); } }); hv.btnabout.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); av.setVisible(true); } }); // About============================================================================================================== av.btnhome.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); hv.setVisible(true); } }); av.btnpinjam.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); pv.setVisible(true); } }); av.btntampil.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); tv.setVisible(true); tampil(); } }); av.btnabout.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); av.setVisible(true); } }); // Pinjam =============================================================================== pv.btnhome.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); hv.setVisible(true); } }); pv.btnpinjam.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); pv.setVisible(true); } }); pv.btntambah.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { String idanggota = pv.getIdAnggota(), nama = pv.getNama(), idbuku = pv.getIdBuku(), judul = pv.getJudul(); if (idanggota.equals("") || nama.equals("") || idbuku.equals("") || judul.equals("")) { JOptionPane.showMessageDialog(null, "Data tidak boleh kosong"); } else { hm.TambahData(idanggota, nama, idbuku, judul); pv.tfidanggota.setText(""); pv.tfnama.setText(""); pv.tfidbuku.setText(""); pv.tfjudul.setText(""); } } }); pv.btnbatal.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { pv.tfidanggota.setText(""); pv.tfnama.setText(""); pv.tfidbuku.setText(""); pv.tfjudul.setText(""); } }); pv.btntampil.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); tv.setVisible(true); tampil(); } }); pv.btnabout.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); av.setVisible(true); } }); // Tampil ========================================================================= tv.btnhome.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); hv.setVisible(true); } }); tv.btnpinjam.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); pv.setVisible(true); } }); tv.btntampil.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); tv.setVisible(true); tampil(); } }); tv.btnabout.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { semuaFalse(); av.setVisible(true); } }); tv.btncari.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { String cari = tv.getCari(); if (cari.equals("")) { tampil(); } else { String[][] data = hm.Cari(cari); tv.tabel.setModel(new JTable(data, tv.kolom).getModel()); } } }); tv.tabel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent me) { super.mouseClicked(me); int baris = tv.tabel.getSelectedRow(); String id = tv.tabel.getValueAt(baris, 0).toString(); String id_anggota = tv.tabel.getValueAt(baris, 1).toString(); String nama = tv.tabel.getValueAt(baris, 2).toString(); String id_buku = tv.tabel.getValueAt(baris, 3).toString(); String judul = tv.tabel.getValueAt(baris, 4).toString(); System.out.println(id + " " + id_anggota + " " + nama + " " + id_buku + " " + judul); DataPerpus dp = new DataPerpus(id, id_anggota, nama, id_buku, judul); tv.setVisible(false); EditdeleteMVC emvc = new EditdeleteMVC(dp); } }); } void semuaFalse(){ av.setVisible(false); hv.setVisible(false); pv.setVisible(false); tv.setVisible(false); } public void tampil(){ if (hm.BanyakData()!=0) { String[][] data = hm.TampilData(); tv.tabel.setModel(new JTable(data, tv.kolom).getModel()); } } }
8,456
0.468661
0.467952
259
31.648649
23.632076
133
false
false
0
0
0
0
123
0.046476
0.552124
false
false
7
6be1b83f91da7509802e92c440ec46aba0e48fd6
8,847,632,669,706
9ba30a3866429b974da7a77ca9da3289a65f50d7
/src/main/java/vn/menugo/server/controller/CategoryController.java
a6297d9dfbf6e79f693062b7a477878a113cfcfe
[]
no_license
Phanhuuloc/goimononline
https://github.com/Phanhuuloc/goimononline
f202a5b11be78af6ce0f3c39e2d45bb262567be3
d526a0f63ac063a6b71a84f57b2e8cfb17221a37
refs/heads/master
2021-07-16T21:22:19.347000
2017-09-19T16:36:34
2017-09-19T16:36:34
103,842,505
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
//package vn.menugo.server.controller; // //import org.slf4j.Logger; //import org.slf4j.LoggerFactory; //import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.http.HttpStatus; //import org.springframework.http.ResponseEntity; //import org.springframework.web.bind.annotation.*; //import vn.menugo.server.Exception.FailedCreatingEx; //import vn.menugo.server.Repo.CategoryRepository; //import vn.menugo.server.Service.CategoryRepositoryService; //import vn.menugo.server.Service.CategoryService; //import vn.menugo.server.Service.ProviderRepositoryService; //import vn.menugo.server.model.*; // // //import java.util.List; //import java.util.UUID; // ///** // * Created by itn0309 on 7/8/2017. // */ //@RestController //@RequestMapping("/category") //public class CategoryController { // // private static final Logger logger = LoggerFactory.getLogger(CategoryController.class); // // private final CategoryService categoryService; // // // @Autowired // public CategoryController(CategoryService categoryService) { // this.categoryService = categoryService; // } // // @PostMapping(value = "") // public ResponseEntity<String> createCategory(Category category) { // // Category c = new Category(UUID.randomUUID(), category.getName(), category.getDefaultImage()); // Provider provider = pservice.findByUuid(category.getProvider().getUuid()); // c.setProvider(provider); // // try { // service.create(c); // } catch (Exception e) { // logger.error("Create category failed", e); // throw new FailedCreatingEx("Create category failed"); // } // // provider.getCat().add(c); // pservice.update(provider); // // logger.info("Create category successfully"); // return new ResponseEntity<String>(String.format("Create provider %s successfully", c.getName()), HttpStatus.CREATED); // } // // @RequestMapping(value = "list", produces = {"application/json", "text/json"}, method = RequestMethod.GET) // public ResponseEntity<Wrap> getCategories() { // List<Category> list = service.findAll(); // Wrap w = new Wrap<>(list); // return new ResponseEntity<Wrap>(w, HttpStatus.OK); // } // // @RequestMapping(value = "{uuid}/menu", produces = {"application/json", "text/json"}, method = RequestMethod.GET) // public ResponseEntity getMenu(@PathVariable("uuid") UUID uuid) { // Category cat = service.findByUuid(uuid); // List<Mon> menu = cat.getMenu(); // Wrap w = new Wrap<>(menu); // // return new ResponseEntity<>(w, HttpStatus.OK); // } // // @RequestMapping(value = "{uuid}", produces = {"application/json", "text/json"}, method = RequestMethod.GET) // public ResponseEntity getCategory(@PathVariable("uuid") UUID uuid) { // Category c = service.findByUuid(uuid); // // return new ResponseEntity<>(c, HttpStatus.OK); // } //}
UTF-8
Java
2,977
java
CategoryController.java
Java
[ { "context": "\n//import java.util.UUID;\n//\n///**\n// * Created by itn0309 on 7/8/2017.\n// */\n//@RestController\n//@RequestMa", "end": 717, "score": 0.9990342259407043, "start": 710, "tag": "USERNAME", "value": "itn0309" } ]
null
[]
//package vn.menugo.server.controller; // //import org.slf4j.Logger; //import org.slf4j.LoggerFactory; //import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.http.HttpStatus; //import org.springframework.http.ResponseEntity; //import org.springframework.web.bind.annotation.*; //import vn.menugo.server.Exception.FailedCreatingEx; //import vn.menugo.server.Repo.CategoryRepository; //import vn.menugo.server.Service.CategoryRepositoryService; //import vn.menugo.server.Service.CategoryService; //import vn.menugo.server.Service.ProviderRepositoryService; //import vn.menugo.server.model.*; // // //import java.util.List; //import java.util.UUID; // ///** // * Created by itn0309 on 7/8/2017. // */ //@RestController //@RequestMapping("/category") //public class CategoryController { // // private static final Logger logger = LoggerFactory.getLogger(CategoryController.class); // // private final CategoryService categoryService; // // // @Autowired // public CategoryController(CategoryService categoryService) { // this.categoryService = categoryService; // } // // @PostMapping(value = "") // public ResponseEntity<String> createCategory(Category category) { // // Category c = new Category(UUID.randomUUID(), category.getName(), category.getDefaultImage()); // Provider provider = pservice.findByUuid(category.getProvider().getUuid()); // c.setProvider(provider); // // try { // service.create(c); // } catch (Exception e) { // logger.error("Create category failed", e); // throw new FailedCreatingEx("Create category failed"); // } // // provider.getCat().add(c); // pservice.update(provider); // // logger.info("Create category successfully"); // return new ResponseEntity<String>(String.format("Create provider %s successfully", c.getName()), HttpStatus.CREATED); // } // // @RequestMapping(value = "list", produces = {"application/json", "text/json"}, method = RequestMethod.GET) // public ResponseEntity<Wrap> getCategories() { // List<Category> list = service.findAll(); // Wrap w = new Wrap<>(list); // return new ResponseEntity<Wrap>(w, HttpStatus.OK); // } // // @RequestMapping(value = "{uuid}/menu", produces = {"application/json", "text/json"}, method = RequestMethod.GET) // public ResponseEntity getMenu(@PathVariable("uuid") UUID uuid) { // Category cat = service.findByUuid(uuid); // List<Mon> menu = cat.getMenu(); // Wrap w = new Wrap<>(menu); // // return new ResponseEntity<>(w, HttpStatus.OK); // } // // @RequestMapping(value = "{uuid}", produces = {"application/json", "text/json"}, method = RequestMethod.GET) // public ResponseEntity getCategory(@PathVariable("uuid") UUID uuid) { // Category c = service.findByUuid(uuid); // // return new ResponseEntity<>(c, HttpStatus.OK); // } //}
2,977
0.666443
0.662412
80
36.212502
31.433538
127
false
false
0
0
0
0
0
0
0.675
false
false
7
a38c201af60082e4d7586164cdad9a202ad596ee
27,436,251,124,443
087c12d75d30c6291f779c547c26f76adb2073b0
/workload/src/main/java/com/nec/strudel/instrument/impl/ProfilerOutput.java
e35c21e65355a07b8f8c842b01a0a0037bf8a494
[ "Apache-2.0" ]
permissive
zjpjohn/strudel
https://github.com/zjpjohn/strudel
b15bd2be66b3f9b6bf0a092e4426d4666225fd33
8bc01eb3214b42e0087d7fd2f2ed7b674e198065
refs/heads/master
2020-12-28T20:20:05.787000
2016-03-29T13:18:19
2016-03-29T13:18:19
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/******************************************************************************* * Copyright 2015, 2016 Junichi Tatemura * * 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.nec.strudel.instrument.impl; import java.util.ArrayList; import java.util.Collections; import java.util.List; import com.nec.strudel.instrument.Profiling; import com.nec.strudel.json.func.Value; import com.nec.strudel.metrics.NamedFunc; import com.nec.strudel.metrics.TimeMetrics; public final class ProfilerOutput { private ProfilerOutput() { } public static List<NamedFunc> outputsOf(Class<?> profiler) { List<NamedFunc> funcs = new ArrayList<NamedFunc>(); ProfilerDescriptor desc = ProfilerDescriptor.of(profiler); for (InstrumentDescriptor instr : desc.getInstruments()) { switch (instr.getType()) { case COUNT: funcs.add(new NamedFunc(instr.getName(), Value.of(instr.getName()))); break; case TIME: funcs.addAll(TimeMetrics.outputsOf(instr.getName())); break; default: throw new IllegalArgumentException( "unsupported type: " + instr.getType()); } } return funcs; } public static List<NamedFunc> on(Class<?> profiled) { Profiling prof = profiled.getAnnotation(Profiling.class); if (prof != null) { return outputsOf(prof.value()); } Class<?> sup = profiled.getSuperclass(); if (sup != null) { return on(sup); } return Collections.emptyList(); } }
UTF-8
Java
2,265
java
ProfilerOutput.java
Java
[ { "context": "**************************\n * Copyright 2015, 2016 Junichi Tatemura\n *\n * Licensed under the Apache License, Version ", "end": 121, "score": 0.9998266100883484, "start": 105, "tag": "NAME", "value": "Junichi Tatemura" } ]
null
[]
/******************************************************************************* * Copyright 2015, 2016 <NAME> * * 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.nec.strudel.instrument.impl; import java.util.ArrayList; import java.util.Collections; import java.util.List; import com.nec.strudel.instrument.Profiling; import com.nec.strudel.json.func.Value; import com.nec.strudel.metrics.NamedFunc; import com.nec.strudel.metrics.TimeMetrics; public final class ProfilerOutput { private ProfilerOutput() { } public static List<NamedFunc> outputsOf(Class<?> profiler) { List<NamedFunc> funcs = new ArrayList<NamedFunc>(); ProfilerDescriptor desc = ProfilerDescriptor.of(profiler); for (InstrumentDescriptor instr : desc.getInstruments()) { switch (instr.getType()) { case COUNT: funcs.add(new NamedFunc(instr.getName(), Value.of(instr.getName()))); break; case TIME: funcs.addAll(TimeMetrics.outputsOf(instr.getName())); break; default: throw new IllegalArgumentException( "unsupported type: " + instr.getType()); } } return funcs; } public static List<NamedFunc> on(Class<?> profiled) { Profiling prof = profiled.getAnnotation(Profiling.class); if (prof != null) { return outputsOf(prof.value()); } Class<?> sup = profiled.getSuperclass(); if (sup != null) { return on(sup); } return Collections.emptyList(); } }
2,255
0.589845
0.584547
65
33.846153
25.007217
81
false
false
0
0
0
0
0
0
0.430769
false
false
7
f0b3fa39ccdb390c16bb7d5603d2c6470cbffac4
6,236,292,546,115
8f7398213f54553e0733b7f626c8526f3ffe9ef2
/ChatExtension/src/chat/redis/RedisPoolFactory.java
e40955716667193e025c6a6ee42af4aa674be0c6
[]
no_license
khoadtang/Chat
https://github.com/khoadtang/Chat
9fb9dbddfa9c15e97447e4f7ef2ff2f62872d79d
ad2fde27896d312fb9b15cc5bb42c17cc419bc90
refs/heads/master
2018-01-10T00:45:25.313000
2016-04-11T11:04:08
2016-04-11T11:04:08
55,768,272
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package chat.redis; import org.apache.commons.pool2.impl.GenericObjectPoolConfig; import redis.clients.jedis.JedisPool; public class RedisPoolFactory { private static RedisPoolFactory instance = null; private RedisPoolFactory() { } public static RedisPoolFactory getInstance() { if(instance == null) { instance = new RedisPoolFactory(); } return instance; } public JedisPool create(String host, int port, String password, int db, int timeOut, int maxIdle, int maxActive) { GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setMaxIdle(maxIdle); config.setMaxWaitMillis(timeOut); config.setMaxTotal(maxActive); config.setTestOnBorrow(true); config.setTestOnReturn(true); config.setTestWhileIdle(true); config.setTestOnCreate(true); return new JedisPool(config, host, port, timeOut, password, db); } public JedisPool create(String host, int port) { GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setMaxTotal(10); config.setMaxIdle(10); config.setMaxWaitMillis(10); config.setTestOnBorrow(true); config.setTestOnReturn(true); config.setTestWhileIdle(true); config.setTestOnCreate(true); return new JedisPool(config, host, port); } public JedisPool create(String host, int port, String password) { GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setMaxTotal(10); config.setMaxIdle(10); config.setMaxWaitMillis(10); config.setTestOnBorrow(true); config.setTestOnReturn(true); config.setTestWhileIdle(true); config.setTestOnCreate(true); return new JedisPool(config, host, port, 10, password); } public JedisPool create(String host, int port, String password, int database) { GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setMaxTotal(10); config.setMaxIdle(10); config.setMaxWaitMillis(10); config.setTestOnBorrow(true); config.setTestOnReturn(true); config.setTestWhileIdle(true); config.setTestOnCreate(true); return new JedisPool(config, host, port, 10, password, database); } }
UTF-8
Java
2,474
java
RedisPoolFactory.java
Java
[]
null
[]
package chat.redis; import org.apache.commons.pool2.impl.GenericObjectPoolConfig; import redis.clients.jedis.JedisPool; public class RedisPoolFactory { private static RedisPoolFactory instance = null; private RedisPoolFactory() { } public static RedisPoolFactory getInstance() { if(instance == null) { instance = new RedisPoolFactory(); } return instance; } public JedisPool create(String host, int port, String password, int db, int timeOut, int maxIdle, int maxActive) { GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setMaxIdle(maxIdle); config.setMaxWaitMillis(timeOut); config.setMaxTotal(maxActive); config.setTestOnBorrow(true); config.setTestOnReturn(true); config.setTestWhileIdle(true); config.setTestOnCreate(true); return new JedisPool(config, host, port, timeOut, password, db); } public JedisPool create(String host, int port) { GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setMaxTotal(10); config.setMaxIdle(10); config.setMaxWaitMillis(10); config.setTestOnBorrow(true); config.setTestOnReturn(true); config.setTestWhileIdle(true); config.setTestOnCreate(true); return new JedisPool(config, host, port); } public JedisPool create(String host, int port, String password) { GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setMaxTotal(10); config.setMaxIdle(10); config.setMaxWaitMillis(10); config.setTestOnBorrow(true); config.setTestOnReturn(true); config.setTestWhileIdle(true); config.setTestOnCreate(true); return new JedisPool(config, host, port, 10, password); } public JedisPool create(String host, int port, String password, int database) { GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setMaxTotal(10); config.setMaxIdle(10); config.setMaxWaitMillis(10); config.setTestOnBorrow(true); config.setTestOnReturn(true); config.setTestWhileIdle(true); config.setTestOnCreate(true); return new JedisPool(config, host, port, 10, password, database); } }
2,474
0.641471
0.632175
80
29.9125
22.855631
81
false
false
0
0
0
0
0
0
0.8875
false
false
7
7d0c6b91112f2661d25356f589d33dfe3bab7d43
23,244,363,041,667
0d9c86c0694409fafe8adb18a63652b3965dc71c
/vjezba.java
e7b729f1954b1b4b46fb725a88a72d549fb8c160
[]
no_license
vocislav/bzvz
https://github.com/vocislav/bzvz
cecf37b444905103073964b15959be0d4c379aa4
615c949a4c93d4b652a74609f62903c46c603d81
refs/heads/master
2021-04-12T11:06:43.990000
2016-06-25T14:52:54
2016-06-25T14:52:54
61,947,476
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.*; class Robot { public void speak(String text){ System.out.println(text);} public int nesto(int broj) { int kvadrat; kvadrat=broj*broj; return kvadrat; } public double la(int broj){ double korjen; korjen=Math.sqrt(broj); return korjen; } } public class vjezba { public static void main(String[] args) { Scanner in=new Scanner(System.in); System.out.println("Upiši broj koji želiš kvadrirati: "); Robot ava=new Robot(); int broj1=in.nextInt(); double da=ava.la(broj1); int oho=ava.nesto(broj1); ava.speak("Bok, ja sam robot koji kvadrira i korjenuje"); System.out.println("Ovo je kvadrat: "+oho+" broja "+broj1+" , a ovo njegov korjen: "+da); } }
WINDOWS-1250
Java
725
java
vjezba.java
Java
[]
null
[]
import java.util.*; class Robot { public void speak(String text){ System.out.println(text);} public int nesto(int broj) { int kvadrat; kvadrat=broj*broj; return kvadrat; } public double la(int broj){ double korjen; korjen=Math.sqrt(broj); return korjen; } } public class vjezba { public static void main(String[] args) { Scanner in=new Scanner(System.in); System.out.println("Upiši broj koji želiš kvadrirati: "); Robot ava=new Robot(); int broj1=in.nextInt(); double da=ava.la(broj1); int oho=ava.nesto(broj1); ava.speak("Bok, ja sam robot koji kvadrira i korjenuje"); System.out.println("Ovo je kvadrat: "+oho+" broja "+broj1+" , a ovo njegov korjen: "+da); } }
725
0.666205
0.660665
33
20.878788
20.031425
91
false
false
0
0
0
0
0
0
2.030303
false
false
7
71bf2d4a7111ea2eb4b11c2ed47acf894ea28776
25,666,724,566,611
02635dd644d5f031c3fa9008ada81cbf85e57860
/src/factorymethod/PngTool.java
1972fe8bd533a069152274bd18eb313b9a26a40c
[]
no_license
MosesRen/Pattern-Design
https://github.com/MosesRen/Pattern-Design
0e59c11f06a2a6787f7f673ab978c0de7e503873
ae222e9a30d69e752ed7d0da9dac073f53064677
refs/heads/master
2020-12-15T07:59:57.093000
2020-01-21T03:21:25
2020-01-21T03:21:25
235,038,742
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package factorymethod; /** * @description: * @author: jehuRen * @date: Created in 2020/1/20 11:17 */ public class PngTool implements PicReadTool { @Override public void read() { System.out.println("read png"); } }
UTF-8
Java
239
java
PngTool.java
Java
[ { "context": "e factorymethod;\n\n/**\n * @description:\n * @author: jehuRen\n * @date: Created in 2020/1/20 11:17\n */\npublic c", "end": 64, "score": 0.9973875880241394, "start": 57, "tag": "USERNAME", "value": "jehuRen" } ]
null
[]
package factorymethod; /** * @description: * @author: jehuRen * @date: Created in 2020/1/20 11:17 */ public class PngTool implements PicReadTool { @Override public void read() { System.out.println("read png"); } }
239
0.635983
0.589958
13
17.384615
14.68405
45
false
false
0
0
0
0
0
0
0.153846
false
false
7
306fb9afe5d0ad6ea18808913feb35f7a2cb5712
25,666,724,565,426
65e29a551de3fb8945186a585c9041a1f7c161dd
/CSE443_HW1_141044071/SourceCodes/src/com/part4b/TPX300.java
d74f8da20e265ca5825ca85ceda4001cdfa36c3e
[]
no_license
selcukacc/CSE_443_Design_Patterns
https://github.com/selcukacc/CSE_443_Design_Patterns
e866e2eed62613e589f4331fe66603b72c70e1ce
4f49b9b9535fd8ca67f7145bdc384469fce7e91f
refs/heads/master
2020-12-21T03:52:42.809000
2020-01-26T10:48:28
2020-01-26T10:48:28
236,297,353
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.part4b; public class TPX300 extends Plane { PlaneComponentFactory componentFactory; public TPX300(PlaneComponentFactory componentFactory) { this.componentFactory = componentFactory; purpose = "Transatlantic Flights"; skeleton = "Titanium Alloy"; engine = "Quadro Jet Engines"; seating = "250 seats"; } @Override public void assemble() { System.out.println("Assembling " + name); engineInjectionType = componentFactory.createEngineInjectionType(); seatingCover = componentFactory.createSeatingCover(); } }
UTF-8
Java
628
java
TPX300.java
Java
[]
null
[]
package com.part4b; public class TPX300 extends Plane { PlaneComponentFactory componentFactory; public TPX300(PlaneComponentFactory componentFactory) { this.componentFactory = componentFactory; purpose = "Transatlantic Flights"; skeleton = "Titanium Alloy"; engine = "Quadro Jet Engines"; seating = "250 seats"; } @Override public void assemble() { System.out.println("Assembling " + name); engineInjectionType = componentFactory.createEngineInjectionType(); seatingCover = componentFactory.createSeatingCover(); } }
628
0.659236
0.643312
20
29.4
22.566347
75
false
false
0
0
0
0
0
0
0.5
false
false
7
ee46ec027db25133b08f1e75e1f0199da774bfc1
29,205,777,660,599
c2e6f7c40edce79fd498a5bbaba4c2d69cf05e0c
/src/main/java/com/google/android/gms/internal/firebase_ml/zznj.java
fbec3f491da892e153c0178baa9197f2d694a175
[]
no_license
pengju1218/decompiled-apk
https://github.com/pengju1218/decompiled-apk
7f64ee6b2d7424b027f4f112c77e47cd420b2b8c
b60b54342a8e294486c45b2325fb78155c3c37e6
refs/heads/master
2022-03-23T02:57:09.115000
2019-12-28T23:13:07
2019-12-28T23:13:07
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.google.android.gms.internal.firebase_ml; import com.google.android.gms.common.api.internal.BackgroundDetector; import com.google.android.gms.common.internal.GmsLogger; final class zznj implements BackgroundDetector.BackgroundStateChangeListener { private final /* synthetic */ zzni zzapi; zznj(zzni zzni) { this.zzapi = zzni; } public final void onBackgroundStateChanged(boolean z) { GmsLogger a = zzni.zzaoj; StringBuilder sb = new StringBuilder(34); sb.append("Background state changed to: "); sb.append(z); a.v("ModelResourceManager", sb.toString()); this.zzapi.zzapd.set(z ? 2000 : 300000); this.zzapi.zzkm(); } }
UTF-8
Java
718
java
zznj.java
Java
[]
null
[]
package com.google.android.gms.internal.firebase_ml; import com.google.android.gms.common.api.internal.BackgroundDetector; import com.google.android.gms.common.internal.GmsLogger; final class zznj implements BackgroundDetector.BackgroundStateChangeListener { private final /* synthetic */ zzni zzapi; zznj(zzni zzni) { this.zzapi = zzni; } public final void onBackgroundStateChanged(boolean z) { GmsLogger a = zzni.zzaoj; StringBuilder sb = new StringBuilder(34); sb.append("Background state changed to: "); sb.append(z); a.v("ModelResourceManager", sb.toString()); this.zzapi.zzapd.set(z ? 2000 : 300000); this.zzapi.zzkm(); } }
718
0.683844
0.667131
22
31.636364
24.728609
78
false
false
0
0
0
0
0
0
0.590909
false
false
7
81750d15fd86f13494197ac93240f6bb3587122c
31,301,721,684,210
478ac7db038ae178cb8eb04acf9a1736f00d216a
/src/test/java/api/Demo2Test.java
91daf445d71d409b4f714db69e894901378459a4
[]
no_license
tangyiming/ares-example
https://github.com/tangyiming/ares-example
6cd2ed06d5f69ae9fec445410ca5160a44509e52
de32d1b5f8a147768f68aad6c7b4729576927d05
refs/heads/main
2023-01-06T16:53:32.710000
2020-11-01T08:23:06
2020-11-01T08:23:06
309,052,569
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package api; import com.tangym.BaseCase; import com.tangym.annotations.Api; import com.tangym.constant.Const; import com.tangym.dataparser.ExcelDataParser; import com.tangym.utils.JsonUtil; import io.restassured.RestAssured; import io.restassured.response.Response; import org.testng.annotations.Test; import java.util.Map; import static io.restassured.RestAssured.given; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; @Api(name = "module2") /* name 对应测试数据表格名 */ public class Demo2Test extends BaseCase { /* 测试脚本要继承BaseCase */ /** * 这是一个使用了路径参数的例子, 也是一个使用 hamcrest 断言的例子,也是一个使用了json schema断言的例子 */ @Test(dataProvider = Const.PROVIDER_DATA, description = "豆瓣查询用户信息接口") /* description 描述测试case,更多参数发掘查看@Test注解源码 */ public void queryUser(Map<String, String> providerParams) { /* 方法名与excel中sheet表名对应 */ /* 解析测试数据 */ ExcelDataParser dataParser = new ExcelDataParser(); dataParser.parseProviderParams(providerParams); /* 请求接口 */ RestAssured.baseURI = "https://api.douban.com"; //因为演示使用了多个不同的baseURI,所以需要重新赋值覆盖env.yml中默认的baseURI Response response = given().pathParam("name", dataParser.requestParams.get("name")).get(dataParser.commonParams.get(Const.URL).toString()); /* 结果hamcrest断言 */ assertThat(response.getBody().asString(), containsString((String) dataParser.commonParams.get(Const.EXCEPT_RESULT))); /* 结果json schema断言 */ JsonUtil.matchesJsonSchema(response, "jsonschema/user_schema.json"); } }
UTF-8
Java
1,836
java
Demo2Test.java
Java
[]
null
[]
package api; import com.tangym.BaseCase; import com.tangym.annotations.Api; import com.tangym.constant.Const; import com.tangym.dataparser.ExcelDataParser; import com.tangym.utils.JsonUtil; import io.restassured.RestAssured; import io.restassured.response.Response; import org.testng.annotations.Test; import java.util.Map; import static io.restassured.RestAssured.given; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; @Api(name = "module2") /* name 对应测试数据表格名 */ public class Demo2Test extends BaseCase { /* 测试脚本要继承BaseCase */ /** * 这是一个使用了路径参数的例子, 也是一个使用 hamcrest 断言的例子,也是一个使用了json schema断言的例子 */ @Test(dataProvider = Const.PROVIDER_DATA, description = "豆瓣查询用户信息接口") /* description 描述测试case,更多参数发掘查看@Test注解源码 */ public void queryUser(Map<String, String> providerParams) { /* 方法名与excel中sheet表名对应 */ /* 解析测试数据 */ ExcelDataParser dataParser = new ExcelDataParser(); dataParser.parseProviderParams(providerParams); /* 请求接口 */ RestAssured.baseURI = "https://api.douban.com"; //因为演示使用了多个不同的baseURI,所以需要重新赋值覆盖env.yml中默认的baseURI Response response = given().pathParam("name", dataParser.requestParams.get("name")).get(dataParser.commonParams.get(Const.URL).toString()); /* 结果hamcrest断言 */ assertThat(response.getBody().asString(), containsString((String) dataParser.commonParams.get(Const.EXCEPT_RESULT))); /* 结果json schema断言 */ JsonUtil.matchesJsonSchema(response, "jsonschema/user_schema.json"); } }
1,836
0.736271
0.734994
40
38.150002
37.200504
147
false
false
0
0
0
0
0
0
0.625
false
false
7
142291089b32d4a4a48a783ac87ca0028a609fc3
23,227,183,155,479
6ce33a6e475034d1dd1d0321f9b19a7b5ae4fafb
/back-end/src/main/java/com/domgarr/concetto/models/InterInterval.java
14db5256515563d7c161632423d3ff34a11f2add
[ "MIT" ]
permissive
domgarr/concetto
https://github.com/domgarr/concetto
23bf9d76b457d380ec86a2dd8c4ba05a490c9c74
c1f28475167c314e0ee7303c99f05c333cd9f0d9
refs/heads/master
2020-12-19T10:02:01.248000
2020-11-01T17:37:26
2020-11-01T17:37:26
235,702,974
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.domgarr.concetto.models; import com.domgarr.concetto.utility.IntervalUtility; import lombok.Data; import org.hibernate.validator.constraints.Range; import javax.persistence.*; @Entity @Data public class InterInterval { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private int repitionCount; private int length; private double eFactor; @Range(min=0, max=5) private int responseRating; public InterInterval(){ this.repitionCount = 0; //Response rating doesn't matter for the first calculation. IntervalUtility.calculateNextInterval(0,this); this.eFactor = IntervalUtility.initialEFactor; } }
UTF-8
Java
707
java
InterInterval.java
Java
[]
null
[]
package com.domgarr.concetto.models; import com.domgarr.concetto.utility.IntervalUtility; import lombok.Data; import org.hibernate.validator.constraints.Range; import javax.persistence.*; @Entity @Data public class InterInterval { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private int repitionCount; private int length; private double eFactor; @Range(min=0, max=5) private int responseRating; public InterInterval(){ this.repitionCount = 0; //Response rating doesn't matter for the first calculation. IntervalUtility.calculateNextInterval(0,this); this.eFactor = IntervalUtility.initialEFactor; } }
707
0.725601
0.719943
28
24.25
19.900871
67
false
false
0
0
0
0
0
0
0.535714
false
false
7
135f5e792014b8a6296f923434213be99daed472
34,007,551,055,851
4a600c0e1ce1fa15668b44b1f0e1bc2479d6af65
/src/Entites/Rocher.java
5917385b737fdbbb04d4df4d1809c1b9ed25e2ad
[]
no_license
alexandrejanin/escape-game
https://github.com/alexandrejanin/escape-game
ce72aedddc47a82c7ba956c80ad162d0f345326e
bc929fb6aaab4031fb3f7a399e39e27b86cf4d6c
refs/heads/master
2020-05-02T07:44:55.080000
2019-04-15T21:55:10
2019-04-15T21:55:10
177,826,028
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Entites; import Utilitaires.Vecteur; public final class Rocher extends Obstacle { private final int tailleMin; public Rocher(Vecteur position) { super(position); tailleMin = 120; } public boolean peutPasser(Animal animal) { return animal.getTaille() >= tailleMin; } @Override public Character getCar() { return '♣'; } @Override public String getNom() { return "Rocher"; } }
UTF-8
Java
476
java
Rocher.java
Java
[ { "context": "ride\n public String getNom() {\n return \"Rocher\";\n }\n\n}\n", "end": 462, "score": 0.5101464986801147, "start": 456, "tag": "NAME", "value": "Rocher" } ]
null
[]
package Entites; import Utilitaires.Vecteur; public final class Rocher extends Obstacle { private final int tailleMin; public Rocher(Vecteur position) { super(position); tailleMin = 120; } public boolean peutPasser(Animal animal) { return animal.getTaille() >= tailleMin; } @Override public Character getCar() { return '♣'; } @Override public String getNom() { return "Rocher"; } }
476
0.609705
0.603376
28
15.928572
15.592875
47
false
false
0
0
0
0
0
0
0.285714
false
false
7
886e3224c758f3d1bca7ebbe5dfa1cf5c90f578c
3,616,362,502,134
705784ccc8b4c0c4c5d65fdd8c75c9a56c676e93
/src/pr2/a10/FirstSmileyPanel.java
0949a328bcef9b0e3a4f6949bffd1acd503822a3
[]
no_license
arsonite/prog
https://github.com/arsonite/prog
f0d33425e503c647e7eea97f014ba2936c97e1db
eb2990f168d85258edae2101a3be24857ba4dfdb
refs/heads/master
2020-04-20T08:38:45.388000
2019-02-01T18:52:47
2019-02-01T18:52:47
168,745,245
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pr2.a10; import java.awt.Color; import java.awt.Graphics; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import javax.swing.JPanel; public class FirstSmileyPanel extends JPanel implements PropertyChangeListener { private static final long serialVersionUID = 1015852072807854606L; protected int x; protected int y; protected int d; protected int r; protected int w; protected int r8; protected int w3; protected int lE; protected int rE; protected int yE; protected int lP; protected int yP; protected int rP; protected double angle; protected double bM; protected boolean smile; protected Color pupilColor; protected Color socketColor; protected Color faceColor; protected SmileyModel m; public FirstSmileyPanel(SmileyModel m){ this.m = m; x = m.getX(); y = m.getY(); r = m.getRadius(); pupilColor = m.getPupilColor(); socketColor = m.getSocketColor(); faceColor = m.getFaceColor(); angle = m.getAngle(); smile = m.isSmile(); bM = angle*Math.PI/180; d = r*2; w = r/2; r8 = r/8; w3 = w/3; lE = x + r/2 - r8; rE = x + r + r8; yE = y + r/2; lP = (int) (lE + w3 - Math.cos(bM)*(r8)); yP = (int) (yE + w3 - Math.sin(bM)*(r8)); rP = (int) (rE + w3 - Math.cos(bM)*(r8)); } public void paintComponent(Graphics g){ super.paintComponent(g); drawFace(g); drawEyes(g); drawSmile(g); } public void propertyChange(PropertyChangeEvent e){ if(e.getPropertyName().equals("MODEL_UPDATE")){ x = m.getX(); y = m.getY(); r = m.getRadius(); pupilColor = m.getPupilColor(); socketColor = m.getSocketColor(); faceColor = m.getFaceColor(); angle = m.getAngle(); smile = m.isSmile(); bM = angle*Math.PI/180; d = r*2; w = r/2; r8 = r/8; w3 = w/3; lE = x + r/2 - r8; rE = x + r + r8; yE = y + r/2; lP = (int) (lE + w3 - Math.cos(bM)*(r8)); yP = (int) (yE + w3 - Math.sin(bM)*(r8)); rP = (int) (rE + w3 - Math.cos(bM)*(r8)); repaint(); } } public void drawFace(Graphics g) { g.setColor(faceColor); g.fillOval(x, y, d, d); } public void drawEyes(Graphics g) { g.setColor(socketColor); g.fillOval(lE, yE, w, w); g.fillOval(rE, yE, w, w); g.setColor(pupilColor); g.fillOval(lP, yP, w3, w3); g.fillOval(rP, yP, w3, w3); } public void drawSmile(Graphics g) { g.setColor(Color.RED); if(smile){ g.fillArc(x+r/2, y+r/4+r/2, r, r, 180, 180); } else{ g.drawArc(x+r/2, y+r+r/4, r, r/2, 360, 180); } } }
UTF-8
Java
2,489
java
FirstSmileyPanel.java
Java
[]
null
[]
package pr2.a10; import java.awt.Color; import java.awt.Graphics; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import javax.swing.JPanel; public class FirstSmileyPanel extends JPanel implements PropertyChangeListener { private static final long serialVersionUID = 1015852072807854606L; protected int x; protected int y; protected int d; protected int r; protected int w; protected int r8; protected int w3; protected int lE; protected int rE; protected int yE; protected int lP; protected int yP; protected int rP; protected double angle; protected double bM; protected boolean smile; protected Color pupilColor; protected Color socketColor; protected Color faceColor; protected SmileyModel m; public FirstSmileyPanel(SmileyModel m){ this.m = m; x = m.getX(); y = m.getY(); r = m.getRadius(); pupilColor = m.getPupilColor(); socketColor = m.getSocketColor(); faceColor = m.getFaceColor(); angle = m.getAngle(); smile = m.isSmile(); bM = angle*Math.PI/180; d = r*2; w = r/2; r8 = r/8; w3 = w/3; lE = x + r/2 - r8; rE = x + r + r8; yE = y + r/2; lP = (int) (lE + w3 - Math.cos(bM)*(r8)); yP = (int) (yE + w3 - Math.sin(bM)*(r8)); rP = (int) (rE + w3 - Math.cos(bM)*(r8)); } public void paintComponent(Graphics g){ super.paintComponent(g); drawFace(g); drawEyes(g); drawSmile(g); } public void propertyChange(PropertyChangeEvent e){ if(e.getPropertyName().equals("MODEL_UPDATE")){ x = m.getX(); y = m.getY(); r = m.getRadius(); pupilColor = m.getPupilColor(); socketColor = m.getSocketColor(); faceColor = m.getFaceColor(); angle = m.getAngle(); smile = m.isSmile(); bM = angle*Math.PI/180; d = r*2; w = r/2; r8 = r/8; w3 = w/3; lE = x + r/2 - r8; rE = x + r + r8; yE = y + r/2; lP = (int) (lE + w3 - Math.cos(bM)*(r8)); yP = (int) (yE + w3 - Math.sin(bM)*(r8)); rP = (int) (rE + w3 - Math.cos(bM)*(r8)); repaint(); } } public void drawFace(Graphics g) { g.setColor(faceColor); g.fillOval(x, y, d, d); } public void drawEyes(Graphics g) { g.setColor(socketColor); g.fillOval(lE, yE, w, w); g.fillOval(rE, yE, w, w); g.setColor(pupilColor); g.fillOval(lP, yP, w3, w3); g.fillOval(rP, yP, w3, w3); } public void drawSmile(Graphics g) { g.setColor(Color.RED); if(smile){ g.fillArc(x+r/2, y+r/4+r/2, r, r, 180, 180); } else{ g.drawArc(x+r/2, y+r+r/4, r, r/2, 360, 180); } } }
2,489
0.627561
0.593813
111
21.432432
14.861294
80
false
false
0
0
0
0
0
0
2.54054
false
false
7
e3db4b81789d2d9553a905b5b74ba4752ce09aaf
36,146,444,774,772
82eba08b9a7ee1bd1a5f83c3176bf3c0826a3a32
/ZmailServer/src/java/org/zmail/cs/security/sasl/ZmailAuthenticator.java
0cde3027aff3650742d6b94fee153cdf040fddeb
[ "MIT" ]
permissive
keramist/zmailserver
https://github.com/keramist/zmailserver
d01187fb6086bf3784fe180bea2e1c0854c83f3f
762642b77c8f559a57e93c9f89b1473d6858c159
refs/heads/master
2021-01-21T05:56:25.642000
2013-10-21T11:27:05
2013-10-22T12:48:43
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * ***** BEGIN LICENSE BLOCK ***** * Zimbra Collaboration Suite Server * Copyright (C) 2008, 2009, 2010, 2011, 2012 VMware, Inc. * * The contents of this file are subject to the Zimbra Public License * Version 1.3 ("License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.zimbra.com/license. * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. * ***** END LICENSE BLOCK ***** */ package org.zmail.cs.security.sasl; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.security.sasl.SaslServer; import org.zmail.common.account.Key; import org.zmail.common.service.ServiceException; import org.zmail.cs.account.Account; import org.zmail.cs.account.AuthToken; import org.zmail.cs.account.AuthTokenException; import org.zmail.cs.account.Provisioning; import org.zmail.cs.account.ZmailAuthToken; import org.zmail.cs.account.auth.AuthContext; import org.zmail.cs.service.AuthProvider; public class ZmailAuthenticator extends Authenticator { public static final String MECHANISM = "X-ZIMBRA"; public ZmailAuthenticator(AuthenticatorUser user) { super(MECHANISM, user); } // X-ZIMBRA is supported in all protocols (IMAP, POP, etc.) @Override protected boolean isSupported() { return true; } @Override public boolean initialize() { return true; } @Override public void dispose() { } @Override public boolean isEncryptionEnabled() { return false; } @Override public InputStream unwrap(InputStream is) { return null; } @Override public OutputStream wrap(OutputStream os) { return null; } @Override public SaslServer getSaslServer() { return null; } @Override public void handle(byte[] data) throws IOException { if (isComplete()) throw new IllegalStateException("Authentication already completed"); String message = new String(data, "utf-8"); int nul1 = message.indexOf('\0'), nul2 = message.indexOf('\0', nul1 + 1); if (nul1 == -1 || nul2 == -1) { sendBadRequest(); return; } String authorizeId = message.substring(0, nul1); String authenticateId = message.substring(nul1 + 1, nul2); String authtoken = message.substring(nul2 + 1); authenticate(authorizeId, authenticateId, authtoken); } @Override public Account authenticate(String username, String authenticateId, String authtoken, AuthContext.Protocol protocol, String origRemoteIp, String remoteIp, String userAgent) throws ServiceException { if (authenticateId == null || authenticateId.equals("")) return null; // validate the auth token Provisioning prov = Provisioning.getInstance(); AuthToken at; try { at = ZmailAuthToken.getAuthToken(authtoken); } catch (AuthTokenException e) { return null; } try { AuthProvider.validateAuthToken(prov, at, false); } catch (ServiceException e) { return null; } // make sure that the authentication account is valid Account authAccount = prov.get(Key.AccountBy.name, authenticateId, at); if (authAccount == null) return null; // make sure the auth token belongs to authenticatedId if (!at.getAccountId().equalsIgnoreCase(authAccount.getId())) return null; // if necessary, check that the authenticated user can authorize as the target user Account targetAcct = authorize(authAccount, username, AuthToken.isAnyAdmin(at)); if (targetAcct != null) prov.accountAuthed(authAccount); return targetAcct; } }
UTF-8
Java
3,911
java
ZmailAuthenticator.java
Java
[]
null
[]
/* * ***** BEGIN LICENSE BLOCK ***** * Zimbra Collaboration Suite Server * Copyright (C) 2008, 2009, 2010, 2011, 2012 VMware, Inc. * * The contents of this file are subject to the Zimbra Public License * Version 1.3 ("License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.zimbra.com/license. * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. * ***** END LICENSE BLOCK ***** */ package org.zmail.cs.security.sasl; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.security.sasl.SaslServer; import org.zmail.common.account.Key; import org.zmail.common.service.ServiceException; import org.zmail.cs.account.Account; import org.zmail.cs.account.AuthToken; import org.zmail.cs.account.AuthTokenException; import org.zmail.cs.account.Provisioning; import org.zmail.cs.account.ZmailAuthToken; import org.zmail.cs.account.auth.AuthContext; import org.zmail.cs.service.AuthProvider; public class ZmailAuthenticator extends Authenticator { public static final String MECHANISM = "X-ZIMBRA"; public ZmailAuthenticator(AuthenticatorUser user) { super(MECHANISM, user); } // X-ZIMBRA is supported in all protocols (IMAP, POP, etc.) @Override protected boolean isSupported() { return true; } @Override public boolean initialize() { return true; } @Override public void dispose() { } @Override public boolean isEncryptionEnabled() { return false; } @Override public InputStream unwrap(InputStream is) { return null; } @Override public OutputStream wrap(OutputStream os) { return null; } @Override public SaslServer getSaslServer() { return null; } @Override public void handle(byte[] data) throws IOException { if (isComplete()) throw new IllegalStateException("Authentication already completed"); String message = new String(data, "utf-8"); int nul1 = message.indexOf('\0'), nul2 = message.indexOf('\0', nul1 + 1); if (nul1 == -1 || nul2 == -1) { sendBadRequest(); return; } String authorizeId = message.substring(0, nul1); String authenticateId = message.substring(nul1 + 1, nul2); String authtoken = message.substring(nul2 + 1); authenticate(authorizeId, authenticateId, authtoken); } @Override public Account authenticate(String username, String authenticateId, String authtoken, AuthContext.Protocol protocol, String origRemoteIp, String remoteIp, String userAgent) throws ServiceException { if (authenticateId == null || authenticateId.equals("")) return null; // validate the auth token Provisioning prov = Provisioning.getInstance(); AuthToken at; try { at = ZmailAuthToken.getAuthToken(authtoken); } catch (AuthTokenException e) { return null; } try { AuthProvider.validateAuthToken(prov, at, false); } catch (ServiceException e) { return null; } // make sure that the authentication account is valid Account authAccount = prov.get(Key.AccountBy.name, authenticateId, at); if (authAccount == null) return null; // make sure the auth token belongs to authenticatedId if (!at.getAccountId().equalsIgnoreCase(authAccount.getId())) return null; // if necessary, check that the authenticated user can authorize as the target user Account targetAcct = authorize(authAccount, username, AuthToken.isAnyAdmin(at)); if (targetAcct != null) prov.accountAuthed(authAccount); return targetAcct; } }
3,911
0.667093
0.656865
106
35.896225
28.183674
128
false
false
0
0
0
0
0
0
0.745283
false
false
7
acad585c6c6d8ea14d3da59d8c6d0aa23810a605
5,652,177,001,099
9d3dd046912a8d57e0114e7a45b96a41bf0960f4
/src/main/java/MouseNavigationBehavior.java
6ac04a92cde6682f39722e4d76d746d1a58ead08
[]
no_license
tgnottingham/ParticlePhysics3D
https://github.com/tgnottingham/ParticlePhysics3D
2292558725b70bdcbdb17eda2aabe3d0623ecac5
c0da56f3363aa3f80b68dbf94985d8db788b531b
refs/heads/master
2021-01-19T19:35:37.480000
2017-01-31T07:01:42
2017-01-31T07:01:42
9,852,509
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.awt.AWTEvent; import java.awt.AWTException; import java.awt.Component; import java.awt.Dimension; import java.awt.Insets; import java.awt.Robot; import java.awt.event.MouseEvent; import java.util.Enumeration; import java.util.LinkedList; import org.scijava.java3d.Transform3D; import org.scijava.java3d.TransformGroup; import org.scijava.java3d.WakeupCriterion; import org.scijava.java3d.WakeupOnAWTEvent; import org.scijava.java3d.WakeupOnBehaviorPost; import org.scijava.java3d.WakeupOr; import javax.swing.JFrame; import org.scijava.vecmath.Matrix4d; import org.scijava.vecmath.Vector3d; import org.scijava.java3d.utils.behaviors.mouse.MouseBehavior; import org.scijava.java3d.utils.behaviors.mouse.MouseBehaviorCallback; public class MouseNavigationBehavior extends MouseBehavior { double x_angle, y_angle; double x_factor = .03; double y_factor = .03; private MouseBehaviorCallback callback = null; private JFrame frame; private boolean ignoreNextEvent = true; private Robot robot; /** * Creates a rotate behavior given the transform group. * * @param transformGroup * The transformGroup to operate on. */ public MouseNavigationBehavior(TransformGroup transformGroup) { super(transformGroup); try { robot = new Robot(); } catch (AWTException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * Creates a default mouse rotate behavior. **/ public MouseNavigationBehavior() { super(0); try { robot = new Robot(); } catch (AWTException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * Creates a rotate behavior. Note that this behavior still needs a * transform group to work on (use setTransformGroup(tg)) and the transform * group must add this behavior. * * @param flags * interesting flags (wakeup conditions). */ public MouseNavigationBehavior(int flags) { super(flags); try { robot = new Robot(); } catch (AWTException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * Creates a rotate behavior that uses AWT listeners and behavior posts * rather than WakeupOnAWTEvent. The behavior is added to the specified * Component. A null component can be passed to specify the behavior should * use listeners. Components can then be added to the behavior with the * addListener(Component c) method. * * @param c * The Component to add the MouseListener and MouseMotionListener * to. * @since Java 3D 1.2.1 */ public MouseNavigationBehavior(Component c) { super(c, 0); try { robot = new Robot(); } catch (AWTException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * Creates a rotate behavior that uses AWT listeners and behavior posts * rather than WakeupOnAWTEvent. The behaviors is added to the specified * Component and works on the given TransformGroup. A null component can be * passed to specify the behavior should use listeners. Components can then * be added to the behavior with the addListener(Component c) method. * * @param c * The Component to add the MouseListener and MouseMotionListener * to. * @param transformGroup * The TransformGroup to operate on. * @since Java 3D 1.2.1 */ public MouseNavigationBehavior(Component c, TransformGroup transformGroup) { super(c, transformGroup); try { robot = new Robot(); } catch (AWTException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * Creates a rotate behavior that uses AWT listeners and behavior posts * rather than WakeupOnAWTEvent. The behavior is added to the specified * Component. A null component can be passed to specify the behavior should * use listeners. Components can then be added to the behavior with the * addListener(Component c) method. Note that this behavior still needs a * transform group to work on (use setTransformGroup(tg)) and the transform * group must add this behavior. * * @param flags * interesting flags (wakeup conditions). * @since Java 3D 1.2.1 */ public MouseNavigationBehavior(Component c, int flags) { super(c, flags); try { robot = new Robot(); } catch (AWTException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void initialize() { mouseEvents = new WakeupCriterion[5]; mouseEvents[0] = new WakeupOnAWTEvent(MouseEvent.MOUSE_MOVED); mouseEvents[1] = new WakeupOnAWTEvent(MouseEvent.MOUSE_DRAGGED); mouseEvents[2] = new WakeupOnAWTEvent(MouseEvent.MOUSE_PRESSED); mouseEvents[3] = new WakeupOnAWTEvent(MouseEvent.MOUSE_RELEASED); mouseEvents[4] = new WakeupOnAWTEvent(MouseEvent.MOUSE_WHEEL); mouseq = new LinkedList(); mouseCriterion = new WakeupOr(mouseEvents); wakeupOn (mouseCriterion); x = 0; y = 0; x_last = 0; y_last = 0; x_angle = 0; y_angle = 0; if ((flags & INVERT_INPUT) == INVERT_INPUT) { invert = true; x_factor *= -1; y_factor *= -1; } } /** * Return the x-axis movement multipler. **/ public double getXFactor() { return x_factor; } /** * Return the y-axis movement multipler. **/ public double getYFactor() { return y_factor; } /** * Set the x-axis amd y-axis movement multipler with factor. **/ public void setFactor(double factor) { x_factor = y_factor = factor; } /** * Set the x-axis amd y-axis movement multipler with xFactor and yFactor * respectively. **/ public void setFactor(double xFactor, double yFactor) { x_factor = xFactor; y_factor = yFactor; } public void processStimulus(Enumeration criteria) { WakeupCriterion wakeup; AWTEvent[] events; MouseEvent evt; while (criteria.hasMoreElements()) { wakeup = (WakeupCriterion) criteria.nextElement(); if (wakeup instanceof WakeupOnAWTEvent) { events = ((WakeupOnAWTEvent) wakeup).getAWTEvent(); if (events.length > 0) { evt = (MouseEvent) events[events.length - 1]; doProcess(evt); } } else if (wakeup instanceof WakeupOnBehaviorPost) { while (true) { // access to the queue must be synchronized synchronized (mouseq) { if (mouseq.isEmpty()) break; evt = (MouseEvent) mouseq.remove(0); // consolidate MOUSE_DRAG events while ((evt.getID() == MouseEvent.MOUSE_MOVED) && !mouseq.isEmpty() && (((MouseEvent) mouseq.get(0)).getID() == MouseEvent.MOUSE_MOVED)) { evt = (MouseEvent) mouseq.remove(0); } } doProcess(evt); } } } wakeupOn(mouseCriterion); } void doProcess(MouseEvent evt) { int id; int dx, dy; processMouseEvent(evt); if ((((flags & MANUAL_WAKEUP) == 0)) || ((wakeUp) && ((flags & MANUAL_WAKEUP) != 0))) { id = evt.getID(); if ((id == MouseEvent.MOUSE_MOVED) && !evt.isMetaDown() && !evt.isAltDown()) { final Dimension size = frame.getSize(); final int localCenterX = size.width / 2; final int localCenterY = size.height / 2; Insets insets = frame.getInsets(); int centerX = frame.getX() + insets.left + localCenterX; int centerY = frame.getY() + insets.top + localCenterY; if (ignoreNextEvent) { ignoreNextEvent = false; robot.mouseMove(centerX, centerY); return; } x = evt.getX(); y = evt.getY(); if (!reset && !(Math.abs(x - localCenterX) <= 2 && Math.abs(y - localCenterY) <= 2)) { dx = x - localCenterX; dy = y - localCenterY; x_angle += dy * y_factor; y_angle += dx * x_factor; transformGroup.getTransform(currXform); Matrix4d mat = new Matrix4d(); currXform.get(mat); currXform.set(1); transformX.rotX(x_angle); transformY.rotY(y_angle); if (!invert) { currXform.mul(currXform, transformX); currXform.mul(currXform, transformY); } else { currXform.mul(transformX, currXform); currXform.mul(transformY, currXform); } // Set old translation back Vector3d translation = new Vector3d(mat.m03, mat.m13, mat.m23); currXform.setTranslation(translation); // Update xform transformGroup.setTransform(currXform); transformChanged(currXform); if (callback != null) callback.transformChanged(MouseBehaviorCallback.ROTATE, currXform); robot.mouseMove(centerX, centerY); } else { reset = false; } x_last = x; y_last = y; } else if (id == MouseEvent.MOUSE_PRESSED || id == MouseEvent.MOUSE_DRAGGED) { ignoreNextEvent = true; x_last = evt.getX(); y_last = evt.getY(); } } } /** * Users can overload this method which is called every time the Behavior * updates the transform * * Default implementation does nothing */ public void transformChanged(Transform3D transform) { } /** * The transformChanged method in the callback class will be called every * time the transform is updated */ public void setupCallback(MouseBehaviorCallback callback) { this.callback = callback; } public void setFrame(JFrame appFrame) { frame = appFrame; } @Override public void setEnable(boolean enabled) { super.setEnable(enabled); ignoreNextEvent = true; } }
UTF-8
Java
11,409
java
MouseNavigationBehavior.java
Java
[]
null
[]
import java.awt.AWTEvent; import java.awt.AWTException; import java.awt.Component; import java.awt.Dimension; import java.awt.Insets; import java.awt.Robot; import java.awt.event.MouseEvent; import java.util.Enumeration; import java.util.LinkedList; import org.scijava.java3d.Transform3D; import org.scijava.java3d.TransformGroup; import org.scijava.java3d.WakeupCriterion; import org.scijava.java3d.WakeupOnAWTEvent; import org.scijava.java3d.WakeupOnBehaviorPost; import org.scijava.java3d.WakeupOr; import javax.swing.JFrame; import org.scijava.vecmath.Matrix4d; import org.scijava.vecmath.Vector3d; import org.scijava.java3d.utils.behaviors.mouse.MouseBehavior; import org.scijava.java3d.utils.behaviors.mouse.MouseBehaviorCallback; public class MouseNavigationBehavior extends MouseBehavior { double x_angle, y_angle; double x_factor = .03; double y_factor = .03; private MouseBehaviorCallback callback = null; private JFrame frame; private boolean ignoreNextEvent = true; private Robot robot; /** * Creates a rotate behavior given the transform group. * * @param transformGroup * The transformGroup to operate on. */ public MouseNavigationBehavior(TransformGroup transformGroup) { super(transformGroup); try { robot = new Robot(); } catch (AWTException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * Creates a default mouse rotate behavior. **/ public MouseNavigationBehavior() { super(0); try { robot = new Robot(); } catch (AWTException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * Creates a rotate behavior. Note that this behavior still needs a * transform group to work on (use setTransformGroup(tg)) and the transform * group must add this behavior. * * @param flags * interesting flags (wakeup conditions). */ public MouseNavigationBehavior(int flags) { super(flags); try { robot = new Robot(); } catch (AWTException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * Creates a rotate behavior that uses AWT listeners and behavior posts * rather than WakeupOnAWTEvent. The behavior is added to the specified * Component. A null component can be passed to specify the behavior should * use listeners. Components can then be added to the behavior with the * addListener(Component c) method. * * @param c * The Component to add the MouseListener and MouseMotionListener * to. * @since Java 3D 1.2.1 */ public MouseNavigationBehavior(Component c) { super(c, 0); try { robot = new Robot(); } catch (AWTException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * Creates a rotate behavior that uses AWT listeners and behavior posts * rather than WakeupOnAWTEvent. The behaviors is added to the specified * Component and works on the given TransformGroup. A null component can be * passed to specify the behavior should use listeners. Components can then * be added to the behavior with the addListener(Component c) method. * * @param c * The Component to add the MouseListener and MouseMotionListener * to. * @param transformGroup * The TransformGroup to operate on. * @since Java 3D 1.2.1 */ public MouseNavigationBehavior(Component c, TransformGroup transformGroup) { super(c, transformGroup); try { robot = new Robot(); } catch (AWTException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * Creates a rotate behavior that uses AWT listeners and behavior posts * rather than WakeupOnAWTEvent. The behavior is added to the specified * Component. A null component can be passed to specify the behavior should * use listeners. Components can then be added to the behavior with the * addListener(Component c) method. Note that this behavior still needs a * transform group to work on (use setTransformGroup(tg)) and the transform * group must add this behavior. * * @param flags * interesting flags (wakeup conditions). * @since Java 3D 1.2.1 */ public MouseNavigationBehavior(Component c, int flags) { super(c, flags); try { robot = new Robot(); } catch (AWTException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void initialize() { mouseEvents = new WakeupCriterion[5]; mouseEvents[0] = new WakeupOnAWTEvent(MouseEvent.MOUSE_MOVED); mouseEvents[1] = new WakeupOnAWTEvent(MouseEvent.MOUSE_DRAGGED); mouseEvents[2] = new WakeupOnAWTEvent(MouseEvent.MOUSE_PRESSED); mouseEvents[3] = new WakeupOnAWTEvent(MouseEvent.MOUSE_RELEASED); mouseEvents[4] = new WakeupOnAWTEvent(MouseEvent.MOUSE_WHEEL); mouseq = new LinkedList(); mouseCriterion = new WakeupOr(mouseEvents); wakeupOn (mouseCriterion); x = 0; y = 0; x_last = 0; y_last = 0; x_angle = 0; y_angle = 0; if ((flags & INVERT_INPUT) == INVERT_INPUT) { invert = true; x_factor *= -1; y_factor *= -1; } } /** * Return the x-axis movement multipler. **/ public double getXFactor() { return x_factor; } /** * Return the y-axis movement multipler. **/ public double getYFactor() { return y_factor; } /** * Set the x-axis amd y-axis movement multipler with factor. **/ public void setFactor(double factor) { x_factor = y_factor = factor; } /** * Set the x-axis amd y-axis movement multipler with xFactor and yFactor * respectively. **/ public void setFactor(double xFactor, double yFactor) { x_factor = xFactor; y_factor = yFactor; } public void processStimulus(Enumeration criteria) { WakeupCriterion wakeup; AWTEvent[] events; MouseEvent evt; while (criteria.hasMoreElements()) { wakeup = (WakeupCriterion) criteria.nextElement(); if (wakeup instanceof WakeupOnAWTEvent) { events = ((WakeupOnAWTEvent) wakeup).getAWTEvent(); if (events.length > 0) { evt = (MouseEvent) events[events.length - 1]; doProcess(evt); } } else if (wakeup instanceof WakeupOnBehaviorPost) { while (true) { // access to the queue must be synchronized synchronized (mouseq) { if (mouseq.isEmpty()) break; evt = (MouseEvent) mouseq.remove(0); // consolidate MOUSE_DRAG events while ((evt.getID() == MouseEvent.MOUSE_MOVED) && !mouseq.isEmpty() && (((MouseEvent) mouseq.get(0)).getID() == MouseEvent.MOUSE_MOVED)) { evt = (MouseEvent) mouseq.remove(0); } } doProcess(evt); } } } wakeupOn(mouseCriterion); } void doProcess(MouseEvent evt) { int id; int dx, dy; processMouseEvent(evt); if ((((flags & MANUAL_WAKEUP) == 0)) || ((wakeUp) && ((flags & MANUAL_WAKEUP) != 0))) { id = evt.getID(); if ((id == MouseEvent.MOUSE_MOVED) && !evt.isMetaDown() && !evt.isAltDown()) { final Dimension size = frame.getSize(); final int localCenterX = size.width / 2; final int localCenterY = size.height / 2; Insets insets = frame.getInsets(); int centerX = frame.getX() + insets.left + localCenterX; int centerY = frame.getY() + insets.top + localCenterY; if (ignoreNextEvent) { ignoreNextEvent = false; robot.mouseMove(centerX, centerY); return; } x = evt.getX(); y = evt.getY(); if (!reset && !(Math.abs(x - localCenterX) <= 2 && Math.abs(y - localCenterY) <= 2)) { dx = x - localCenterX; dy = y - localCenterY; x_angle += dy * y_factor; y_angle += dx * x_factor; transformGroup.getTransform(currXform); Matrix4d mat = new Matrix4d(); currXform.get(mat); currXform.set(1); transformX.rotX(x_angle); transformY.rotY(y_angle); if (!invert) { currXform.mul(currXform, transformX); currXform.mul(currXform, transformY); } else { currXform.mul(transformX, currXform); currXform.mul(transformY, currXform); } // Set old translation back Vector3d translation = new Vector3d(mat.m03, mat.m13, mat.m23); currXform.setTranslation(translation); // Update xform transformGroup.setTransform(currXform); transformChanged(currXform); if (callback != null) callback.transformChanged(MouseBehaviorCallback.ROTATE, currXform); robot.mouseMove(centerX, centerY); } else { reset = false; } x_last = x; y_last = y; } else if (id == MouseEvent.MOUSE_PRESSED || id == MouseEvent.MOUSE_DRAGGED) { ignoreNextEvent = true; x_last = evt.getX(); y_last = evt.getY(); } } } /** * Users can overload this method which is called every time the Behavior * updates the transform * * Default implementation does nothing */ public void transformChanged(Transform3D transform) { } /** * The transformChanged method in the callback class will be called every * time the transform is updated */ public void setupCallback(MouseBehaviorCallback callback) { this.callback = callback; } public void setFrame(JFrame appFrame) { frame = appFrame; } @Override public void setEnable(boolean enabled) { super.setEnable(enabled); ignoreNextEvent = true; } }
11,409
0.547112
0.541327
354
31.228813
23.717646
80
false
false
0
0
0
0
0
0
0.412429
false
false
7
95369a4ed720c697ccdf90993dd17156e0aaa7db
17,763,984,778,458
046a75fb6305df060f35de758ee9db0a48590551
/isa/src/main/java/ISA/project/model/StatusSedista.java
e58582988222328ff49b541e8652a966ff1e4e4b
[]
no_license
NikolaPavlovic1/ISA_Projekat
https://github.com/NikolaPavlovic1/ISA_Projekat
161ab6bf2cf0a741c32348d3379bb0330f16eb74
658b5a2b731a8db5fc75321f3ef17151ca0c54fb
refs/heads/master
2020-04-04T11:19:38.065000
2019-09-27T19:22:38
2019-09-27T19:22:38
155,886,898
0
3
null
null
null
null
null
null
null
null
null
null
null
null
null
package ISA.project.model; public enum StatusSedista { SLOBODNO, REZERVISANO, BRZA_REZERVACIJA, OBRISANO }
UTF-8
Java
122
java
StatusSedista.java
Java
[]
null
[]
package ISA.project.model; public enum StatusSedista { SLOBODNO, REZERVISANO, BRZA_REZERVACIJA, OBRISANO }
122
0.713115
0.713115
9
11.555555
9.878271
27
false
false
0
0
0
0
0
0
0.888889
false
false
7
8eae5f5eae7df886e0fdd8e1f25155bb0f943247
34,626,026,363,835
5fff04f2d120cbaf53b1624064db1e1ed6527980
/src/Scheduler.java
b7be4223a7a219764391856066c7361444fb50ce
[]
no_license
thunderZH963/java-for-elevator
https://github.com/thunderZH963/java-for-elevator
e566ac62bbd963f7193f37c7a122642a0501e0da
9ca6b0fd1b10c7de06ceffdd50640be818554419
refs/heads/master
2022-11-20T14:27:34.234000
2020-07-14T04:44:13
2020-07-14T04:44:13
279,483,702
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import com.oocourse.elevator3.PersonRequest; import java.util.ArrayList; import java.util.Arrays; public class Scheduler extends Thread { private int stall; private ArrayList<Request> inputQueue = new ArrayList<>(); private ArrayList<Request> requestQueue = new ArrayList<>(); private ArrayList<MoreElevator> elevatorPool = new ArrayList<>(); private ArrayList<Integer> asFloor = new ArrayList<>(Arrays .asList(-3,-2,-1,1,15,16,17,18,19,20)); private ArrayList<Integer> bsFloor = new ArrayList<>(Arrays .asList(-2,-1,1,2,4,5,6,7,8,9,10,11,12,13,14,15)); private ArrayList<Integer> csFloor = new ArrayList<>(Arrays .asList(1,3,5,7,9,11,13,15)); public Scheduler() { elevatorPool.add(new MoreElevator("A",this)); elevatorPool.add(new MoreElevator("B",this)); elevatorPool.add(new MoreElevator("C", this)); } public void run() { while (true) { upgrading(); } } public void upgrading() { synchronized (inputQueue) { while (inputQueue.size() == 0) { try { inputQueue.wait(); } catch (Exception e) { System.out.println(e); } } synchronized (requestQueue) { Request request = inputQueue.get(0); inputQueue.remove(0); requestQueue.add(request); requestQueue.notifyAll(); //if (inputQueue.size() == 0 && getStall() == 1) { // break; //} } inputQueue.notifyAll(); } } public void startPool() { for (int i = 0; i < elevatorPool.size(); i++) { elevatorPool.get(i).start(); elevatorPool.get(i).setName("电梯"); } } public Request get(String name) { synchronized (requestQueue) { while (requestQueue.isEmpty() || isEmpty(name) == -1) { try { requestQueue.wait(); } catch (Exception e) { System.out.println(e); } } int temp = isEmpty(name); Request request = requestQueue.get(temp); requestQueue.remove(temp); requestQueue.notifyAll(); return request; } } public void put(PersonRequest request) { synchronized (inputQueue) { inputQueue.add(new Request(request)); inputQueue.notifyAll(); } } public void setStall() { this.stall = 1; } public int getStall() { return this.stall; } public ArrayList<Request> getInputQueue() { return this.inputQueue; } public int isEmpty(String name) { if (requestQueue.size() == 0) { return -1; } if (name.equals("A")) { for (int i = 0; i < requestQueue.size(); i++) { if (asFloor.contains(requestQueue.get(i). getPersonRequest().getFromFloor()) && !(requestQueue.get(i).getChange() == 0 && !asFloor.contains(requestQueue.get(i). getPersonRequest().getToFloor()))) { return i; } } return -1; } else if (name.equals("B")) { for (int i = 0; i < requestQueue.size(); i++) { if (bsFloor.contains(requestQueue.get(i). getPersonRequest().getFromFloor()) && !(requestQueue.get(i).getChange() == 0 && !bsFloor.contains(requestQueue.get(i). getPersonRequest().getToFloor()))) { return i; } } return -1; } else if (name.equals("C")) { for (int i = 0; i < requestQueue.size(); i++) { if (csFloor.contains(requestQueue.get(i). getPersonRequest().getFromFloor()) && !(requestQueue.get(i).getChange() == 0 && !csFloor.contains(requestQueue.get(i). getPersonRequest().getToFloor()))) { return i; } } return -1; } return -1; } public ArrayList<Request> getRequestQueue() { return this.requestQueue; } public void remove(int i) { this.getRequestQueue().remove(i); } public void add(Request request) { requestQueue.add(request); } public boolean noRun() { if (getStall() == 1 && elevatorPool.get(0).getExit() == 0 && elevatorPool.get(1).getExit() == 0 && elevatorPool.get(2).getExit() == 0) { return true; } else { return false; } } }
UTF-8
Java
5,108
java
Scheduler.java
Java
[]
null
[]
import com.oocourse.elevator3.PersonRequest; import java.util.ArrayList; import java.util.Arrays; public class Scheduler extends Thread { private int stall; private ArrayList<Request> inputQueue = new ArrayList<>(); private ArrayList<Request> requestQueue = new ArrayList<>(); private ArrayList<MoreElevator> elevatorPool = new ArrayList<>(); private ArrayList<Integer> asFloor = new ArrayList<>(Arrays .asList(-3,-2,-1,1,15,16,17,18,19,20)); private ArrayList<Integer> bsFloor = new ArrayList<>(Arrays .asList(-2,-1,1,2,4,5,6,7,8,9,10,11,12,13,14,15)); private ArrayList<Integer> csFloor = new ArrayList<>(Arrays .asList(1,3,5,7,9,11,13,15)); public Scheduler() { elevatorPool.add(new MoreElevator("A",this)); elevatorPool.add(new MoreElevator("B",this)); elevatorPool.add(new MoreElevator("C", this)); } public void run() { while (true) { upgrading(); } } public void upgrading() { synchronized (inputQueue) { while (inputQueue.size() == 0) { try { inputQueue.wait(); } catch (Exception e) { System.out.println(e); } } synchronized (requestQueue) { Request request = inputQueue.get(0); inputQueue.remove(0); requestQueue.add(request); requestQueue.notifyAll(); //if (inputQueue.size() == 0 && getStall() == 1) { // break; //} } inputQueue.notifyAll(); } } public void startPool() { for (int i = 0; i < elevatorPool.size(); i++) { elevatorPool.get(i).start(); elevatorPool.get(i).setName("电梯"); } } public Request get(String name) { synchronized (requestQueue) { while (requestQueue.isEmpty() || isEmpty(name) == -1) { try { requestQueue.wait(); } catch (Exception e) { System.out.println(e); } } int temp = isEmpty(name); Request request = requestQueue.get(temp); requestQueue.remove(temp); requestQueue.notifyAll(); return request; } } public void put(PersonRequest request) { synchronized (inputQueue) { inputQueue.add(new Request(request)); inputQueue.notifyAll(); } } public void setStall() { this.stall = 1; } public int getStall() { return this.stall; } public ArrayList<Request> getInputQueue() { return this.inputQueue; } public int isEmpty(String name) { if (requestQueue.size() == 0) { return -1; } if (name.equals("A")) { for (int i = 0; i < requestQueue.size(); i++) { if (asFloor.contains(requestQueue.get(i). getPersonRequest().getFromFloor()) && !(requestQueue.get(i).getChange() == 0 && !asFloor.contains(requestQueue.get(i). getPersonRequest().getToFloor()))) { return i; } } return -1; } else if (name.equals("B")) { for (int i = 0; i < requestQueue.size(); i++) { if (bsFloor.contains(requestQueue.get(i). getPersonRequest().getFromFloor()) && !(requestQueue.get(i).getChange() == 0 && !bsFloor.contains(requestQueue.get(i). getPersonRequest().getToFloor()))) { return i; } } return -1; } else if (name.equals("C")) { for (int i = 0; i < requestQueue.size(); i++) { if (csFloor.contains(requestQueue.get(i). getPersonRequest().getFromFloor()) && !(requestQueue.get(i).getChange() == 0 && !csFloor.contains(requestQueue.get(i). getPersonRequest().getToFloor()))) { return i; } } return -1; } return -1; } public ArrayList<Request> getRequestQueue() { return this.requestQueue; } public void remove(int i) { this.getRequestQueue().remove(i); } public void add(Request request) { requestQueue.add(request); } public boolean noRun() { if (getStall() == 1 && elevatorPool.get(0).getExit() == 0 && elevatorPool.get(1).getExit() == 0 && elevatorPool.get(2).getExit() == 0) { return true; } else { return false; } } }
5,108
0.470219
0.455133
161
30.701864
19.869713
70
false
false
0
0
0
0
0
0
0.57764
false
false
7
07b4f98140e6419633ddc1d83151da89118a0967
29,695,403,943,381
0f376d476acac8861c63ea4f5da0389b75586ecc
/uima-util/src/main/java/edu/cmu/cs/lti/uima/annotator/CrossValidationReader.java
ad01ef611325280bca2a31728513620ec0796569
[]
no_license
etsurin/uima-base-tools
https://github.com/etsurin/uima-base-tools
98021cad8c21b959019fa9187b45f2f096c89609
c0334bf35ccd70cb1e57ccd3eb98bd33f2385863
refs/heads/master
2023-07-04T14:24:58.567000
2020-05-13T21:28:24
2020-05-13T21:28:24
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.cmu.cs.lti.uima.annotator; import com.google.common.collect.Lists; import edu.cmu.cs.lti.uima.util.CasSerialization; import org.apache.uima.UimaContext; import org.apache.uima.collection.CollectionException; import org.apache.uima.fit.descriptor.ConfigurationParameter; import org.apache.uima.fit.util.JCasUtil; import org.apache.uima.jcas.JCas; import org.apache.uima.resource.ResourceInitializationException; import org.apache.uima.util.Progress; import org.apache.uima.util.ProgressImpl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; import java.util.*; /** * Created with IntelliJ IDEA. * Date: 9/1/15 * Time: 10:27 AM * * @author Zhengzhong Liu */ public class CrossValidationReader extends AbstractCollectionReader { private final Logger logger = LoggerFactory.getLogger(getClass()); public static final String PARAM_SEED = "seed"; @ConfigurationParameter(name = PARAM_SEED, defaultValue = "17") private int seed; public static final String PARAM_SPLITS = "splits"; @ConfigurationParameter(name = PARAM_SPLITS, defaultValue = "5") private int splitsCnt; public static final String PARAM_SLICE = "slice"; @ConfigurationParameter(name = PARAM_SLICE, description = "which slice of the above split") private int slice; public static final String PARAM_MODE_EVAL = "modeEval"; @ConfigurationParameter(name = PARAM_MODE_EVAL, description = "true => eval (=returns 1 slice for eval);" + " false => train (=returns e.g. 9 slices for training)") private boolean modeEval; private List<File> corpus; private int currentIndex; private Iterator<File> corpusIter; @Override public void initialize(UimaContext context) throws ResourceInitializationException { super.initialize(context); logger.info("Starting cross validation reader for " + (modeEval ? "evaluation" : "training")); if (files.size() < splitsCnt) { throw new IllegalArgumentException(String.format("Number of files [%d] smaller than split count [%d].", files.size(), splitsCnt)); } // Always sorted to ensure the split are the same at different place. Collections.sort(files); Collections.shuffle(files, new Random(seed)); int splitSize = (int) Math.ceil(files.size() / splitsCnt); List<List<File>> partitions = Lists.partition(files, splitSize); if (modeEval) { corpus = partitions.get(slice); logger.info(String.format("Reading %d files for development.", corpus.size())); } else { corpus = new ArrayList<>(); for (int i = 0; i < partitions.size(); i++) { if (i != slice) { corpus.addAll(partitions.get(i)); } } // We sort and shuffle the training portion again. Collections.sort(corpus); Collections.shuffle(corpus, new Random(seed)); logger.info(String.format("Reading %d files for training.", corpus.size())); } corpusIter = corpus.iterator(); currentIndex = 0; } @Override public void getNext(JCas jCas) throws IOException, CollectionException { JCas inputView = JCasUtil.getView(jCas, inputViewName, jCas); currentIndex++; CasSerialization.readXmi(inputView, corpusIter.next()); } @Override public boolean hasNext() throws IOException, CollectionException { return corpusIter.hasNext(); } @Override public Progress[] getProgress() { return new Progress[]{new ProgressImpl(currentIndex, corpus.size(), Progress.ENTITIES)}; } }
UTF-8
Java
3,753
java
CrossValidationReader.java
Java
[ { "context": "A.\n * Date: 9/1/15\n * Time: 10:27 AM\n *\n * @author Zhengzhong Liu\n */\npublic class CrossValidationReader extends Ab", "end": 729, "score": 0.999843418598175, "start": 715, "tag": "NAME", "value": "Zhengzhong Liu" } ]
null
[]
package edu.cmu.cs.lti.uima.annotator; import com.google.common.collect.Lists; import edu.cmu.cs.lti.uima.util.CasSerialization; import org.apache.uima.UimaContext; import org.apache.uima.collection.CollectionException; import org.apache.uima.fit.descriptor.ConfigurationParameter; import org.apache.uima.fit.util.JCasUtil; import org.apache.uima.jcas.JCas; import org.apache.uima.resource.ResourceInitializationException; import org.apache.uima.util.Progress; import org.apache.uima.util.ProgressImpl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; import java.util.*; /** * Created with IntelliJ IDEA. * Date: 9/1/15 * Time: 10:27 AM * * @author <NAME> */ public class CrossValidationReader extends AbstractCollectionReader { private final Logger logger = LoggerFactory.getLogger(getClass()); public static final String PARAM_SEED = "seed"; @ConfigurationParameter(name = PARAM_SEED, defaultValue = "17") private int seed; public static final String PARAM_SPLITS = "splits"; @ConfigurationParameter(name = PARAM_SPLITS, defaultValue = "5") private int splitsCnt; public static final String PARAM_SLICE = "slice"; @ConfigurationParameter(name = PARAM_SLICE, description = "which slice of the above split") private int slice; public static final String PARAM_MODE_EVAL = "modeEval"; @ConfigurationParameter(name = PARAM_MODE_EVAL, description = "true => eval (=returns 1 slice for eval);" + " false => train (=returns e.g. 9 slices for training)") private boolean modeEval; private List<File> corpus; private int currentIndex; private Iterator<File> corpusIter; @Override public void initialize(UimaContext context) throws ResourceInitializationException { super.initialize(context); logger.info("Starting cross validation reader for " + (modeEval ? "evaluation" : "training")); if (files.size() < splitsCnt) { throw new IllegalArgumentException(String.format("Number of files [%d] smaller than split count [%d].", files.size(), splitsCnt)); } // Always sorted to ensure the split are the same at different place. Collections.sort(files); Collections.shuffle(files, new Random(seed)); int splitSize = (int) Math.ceil(files.size() / splitsCnt); List<List<File>> partitions = Lists.partition(files, splitSize); if (modeEval) { corpus = partitions.get(slice); logger.info(String.format("Reading %d files for development.", corpus.size())); } else { corpus = new ArrayList<>(); for (int i = 0; i < partitions.size(); i++) { if (i != slice) { corpus.addAll(partitions.get(i)); } } // We sort and shuffle the training portion again. Collections.sort(corpus); Collections.shuffle(corpus, new Random(seed)); logger.info(String.format("Reading %d files for training.", corpus.size())); } corpusIter = corpus.iterator(); currentIndex = 0; } @Override public void getNext(JCas jCas) throws IOException, CollectionException { JCas inputView = JCasUtil.getView(jCas, inputViewName, jCas); currentIndex++; CasSerialization.readXmi(inputView, corpusIter.next()); } @Override public boolean hasNext() throws IOException, CollectionException { return corpusIter.hasNext(); } @Override public Progress[] getProgress() { return new Progress[]{new ProgressImpl(currentIndex, corpus.size(), Progress.ENTITIES)}; } }
3,745
0.667732
0.663203
104
35.08654
29.282152
115
false
false
0
0
0
0
0
0
0.673077
false
false
7
24cf9b7291b3a2c48a54f40d7683de20bfb9b3b5
26,079,041,478,541
4b252cb42750c45f876cbaa754ac7e38d4832994
/comviz/src/database/model/ontology/OntologyRelationship.java
92d478b311ed3a089c8b579aaf85073e75bffd1b
[]
no_license
maxpayne200/comonviz
https://github.com/maxpayne200/comonviz
84befbba6d44efd3a3d5c088a2074d47cb5146a2
05683b7bec59a8ef2c15a4bc18411b5356afdbb3
refs/heads/master
2021-01-23T04:10:01.243000
2013-11-20T09:10:10
2013-11-20T09:10:10
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package database.model.ontology; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.PrimaryKeyJoinColumn; import database.model.Trackable; @Entity @PrimaryKeyJoinColumn(name="ID") public class OntologyRelationship extends Trackable { @Column(columnDefinition = "TEXT") private String key; public String getKey() { return key; } public void setKey(String key) { this.key = key; } private Long srcClassId; private Long dstClassId; private Long axiomId; private boolean isBidirection; public Long getSrcClassId() { return srcClassId; } public Long getDstClassId() { return dstClassId; } public Long getAxiomId() { return axiomId; } public boolean isBidirection() { return isBidirection; } public void setSrcClassId(Long srcClassId) { this.srcClassId = srcClassId; } public void setDstClassId(Long dstClassId) { this.dstClassId = dstClassId; } public void setAxiomId(Long axiomId) { this.axiomId = axiomId; } public void setBidirection(boolean isBidirection) { this.isBidirection = isBidirection; } }
UTF-8
Java
1,139
java
OntologyRelationship.java
Java
[]
null
[]
package database.model.ontology; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.PrimaryKeyJoinColumn; import database.model.Trackable; @Entity @PrimaryKeyJoinColumn(name="ID") public class OntologyRelationship extends Trackable { @Column(columnDefinition = "TEXT") private String key; public String getKey() { return key; } public void setKey(String key) { this.key = key; } private Long srcClassId; private Long dstClassId; private Long axiomId; private boolean isBidirection; public Long getSrcClassId() { return srcClassId; } public Long getDstClassId() { return dstClassId; } public Long getAxiomId() { return axiomId; } public boolean isBidirection() { return isBidirection; } public void setSrcClassId(Long srcClassId) { this.srcClassId = srcClassId; } public void setDstClassId(Long dstClassId) { this.dstClassId = dstClassId; } public void setAxiomId(Long axiomId) { this.axiomId = axiomId; } public void setBidirection(boolean isBidirection) { this.isBidirection = isBidirection; } }
1,139
0.72432
0.72432
50
20.780001
15.788971
53
false
false
0
0
0
0
0
0
1.34
false
false
7
fc0419144c07353cc712f37775df25af5ce70ffc
27,049,704,054,015
083d942abcfcb81fb71f608da4d5197a63238018
/src/HelloWorldPractice.java
811c15acf8d157fdd6527f58fa4a2bb859bd2cd9
[]
no_license
yoshihitoya/Javapractice
https://github.com/yoshihitoya/Javapractice
8c29b2c8a08e95a120e10106927294d17ca16124
3e7b793062b588dc6f1b90e2490ed0b74b6c31a3
refs/heads/master
2023-06-01T21:51:10.156000
2021-06-19T13:38:53
2021-06-19T13:38:53
376,994,177
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class HelloWorldPractice { public static void main(String args[]) { String greeting = "Hello World"; System.out.println(greeting); } }
UTF-8
Java
154
java
HelloWorldPractice.java
Java
[]
null
[]
public class HelloWorldPractice { public static void main(String args[]) { String greeting = "Hello World"; System.out.println(greeting); } }
154
0.694805
0.694805
9
16.111111
16.868408
41
false
false
0
0
0
0
0
0
1.222222
false
false
7
cde5a55fef0a3e2d98f6ead33a8b36d688f14d85
10,737,418,271,989
bbb03fba9c24b45d38fac156a18734f98af86c2d
/kr/src/main/java/com/mn/project/res/ResVO.java
35df07e2ffe251d65774681b67980af2482b2ca9
[]
no_license
mn1223/mn
https://github.com/mn1223/mn
82bae1da57771025486e9c9b40cfef8c65fe28b0
e43bb2b067d797cf7bada13239a83216e072f377
refs/heads/master
2022-12-27T15:49:18.524000
2020-01-29T04:01:47
2020-01-29T04:01:47
229,732,106
0
0
null
false
2022-12-16T10:32:15
2019-12-23T10:44:34
2020-01-29T04:01:52
2022-12-16T10:32:14
11,377
0
0
15
Java
false
false
package com.mn.project.res; public class ResVO { private int pno; private String pDate; private String pLoc; private String pPrice; private String ubookmmid; public String getUbookmmid() { return ubookmmid; } public void setUbookmmid(String ubookmmid) { this.ubookmmid = ubookmmid; } public int getPno() { return pno; } public void setPno(int pno) { this.pno = pno; } public String getpDate() { return pDate; } public void setpDate(String pDate) { this.pDate = pDate; } public String getpLoc() { return pLoc; } public void setpLoc(String pLoc) { this.pLoc = pLoc; } public String getpPrice() { return pPrice; } public void setpPrice(String pPrice) { this.pPrice = pPrice; } @Override public String toString() { return "ResVO [pno=" + pno + ", pDate=" + pDate + ", pLoc=" + pLoc + ", pPrice=" + pPrice + ", ubookmmid=" + ubookmmid + "]"; } }
UTF-8
Java
955
java
ResVO.java
Java
[]
null
[]
package com.mn.project.res; public class ResVO { private int pno; private String pDate; private String pLoc; private String pPrice; private String ubookmmid; public String getUbookmmid() { return ubookmmid; } public void setUbookmmid(String ubookmmid) { this.ubookmmid = ubookmmid; } public int getPno() { return pno; } public void setPno(int pno) { this.pno = pno; } public String getpDate() { return pDate; } public void setpDate(String pDate) { this.pDate = pDate; } public String getpLoc() { return pLoc; } public void setpLoc(String pLoc) { this.pLoc = pLoc; } public String getpPrice() { return pPrice; } public void setpPrice(String pPrice) { this.pPrice = pPrice; } @Override public String toString() { return "ResVO [pno=" + pno + ", pDate=" + pDate + ", pLoc=" + pLoc + ", pPrice=" + pPrice + ", ubookmmid=" + ubookmmid + "]"; } }
955
0.624084
0.624084
49
17.489796
18.029593
108
false
false
0
0
0
0
0
0
1.632653
false
false
7
8a07fa3193f03fb9280215f912ee0b3b39909c17
1,752,346,673,368
d81e82f3245630e1c42d6c05ddbef07c2ae74ef9
/src/main/java/com/tt/badu3/core/data/SeveritySorter.java
794934592d1c225fec676052db993407d0405cfc
[]
no_license
mkaraoz/Badu3
https://github.com/mkaraoz/Badu3
53a4967042e4f05780724291ed6c98f862b908a8
16dc0ae811c28695c6be70eb9a19f2f4eb4f6ffb
refs/heads/master
2022-05-29T11:02:56.792000
2021-12-30T09:18:38
2021-12-30T09:18:38
235,272,891
0
0
null
false
2022-05-20T21:23:39
2020-01-21T06:40:04
2021-12-30T09:18:40
2022-05-20T21:23:38
338
0
0
1
Java
false
false
/* * Copyright 2019 mk. * * 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.tt.badu3.core.data; import java.util.ArrayList; import java.util.List; /** * @author mk */ class SeveritySorter { public static void stupidSort(List<Vulnerability> vulnerabilities) { List<Vulnerability> sorted = new ArrayList<>(); for (Vulnerability vuln : vulnerabilities) { if (vuln.getSeverity().equals("Acil")) sorted.add(vuln); } for (Vulnerability vuln : vulnerabilities) { if (vuln.getSeverity().equals("Kritik")) sorted.add(vuln); } for (Vulnerability vuln : vulnerabilities) { if (vuln.getSeverity().equals("Yüksek")) sorted.add(vuln); } for (Vulnerability vuln : vulnerabilities) { if (vuln.getSeverity().equals("Orta")) sorted.add(vuln); } for (Vulnerability vuln : vulnerabilities) { if (vuln.getSeverity().equals("Düşük")) sorted.add(vuln); } vulnerabilities.clear(); vulnerabilities.addAll(sorted); } }
UTF-8
Java
1,727
java
SeveritySorter.java
Java
[ { "context": "/*\n * Copyright 2019 mk.\n *\n * Licensed under the Apache License, Version", "end": 23, "score": 0.9130852222442627, "start": 21, "tag": "USERNAME", "value": "mk" }, { "context": ".ArrayList;\nimport java.util.List;\n\n/**\n * @author mk\n */\nclass SeveritySorter {\n\n public static voi", "end": 690, "score": 0.9475924968719482, "start": 688, "tag": "USERNAME", "value": "mk" } ]
null
[]
/* * Copyright 2019 mk. * * 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.tt.badu3.core.data; import java.util.ArrayList; import java.util.List; /** * @author mk */ class SeveritySorter { public static void stupidSort(List<Vulnerability> vulnerabilities) { List<Vulnerability> sorted = new ArrayList<>(); for (Vulnerability vuln : vulnerabilities) { if (vuln.getSeverity().equals("Acil")) sorted.add(vuln); } for (Vulnerability vuln : vulnerabilities) { if (vuln.getSeverity().equals("Kritik")) sorted.add(vuln); } for (Vulnerability vuln : vulnerabilities) { if (vuln.getSeverity().equals("Yüksek")) sorted.add(vuln); } for (Vulnerability vuln : vulnerabilities) { if (vuln.getSeverity().equals("Orta")) sorted.add(vuln); } for (Vulnerability vuln : vulnerabilities) { if (vuln.getSeverity().equals("Düşük")) sorted.add(vuln); } vulnerabilities.clear(); vulnerabilities.addAll(sorted); } }
1,727
0.60592
0.600696
62
26.790323
23.876116
75
false
false
0
0
0
0
0
0
0.258065
false
false
7
964bce2dcf044251eb340ff5b086638ce0793657
10,711,648,464,803
0068fa2fcec3c16e9933e2ab5ef9538e284e5934
/yx_wms_dao/src/main/java/com/yx/wms_dao/DeliveryOrder/DeliveryOrderMapper.java
01caa2f7ecf855ec7e48bfc839c5f7dcc95c202e
[]
no_license
dengshaobo/yx_wms
https://github.com/dengshaobo/yx_wms
230e053683451bc26a224715d48c993e97b318e2
3a080a9f428bb338b045c06cdea259f4045283d1
refs/heads/master
2020-06-27T06:23:22.936000
2019-06-06T06:33:49
2019-06-10T03:50:02
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yx.wms_dao.DeliveryOrder; import com.yx.model.DeliveryOrder.DeliveryOrder; import com.yx.model.DeliveryOrder.DeliveryOrderItem; import org.springframework.stereotype.Repository; import java.util.HashMap; import java.util.List; @Repository public interface DeliveryOrderMapper { //获取发货单列表 List<DeliveryOrder> GetDeliveryOrderList(HashMap<String, String> filter); //获取发货单详情 DeliveryOrder GetDeliveryOrderInfo(String deliveryOrderId); //获取发货单明细 List<DeliveryOrderItem> GetDeliveryOrderItems(String deliveryOrderId); //新增发货单 int InsertDeliveryOrder(DeliveryOrder deliveryOrder); //修改发货单信息 int UpdateDeliveryOrder(DeliveryOrder deliveryOrder); }
UTF-8
Java
767
java
DeliveryOrderMapper.java
Java
[]
null
[]
package com.yx.wms_dao.DeliveryOrder; import com.yx.model.DeliveryOrder.DeliveryOrder; import com.yx.model.DeliveryOrder.DeliveryOrderItem; import org.springframework.stereotype.Repository; import java.util.HashMap; import java.util.List; @Repository public interface DeliveryOrderMapper { //获取发货单列表 List<DeliveryOrder> GetDeliveryOrderList(HashMap<String, String> filter); //获取发货单详情 DeliveryOrder GetDeliveryOrderInfo(String deliveryOrderId); //获取发货单明细 List<DeliveryOrderItem> GetDeliveryOrderItems(String deliveryOrderId); //新增发货单 int InsertDeliveryOrder(DeliveryOrder deliveryOrder); //修改发货单信息 int UpdateDeliveryOrder(DeliveryOrder deliveryOrder); }
767
0.7903
0.7903
27
24.962963
25.310635
77
false
false
0
0
0
0
0
0
0.444444
false
false
7
7b1214cabd34d87f1cb6460d2ab278058faa3f29
17,755,394,871,753
19a67736ee0aff7fe550e536721eae033edcaf64
/chapter1/src/com/yamdeng/util/Util2.java
8ac5d61a979b59d61fb9e505e73d80f0fd819c31
[]
no_license
yamdeng/study-java
https://github.com/yamdeng/study-java
5a736b04d867d4ecda71bf2b6b7b46697b5f8000
1aa4b441fa29a8f8076eeb3d43e56c0bd3e1fb1e
refs/heads/master
2020-07-07T21:47:05.884000
2019-08-23T09:54:32
2019-08-23T09:54:32
203,485,680
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yamdeng.util; public class Util2 { private int age = 10; public int getAge() { System.out.println("Util2 getAge() : " + this.age); return this.age; } }
UTF-8
Java
193
java
Util2.java
Java
[]
null
[]
package com.yamdeng.util; public class Util2 { private int age = 10; public int getAge() { System.out.println("Util2 getAge() : " + this.age); return this.age; } }
193
0.590674
0.569948
10
18.4
17.24065
59
false
false
0
0
0
0
0
0
0.4
false
false
7
13ccac3718a8f730cc27375fbc70a115f8ffd4d6
17,755,394,869,849
6500848c3661afda83a024f9792bc6e2e8e8a14e
/gp_JADX/com/google/android/finsky/api/p125a/ba.java
d6b845ab7814e0524b0aa9ed2e2dc4c72755b366
[]
no_license
enaawy/gproject
https://github.com/enaawy/gproject
fd71d3adb3784d12c52daf4eecd4b2cb5c81a032
91cb88559c60ac741d4418658d0416f26722e789
refs/heads/master
2021-09-03T03:49:37.813000
2018-01-05T09:35:06
2018-01-05T09:35:06
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.google.android.finsky.api.p125a; import com.google.protobuf.nano.C0757i; import com.google.wireless.android.finsky.dfe.nano.fk; final class ba implements cz { ba() { } public final /* synthetic */ C0757i mo1536a(fk fkVar) { return fkVar.T; } }
UTF-8
Java
283
java
ba.java
Java
[]
null
[]
package com.google.android.finsky.api.p125a; import com.google.protobuf.nano.C0757i; import com.google.wireless.android.finsky.dfe.nano.fk; final class ba implements cz { ba() { } public final /* synthetic */ C0757i mo1536a(fk fkVar) { return fkVar.T; } }
283
0.681979
0.628975
13
20.76923
21.170204
59
false
false
0
0
0
0
0
0
0.307692
false
false
7
480cf6cfc72be325e772434b479c256a6d1c7c34
30,983,894,140,761
9e399f1aed97c3f3481b930f10e94f467b39957e
/src/main/java/com/mands/springboot/jpapostgres/example/persistance/OrderRepository.java
93a1bda3b6dc1c110a9c6ff1019c61c94882a23e
[]
no_license
jaygehlot/springboot-postgres-xml-poc
https://github.com/jaygehlot/springboot-postgres-xml-poc
0fb95a6cd72d8d772b3d9ad300f226eed82b06e7
08f936f2aaecc791eef631aea8922e65f5da8b2b
refs/heads/master
2021-01-17T06:30:38.918000
2016-06-14T21:12:18
2016-06-14T21:12:18
61,155,281
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mands.springboot.jpapostgres.example.persistance; import com.mands.springboot.jpapostgres.example.domain.OrderEntity; import org.springframework.data.jpa.repository.JpaRepository; public interface OrderRepository extends JpaRepository<OrderEntity,Long> { }
UTF-8
Java
272
java
OrderRepository.java
Java
[]
null
[]
package com.mands.springboot.jpapostgres.example.persistance; import com.mands.springboot.jpapostgres.example.domain.OrderEntity; import org.springframework.data.jpa.repository.JpaRepository; public interface OrderRepository extends JpaRepository<OrderEntity,Long> { }
272
0.852941
0.852941
8
33
32.969685
74
false
false
0
0
0
0
0
0
0.5
false
false
7
d71dfa16e42121bf5c8f4b8ffd19b5cfa66ff61c
15,590,731,309,877
50a90c0f8f8c2a3c7fa58f43ab79602e0eabde79
/src/main/java/br/com/zupacademy/brenonoccioli/mercadolivre/adicionapergunta/PerguntaController.java
556a2f3aa2546cfa4db0e13ef4e11e9f52f031d3
[ "Apache-2.0" ]
permissive
brenonocciolizup/orange-talents-07-template-ecommerce
https://github.com/brenonocciolizup/orange-talents-07-template-ecommerce
b2887c204372ea48e20051edf981497509da5001
510cbd54f9a60e91e338eb5dfe37358c2d107304
refs/heads/main
2023-07-14T04:03:33.853000
2021-08-16T00:14:39
2021-08-16T00:14:39
392,052,409
0
1
Apache-2.0
true
2021-08-02T18:21:26
2021-08-02T18:21:25
2021-07-05T18:30:10
2021-07-05T18:30:07
4
0
0
0
null
false
false
package br.com.zupacademy.brenonoccioli.mercadolivre.adicionapergunta; import br.com.zupacademy.brenonoccioli.mercadolivre.adicionapergunta.dto.PerguntaSobreProdutoDto; import br.com.zupacademy.brenonoccioli.mercadolivre.adicionapergunta.form.PerguntaSobreProdutoForm; import br.com.zupacademy.brenonoccioli.mercadolivre.cadastroproduto.Produto; import br.com.zupacademy.brenonoccioli.mercadolivre.cadastroproduto.ProdutoRepository; import br.com.zupacademy.brenonoccioli.mercadolivre.config.seguranca.UsuarioLogado; import br.com.zupacademy.brenonoccioli.mercadolivre.usuario.Usuario; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; import javax.validation.Valid; import java.util.Optional; @RestController public class PerguntaController { @Autowired private ProdutoRepository produtoRepository; @Autowired private EnviadorDeEmails disparadorDeEmail; @Autowired private PerguntaRepository perguntaRepository; @PostMapping("/produtos/{id}/pergunta") public ResponseEntity<PerguntaSobreProdutoDto> postarPergunta(@PathVariable("id") Long id, @RequestBody @Valid PerguntaSobreProdutoForm form, @AuthenticationPrincipal UsuarioLogado usuarioLogado){ Optional<Produto> produtoOptional = produtoRepository.findById(id); if(produtoOptional.isEmpty()){ return ResponseEntity.badRequest().build(); } Produto produto = produtoOptional.get(); Usuario donoPergunta = usuarioLogado.get(); if(donoPergunta.equals(produto.getDono())){ return ResponseEntity.badRequest().build(); } PerguntaSobreProduto pergunta = form.toModel(donoPergunta, produto); perguntaRepository.save(pergunta); disparadorDeEmail.enviaEmail(donoPergunta, produto.getDono()); return ResponseEntity.ok().body(new PerguntaSobreProdutoDto(pergunta)); } }
UTF-8
Java
2,437
java
PerguntaController.java
Java
[]
null
[]
package br.com.zupacademy.brenonoccioli.mercadolivre.adicionapergunta; import br.com.zupacademy.brenonoccioli.mercadolivre.adicionapergunta.dto.PerguntaSobreProdutoDto; import br.com.zupacademy.brenonoccioli.mercadolivre.adicionapergunta.form.PerguntaSobreProdutoForm; import br.com.zupacademy.brenonoccioli.mercadolivre.cadastroproduto.Produto; import br.com.zupacademy.brenonoccioli.mercadolivre.cadastroproduto.ProdutoRepository; import br.com.zupacademy.brenonoccioli.mercadolivre.config.seguranca.UsuarioLogado; import br.com.zupacademy.brenonoccioli.mercadolivre.usuario.Usuario; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; import javax.validation.Valid; import java.util.Optional; @RestController public class PerguntaController { @Autowired private ProdutoRepository produtoRepository; @Autowired private EnviadorDeEmails disparadorDeEmail; @Autowired private PerguntaRepository perguntaRepository; @PostMapping("/produtos/{id}/pergunta") public ResponseEntity<PerguntaSobreProdutoDto> postarPergunta(@PathVariable("id") Long id, @RequestBody @Valid PerguntaSobreProdutoForm form, @AuthenticationPrincipal UsuarioLogado usuarioLogado){ Optional<Produto> produtoOptional = produtoRepository.findById(id); if(produtoOptional.isEmpty()){ return ResponseEntity.badRequest().build(); } Produto produto = produtoOptional.get(); Usuario donoPergunta = usuarioLogado.get(); if(donoPergunta.equals(produto.getDono())){ return ResponseEntity.badRequest().build(); } PerguntaSobreProduto pergunta = form.toModel(donoPergunta, produto); perguntaRepository.save(pergunta); disparadorDeEmail.enviaEmail(donoPergunta, produto.getDono()); return ResponseEntity.ok().body(new PerguntaSobreProdutoDto(pergunta)); } }
2,437
0.754206
0.754206
54
44.129631
33.608887
120
false
false
0
0
0
0
0
0
0.611111
false
false
7
0666b82111ee2115790cd8ed018235e5522e999c
15,590,731,306,002
9ba3f6790782c71d0ebe3415ad42fef100ed9da7
/app/src/test/java/comp3350/flashy/tests/domain/MultipleChoiceFlashcardTest.java
9d291280af39c1e1de817f420977902e6dc79f1c
[]
no_license
pratikpatelx/Flashy
https://github.com/pratikpatelx/Flashy
f1350896949d7544d4a847ceb9afcdd88a68008e
8459e7076ced9709c7e308e14f95a48f3a5fbeaf
refs/heads/master
2023-06-06T04:52:40.108000
2019-04-08T19:16:36
2019-04-08T19:16:36
378,527,602
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package comp3350.flashy.tests.domain; import org.junit.Before; import org.junit.Test; import java.util.ArrayList; import comp3350.flashy.domain.MultipleChoiceFlashcard; import static junit.framework.TestCase.assertEquals; import static junit.framework.TestCase.assertTrue; public class MultipleChoiceFlashcardTest { private MultipleChoiceFlashcard card; private ArrayList<String> answers; @Before public void setUp() { answers = new ArrayList<String>(); answers.add("1"); answers.add("2"); card = new MultipleChoiceFlashcard("name", "q", answers); } @Test public void multipleChoiceFlashcardTest() { assertEquals(card.getAnswers(),(answers)); assertEquals(card.getCardType(),("2")); // assertTrue(card.isMultipleChoiceFlashcard()); System.out.println("Multiple Choice Flashcard object test complete."); } }
UTF-8
Java
913
java
MultipleChoiceFlashcardTest.java
Java
[]
null
[]
package comp3350.flashy.tests.domain; import org.junit.Before; import org.junit.Test; import java.util.ArrayList; import comp3350.flashy.domain.MultipleChoiceFlashcard; import static junit.framework.TestCase.assertEquals; import static junit.framework.TestCase.assertTrue; public class MultipleChoiceFlashcardTest { private MultipleChoiceFlashcard card; private ArrayList<String> answers; @Before public void setUp() { answers = new ArrayList<String>(); answers.add("1"); answers.add("2"); card = new MultipleChoiceFlashcard("name", "q", answers); } @Test public void multipleChoiceFlashcardTest() { assertEquals(card.getAnswers(),(answers)); assertEquals(card.getCardType(),("2")); // assertTrue(card.isMultipleChoiceFlashcard()); System.out.println("Multiple Choice Flashcard object test complete."); } }
913
0.702081
0.690033
34
25.794117
22.809671
78
false
false
0
0
0
0
0
0
0.617647
false
false
7
f49557deabd44602b39341ad903c10dc471d629d
20,985,210,272,077
9e0d12c588f589711676d113007c8e122de64c4f
/src/Test/JdbcOracle.java
583b9039be2bf1cd80d674f8ecad2b82c5ef7f40
[]
no_license
WangLian3/TestMichael
https://github.com/WangLian3/TestMichael
ae30dbf84cd9be8b52baccdaac2d43e4265a33b9
c8361373ada4646641fa38f332c6eb5f6d27f414
refs/heads/master
2020-05-07T18:18:08.386000
2019-11-12T05:38:29
2019-11-12T05:38:29
180,759,971
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Test; import java.sql.Connection; //import java.sql.Date; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.text.ParseException; import java.util.Date; import java.text.SimpleDateFormat; public class JdbcOracle { public static void main(String[] args) throws ParseException { Connection connect = null; Statement statement = null; ResultSet resultSet = null; try { Class.forName("oracle.jdbc.OracleDriver"); connect = DriverManager.getConnection("jdbc:oracle:thin:@10.39.101.174:1521:EEDB", "EXIMSYS", "EXIMSYS"); // System.out.println(connect); // statement = connect.createStatement(); PreparedStatement preState = connect.prepareStatement("SELECT *" + " FROM EXIMTRX.IAAC_ACCMASTERLAY" + " WHERE C_UNIT_CODE = ?" + " AND (IA_D_LAST_ACCDATE = ? OR IA_D_LAST_ACCDATE < ?)" + " AND IA_C_STATUS_FLG <> ?" + " AND IA_C_STATUS_FLG <> ?" + " AND IA_C_STATUS_FLG <> ?" + " AND IA_C_STATUS_FLG <> ?" + " AND IA_C_POST_ARD_FLG <> ?" + " AND IA_C_STATUS_FLG <> ?"); // preState.setObject(new java.sql.Date(((Date) param).getTime())); String string = "2009-01-15"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date d = (Date) sdf.parse(string); Date d2 = new java.sql.Date(((Date) d).getTime()); System.out.println(d2); preState.setObject(1, "CSBANK"); preState.setObject(2, null); preState.setObject(3, new java.sql.Date(((Date) d).getTime())); preState.setObject(4, "F"); preState.setObject(5, "C"); preState.setObject(6, "S"); preState.setObject(7, "R"); preState.setObject(8, "A"); preState.setObject(9, "V"); resultSet = preState.executeQuery(); while (resultSet.next()) { String id = resultSet.getString("C_BK_GROUP_ID"); String name = resultSet.getString("C_CNTY_CODE"); String city = resultSet.getString("IA_C_ACCOUNT_TYPE"); System.out.println(id+" "+name+" "+city); //打印输出结果集 } } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); }catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally { try { if (resultSet!=null) resultSet.close(); if (statement!=null) statement.close(); if (connect!=null) connect.close(); } catch (SQLException e) { e.printStackTrace(); } } } }
GB18030
Java
2,818
java
JdbcOracle.java
Java
[ { "context": " = DriverManager.getConnection(\"jdbc:oracle:thin:@10.39.101.174:1521:EEDB\", \"EXIMSYS\", \"EXIMSYS\");\r\n\t\t\t\r\n//\t\t\tSys", "end": 658, "score": 0.9996337294578552, "start": 645, "tag": "IP_ADDRESS", "value": "10.39.101.174" } ]
null
[]
package Test; import java.sql.Connection; //import java.sql.Date; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.text.ParseException; import java.util.Date; import java.text.SimpleDateFormat; public class JdbcOracle { public static void main(String[] args) throws ParseException { Connection connect = null; Statement statement = null; ResultSet resultSet = null; try { Class.forName("oracle.jdbc.OracleDriver"); connect = DriverManager.getConnection("jdbc:oracle:thin:@10.39.101.174:1521:EEDB", "EXIMSYS", "EXIMSYS"); // System.out.println(connect); // statement = connect.createStatement(); PreparedStatement preState = connect.prepareStatement("SELECT *" + " FROM EXIMTRX.IAAC_ACCMASTERLAY" + " WHERE C_UNIT_CODE = ?" + " AND (IA_D_LAST_ACCDATE = ? OR IA_D_LAST_ACCDATE < ?)" + " AND IA_C_STATUS_FLG <> ?" + " AND IA_C_STATUS_FLG <> ?" + " AND IA_C_STATUS_FLG <> ?" + " AND IA_C_STATUS_FLG <> ?" + " AND IA_C_POST_ARD_FLG <> ?" + " AND IA_C_STATUS_FLG <> ?"); // preState.setObject(new java.sql.Date(((Date) param).getTime())); String string = "2009-01-15"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date d = (Date) sdf.parse(string); Date d2 = new java.sql.Date(((Date) d).getTime()); System.out.println(d2); preState.setObject(1, "CSBANK"); preState.setObject(2, null); preState.setObject(3, new java.sql.Date(((Date) d).getTime())); preState.setObject(4, "F"); preState.setObject(5, "C"); preState.setObject(6, "S"); preState.setObject(7, "R"); preState.setObject(8, "A"); preState.setObject(9, "V"); resultSet = preState.executeQuery(); while (resultSet.next()) { String id = resultSet.getString("C_BK_GROUP_ID"); String name = resultSet.getString("C_CNTY_CODE"); String city = resultSet.getString("IA_C_ACCOUNT_TYPE"); System.out.println(id+" "+name+" "+city); //打印输出结果集 } } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); }catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally { try { if (resultSet!=null) resultSet.close(); if (statement!=null) statement.close(); if (connect!=null) connect.close(); } catch (SQLException e) { e.printStackTrace(); } } } }
2,818
0.578103
0.566334
84
31.380953
21.344067
108
false
false
0
0
0
0
0
0
2.523809
false
false
7
7d2cd3be8a15f49b3f3293caedbffd76062d24dc
10,711,648,468,917
2497b632fdb3d4fc4b90d6fc8ac65f36265efe8e
/src/game/AcharCombate.java
8492bc0b22bdebda664a0d946ad6b28c7e1d1cca
[]
no_license
brbuckley/Jogo
https://github.com/brbuckley/Jogo
fe84ad1b1ff19c220f8a61e140f02e48971be427
5bdb0ab8ec69e3626f13418de6c73305de17c6f2
refs/heads/main
2023-08-01T14:52:03.528000
2021-09-14T21:14:54
2021-09-14T21:14:54
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package game; import java.util.ArrayList; /* Ideia: Geração aleatória simples para tipos diferentes de combates baseado no nível.*/ public class AcharCombate { public static void encontro(ArrayList<Personagem> personagens,Mochila mochila) { Guerreiro n = (Guerreiro)personagens.get(0); int l=n.getLvl(); int r=RandomRoll.encounterRoll(); if(l<5) { if(r>=60) { CombateSlime combate = new CombateSlime(); System.out.println("!~!~! Os heróis são atacados por 2 slimes !~!~!"); combate.lutar(personagens,mochila); } if(r<40) { CombateZumbi combate = new CombateZumbi(); System.out.println("!~!~! Os heróis são atacados por 4 zumbis !~!~!"); combate.lutar(personagens, mochila); } }else if (l>=5){ CombateGenerico combate = new CombateGenerico(); System.out.println("!~!~! Os heróis são atacados por 4 Goblins !~!~!"); combate.lutar(personagens,mochila); } } }
UTF-8
Java
1,135
java
AcharCombate.java
Java
[]
null
[]
package game; import java.util.ArrayList; /* Ideia: Geração aleatória simples para tipos diferentes de combates baseado no nível.*/ public class AcharCombate { public static void encontro(ArrayList<Personagem> personagens,Mochila mochila) { Guerreiro n = (Guerreiro)personagens.get(0); int l=n.getLvl(); int r=RandomRoll.encounterRoll(); if(l<5) { if(r>=60) { CombateSlime combate = new CombateSlime(); System.out.println("!~!~! Os heróis são atacados por 2 slimes !~!~!"); combate.lutar(personagens,mochila); } if(r<40) { CombateZumbi combate = new CombateZumbi(); System.out.println("!~!~! Os heróis são atacados por 4 zumbis !~!~!"); combate.lutar(personagens, mochila); } }else if (l>=5){ CombateGenerico combate = new CombateGenerico(); System.out.println("!~!~! Os heróis são atacados por 4 Goblins !~!~!"); combate.lutar(personagens,mochila); } } }
1,135
0.554667
0.545778
31
35.290321
28.151884
87
false
false
0
0
0
0
0
0
0.580645
false
false
7
064f4f8a06dd20cc4c74466c108fc90e05a4a7c9
29,128,468,216,203
de5ac2810b2dc993f9433e272101e57d884ffdf2
/src/main/java/ru/vsu/cs/zombie/server/command/DropResourceCommand.java
84fce5e9fe3a96be7544fd9f13aacde4fa4c8e8b
[]
no_license
BoldinovaNatalya/zombieIsland
https://github.com/BoldinovaNatalya/zombieIsland
937cf1bd67e53c8c59ec1c7ab4d2aa6bbec5874c
bc8dbcdd14737d9bc7df8f6b140f5785b65d223b
refs/heads/master
2020-03-29T20:55:10.239000
2014-05-02T07:46:15
2014-05-02T07:46:15
42,650,261
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ru.vsu.cs.zombie.server.command; import ru.vsu.cs.zombie.server.logic.Island; import ru.vsu.cs.zombie.server.logic.objects.Man; import ru.vsu.cs.zombie.server.logic.objects.Resource; public class DropResourceCommand extends Command { @Override public void execute() { int manID = (Integer) parameters.get("man_id"); int resourceID = (Integer) parameters.get("id"); Island island = session.getIsland(); Command response; Resource resource = (Resource) island.getEntity(resourceID); Man man = (Man) island.getEntity(manID); if (island.playerHasCharacter(manID, session) && resource != null && man.drop(resource)) { response = createResponse(); } else { response = new ErrorCommand("Wrong id", id); } session.write(response); } }
UTF-8
Java
856
java
DropResourceCommand.java
Java
[]
null
[]
package ru.vsu.cs.zombie.server.command; import ru.vsu.cs.zombie.server.logic.Island; import ru.vsu.cs.zombie.server.logic.objects.Man; import ru.vsu.cs.zombie.server.logic.objects.Resource; public class DropResourceCommand extends Command { @Override public void execute() { int manID = (Integer) parameters.get("man_id"); int resourceID = (Integer) parameters.get("id"); Island island = session.getIsland(); Command response; Resource resource = (Resource) island.getEntity(resourceID); Man man = (Man) island.getEntity(manID); if (island.playerHasCharacter(manID, session) && resource != null && man.drop(resource)) { response = createResponse(); } else { response = new ErrorCommand("Wrong id", id); } session.write(response); } }
856
0.648364
0.648364
25
33.200001
25.355078
98
false
false
0
0
0
0
0
0
0.6
false
false
7
8c05e52d11666b656bc918c06540ec8b9d06d00a
14,370,960,613,790
3ac421c10a125d6ccb54a0c5ca4f4b00eb3523a0
/src/main/java/com/example/demo/guava/eventbus/events/InheritEventBusExample.java
574c6fac35f658fcf60a6384706c764206447936
[]
no_license
MShaoShao/demo
https://github.com/MShaoShao/demo
34f770e181fb00fb099edc1d7b7e8f9692c7ae30
04cd8ef4dba6564497d84923880d83fa0d72d5fd
refs/heads/master
2023-01-30T12:14:26.035000
2020-12-01T08:51:09
2020-12-01T08:51:09
271,283,263
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.demo.guava.eventbus.events; import com.example.demo.guava.eventbus.listeners.FruitEaterListener; import com.google.common.eventbus.EventBus; /** * @author miaoshaodong * @date Creater in 16:04 2019/12/4 */ public class InheritEventBusExample { public static void main(String[] args) { final EventBus eventBus = new EventBus(); eventBus.register(new FruitEaterListener()); eventBus.post(new Apple("apple")); System.out.println("=================="); eventBus.post(new Fruit("apple")); } }
UTF-8
Java
561
java
InheritEventBusExample.java
Java
[ { "context": "m.google.common.eventbus.EventBus;\n\n/**\n * @author miaoshaodong\n * @date Creater in 16:04 2019/12/4\n */\npublic cl", "end": 190, "score": 0.9995307922363281, "start": 178, "tag": "USERNAME", "value": "miaoshaodong" } ]
null
[]
package com.example.demo.guava.eventbus.events; import com.example.demo.guava.eventbus.listeners.FruitEaterListener; import com.google.common.eventbus.EventBus; /** * @author miaoshaodong * @date Creater in 16:04 2019/12/4 */ public class InheritEventBusExample { public static void main(String[] args) { final EventBus eventBus = new EventBus(); eventBus.register(new FruitEaterListener()); eventBus.post(new Apple("apple")); System.out.println("=================="); eventBus.post(new Fruit("apple")); } }
561
0.672014
0.652406
18
30.166666
21.651918
68
false
false
0
0
0
0
0
0
0.444444
false
false
7
10190e2fd3feda92b1cdd50ab2444836d9890c6e
28,338,194,258,568
f01e7ea88018e3b265e75d9848dd1da4cfc25036
/ecwms/src/main/java/com/luolai/ecwms/model/bserp/BserpSdphd.java
d16a9786fc8180db7a696d3ace1eb2b7a728adf8
[]
no_license
84665206/myRepository
https://github.com/84665206/myRepository
20be14ee13a105b73028e26b00418933ebd816f5
bebc0c92625934537cdd8bc7b08f1b9b2f89aef8
refs/heads/master
2018-03-29T10:39:04.546000
2017-08-09T04:04:29
2017-08-09T04:04:29
87,689,471
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.luolai.ecwms.model.bserp; import java.math.BigDecimal; import java.util.Date; public class BserpSdphd implements java.io.Serializable{ private static final long serialVersionUID = 1L; private String djbh; //单据编号 private Date rq; //单据日期 private String ydjh; //原单据号 private String djxd; //单据性质(0-普通,1-装箱,2-配码) private String khdm; //客户代码(商店代码) private String khmc; //客户名称(商店名称) private String lxr; //联系人(收货人) private String tel; //联系电话(手机) private String dz; //联系地址(收货地址) private String ckdm; //配货源仓库代码(发货仓) private String ckmc; //配货源仓库名称 private BigDecimal sl; //商品总件数 private BigDecimal je; //商品总金额 private String ys; //商品发出标识 private Date ysrq; //商品发出日期 private String sh; //单据验收标识 private Date shrq; //单据验收日期 private String zdr; //制单人 private String bz; //备注 public String getDjbh() { return djbh; } public void setDjbh(String djbh) { this.djbh = djbh; } public Date getRq() { return rq; } public void setRq(Date rq) { this.rq = rq; } public String getYdjh() { return ydjh; } public void setYdjh(String ydjh) { this.ydjh = ydjh; } public String getDjxd() { return djxd; } public void setDjxd(String djxd) { this.djxd = djxd; } public String getKhdm() { return khdm; } public void setKhdm(String khdm) { this.khdm = khdm; } public String getKhmc() { return khmc; } public void setKhmc(String khmc) { this.khmc = khmc; } public String getLxr() { return lxr; } public void setLxr(String lxr) { this.lxr = lxr; } public String getTel() { return tel; } public void setTel(String tel) { this.tel = tel; } public String getDz() { return dz; } public void setDz(String dz) { this.dz = dz; } public String getCkdm() { return ckdm; } public void setCkdm(String ckdm) { this.ckdm = ckdm; } public String getCkmc() { return ckmc; } public void setCkmc(String ckmc) { this.ckmc = ckmc; } public BigDecimal getSl() { return sl; } public void setSl(BigDecimal sl) { this.sl = sl; } public BigDecimal getJe() { return je; } public void setJe(BigDecimal je) { this.je = je; } public String getYs() { return ys; } public void setYs(String ys) { this.ys = ys; } public Date getYsrq() { return ysrq; } public void setYsrq(Date ysrq) { this.ysrq = ysrq; } public String getSh() { return sh; } public void setSh(String sh) { this.sh = sh; } public Date getShrq() { return shrq; } public void setShrq(Date shrq) { this.shrq = shrq; } public String getZdr() { return zdr; } public void setZdr(String zdr) { this.zdr = zdr; } public String getBz() { return bz; } public void setBz(String bz) { this.bz = bz; } }
UTF-8
Java
3,111
java
BserpSdphd.java
Java
[]
null
[]
package com.luolai.ecwms.model.bserp; import java.math.BigDecimal; import java.util.Date; public class BserpSdphd implements java.io.Serializable{ private static final long serialVersionUID = 1L; private String djbh; //单据编号 private Date rq; //单据日期 private String ydjh; //原单据号 private String djxd; //单据性质(0-普通,1-装箱,2-配码) private String khdm; //客户代码(商店代码) private String khmc; //客户名称(商店名称) private String lxr; //联系人(收货人) private String tel; //联系电话(手机) private String dz; //联系地址(收货地址) private String ckdm; //配货源仓库代码(发货仓) private String ckmc; //配货源仓库名称 private BigDecimal sl; //商品总件数 private BigDecimal je; //商品总金额 private String ys; //商品发出标识 private Date ysrq; //商品发出日期 private String sh; //单据验收标识 private Date shrq; //单据验收日期 private String zdr; //制单人 private String bz; //备注 public String getDjbh() { return djbh; } public void setDjbh(String djbh) { this.djbh = djbh; } public Date getRq() { return rq; } public void setRq(Date rq) { this.rq = rq; } public String getYdjh() { return ydjh; } public void setYdjh(String ydjh) { this.ydjh = ydjh; } public String getDjxd() { return djxd; } public void setDjxd(String djxd) { this.djxd = djxd; } public String getKhdm() { return khdm; } public void setKhdm(String khdm) { this.khdm = khdm; } public String getKhmc() { return khmc; } public void setKhmc(String khmc) { this.khmc = khmc; } public String getLxr() { return lxr; } public void setLxr(String lxr) { this.lxr = lxr; } public String getTel() { return tel; } public void setTel(String tel) { this.tel = tel; } public String getDz() { return dz; } public void setDz(String dz) { this.dz = dz; } public String getCkdm() { return ckdm; } public void setCkdm(String ckdm) { this.ckdm = ckdm; } public String getCkmc() { return ckmc; } public void setCkmc(String ckmc) { this.ckmc = ckmc; } public BigDecimal getSl() { return sl; } public void setSl(BigDecimal sl) { this.sl = sl; } public BigDecimal getJe() { return je; } public void setJe(BigDecimal je) { this.je = je; } public String getYs() { return ys; } public void setYs(String ys) { this.ys = ys; } public Date getYsrq() { return ysrq; } public void setYsrq(Date ysrq) { this.ysrq = ysrq; } public String getSh() { return sh; } public void setSh(String sh) { this.sh = sh; } public Date getShrq() { return shrq; } public void setShrq(Date shrq) { this.shrq = shrq; } public String getZdr() { return zdr; } public void setZdr(String zdr) { this.zdr = zdr; } public String getBz() { return bz; } public void setBz(String bz) { this.bz = bz; } }
3,111
0.624693
0.62329
143
17.937063
13.016513
56
false
false
0
0
0
0
0
0
1.979021
false
false
7
0086901ceacd366ce0aabeecf557c59d4a1debf5
33,655,363,735,651
acf3f5ab5fa10a6018359b14def1d688821f231f
/src/test/java/finalExam/controller/meal/MealControllerTest.java
52f123c85ac9f5be9e0c9bfcc0f2d94371c0568b
[]
no_license
StasNeg/FinalExam
https://github.com/StasNeg/FinalExam
8308b7120fac261165214f430ec978a930b41923
b24587dcc6d798529d15390da983f2cfa628fa32
refs/heads/master
2021-07-14T23:32:33.476000
2017-10-13T12:17:57
2017-10-13T12:17:57
105,012,972
0
0
null
false
2017-10-13T12:17:58
2017-09-27T12:03:00
2017-09-27T13:22:52
2017-10-13T12:17:57
119
0
0
0
Java
null
null
package finalExam.controller.meal; import finalExam.TestUtil; import finalExam.controller.AbstractControllerTest; import finalExam.controller.json.JsonUtil; import finalExam.matcher.BeanMatcher; import finalExam.model.meal.Meal; import finalExam.repository.MealRepository; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.ResultActions; import java.util.Arrays; import static finalExam.TestUtil.userHttpBasic; import static finalExam.testData.RestaurantMealTestData.*; import static finalExam.testData.UserTestData.ADMIN; import static finalExam.testData.UserTestData.USER; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; public class MealControllerTest extends AbstractControllerTest { private static final String REST_URL = MealRestController.REST_URL + '/'; private static final String ADMIN_REST_URL = MealAdminRestController.REST_URL + '/'; private final BeanMatcher<Meal> MATCHER = BeanMatcher.of(Meal.class); @Autowired private MealRepository repository; @Test public void testGet() throws Exception { mockMvc.perform(get(REST_URL + MENU_FIRST_ID + "/meals/" + MEAL_FIRST_ID) .with(userHttpBasic(USER))) .andExpect(status().isOk()) .andDo(print()) // https://jira.spring.io/browse/SPR-14472 .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(MATCHER.contentMatcher(MEAL1)); } @Test public void testDelete() throws Exception { mockMvc.perform(delete(ADMIN_REST_URL + MENU_FIRST_ID + "/meals/" + MEAL_FIRST_ID) .with(userHttpBasic(ADMIN))) .andDo(print()) .andExpect(status().isOk()); MATCHER.assertListEquals(Arrays.asList(MEAL2, MEAL3), repository.getAll(MENU_FIRST_ID)); } @Test public void testGetUnauth() throws Exception { mockMvc.perform(get(REST_URL + MENU_FIRST_ID + "/meals/" + MEAL_FIRST_ID)) .andExpect(status().isUnauthorized()); } @Test public void testUpdate() throws Exception { Meal updated = repository.get(MEAL_FIRST_ID, MENU_FIRST_ID); updated.setName("UpdatedName"); mockMvc.perform(put(ADMIN_REST_URL + MENU_FIRST_ID + "/meals/" + MEAL_FIRST_ID) .contentType(MediaType.APPLICATION_JSON) .with(userHttpBasic(ADMIN)) .content(JsonUtil.writeValue(updated))) .andExpect(status().isOk()); MATCHER.assertEquals(updated, repository.get(MEAL_FIRST_ID, MENU_FIRST_ID)); } @Test public void testCreate() throws Exception { Meal expected = new Meal(null, "New", 23.5); ResultActions action = mockMvc.perform(post(ADMIN_REST_URL + MENU_FIRST_ID) .contentType(MediaType.APPLICATION_JSON) .with(userHttpBasic(ADMIN)) .content(JsonUtil.writeValue(expected))).andExpect(status().isCreated()); Meal returned = MATCHER.fromJsonAction(action); expected.setId(returned.getId()); MATCHER.assertEquals(expected, returned); MATCHER.assertListEquals(Arrays.asList(MEAL1, MEAL2, MEAL3, expected), repository.getAll(MENU_FIRST_ID)); } @Test public void testGetAll() throws Exception { TestUtil.print(mockMvc.perform(get(REST_URL + MENU_FIRST_ID) .with(userHttpBasic(USER))) .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(MATCHER.contentListMatcher(MEAL1,MEAL2,MEAL3))); } }
UTF-8
Java
4,158
java
MealControllerTest.java
Java
[]
null
[]
package finalExam.controller.meal; import finalExam.TestUtil; import finalExam.controller.AbstractControllerTest; import finalExam.controller.json.JsonUtil; import finalExam.matcher.BeanMatcher; import finalExam.model.meal.Meal; import finalExam.repository.MealRepository; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.ResultActions; import java.util.Arrays; import static finalExam.TestUtil.userHttpBasic; import static finalExam.testData.RestaurantMealTestData.*; import static finalExam.testData.UserTestData.ADMIN; import static finalExam.testData.UserTestData.USER; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; public class MealControllerTest extends AbstractControllerTest { private static final String REST_URL = MealRestController.REST_URL + '/'; private static final String ADMIN_REST_URL = MealAdminRestController.REST_URL + '/'; private final BeanMatcher<Meal> MATCHER = BeanMatcher.of(Meal.class); @Autowired private MealRepository repository; @Test public void testGet() throws Exception { mockMvc.perform(get(REST_URL + MENU_FIRST_ID + "/meals/" + MEAL_FIRST_ID) .with(userHttpBasic(USER))) .andExpect(status().isOk()) .andDo(print()) // https://jira.spring.io/browse/SPR-14472 .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(MATCHER.contentMatcher(MEAL1)); } @Test public void testDelete() throws Exception { mockMvc.perform(delete(ADMIN_REST_URL + MENU_FIRST_ID + "/meals/" + MEAL_FIRST_ID) .with(userHttpBasic(ADMIN))) .andDo(print()) .andExpect(status().isOk()); MATCHER.assertListEquals(Arrays.asList(MEAL2, MEAL3), repository.getAll(MENU_FIRST_ID)); } @Test public void testGetUnauth() throws Exception { mockMvc.perform(get(REST_URL + MENU_FIRST_ID + "/meals/" + MEAL_FIRST_ID)) .andExpect(status().isUnauthorized()); } @Test public void testUpdate() throws Exception { Meal updated = repository.get(MEAL_FIRST_ID, MENU_FIRST_ID); updated.setName("UpdatedName"); mockMvc.perform(put(ADMIN_REST_URL + MENU_FIRST_ID + "/meals/" + MEAL_FIRST_ID) .contentType(MediaType.APPLICATION_JSON) .with(userHttpBasic(ADMIN)) .content(JsonUtil.writeValue(updated))) .andExpect(status().isOk()); MATCHER.assertEquals(updated, repository.get(MEAL_FIRST_ID, MENU_FIRST_ID)); } @Test public void testCreate() throws Exception { Meal expected = new Meal(null, "New", 23.5); ResultActions action = mockMvc.perform(post(ADMIN_REST_URL + MENU_FIRST_ID) .contentType(MediaType.APPLICATION_JSON) .with(userHttpBasic(ADMIN)) .content(JsonUtil.writeValue(expected))).andExpect(status().isCreated()); Meal returned = MATCHER.fromJsonAction(action); expected.setId(returned.getId()); MATCHER.assertEquals(expected, returned); MATCHER.assertListEquals(Arrays.asList(MEAL1, MEAL2, MEAL3, expected), repository.getAll(MENU_FIRST_ID)); } @Test public void testGetAll() throws Exception { TestUtil.print(mockMvc.perform(get(REST_URL + MENU_FIRST_ID) .with(userHttpBasic(USER))) .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) .andExpect(MATCHER.contentListMatcher(MEAL1,MEAL2,MEAL3))); } }
4,158
0.690717
0.686628
101
40.168316
31.08534
113
false
false
0
0
0
0
0
0
0.534653
false
false
7
6862bc912d38a54eac1e9a36c37eec0a938605b5
10,342,281,289,644
039a6810479574d61128ac6ad6341f626673aa46
/AndroidImageSlider-master/demo/src/main/java/com/gazan/model/Model_Main.java
f9c3f1c0a27f8e26686aa2f3b7e9fae51e31d1c1
[ "MIT" ]
permissive
kainaspatel/AndroidImageSlider
https://github.com/kainaspatel/AndroidImageSlider
fb76542b414c3b1b16bf2dd01c4042d33b887245
c22351b2972808a76f0c9872f321f8d7e99e9627
refs/heads/master
2021-01-09T20:22:39.416000
2016-07-06T18:07:57
2016-07-06T18:07:57
62,658,065
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.gazan.model; import com.google.gson.annotations.SerializedName; import java.util.ArrayList; /** * Created by mtpl on 12/15/2015. */ public class Model_Main { @SerializedName("status") public String status; @SerializedName("msg") public String msg; @SerializedName("errorcode") public String errorcode; @SerializedName("lastpaid") public ArrayList<Model_Issue_Lastpaid> mListLastPaid = new ArrayList<Model_Issue_Lastpaid>(); @SerializedName("free") public ArrayList<Model_Issue_Free> mListIssueFree = new ArrayList<Model_Issue_Free>(); @SerializedName("paid") public ArrayList<Model_Issue_Paid> mListPaid = new ArrayList<Model_Issue_Paid>(); @SerializedName("sliderImg") public ArrayList<Model_Slider> mListSlider = new ArrayList<Model_Slider>(); }
UTF-8
Java
825
java
Model_Main.java
Java
[ { "context": "e;\n\nimport java.util.ArrayList;\n\n/**\n * Created by mtpl on 12/15/2015.\n */\npublic class Model_Main {\n ", "end": 129, "score": 0.9995887279510498, "start": 125, "tag": "USERNAME", "value": "mtpl" } ]
null
[]
package com.gazan.model; import com.google.gson.annotations.SerializedName; import java.util.ArrayList; /** * Created by mtpl on 12/15/2015. */ public class Model_Main { @SerializedName("status") public String status; @SerializedName("msg") public String msg; @SerializedName("errorcode") public String errorcode; @SerializedName("lastpaid") public ArrayList<Model_Issue_Lastpaid> mListLastPaid = new ArrayList<Model_Issue_Lastpaid>(); @SerializedName("free") public ArrayList<Model_Issue_Free> mListIssueFree = new ArrayList<Model_Issue_Free>(); @SerializedName("paid") public ArrayList<Model_Issue_Paid> mListPaid = new ArrayList<Model_Issue_Paid>(); @SerializedName("sliderImg") public ArrayList<Model_Slider> mListSlider = new ArrayList<Model_Slider>(); }
825
0.72
0.710303
29
27.448277
27.879774
97
false
false
0
0
0
0
0
0
0.344828
false
false
7