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
227c8fca5ec80b5096463823f279acb936159dec
29,661,044,184,136
d4744d255bfb640084a104e38d00ec8cbf507036
/Ex3/Student.java
9e5c59f600fd5163a0f0d47eb63945a5a90c89cc
[]
no_license
AsmitaGauri/Java-Lab-6th-Sem
https://github.com/AsmitaGauri/Java-Lab-6th-Sem
229a199f13a6fb605e6023d4ae91e00357a79232
1c3067589b42caef73a05ef490c2b0454f8bf589
refs/heads/master
2023-07-04T03:20:01.479000
2021-08-12T08:08:55
2021-08-12T08:08:55
395,215,925
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Ex3; public class Student { String name; String address,usn; int age; Student(String name,String address,String usn,int age) { this.name=name; this.age=age; this.address=address; this.usn=usn; } public String toString() { return "Name : "+name+"\nAge : "+age+"\nAddress : "+address+"\n Usn : "+usn; } }
UTF-8
Java
327
java
Student.java
Java
[ { "context": ",String address,String usn,int age)\n\t{\n\tthis.name=name;\n\tthis.age=age;\n\tthis.address=address;\n\tthis.usn=", "end": 156, "score": 0.6614764928817749, "start": 152, "tag": "NAME", "value": "name" } ]
null
[]
package Ex3; public class Student { String name; String address,usn; int age; Student(String name,String address,String usn,int age) { this.name=name; this.age=age; this.address=address; this.usn=usn; } public String toString() { return "Name : "+name+"\nAge : "+age+"\nAddress : "+address+"\n Usn : "+usn; } }
327
0.666667
0.663609
18
17.166666
19.368502
77
false
false
0
0
0
0
0
0
1.5
false
false
12
0c8c60c25574a8990179d0687dba7e25e0fce291
549,755,829,950
9c7e4866992f3406809ff8f548d5724a2378c300
/TestUrm8/src/main/java/com/ericsson/urm/device/driver/registersblockprogramming/Block17.java
32094ded32163cdb7ddca88379a2d003894a9b24
[]
no_license
Ersabba/LorenzoStudio
https://github.com/Ersabba/LorenzoStudio
eb623ee50f3a6163e7a1be980ab846167653c3ab
f76cafb96bb2de928cb0236bb11a6e578344058a
refs/heads/master
2022-12-23T05:57:15.833000
2020-05-19T16:39:02
2020-05-19T16:39:02
157,240,224
0
0
null
false
2022-12-15T23:31:51
2018-11-12T16:07:45
2020-05-19T16:39:24
2022-12-15T23:31:48
2,092
0
0
9
Java
false
false
package com.ericsson.urm.device.driver.registersblockprogramming; public class Block17 implements RegistersBlock { private static final long serialVersionUID = 1L; private String idUtente; public String getIdUtente() { return idUtente; } public void setIdUtente(String idUtente) { this.idUtente = idUtente; } }
UTF-8
Java
327
java
Block17.java
Java
[]
null
[]
package com.ericsson.urm.device.driver.registersblockprogramming; public class Block17 implements RegistersBlock { private static final long serialVersionUID = 1L; private String idUtente; public String getIdUtente() { return idUtente; } public void setIdUtente(String idUtente) { this.idUtente = idUtente; } }
327
0.7737
0.764526
17
18.235294
21.300453
65
false
false
0
0
0
0
0
0
1.058824
false
false
12
8c7f5c908cdb22f12f295ca30ab68a1148030a91
8,177,617,783,076
1d548c806f848a5a142cc202a5a4cf3fe4074c38
/src/main/java/com/jemmy/concurrent/CounterThreadAtomicTest.java
fc5e41c85541bc94c645a382f2370ddc6979868c
[]
no_license
iapplejohn/concurrent
https://github.com/iapplejohn/concurrent
94818b134c401105290619a2fae03e7ab3f5e898
02c3a7f664cc133520f008cb8342af4b2bef5611
refs/heads/master
2021-12-14T08:40:42.276000
2021-11-29T15:31:25
2021-11-29T15:31:25
119,486,002
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (C), 2014-2017, 杭州小卡科技有限公司 * FileName: CounterThreadAtomicTest.java * Author: Cheng Zhujiang * Date: 2017/7/29 22:47 * Description: */ package com.jemmy.concurrent; import java.util.concurrent.atomic.AtomicInteger; /** * CounterThreadAtomicTest * * @author Cheng Zhujiang * @date 2017/7/29 */ public class CounterThreadAtomicTest { public static void main(String[] args) { AtomicInteger ai = new AtomicInteger(0); new Thread() { @Override public void run() { for (int i = 0; i < 1000; i++) { int count = ai.incrementAndGet(); System.out.println("Thread 1 get " + count); } } }.start(); new Thread() { @Override public void run() { for (int i = 0; i < 1000; i++) { int count = ai.incrementAndGet(); System.out.println("Thread 2 get " + count); } } }.start(); } }
UTF-8
Java
1,085
java
CounterThreadAtomicTest.java
Java
[ { "context": "ileName: CounterThreadAtomicTest.java\n * Author: Cheng Zhujiang\n * Date: 2017/7/29 22:47\n * Description: \n */", "end": 112, "score": 0.9998606443405151, "start": 98, "tag": "NAME", "value": "Cheng Zhujiang" }, { "context": "ger;\n\n/**\n * CounterThreadAtomicTest\n *\n * @author Cheng Zhujiang\n * @date 2017/7/29\n */\npublic class CounterThread", "end": 304, "score": 0.9998475313186646, "start": 290, "tag": "NAME", "value": "Cheng Zhujiang" } ]
null
[]
/* * Copyright (C), 2014-2017, 杭州小卡科技有限公司 * FileName: CounterThreadAtomicTest.java * Author: <NAME> * Date: 2017/7/29 22:47 * Description: */ package com.jemmy.concurrent; import java.util.concurrent.atomic.AtomicInteger; /** * CounterThreadAtomicTest * * @author <NAME> * @date 2017/7/29 */ public class CounterThreadAtomicTest { public static void main(String[] args) { AtomicInteger ai = new AtomicInteger(0); new Thread() { @Override public void run() { for (int i = 0; i < 1000; i++) { int count = ai.incrementAndGet(); System.out.println("Thread 1 get " + count); } } }.start(); new Thread() { @Override public void run() { for (int i = 0; i < 1000; i++) { int count = ai.incrementAndGet(); System.out.println("Thread 2 get " + count); } } }.start(); } }
1,069
0.502347
0.465728
44
23.204546
18.856611
64
false
false
0
0
0
0
0
0
0.340909
false
false
12
92ce2553286597ec3830c1b8576eb6e0d6c54ff4
15,066,745,294,662
cc179ee23e87890b470dc697adaca5187464bce8
/phase4-test/src/test/java/com/helger/phase4/server/servlet/UserMessageDuplicateTest.java
f46c733435f7ae8b19acb425f1e4a265b671a075
[ "Apache-2.0" ]
permissive
phax/ph-as4
https://github.com/phax/ph-as4
0eb1bf995dad05e36de6cb151a0e18c2ac421d11
c730cdd507a7b615314a5eb676fb7d084b2861fa
refs/heads/master
2020-04-12T03:56:25.478000
2020-04-03T21:42:22
2020-04-03T21:42:22
62,138,020
6
6
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Copyright (C) 2015-2020 Philip Helger (www.helger.com) * philip[at]helger[dot]com * * 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.helger.phase4.server.servlet; import org.apache.http.HttpEntity; import org.junit.Ignore; import org.junit.Test; import org.w3c.dom.Document; import org.w3c.dom.Node; import com.helger.commons.io.resource.ClassPathResource; import com.helger.phase4.AS4TestConstants; import com.helger.phase4.error.EEbmsError; import com.helger.phase4.http.HttpXMLEntity; import com.helger.phase4.server.message.MockMessages; import com.helger.phase4.servlet.mgr.AS4ServerConfiguration; import com.helger.phase4.soap.ESoapVersion; import com.helger.xml.serialize.read.DOMReader; public final class UserMessageDuplicateTest extends AbstractUserMessageTestSetUpExt { private final ESoapVersion m_eSoapVersion = ESoapVersion.AS4_DEFAULT; @Test public void sendDuplicateMessageOnlyGetOneReceipt () throws Exception { final Node aPayload = DOMReader.readXMLDOM (new ClassPathResource (AS4TestConstants.TEST_SOAP_BODY_PAYLOAD_XML)); final Document aDoc = MockMessages.testUserMessageSoapNotSigned (m_eSoapVersion, aPayload, null) .getAsSoapDocument (aPayload); final HttpEntity aEntity = new HttpXMLEntity (aDoc, m_eSoapVersion.getMimeType ()); sendPlainMessage (aEntity, true, null); sendPlainMessage (aEntity, false, EEbmsError.EBMS_OTHER.getErrorCode ()); } // Only use if you need to test the feature, takes a long time @Ignore @Test public void sendDuplicateMessageTestDisposalFeature () throws Exception { final Node aPayload = DOMReader.readXMLDOM (new ClassPathResource (AS4TestConstants.TEST_SOAP_BODY_PAYLOAD_XML)); final Document aDoc = MockMessages.testUserMessageSoapNotSigned (m_eSoapVersion, aPayload, null) .getAsSoapDocument (aPayload); final HttpEntity aEntity = new HttpXMLEntity (aDoc, m_eSoapVersion.getMimeType ()); sendPlainMessage (aEntity, true, null); // Making sure the message gets disposed off // 60 000 = 1 minute, *2 and + 10000 are a buffer // test file is configured for 1 minute can take LONGER if configured // differently Thread.sleep (AS4ServerConfiguration.getIncomingDuplicateDisposalMinutes () * 60000 * 2 + 10000); sendPlainMessage (aEntity, true, null); } }
UTF-8
Java
2,915
java
UserMessageDuplicateTest.java
Java
[ { "context": "/**\n * Copyright (C) 2015-2020 Philip Helger (www.helger.com)\n * philip[at]helger[dot]com\n *\n ", "end": 44, "score": 0.9998424053192139, "start": 31, "tag": "NAME", "value": "Philip Helger" } ]
null
[]
/** * Copyright (C) 2015-2020 <NAME> (www.helger.com) * philip[at]helger[dot]com * * 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.helger.phase4.server.servlet; import org.apache.http.HttpEntity; import org.junit.Ignore; import org.junit.Test; import org.w3c.dom.Document; import org.w3c.dom.Node; import com.helger.commons.io.resource.ClassPathResource; import com.helger.phase4.AS4TestConstants; import com.helger.phase4.error.EEbmsError; import com.helger.phase4.http.HttpXMLEntity; import com.helger.phase4.server.message.MockMessages; import com.helger.phase4.servlet.mgr.AS4ServerConfiguration; import com.helger.phase4.soap.ESoapVersion; import com.helger.xml.serialize.read.DOMReader; public final class UserMessageDuplicateTest extends AbstractUserMessageTestSetUpExt { private final ESoapVersion m_eSoapVersion = ESoapVersion.AS4_DEFAULT; @Test public void sendDuplicateMessageOnlyGetOneReceipt () throws Exception { final Node aPayload = DOMReader.readXMLDOM (new ClassPathResource (AS4TestConstants.TEST_SOAP_BODY_PAYLOAD_XML)); final Document aDoc = MockMessages.testUserMessageSoapNotSigned (m_eSoapVersion, aPayload, null) .getAsSoapDocument (aPayload); final HttpEntity aEntity = new HttpXMLEntity (aDoc, m_eSoapVersion.getMimeType ()); sendPlainMessage (aEntity, true, null); sendPlainMessage (aEntity, false, EEbmsError.EBMS_OTHER.getErrorCode ()); } // Only use if you need to test the feature, takes a long time @Ignore @Test public void sendDuplicateMessageTestDisposalFeature () throws Exception { final Node aPayload = DOMReader.readXMLDOM (new ClassPathResource (AS4TestConstants.TEST_SOAP_BODY_PAYLOAD_XML)); final Document aDoc = MockMessages.testUserMessageSoapNotSigned (m_eSoapVersion, aPayload, null) .getAsSoapDocument (aPayload); final HttpEntity aEntity = new HttpXMLEntity (aDoc, m_eSoapVersion.getMimeType ()); sendPlainMessage (aEntity, true, null); // Making sure the message gets disposed off // 60 000 = 1 minute, *2 and + 10000 are a buffer // test file is configured for 1 minute can take LONGER if configured // differently Thread.sleep (AS4ServerConfiguration.getIncomingDuplicateDisposalMinutes () * 60000 * 2 + 10000); sendPlainMessage (aEntity, true, null); } }
2,908
0.74717
0.729674
73
38.931507
33.732357
117
false
false
0
0
0
0
0
0
0.643836
false
false
12
8973733ecb62552640bca9118151d19ddb63043d
29,480,655,546,558
857a460a6c8335e099a83d2e7b671618a71b0464
/src/main/java/com/lb/member/service/impl/IPBlacklistServiceImpl.java
51182e98b315a53d34e42a9fbb68addd788b4fec
[]
no_license
zxcv1122BB/lb_n
https://github.com/zxcv1122BB/lb_n
bce2e7c456f4628d615b707f4931bc12c5feff52
9a0a3eb156bb94d66c9176de1e5d506fabecc50e
refs/heads/master
2022-07-10T01:18:47.642000
2019-08-26T14:55:01
2019-08-26T14:55:01
203,388,208
1
1
null
false
2022-06-29T17:35:23
2019-08-20T14:01:58
2020-06-06T17:03:58
2022-06-29T17:35:21
17,955
1
0
7
JavaScript
false
false
package com.lb.member.service.impl; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import com.lb.member.service.IPBlacklistService; import com.lb.sys.dao.IPBlacklistMapper; @Service @Transactional(propagation=Propagation.REQUIRED,readOnly=false,rollbackFor=Exception.class) public class IPBlacklistServiceImpl implements IPBlacklistService { @Autowired private IPBlacklistMapper ipBlacklistMapper; public Integer insertIPBlacklist(Map<String, Object> map) { return ipBlacklistMapper.insertIPBlacklist(map); } public Integer updateIpBlackList(Map<String, Object> map) { return ipBlacklistMapper.updateIpBlackList(map); } public List<Map<String,Object>> selectBlackIpByIp(String ip){ return ipBlacklistMapper.selectBlackIpByIp(ip); } public List<Map<String, Object>> selectBlackIpBystatusAndIP(Map<String, Object> map) { return ipBlacklistMapper.selectBlackIpBystatusAndIP(map); } public Integer deleteBlacklistByid(Integer id) { return ipBlacklistMapper.deleteBlacklistByid(id); } @Override public Integer isExistIp(Map<String, Object> map) { return ipBlacklistMapper.isExistIp(map); } }
UTF-8
Java
1,379
java
IPBlacklistServiceImpl.java
Java
[]
null
[]
package com.lb.member.service.impl; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import com.lb.member.service.IPBlacklistService; import com.lb.sys.dao.IPBlacklistMapper; @Service @Transactional(propagation=Propagation.REQUIRED,readOnly=false,rollbackFor=Exception.class) public class IPBlacklistServiceImpl implements IPBlacklistService { @Autowired private IPBlacklistMapper ipBlacklistMapper; public Integer insertIPBlacklist(Map<String, Object> map) { return ipBlacklistMapper.insertIPBlacklist(map); } public Integer updateIpBlackList(Map<String, Object> map) { return ipBlacklistMapper.updateIpBlackList(map); } public List<Map<String,Object>> selectBlackIpByIp(String ip){ return ipBlacklistMapper.selectBlackIpByIp(ip); } public List<Map<String, Object>> selectBlackIpBystatusAndIP(Map<String, Object> map) { return ipBlacklistMapper.selectBlackIpBystatusAndIP(map); } public Integer deleteBlacklistByid(Integer id) { return ipBlacklistMapper.deleteBlacklistByid(id); } @Override public Integer isExistIp(Map<String, Object> map) { return ipBlacklistMapper.isExistIp(map); } }
1,379
0.806381
0.806381
51
26.039215
27.881374
92
false
false
0
0
0
0
0
0
1.215686
false
false
12
7bb2ebc63f4087d47b9e7764185d76fde5d1a24b
9,156,870,307,819
f2df92c8d64fd47d32f7b9e78dd301803b83fe11
/OsnoviJave/ppllist.java
afcda27f6180381000bd0a9600effddf72797d38
[]
no_license
exdrive/Osnovi-Jave
https://github.com/exdrive/Osnovi-Jave
bc11ce22025a684eb8d49ebe80366edd453677b1
0ada1518d451ee6332d901676271a602fcd19a50
refs/heads/master
2021-01-21T05:17:03.038000
2017-02-25T22:31:15
2017-02-25T22:31:15
83,167,054
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package MultipleClassesLearning; public enum ppllist { nikola("dock", "matf", "2. godina", 1996), pavle("glen", "znrfak", "3. godina", 1996), predrag("djuzepe", "elfak", "1. godina", 1995), djordje("space", "medfak", "2. godina", 1996), aleksa("fiza", "metro", "1. godina", 1996), djole("proto", "elfak", "2. godina", 1996), dimi("bonca", "elfak", "2. godina", 1996), milos("cvele", "fizfak", "4. godina", 1992); private String nadimakCoveka; private String fakultetCoveka; private String godinaFakulteta; private int godisteCoveka; ppllist(String nadimak, String faks, String god, int godiste) { nadimakCoveka = nadimak; fakultetCoveka = faks; godinaFakulteta = god; godisteCoveka = godiste; } public String getInfo() { return String.format("\t%s\t%s\t%s\t%d", nadimakCoveka, fakultetCoveka, godinaFakulteta, godisteCoveka); } }
UTF-8
Java
862
java
ppllist.java
Java
[ { "context": "earning;\n\npublic enum ppllist {\n\n\tnikola(\"dock\", \"matf\", \"2. godina\", 1996),\n\tpavle(\"glen\", \"znrfak\", \"3", "end": 78, "score": 0.9919750690460205, "start": 74, "tag": "NAME", "value": "matf" }, { "context": "ikola(\"dock\", \"matf\", \"2. godina\", 1996),\n\tpavle(\"glen\", \"znrfak\", \"3. godina\", 1996),\n\tpredrag(\"djuzepe", "end": 113, "score": 0.9115780591964722, "start": 109, "tag": "NAME", "value": "glen" }, { "context": "ock\", \"matf\", \"2. godina\", 1996),\n\tpavle(\"glen\", \"znrfak\", \"3. godina\", 1996),\n\tpredrag(\"djuzepe\", \"elfak\"", "end": 123, "score": 0.9466103911399841, "start": 117, "tag": "NAME", "value": "znrfak" }, { "context": "e(\"glen\", \"znrfak\", \"3. godina\", 1996),\n\tpredrag(\"djuzepe\", \"elfak\", \"1. godina\", 1995),\n\tdjordje(\"space\", ", "end": 163, "score": 0.9355887174606323, "start": 156, "tag": "NAME", "value": "djuzepe" }, { "context": "fak\", \"3. godina\", 1996),\n\tpredrag(\"djuzepe\", \"elfak\", \"1. godina\", 1995),\n\tdjordje(\"space\", \"medfak\",", "end": 172, "score": 0.8207067847251892, "start": 170, "tag": "NAME", "value": "ak" }, { "context": "\"elfak\", \"1. godina\", 1995),\n\tdjordje(\"space\", \"medfak\", \"2. godina\", 1996),\n\taleksa(\"fiza\", \"metro\", \"1", "end": 220, "score": 0.7174451351165771, "start": 216, "tag": "NAME", "value": "dfak" }, { "context": "e(\"space\", \"medfak\", \"2. godina\", 1996),\n\taleksa(\"fiza\", \"metro\", \"1. godina\", 1996),\n\tdjole(\"proto\", \"e", "end": 256, "score": 0.6704279184341431, "start": 252, "tag": "NAME", "value": "fiza" }, { "context": "jole(\"proto\", \"elfak\", \"2. godina\", 1996),\n\tdimi(\"bonca\", \"elfak\", \"2. godina\", 1996),\n\tmilos(\"cvele\", \"f", "end": 345, "score": 0.9133396148681641, "start": 340, "tag": "NAME", "value": "bonca" }, { "context": ", \"elfak\", \"2. godina\", 1996),\n\tdimi(\"bonca\", \"elfak\", \"2. godina\", 1996),\n\tmilos(\"cvele\", \"fizfak\", \"", "end": 354, "score": 0.7476540207862854, "start": 352, "tag": "NAME", "value": "ak" }, { "context": "imi(\"bonca\", \"elfak\", \"2. godina\", 1996),\n\tmilos(\"cvele\", \"fizfak\", \"4. godina\", 1992);\n\n\tprivate String ", "end": 390, "score": 0.8048575520515442, "start": 385, "tag": "NAME", "value": "cvele" }, { "context": "a\", \"elfak\", \"2. godina\", 1996),\n\tmilos(\"cvele\", \"fizfak\", \"4. godina\", 1992);\n\n\tprivate String nadimakCov", "end": 400, "score": 0.9539814591407776, "start": 394, "tag": "NAME", "value": "fizfak" } ]
null
[]
package MultipleClassesLearning; public enum ppllist { nikola("dock", "matf", "2. godina", 1996), pavle("glen", "znrfak", "3. godina", 1996), predrag("djuzepe", "elfak", "1. godina", 1995), djordje("space", "medfak", "2. godina", 1996), aleksa("fiza", "metro", "1. godina", 1996), djole("proto", "elfak", "2. godina", 1996), dimi("bonca", "elfak", "2. godina", 1996), milos("cvele", "fizfak", "4. godina", 1992); private String nadimakCoveka; private String fakultetCoveka; private String godinaFakulteta; private int godisteCoveka; ppllist(String nadimak, String faks, String god, int godiste) { nadimakCoveka = nadimak; fakultetCoveka = faks; godinaFakulteta = god; godisteCoveka = godiste; } public String getInfo() { return String.format("\t%s\t%s\t%s\t%d", nadimakCoveka, fakultetCoveka, godinaFakulteta, godisteCoveka); } }
862
0.684455
0.638051
30
27.733334
23.501678
106
false
false
0
0
0
0
0
0
2.5
false
false
12
1e1e178d65e091b87384bbb33ce46a490502c0e8
11,424,613,064,680
2049aa4c370abda69284d7ed4c1c49efea72705a
/src/Entity/NhaCungCap.java
af1209ccfaaee0dbdf1a25c424b4e7c0bdf07354
[]
no_license
doanhieudtu/JavaFX-Managerment-For-Saler
https://github.com/doanhieudtu/JavaFX-Managerment-For-Saler
6983a70541a2e2563ede6a6a73a3eabf78233a78
673423f5140d7ccf0ae675bc4ca577e282a1fbeb
refs/heads/master
2020-05-21T21:04:44.285000
2019-05-11T14:59:00
2019-05-11T14:59:00
186,146,315
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Entity; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @XmlRootElement(name="NhaCungCap") @XmlAccessorType(XmlAccessType.FIELD) @JsonIgnoreProperties(ignoreUnknown = true) public class NhaCungCap { private int manhaccap; private String tencongty; private String diachi; private String sodt; /*email*/ private String email; private NhomNhaCCap nhomNhaCCap; public int getManhaccap() { return manhaccap; } public void setManhaccap(int manhaccap) { this.manhaccap = manhaccap; } public String getTencongty() { return tencongty; } public void setTencongty(String tencongty) { this.tencongty = tencongty; } public String getDiachi() { return diachi; } public void setDiachi(String diachi) { this.diachi = diachi; } public String getSodt() { return sodt; } public void setSodt(String sodt) { this.sodt = sodt; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public NhomNhaCCap getNhomNhaCCap() { return nhomNhaCCap; } public void setNhomNhaCCap(NhomNhaCCap nhomNhaCCap) { this.nhomNhaCCap = nhomNhaCCap; } /*1 nhà cung cấp có thể cung cấp nhiều loại hàng*/ // @OneToMany(mappedBy = "nhaCungCap", fetch = FetchType.LAZY) // List<NhaCC_LoaiHang> lsNhaCC_loaiHang; // // /*1 nhà cung cấp có thể cung cấp nhiều mặt hàng*/ // @JsonBackReference // @OneToMany(mappedBy = "nhaCungCap", fetch = FetchType.LAZY) // List<NhaCC_MatHang> ls_Mat_hang_NhaCC; }
UTF-8
Java
1,726
java
NhaCungCap.java
Java
[]
null
[]
package Entity; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @XmlRootElement(name="NhaCungCap") @XmlAccessorType(XmlAccessType.FIELD) @JsonIgnoreProperties(ignoreUnknown = true) public class NhaCungCap { private int manhaccap; private String tencongty; private String diachi; private String sodt; /*email*/ private String email; private NhomNhaCCap nhomNhaCCap; public int getManhaccap() { return manhaccap; } public void setManhaccap(int manhaccap) { this.manhaccap = manhaccap; } public String getTencongty() { return tencongty; } public void setTencongty(String tencongty) { this.tencongty = tencongty; } public String getDiachi() { return diachi; } public void setDiachi(String diachi) { this.diachi = diachi; } public String getSodt() { return sodt; } public void setSodt(String sodt) { this.sodt = sodt; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public NhomNhaCCap getNhomNhaCCap() { return nhomNhaCCap; } public void setNhomNhaCCap(NhomNhaCCap nhomNhaCCap) { this.nhomNhaCCap = nhomNhaCCap; } /*1 nhà cung cấp có thể cung cấp nhiều loại hàng*/ // @OneToMany(mappedBy = "nhaCungCap", fetch = FetchType.LAZY) // List<NhaCC_LoaiHang> lsNhaCC_loaiHang; // // /*1 nhà cung cấp có thể cung cấp nhiều mặt hàng*/ // @JsonBackReference // @OneToMany(mappedBy = "nhaCungCap", fetch = FetchType.LAZY) // List<NhaCC_MatHang> ls_Mat_hang_NhaCC; }
1,726
0.714118
0.712941
85
19
19.332386
66
false
false
0
0
0
0
0
0
1
false
false
12
28bf291dc242d73244b270423b4a823df4fdd2c0
21,002,390,134,819
6b23d8ae464de075ad006c204bd7e946971b0570
/WEB-INF/plugin/bookmark/src/jp/groupsession/v2/bmk/model/BmkHtmlDataModel.java
2a2652c1f0e7e6966cefa5aaa526ecb56205de3c
[]
no_license
kosuke8/gsession
https://github.com/kosuke8/gsession
a259c71857ed36811bd8eeac19c456aa8f96c61e
edd22517a22d1fb2c9339fc7f2a52e4122fc1992
refs/heads/master
2021-08-20T05:43:09.431000
2017-11-28T07:10:08
2017-11-28T07:10:08
112,293,459
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package jp.groupsession.v2.bmk.model; import java.io.Serializable; /** * <p>HTMLから取得した情報を格納するModel * * @author JTS */ public class BmkHtmlDataModel implements Serializable { /** タイトル */ private String title__; /** コメント */ private String description__; /** * <p>description を取得します。 * @return description */ public String getDescription() { return description__; } /** * <p>description をセットします。 * @param description description */ public void setDescription(String description) { description__ = description; } /** * <p>title を取得します。 * @return title */ public String getTitle() { return title__; } /** * <p>title をセットします。 * @param title title */ public void setTitle(String title) { title__ = title; } }
UTF-8
Java
1,013
java
BmkHtmlDataModel.java
Java
[ { "context": "\n/**\r\n * <p>HTMLから取得した情報を格納するModel\r\n *\r\n * @author JTS\r\n */\r\npublic class BmkHtmlDataModel implements Se", "end": 126, "score": 0.9994958639144897, "start": 123, "tag": "USERNAME", "value": "JTS" } ]
null
[]
package jp.groupsession.v2.bmk.model; import java.io.Serializable; /** * <p>HTMLから取得した情報を格納するModel * * @author JTS */ public class BmkHtmlDataModel implements Serializable { /** タイトル */ private String title__; /** コメント */ private String description__; /** * <p>description を取得します。 * @return description */ public String getDescription() { return description__; } /** * <p>description をセットします。 * @param description description */ public void setDescription(String description) { description__ = description; } /** * <p>title を取得します。 * @return title */ public String getTitle() { return title__; } /** * <p>title をセットします。 * @param title title */ public void setTitle(String title) { title__ = title; } }
1,013
0.542261
0.541164
45
18.244444
14.621378
55
false
false
0
0
0
0
0
0
0.177778
false
false
12
ac6c54a2995d0ac3ca1c9d1d30b743807d79b807
31,568,009,670,977
16640ec15e2dd0916cfe1a6b4ca70fc852b09a64
/wadp/src/main/java/com/hongguaninfo/hgdf/wadp/web/sys/SysUserGroupController.java
f3fb05714b8b70167e6b0d861f66d246ed660d04
[]
no_license
hhp676/LaiWuWater
https://github.com/hhp676/LaiWuWater
5d569fc205037f1883a5e65565a7ee57d8830cb8
a57f1f20b008070ee160156afaf229376bfe551c
refs/heads/master
2020-04-01T09:27:17.223000
2018-10-24T07:45:57
2018-10-24T07:45:57
153,070,956
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hongguaninfo.hgdf.wadp.web.sys; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.hongguaninfo.hgdf.wadp.core.aop.log.UserLog; import com.hongguaninfo.hgdf.wadp.core.base.BasePage; import com.hongguaninfo.hgdf.wadp.core.exception.BizException; import com.hongguaninfo.hgdf.wadp.core.interceptor.RepeatSubmitToken; import com.hongguaninfo.hgdf.wadp.core.templete.HttpTemplete; import com.hongguaninfo.hgdf.wadp.core.templete.OperateTemplete; import com.hongguaninfo.hgdf.wadp.entity.sys.SysUserGroup; import com.hongguaninfo.hgdf.wadp.service.sys.SysRoleUgroupJoinService; import com.hongguaninfo.hgdf.wadp.service.sys.SysUgroupAuthJoinService; import com.hongguaninfo.hgdf.wadp.service.sys.SysUserGroupService; import com.hongguaninfo.hgdf.wadp.shiro.conf.Auths; import com.hongguaninfo.hgdf.core.utils.exception.BaseException; @Controller @RequestMapping("/sys/userGroup") public class SysUserGroupController { @Autowired private SysUserGroupService sysUserGroupService; @Autowired private SysRoleUgroupJoinService sysRoleUgroupJoinService; @Autowired private SysUgroupAuthJoinService sysUgroupAuthJoinService; @RequestMapping(value = "/showSysUserGroup") @RequiresPermissions(Auths.SYS_USERGROUP) public String showSysUserGroup(HttpServletRequest request, HttpServletResponse response, Model model) { OperateTemplete templete = new HttpTemplete(request) { protected void doSomething() throws BaseException { str = "sys/sysUserGroup_show"; } }; return templete.operateModel(); } @RequestMapping(value = "/sysUserGroupDetail/{groupId}/{fid}") @RequiresPermissions(Auths.SYS_USERGROUP_VIEW) public String sysUserGroupDetail(@PathVariable int groupId, @PathVariable int fid, HttpServletRequest request, HttpServletResponse response, Model model) throws BizException { model.addAttribute("fid", fid); SysUserGroup bo = sysUserGroupService.getUserGroupById(groupId); if (groupId == 0 && fid != 0) { bo.setfName(sysUserGroupService.getUserGroupById(fid) .getGroupName()); } model.addAttribute("userGroup", bo); OperateTemplete templete = new HttpTemplete(request) { protected void doSomething() throws BaseException { str = "sys/sysUserGroup_detail"; } }; return templete.operateModel(); } @RequestMapping("/list") @RequiresPermissions(Auths.SYS_USERGROUP) @ResponseBody public Map getSysUserGroupList(final SysUserGroup vo, final BasePage basePage, HttpServletResponse response, HttpServletRequest request) { OperateTemplete templete = new HttpTemplete(request) { protected void doSomething() throws BizException { sysUserGroupService.getSysUserGroupList(basePage, vo, map); } }; return templete.operate(); } @RequestMapping("/add") @RequiresPermissions(Auths.SYS_USERGROUP_ADD) @ResponseBody @RepeatSubmitToken(removeToken = true) @UserLog(code = "addSysUserGroup", name = "增加用户组", remarkClass = SysUserGroup.class) public Map addSysUserGroup(@Valid final SysUserGroup vo, BindingResult result, HttpServletResponse response, final HttpServletRequest request) { OperateTemplete templete = new HttpTemplete(request, result) { protected void doSomething() throws BizException { if (doValidate()) { sysUserGroupService.insertUserGroup(vo); } } }; return templete.operate(); } @RequestMapping("/edit") @RequiresPermissions(Auths.SYS_USERGROUP_EDIT) @ResponseBody @UserLog(code = "editSysUserGroup", name = "修改用户组", remarkClass = SysUserGroup.class) public Map editSysUserGroup(final SysUserGroup vo, HttpServletResponse response, final HttpServletRequest request) { OperateTemplete templete = new HttpTemplete(request) { protected void doSomething() throws BizException { if (doValidate()) { sysUserGroupService.updateUserGroup(vo); } } }; return templete.operate(); } @RequestMapping("/delete") @RequiresPermissions(Auths.SYS_USERGROUP_DELETE) @ResponseBody @UserLog(code = "deleteSysUserGroup", name = "删除用户组", remarkClass = Integer.class) public Map deleteSysUserGroup(final Integer id, HttpServletResponse response, final HttpServletRequest request) { OperateTemplete templete = new HttpTemplete(request) { protected void doSomething() throws BizException { sysUserGroupService.deleteById(id); } }; return templete.operate(); } @RequestMapping("/authList") @ResponseBody public Map getSysAuthList(final int groupId, final BasePage basePage, HttpServletResponse response, HttpServletRequest request) { OperateTemplete templete = new HttpTemplete(request) { protected void doSomething() throws BizException { map.put("list", sysUgroupAuthJoinService.getListByGroupId(groupId)); } }; return templete.operate(); } @RequestMapping("/roleList") @ResponseBody public Map getSysRoleList(final int groupId, final BasePage basePage, HttpServletResponse response, HttpServletRequest request) { OperateTemplete templete = new HttpTemplete(request) { protected void doSomething() throws BizException { map.put("list", sysRoleUgroupJoinService.getListByGroupId(groupId)); } }; return templete.operate(); } }
UTF-8
Java
6,527
java
SysUserGroupController.java
Java
[]
null
[]
package com.hongguaninfo.hgdf.wadp.web.sys; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.hongguaninfo.hgdf.wadp.core.aop.log.UserLog; import com.hongguaninfo.hgdf.wadp.core.base.BasePage; import com.hongguaninfo.hgdf.wadp.core.exception.BizException; import com.hongguaninfo.hgdf.wadp.core.interceptor.RepeatSubmitToken; import com.hongguaninfo.hgdf.wadp.core.templete.HttpTemplete; import com.hongguaninfo.hgdf.wadp.core.templete.OperateTemplete; import com.hongguaninfo.hgdf.wadp.entity.sys.SysUserGroup; import com.hongguaninfo.hgdf.wadp.service.sys.SysRoleUgroupJoinService; import com.hongguaninfo.hgdf.wadp.service.sys.SysUgroupAuthJoinService; import com.hongguaninfo.hgdf.wadp.service.sys.SysUserGroupService; import com.hongguaninfo.hgdf.wadp.shiro.conf.Auths; import com.hongguaninfo.hgdf.core.utils.exception.BaseException; @Controller @RequestMapping("/sys/userGroup") public class SysUserGroupController { @Autowired private SysUserGroupService sysUserGroupService; @Autowired private SysRoleUgroupJoinService sysRoleUgroupJoinService; @Autowired private SysUgroupAuthJoinService sysUgroupAuthJoinService; @RequestMapping(value = "/showSysUserGroup") @RequiresPermissions(Auths.SYS_USERGROUP) public String showSysUserGroup(HttpServletRequest request, HttpServletResponse response, Model model) { OperateTemplete templete = new HttpTemplete(request) { protected void doSomething() throws BaseException { str = "sys/sysUserGroup_show"; } }; return templete.operateModel(); } @RequestMapping(value = "/sysUserGroupDetail/{groupId}/{fid}") @RequiresPermissions(Auths.SYS_USERGROUP_VIEW) public String sysUserGroupDetail(@PathVariable int groupId, @PathVariable int fid, HttpServletRequest request, HttpServletResponse response, Model model) throws BizException { model.addAttribute("fid", fid); SysUserGroup bo = sysUserGroupService.getUserGroupById(groupId); if (groupId == 0 && fid != 0) { bo.setfName(sysUserGroupService.getUserGroupById(fid) .getGroupName()); } model.addAttribute("userGroup", bo); OperateTemplete templete = new HttpTemplete(request) { protected void doSomething() throws BaseException { str = "sys/sysUserGroup_detail"; } }; return templete.operateModel(); } @RequestMapping("/list") @RequiresPermissions(Auths.SYS_USERGROUP) @ResponseBody public Map getSysUserGroupList(final SysUserGroup vo, final BasePage basePage, HttpServletResponse response, HttpServletRequest request) { OperateTemplete templete = new HttpTemplete(request) { protected void doSomething() throws BizException { sysUserGroupService.getSysUserGroupList(basePage, vo, map); } }; return templete.operate(); } @RequestMapping("/add") @RequiresPermissions(Auths.SYS_USERGROUP_ADD) @ResponseBody @RepeatSubmitToken(removeToken = true) @UserLog(code = "addSysUserGroup", name = "增加用户组", remarkClass = SysUserGroup.class) public Map addSysUserGroup(@Valid final SysUserGroup vo, BindingResult result, HttpServletResponse response, final HttpServletRequest request) { OperateTemplete templete = new HttpTemplete(request, result) { protected void doSomething() throws BizException { if (doValidate()) { sysUserGroupService.insertUserGroup(vo); } } }; return templete.operate(); } @RequestMapping("/edit") @RequiresPermissions(Auths.SYS_USERGROUP_EDIT) @ResponseBody @UserLog(code = "editSysUserGroup", name = "修改用户组", remarkClass = SysUserGroup.class) public Map editSysUserGroup(final SysUserGroup vo, HttpServletResponse response, final HttpServletRequest request) { OperateTemplete templete = new HttpTemplete(request) { protected void doSomething() throws BizException { if (doValidate()) { sysUserGroupService.updateUserGroup(vo); } } }; return templete.operate(); } @RequestMapping("/delete") @RequiresPermissions(Auths.SYS_USERGROUP_DELETE) @ResponseBody @UserLog(code = "deleteSysUserGroup", name = "删除用户组", remarkClass = Integer.class) public Map deleteSysUserGroup(final Integer id, HttpServletResponse response, final HttpServletRequest request) { OperateTemplete templete = new HttpTemplete(request) { protected void doSomething() throws BizException { sysUserGroupService.deleteById(id); } }; return templete.operate(); } @RequestMapping("/authList") @ResponseBody public Map getSysAuthList(final int groupId, final BasePage basePage, HttpServletResponse response, HttpServletRequest request) { OperateTemplete templete = new HttpTemplete(request) { protected void doSomething() throws BizException { map.put("list", sysUgroupAuthJoinService.getListByGroupId(groupId)); } }; return templete.operate(); } @RequestMapping("/roleList") @ResponseBody public Map getSysRoleList(final int groupId, final BasePage basePage, HttpServletResponse response, HttpServletRequest request) { OperateTemplete templete = new HttpTemplete(request) { protected void doSomething() throws BizException { map.put("list", sysRoleUgroupJoinService.getListByGroupId(groupId)); } }; return templete.operate(); } }
6,527
0.689703
0.689395
165
38.375759
25.507301
89
false
false
0
0
0
0
0
0
0.551515
false
false
12
0e857d3aff32a1bca94d4756dffb48920334d92b
14,723,147,943,185
33b60ccf3d992e139edd8053156320435c7d1910
/src/main/java/com/appcity/app/estadistica/services/IEstadisticaService.java
c3b1a66e7194f3d68a742117f8e74a3664139da0
[]
no_license
DavidGuerrero95/Microservice-Statistics-with-MongoDB
https://github.com/DavidGuerrero95/Microservice-Statistics-with-MongoDB
110600491637b60c390144f2817fc4d3abbcfdc8
0f5d04bfcbbb74aa61c89a11366c4741c10c1926
refs/heads/master
2023-08-06T19:31:44.495000
2021-09-17T05:37:38
2021-09-17T05:37:38
407,419,189
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.appcity.app.estadistica.services; import java.util.List; import com.appcity.app.estadistica.models.Proyectos; import com.appcity.app.estadistica.request.Resultados; public interface IEstadisticaService { public List<List<String>> tipoUnoCuatro(int i, Proyectos proyecto, Resultados resultados); public List<List<String>> tipoDos(int i, Proyectos proyecto, Resultados resultados); public List<List<String>> tipoTres(int i, Proyectos proyecto, Resultados resultados); }
UTF-8
Java
493
java
IEstadisticaService.java
Java
[]
null
[]
package com.appcity.app.estadistica.services; import java.util.List; import com.appcity.app.estadistica.models.Proyectos; import com.appcity.app.estadistica.request.Resultados; public interface IEstadisticaService { public List<List<String>> tipoUnoCuatro(int i, Proyectos proyecto, Resultados resultados); public List<List<String>> tipoDos(int i, Proyectos proyecto, Resultados resultados); public List<List<String>> tipoTres(int i, Proyectos proyecto, Resultados resultados); }
493
0.799189
0.799189
17
28
33.562935
91
false
false
0
0
0
0
0
0
1.058824
false
false
12
14b653c043d3be4a6548cc94894af2d79a894c57
28,458,453,370,267
caaa0d09ae6db7bd4f2cd2dffd9e0fa64d918b1b
/app/src/main/java/com/example/myapplication/Administration/Admin_Panel/ParcelDetailActivity.java
520ed0ce1f4afc23b8e3ffbf3053e24075422211
[]
no_license
MudassirHussain-dev/FinalPPP
https://github.com/MudassirHussain-dev/FinalPPP
567d485086d07b9949d8016071385e9d756571c4
0ddfc88b1a9f7fd2c644b14a5904bf6377415d3f
refs/heads/master
2023-06-16T21:48:16.711000
2021-07-03T12:08:49
2021-07-03T12:08:49
380,699,720
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.myapplication.Administration.Admin_Panel; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.widget.TextView; import com.example.myapplication.R; public class ParcelDetailActivity extends AppCompatActivity { TextView id,articleno,time,date,bookingoggice,deliveryoffice,destination,mobile,email,name; Bundle bundle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_parcel_detail); id=findViewById(R.id.txt_parcle_ID); articleno=findViewById(R.id.txt_parcle_article_number); time=findViewById(R.id.txt_booking_parcel_register_time); date=findViewById(R.id.txt_booking_parcel_register_date); bookingoggice=findViewById(R.id.txt_booking_parcel_register_bookingoffice); deliveryoffice=findViewById(R.id.txt_booking_parcel_delivery_office); destination=findViewById(R.id.txt_destination_parcel_office); email=findViewById(R.id.txt_registaremaildetail); mobile=findViewById(R.id.txt_parcel_register_customer_mobileno); name = findViewById(R.id.txt_customername); bundle=getIntent().getExtras(); if(bundle!=null){ id.setText(bundle.getString("ID")); articleno.setText(bundle.getString("Track_ID")); time.setText(bundle.getString("Datee")); date.setText(bundle.getString("Timee")); bookingoggice.setText(bundle.getString("Delivery_office")); deliveryoffice.setText(bundle.getString("Bookig_office")); destination.setText(bundle.getString("Target_Office")); mobile.setText(bundle.getString("Mobile_no")); name.setText(bundle.getString("CustomerName")); email.setText(bundle.getString("Email_Id")); } } }
UTF-8
Java
1,908
java
ParcelDetailActivity.java
Java
[]
null
[]
package com.example.myapplication.Administration.Admin_Panel; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.widget.TextView; import com.example.myapplication.R; public class ParcelDetailActivity extends AppCompatActivity { TextView id,articleno,time,date,bookingoggice,deliveryoffice,destination,mobile,email,name; Bundle bundle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_parcel_detail); id=findViewById(R.id.txt_parcle_ID); articleno=findViewById(R.id.txt_parcle_article_number); time=findViewById(R.id.txt_booking_parcel_register_time); date=findViewById(R.id.txt_booking_parcel_register_date); bookingoggice=findViewById(R.id.txt_booking_parcel_register_bookingoffice); deliveryoffice=findViewById(R.id.txt_booking_parcel_delivery_office); destination=findViewById(R.id.txt_destination_parcel_office); email=findViewById(R.id.txt_registaremaildetail); mobile=findViewById(R.id.txt_parcel_register_customer_mobileno); name = findViewById(R.id.txt_customername); bundle=getIntent().getExtras(); if(bundle!=null){ id.setText(bundle.getString("ID")); articleno.setText(bundle.getString("Track_ID")); time.setText(bundle.getString("Datee")); date.setText(bundle.getString("Timee")); bookingoggice.setText(bundle.getString("Delivery_office")); deliveryoffice.setText(bundle.getString("Bookig_office")); destination.setText(bundle.getString("Target_Office")); mobile.setText(bundle.getString("Mobile_no")); name.setText(bundle.getString("CustomerName")); email.setText(bundle.getString("Email_Id")); } } }
1,908
0.698637
0.698637
45
41.400002
27.476374
95
false
false
0
0
0
0
0
0
0.866667
false
false
12
21ce38a79179fb8af5f6e2375c65ef78f256abcb
27,582,279,980,014
e0089275433a01e6836b6742fedf0e5e42bfb874
/src/com/thread/exam/Exam02.java
6c67eb55a70b67ace82f16f5fd3c765abb8259eb
[]
no_license
rainty02/JavaTheorem
https://github.com/rainty02/JavaTheorem
82b1240d06f6fccce6a4994df64efb50e3085db5
c283e0275ed76f3433ad9e95525825a8592e0ec8
refs/heads/main
2023-08-27T08:22:15.953000
2021-09-29T14:58:56
2021-09-29T14:58:56
371,240,224
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.thread.exam; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Scanner; public class Exam02 { public static void main(String[] args) { // 2.복사하고자 하는 파일 경로와 복사할 파일의 디렉토리 주소를 받아 // 파일을 복사하는 프로그램을 만들어봅시다. // ①복사할 대상 파일의 경로와 복사해올 위치 경로를 받는 메인 스레드는 멈춤 없이 실행하고 String origin; String copyPath; String copyName; Scanner sc = new Scanner(System.in); // 원본파일의 경로를 받아 해당 경로의 파일이 있는지 확인 System.out.print("원본 파일의 이름과 경로를 입력해주세요 > "); origin = sc.nextLine(); File originPath = new File(origin); System.out.println(originPath); if (!originPath.exists()) { System.out.println("파일이 존재하지 않습니다."); System.out.println("경로를 확인해주세요."); } // 복사될 파일의 경로를 확인 후 디렉토리 생성 System.out.print("복사될 파일의 경로를 입력해주세요 > "); copyPath = sc.nextLine(); File copy = new File(copyPath); System.out.println(copyPath); if (!copy.exists()) { copy.mkdir(); System.out.println("디렉토리를 생성했습니다."); } // 복사될 파일의 이름을 받아 경로 입력 System.out.print("복사될 파일의 이름를 입력해주세요 > "); copyName = copyPath + "\\" + "\\" + sc.nextLine(); System.out.println(copyName); // 데이터의 복사는 스레드로 처리하는 프로그램을 만들어 봅시다. CopyThread ct = new CopyThread(origin, copyName); ct.start(); } } class CopyThread extends Thread { String origin; String copy; public CopyThread(String origin, String copy) { this.origin = origin; this.copy = copy; } public void run() { try { // 원본과 복사할 파일의 경로 입력 InputStream in = new FileInputStream(this.origin); OutputStream out = new FileOutputStream(this.copy); BufferedInputStream fin = new BufferedInputStream(in); BufferedOutputStream fout = new BufferedOutputStream(out); // 카피한 데이터의 크기 int copyByte = 0; // 파일에서 읽어올 바이트 데이터 int bData = -1; while(true) { bData = fin.read(); // 파일의 모든 데이터를 읽으면 -1 반환하며 반복탈출 if(bData==-1) { break; } // 데이터 저장 fout.write(bData); copyByte++; } // ②파일이 복사가 완료되면 완료 메시지를 콘솔에 출력합시다. System.out.println("복사 완료 ("+copyByte+"byte)"); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
UTF-8
Java
3,090
java
Exam02.java
Java
[]
null
[]
package com.thread.exam; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Scanner; public class Exam02 { public static void main(String[] args) { // 2.복사하고자 하는 파일 경로와 복사할 파일의 디렉토리 주소를 받아 // 파일을 복사하는 프로그램을 만들어봅시다. // ①복사할 대상 파일의 경로와 복사해올 위치 경로를 받는 메인 스레드는 멈춤 없이 실행하고 String origin; String copyPath; String copyName; Scanner sc = new Scanner(System.in); // 원본파일의 경로를 받아 해당 경로의 파일이 있는지 확인 System.out.print("원본 파일의 이름과 경로를 입력해주세요 > "); origin = sc.nextLine(); File originPath = new File(origin); System.out.println(originPath); if (!originPath.exists()) { System.out.println("파일이 존재하지 않습니다."); System.out.println("경로를 확인해주세요."); } // 복사될 파일의 경로를 확인 후 디렉토리 생성 System.out.print("복사될 파일의 경로를 입력해주세요 > "); copyPath = sc.nextLine(); File copy = new File(copyPath); System.out.println(copyPath); if (!copy.exists()) { copy.mkdir(); System.out.println("디렉토리를 생성했습니다."); } // 복사될 파일의 이름을 받아 경로 입력 System.out.print("복사될 파일의 이름를 입력해주세요 > "); copyName = copyPath + "\\" + "\\" + sc.nextLine(); System.out.println(copyName); // 데이터의 복사는 스레드로 처리하는 프로그램을 만들어 봅시다. CopyThread ct = new CopyThread(origin, copyName); ct.start(); } } class CopyThread extends Thread { String origin; String copy; public CopyThread(String origin, String copy) { this.origin = origin; this.copy = copy; } public void run() { try { // 원본과 복사할 파일의 경로 입력 InputStream in = new FileInputStream(this.origin); OutputStream out = new FileOutputStream(this.copy); BufferedInputStream fin = new BufferedInputStream(in); BufferedOutputStream fout = new BufferedOutputStream(out); // 카피한 데이터의 크기 int copyByte = 0; // 파일에서 읽어올 바이트 데이터 int bData = -1; while(true) { bData = fin.read(); // 파일의 모든 데이터를 읽으면 -1 반환하며 반복탈출 if(bData==-1) { break; } // 데이터 저장 fout.write(bData); copyByte++; } // ②파일이 복사가 완료되면 완료 메시지를 콘솔에 출력합시다. System.out.println("복사 완료 ("+copyByte+"byte)"); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
3,090
0.660214
0.656507
105
22.133333
16.553558
61
false
false
0
0
0
0
0
0
2.361905
false
false
12
fd979cb7f14be7b3ca1383505b2afeda8f38741b
23,536,420,796,740
ddd8c38c4d7976f86cef68916fb959c7255ebd03
/src/com/baodian/service/file/impl/FileManagerImpl.java
a2f75307357475d0f0af19ccb18695fec0573351
[]
no_license
gitBaodian/xxbmis
https://github.com/gitBaodian/xxbmis
e8e0928875c3fe99af5c9e6dd65d4ca87a93ca3f
f61181de75e7f47c3f4360e2a70ce9e3a95563cd
refs/heads/master
2021-01-17T08:15:59.879000
2016-04-05T02:26:05
2016-04-05T02:26:05
39,928,836
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.baodian.service.file.impl; import java.io.File; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Hashtable; import java.util.List; import org.apache.struts2.ServletActionContext; import org.json.simple.JSONObject; import org.springframework.stereotype.Service; import com.baodian.service.file.FileManager; import com.baodian.service.util.InitDataManager; import com.baodian.util.file.NameComparator; import com.baodian.util.file.SizeComparator; import com.baodian.util.file.TypeComparator; @Service("fileManager") public class FileManagerImpl implements FileManager { @SuppressWarnings({ "unchecked", "rawtypes" }) public String filesMes(int userId, String dirName, String path, String order) { //根目录路径,可以指定绝对路径,比如 /var/www/documents/ String basepath = InitDataManager.upload[4] + userId + "/"; String rootPath = ServletActionContext.getServletContext().getRealPath(basepath) + "/"; //根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/documents/ String rootUrl = ServletActionContext.getServletContext().getContextPath() + basepath; File currentPathFile = new File(rootPath); if (!currentPathFile.exists()) { currentPathFile.mkdirs(); } if (dirName != null) { rootPath += dirName + "/"; rootUrl += dirName + "/"; } //根据path参数,设置各路径和URL path = path != null ? path : "";//----------------------------- String currentPath = rootPath + path; String currentUrl = rootUrl + path; String currentDirPath = path; String moveupDirPath = ""; if (!"".equals(path)) { String str = currentDirPath.substring(0, currentDirPath.length() - 1); moveupDirPath = str.lastIndexOf("/") >= 0 ? str.substring(0, str.lastIndexOf("/") + 1) : ""; } //排序形式,name or size or type order = order != null ? order.toLowerCase() : "name"; //不允许使用..移动到上一级目录 if (path.indexOf("..") >= 0) { return "{\"message\":\"不允许访问!\"}"; } //最后一个字符不是/ if (!"".equals(path) && !path.endsWith("/")) { return "{\"message\":\"参数有误!\"}"; } //目录不存在或不是目录 currentPathFile = new File(currentPath); if(!currentPathFile.isDirectory()){ return "{\"message\":\"文件夹不存在,请先上传文件!\"}"; } //遍历目录取的文件信息 List<Hashtable> fileList = new ArrayList<Hashtable>(); if(currentPathFile.listFiles() != null) { String fileName, fileExt; for (File file : currentPathFile.listFiles()) { Hashtable<String, Object> hash = new Hashtable<String, Object>(); fileName = file.getName(); if(file.isDirectory()) { hash.put("is_dir", true); hash.put("has_file", (file.list().length != 0)); hash.put("filesize", 0L); hash.put("is_photo", false); hash.put("filetype", ""); } else if(file.isFile()){ fileExt = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase(); hash.put("is_dir", false); hash.put("has_file", false); hash.put("filesize", file.length()); hash.put("is_photo", InitDataManager.imageSet.contains(fileExt)); hash.put("filetype", fileExt); } hash.put("filename", fileName); hash.put("datetime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(file.lastModified())); fileList.add(hash); } } if ("size".equals(order)) { Collections.sort(fileList, new SizeComparator()); } else if ("type".equals(order)) { Collections.sort(fileList, new TypeComparator()); } else { Collections.sort(fileList, new NameComparator()); } JSONObject result = new JSONObject(); result.put("moveup_dir_path", moveupDirPath); result.put("current_dir_path", currentDirPath); result.put("current_url", currentUrl); result.put("total_count", fileList.size()); result.put("file_list", fileList); return result.toJSONString(); } }
UTF-8
Java
4,055
java
FileManagerImpl.java
Java
[]
null
[]
package com.baodian.service.file.impl; import java.io.File; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Hashtable; import java.util.List; import org.apache.struts2.ServletActionContext; import org.json.simple.JSONObject; import org.springframework.stereotype.Service; import com.baodian.service.file.FileManager; import com.baodian.service.util.InitDataManager; import com.baodian.util.file.NameComparator; import com.baodian.util.file.SizeComparator; import com.baodian.util.file.TypeComparator; @Service("fileManager") public class FileManagerImpl implements FileManager { @SuppressWarnings({ "unchecked", "rawtypes" }) public String filesMes(int userId, String dirName, String path, String order) { //根目录路径,可以指定绝对路径,比如 /var/www/documents/ String basepath = InitDataManager.upload[4] + userId + "/"; String rootPath = ServletActionContext.getServletContext().getRealPath(basepath) + "/"; //根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/documents/ String rootUrl = ServletActionContext.getServletContext().getContextPath() + basepath; File currentPathFile = new File(rootPath); if (!currentPathFile.exists()) { currentPathFile.mkdirs(); } if (dirName != null) { rootPath += dirName + "/"; rootUrl += dirName + "/"; } //根据path参数,设置各路径和URL path = path != null ? path : "";//----------------------------- String currentPath = rootPath + path; String currentUrl = rootUrl + path; String currentDirPath = path; String moveupDirPath = ""; if (!"".equals(path)) { String str = currentDirPath.substring(0, currentDirPath.length() - 1); moveupDirPath = str.lastIndexOf("/") >= 0 ? str.substring(0, str.lastIndexOf("/") + 1) : ""; } //排序形式,name or size or type order = order != null ? order.toLowerCase() : "name"; //不允许使用..移动到上一级目录 if (path.indexOf("..") >= 0) { return "{\"message\":\"不允许访问!\"}"; } //最后一个字符不是/ if (!"".equals(path) && !path.endsWith("/")) { return "{\"message\":\"参数有误!\"}"; } //目录不存在或不是目录 currentPathFile = new File(currentPath); if(!currentPathFile.isDirectory()){ return "{\"message\":\"文件夹不存在,请先上传文件!\"}"; } //遍历目录取的文件信息 List<Hashtable> fileList = new ArrayList<Hashtable>(); if(currentPathFile.listFiles() != null) { String fileName, fileExt; for (File file : currentPathFile.listFiles()) { Hashtable<String, Object> hash = new Hashtable<String, Object>(); fileName = file.getName(); if(file.isDirectory()) { hash.put("is_dir", true); hash.put("has_file", (file.list().length != 0)); hash.put("filesize", 0L); hash.put("is_photo", false); hash.put("filetype", ""); } else if(file.isFile()){ fileExt = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase(); hash.put("is_dir", false); hash.put("has_file", false); hash.put("filesize", file.length()); hash.put("is_photo", InitDataManager.imageSet.contains(fileExt)); hash.put("filetype", fileExt); } hash.put("filename", fileName); hash.put("datetime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(file.lastModified())); fileList.add(hash); } } if ("size".equals(order)) { Collections.sort(fileList, new SizeComparator()); } else if ("type".equals(order)) { Collections.sort(fileList, new TypeComparator()); } else { Collections.sort(fileList, new NameComparator()); } JSONObject result = new JSONObject(); result.put("moveup_dir_path", moveupDirPath); result.put("current_dir_path", currentDirPath); result.put("current_url", currentUrl); result.put("total_count", fileList.size()); result.put("file_list", fileList); return result.toJSONString(); } }
4,055
0.656911
0.654037
104
34.798077
21.980053
98
false
false
0
0
0
0
0
0
3.009615
false
false
12
3fffcc3815ef02e9d9f099c64de9cf6439ceff0f
15,719,580,318,492
29e7ba3678470cb436e041cfd529b074e6fb38a9
/inspurcloud-k8s/incloudmanager-utils/incloudmanager-common/src/main/java/com/inspur/incloud/dao/BaseDaoImpl.java
79c8f731c9cc61d7555907cca07f400a654e3b7d
[]
no_license
sunyandi/springcloud
https://github.com/sunyandi/springcloud
9ce24c1a30ccb396ff7453f39bf8aa13672f33d9
957fcaecb9b24865d9e711074367939d7f7cb131
refs/heads/master
2018-11-18T01:58:24.613000
2018-10-09T08:07:15
2018-10-09T08:07:15
146,541,695
0
2
null
false
2018-08-29T12:28:48
2018-08-29T03:46:30
2018-08-29T03:46:33
2018-08-29T03:46:32
0
0
1
1
null
false
null
package com.inspur.incloud.dao; import java.io.Serializable; import java.util.List; import java.util.Map; import javax.annotation.Resource; import org.hibernate.Query; import org.hibernate.SQLQuery; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.transform.Transformers; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.orm.hibernate4.support.HibernateDaoSupport; //import org.springframework.stereotype.Repository; //@Repository("baseDao") public class BaseDaoImpl<T> extends HibernateDaoSupport implements BaseDao<T> { @Resource public void setSessionFactory0(SessionFactory sessionFactory){ super.setSessionFactory(sessionFactory); } @Autowired private SessionFactory sessionFactory; public Session getCurrentSession() { return sessionFactory.getCurrentSession(); } public Serializable save(T o) { return getCurrentSession().save(o); } public void delete(T o) { getCurrentSession().delete(o); } public void saveOrUpdate(T o) { getCurrentSession().saveOrUpdate(getCurrentSession().merge(o)); } public void update(T o) { getCurrentSession().update(o); } public List<T> getByHQL(boolean withCache, String hql, Map<String, Object> params) { Query q = getCurrentSession().createQuery(hql); if (params != null && !params.isEmpty()) { for (String key : params.keySet()) { q.setParameter(key, params.get(key)); } } return q.setCacheable(withCache).list(); } public List<T> getByHQL(boolean withCache, String hql, Map<String, Object> params, int page, int rows) { Query q = getCurrentSession().createQuery(hql); if (params != null && !params.isEmpty()) { for (String key : params.keySet()) { q.setParameter(key, params.get(key)); } } return q.setCacheable(withCache).setFirstResult((page - 1) * rows)// .setMaxResults(rows)// .list(); } public long countByHQL(boolean withCache, String hql, Map<String, Object> params) { Query q = getCurrentSession().createQuery(hql); if (params != null && !params.isEmpty()) { for (String key : params.keySet()) { q.setParameter(key, params.get(key)); } } return (Long) q.setCacheable(withCache).uniqueResult(); } public long countBySQL(boolean withCache, String sql, Map<String, Object> params) { SQLQuery q = getCurrentSession().createSQLQuery(sql); if (params != null && !params.isEmpty()) { for (String key : params.keySet()) { q.setParameter(key, params.get(key)); } } return (Long) q.setCacheable(withCache).uniqueResult(); } public List<Map<String, Object>> getResultMapBySql(String sql, Map<String, Object> params) { SQLQuery q = getCurrentSession().createSQLQuery(sql); if (params != null && !params.isEmpty()) { for (String key : params.keySet()) { q.setParameter(key, params.get(key)); } } return q.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).list(); } public List<Map<String, Object>> getResultMapBySql(String sql, Map<String, Object> params, int page, int rows) { SQLQuery q = getCurrentSession().createSQLQuery(sql); if (params != null && !params.isEmpty()) { for (String key : params.keySet()) { q.setParameter(key, params.get(key)); } } return q.setFirstResult((page - 1) * rows)// .setMaxResults(rows)// .setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP)// .list(); } public int executeHQL(String hql,Map<String,Object> params) { Query q = getCurrentSession().createQuery(hql); if (params != null && !params.isEmpty()) { for (String key : params.keySet()) { q.setParameter(key, params.get(key)); } } return q.executeUpdate(); } public int executeSQL(String sql,Map<String,Object> params) { SQLQuery q = getCurrentSession().createSQLQuery(sql); if (params != null && !params.isEmpty()) { for (String key : params.keySet()) { q.setParameter(key, params.get(key)); } } return q.executeUpdate(); } }
UTF-8
Java
4,376
java
BaseDaoImpl.java
Java
[]
null
[]
package com.inspur.incloud.dao; import java.io.Serializable; import java.util.List; import java.util.Map; import javax.annotation.Resource; import org.hibernate.Query; import org.hibernate.SQLQuery; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.transform.Transformers; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.orm.hibernate4.support.HibernateDaoSupport; //import org.springframework.stereotype.Repository; //@Repository("baseDao") public class BaseDaoImpl<T> extends HibernateDaoSupport implements BaseDao<T> { @Resource public void setSessionFactory0(SessionFactory sessionFactory){ super.setSessionFactory(sessionFactory); } @Autowired private SessionFactory sessionFactory; public Session getCurrentSession() { return sessionFactory.getCurrentSession(); } public Serializable save(T o) { return getCurrentSession().save(o); } public void delete(T o) { getCurrentSession().delete(o); } public void saveOrUpdate(T o) { getCurrentSession().saveOrUpdate(getCurrentSession().merge(o)); } public void update(T o) { getCurrentSession().update(o); } public List<T> getByHQL(boolean withCache, String hql, Map<String, Object> params) { Query q = getCurrentSession().createQuery(hql); if (params != null && !params.isEmpty()) { for (String key : params.keySet()) { q.setParameter(key, params.get(key)); } } return q.setCacheable(withCache).list(); } public List<T> getByHQL(boolean withCache, String hql, Map<String, Object> params, int page, int rows) { Query q = getCurrentSession().createQuery(hql); if (params != null && !params.isEmpty()) { for (String key : params.keySet()) { q.setParameter(key, params.get(key)); } } return q.setCacheable(withCache).setFirstResult((page - 1) * rows)// .setMaxResults(rows)// .list(); } public long countByHQL(boolean withCache, String hql, Map<String, Object> params) { Query q = getCurrentSession().createQuery(hql); if (params != null && !params.isEmpty()) { for (String key : params.keySet()) { q.setParameter(key, params.get(key)); } } return (Long) q.setCacheable(withCache).uniqueResult(); } public long countBySQL(boolean withCache, String sql, Map<String, Object> params) { SQLQuery q = getCurrentSession().createSQLQuery(sql); if (params != null && !params.isEmpty()) { for (String key : params.keySet()) { q.setParameter(key, params.get(key)); } } return (Long) q.setCacheable(withCache).uniqueResult(); } public List<Map<String, Object>> getResultMapBySql(String sql, Map<String, Object> params) { SQLQuery q = getCurrentSession().createSQLQuery(sql); if (params != null && !params.isEmpty()) { for (String key : params.keySet()) { q.setParameter(key, params.get(key)); } } return q.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).list(); } public List<Map<String, Object>> getResultMapBySql(String sql, Map<String, Object> params, int page, int rows) { SQLQuery q = getCurrentSession().createSQLQuery(sql); if (params != null && !params.isEmpty()) { for (String key : params.keySet()) { q.setParameter(key, params.get(key)); } } return q.setFirstResult((page - 1) * rows)// .setMaxResults(rows)// .setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP)// .list(); } public int executeHQL(String hql,Map<String,Object> params) { Query q = getCurrentSession().createQuery(hql); if (params != null && !params.isEmpty()) { for (String key : params.keySet()) { q.setParameter(key, params.get(key)); } } return q.executeUpdate(); } public int executeSQL(String sql,Map<String,Object> params) { SQLQuery q = getCurrentSession().createSQLQuery(sql); if (params != null && !params.isEmpty()) { for (String key : params.keySet()) { q.setParameter(key, params.get(key)); } } return q.executeUpdate(); } }
4,376
0.636654
0.63574
133
31.902256
26.755329
115
false
false
0
0
0
0
0
0
0.62406
false
false
12
d3d21556677fc3f825c7a646a4a67bd6201d5dee
13,237,089,210,472
1364c55f09d1535c7bd7ca2a66775141f4924440
/DesignMode-proxy/src/com/szjz/FlyweightPattern/ConcreteFlyweight.java
5b21816f42a78ffda9b2c793a8b7e8aa61ee47ca
[]
no_license
szjzszjz/patternDesign
https://github.com/szjzszjz/patternDesign
554958328f7b9a09363740b960bb7189d6899bd1
f03ea787221ec515561297db2403fbec9f26da05
refs/heads/master
2020-05-16T22:27:37.399000
2019-05-07T12:10:16
2019-05-07T12:10:16
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.szjz.FlyweightPattern; /** * 具体的享元角色 * * @author 石中君子 * */ public class ConcreteFlyweight implements Flyweight { private String key; public ConcreteFlyweight(String key) { this.key = key; System.out.println("具体享元" + key + "被创建!"); } @Override public void operation(UnsharedConcreteFlyweight state) { System.out.print("具体享元" + key + "被调用,"); System.out.println("非享元信息是:" + state.getInfo()); } }
GB18030
Java
521
java
ConcreteFlyweight.java
Java
[ { "context": "eightPattern;\r\n\r\n/**\r\n * 具体的享元角色\r\n * \r\n * @author 石中君子\r\n *\r\n */\r\npublic class ConcreteFlyweight implemen", "end": 75, "score": 0.9997499585151672, "start": 71, "tag": "NAME", "value": "石中君子" } ]
null
[]
package com.szjz.FlyweightPattern; /** * 具体的享元角色 * * @author 石中君子 * */ public class ConcreteFlyweight implements Flyweight { private String key; public ConcreteFlyweight(String key) { this.key = key; System.out.println("具体享元" + key + "被创建!"); } @Override public void operation(UnsharedConcreteFlyweight state) { System.out.print("具体享元" + key + "被调用,"); System.out.println("非享元信息是:" + state.getInfo()); } }
521
0.643956
0.643956
24
16.958334
19.565018
57
false
false
0
0
0
0
0
0
0.833333
false
false
12
9e0a80fcab667dc626c79973c4785578d6ce218b
2,628,519,993,478
d9d3a0a74bd7771e750f8f2e7bfd26dd07695582
/app/src/main/java/com/example/gestaoatleta/EditarAtividadeActivity.java
c1290f8bd6b4c9287e8a5c7464f982729908cc8c
[]
no_license
Bruno99Jesus/GestaoAtleta
https://github.com/Bruno99Jesus/GestaoAtleta
123f006a7b02b229e4aa8a5709283cfd3ed0182f
96d4279c6a984a09d52e9bd70aeb52e70d35d74a
refs/heads/master
2020-05-03T02:49:56.104000
2019-05-26T22:53:10
2019-05-26T22:53:10
175,680,673
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.gestaoatleta; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.EditText; import android.widget.Toast; public class EditarAtividadeActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_editar_atividade); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } private void adicionarAtividade() { Intent intent = getIntent(); String message = ((Intent) intent).getStringExtra(DefinicoesApp.MENSAGEM); Toast.makeText(this, message, Toast.LENGTH_SHORT).show(); } public void adicionarAtividadeBotao(View view) { EditText editTextTituloAtividade = (EditText) findViewById(R.id.textInputTituloAtividade); String tituloAtividade = editTextTituloAtividade.getText().toString(); if (tituloAtividade.trim().length() == 0) { editTextTituloAtividade.setError("Insira um Título"); editTextTituloAtividade.requestFocus(); return; } EditText editTextTempoDecorrido = (EditText) findViewById(R.id.textInputTempoDecorrido); String tempoDecorrido = editTextTempoDecorrido.getText().toString(); if (tempoDecorrido.trim().length() == 0) { editTextTempoDecorrido.setError("Insira o tempo decorrido"); editTextTempoDecorrido.requestFocus(); return; } EditText editTextHora = (EditText) findViewById(R.id.textInputHora); String hora = editTextHora.getText().toString(); if (hora.trim().length() == 0) { editTextHora.setError("Insira a hora de inicio da atividade"); editTextHora.requestFocus(); return; } EditText editTextDia = (EditText) findViewById(R.id.textInputData); String dia = editTextDia.getText().toString(); if (dia.trim().length() == 0) { editTextDia.setError("Insira o dia da atividade"); editTextDia.requestFocus(); return; } Intent intent = new Intent(this, AdicionarAtividadeActivity.class); Toast.makeText(this, "Atividade Guardada com Sucesso!", Toast.LENGTH_SHORT).show(); finish(); } public void cancelarBotao(View view) { finish(); } }
UTF-8
Java
2,734
java
EditarAtividadeActivity.java
Java
[]
null
[]
package com.example.gestaoatleta; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.EditText; import android.widget.Toast; public class EditarAtividadeActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_editar_atividade); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } private void adicionarAtividade() { Intent intent = getIntent(); String message = ((Intent) intent).getStringExtra(DefinicoesApp.MENSAGEM); Toast.makeText(this, message, Toast.LENGTH_SHORT).show(); } public void adicionarAtividadeBotao(View view) { EditText editTextTituloAtividade = (EditText) findViewById(R.id.textInputTituloAtividade); String tituloAtividade = editTextTituloAtividade.getText().toString(); if (tituloAtividade.trim().length() == 0) { editTextTituloAtividade.setError("Insira um Título"); editTextTituloAtividade.requestFocus(); return; } EditText editTextTempoDecorrido = (EditText) findViewById(R.id.textInputTempoDecorrido); String tempoDecorrido = editTextTempoDecorrido.getText().toString(); if (tempoDecorrido.trim().length() == 0) { editTextTempoDecorrido.setError("Insira o tempo decorrido"); editTextTempoDecorrido.requestFocus(); return; } EditText editTextHora = (EditText) findViewById(R.id.textInputHora); String hora = editTextHora.getText().toString(); if (hora.trim().length() == 0) { editTextHora.setError("Insira a hora de inicio da atividade"); editTextHora.requestFocus(); return; } EditText editTextDia = (EditText) findViewById(R.id.textInputData); String dia = editTextDia.getText().toString(); if (dia.trim().length() == 0) { editTextDia.setError("Insira o dia da atividade"); editTextDia.requestFocus(); return; } Intent intent = new Intent(this, AdicionarAtividadeActivity.class); Toast.makeText(this, "Atividade Guardada com Sucesso!", Toast.LENGTH_SHORT).show(); finish(); } public void cancelarBotao(View view) { finish(); } }
2,734
0.672521
0.670326
90
29.366667
28.959532
98
false
false
0
0
0
0
0
0
0.522222
false
false
12
f79b6e54f26f11594f3d42528e0d9e102db1fd4c
704,374,679,675
263f8203fe0599066abf7cf6bf4b46cba1577ffa
/src/old/ex1/Server.java
5dd746fc8cae7a9fffd0af1f7a86dc826c8baf81
[]
no_license
jaimetotal/SD
https://github.com/jaimetotal/SD
7870308649cd7dad9c3b03037caaae9f95cb071e
edc66fa619283737f71ca1c22c2b70f859165293
refs/heads/master
2021-01-25T12:09:27.122000
2014-05-19T22:28:46
2014-05-19T22:28:46
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ex1; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; /** * Created with IntelliJ IDEA. * User: AntónioJaime * Date: 24-09-2013 * Time: 20:48 * To change this template use PeerFile | Settings | PeerFile Templates. */ public class Server { public void startUp() throws IOException { ServerSocket serverSocket = null; try { serverSocket = new ServerSocket(7000); } catch (IOException e) { System.err.println("Could not listen on port: 7000."); System.exit(1); } Socket clientSocket = null; try { clientSocket = serverSocket.accept(); } catch (IOException e) { System.err.println("Accept failed."); System.exit(1); } String userInput; BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true); String prefix = serverSocket.getLocalSocketAddress() + ":" + clientSocket.getLocalAddress() + ":"; while ((userInput = in.readLine()) != null && !userInput.equals("exit")) { System.out.println("Input received: " + userInput); out.println(prefix + userInput); } System.out.println("Cliente fugiu!"); } }
UTF-8
Java
1,477
java
Server.java
Java
[ { "context": "cket;\n\n/**\n * Created with IntelliJ IDEA.\n * User: AntónioJaime\n * Date: 24-09-2013\n * Time: 20:48\n * To change t", "end": 246, "score": 0.9995207786560059, "start": 234, "tag": "NAME", "value": "AntónioJaime" } ]
null
[]
package ex1; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; /** * Created with IntelliJ IDEA. * User: AntónioJaime * Date: 24-09-2013 * Time: 20:48 * To change this template use PeerFile | Settings | PeerFile Templates. */ public class Server { public void startUp() throws IOException { ServerSocket serverSocket = null; try { serverSocket = new ServerSocket(7000); } catch (IOException e) { System.err.println("Could not listen on port: 7000."); System.exit(1); } Socket clientSocket = null; try { clientSocket = serverSocket.accept(); } catch (IOException e) { System.err.println("Accept failed."); System.exit(1); } String userInput; BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true); String prefix = serverSocket.getLocalSocketAddress() + ":" + clientSocket.getLocalAddress() + ":"; while ((userInput = in.readLine()) != null && !userInput.equals("exit")) { System.out.println("Input received: " + userInput); out.println(prefix + userInput); } System.out.println("Cliente fugiu!"); } }
1,477
0.626694
0.611111
51
27.941177
26.834578
106
false
false
0
0
0
0
0
0
0.490196
false
false
12
44f92c0ce08d66381ed873ee8de6aecc5e519779
20,761,871,910,043
e3d5050cec7454e69c232014427a1bea6df5f38b
/src/loopsDemo/loops.java
d7455cfa63810b1849e303afb55888d6302189d3
[]
no_license
ravindra8217/Ravi
https://github.com/ravindra8217/Ravi
1b8ccc3387b648d18725546a300c2428a5021ae3
27db355daa39a2c4d5422d910de6334755e121f7
refs/heads/master
2020-03-25T20:04:50.297000
2018-08-10T12:26:18
2018-08-10T12:26:18
144,114,044
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package loopsDemo; /* What are loops: loop is general concepts in any programming language which will allow you to run * certain piece of code to run multiple times. * * For loop: * While loop: * Do While loop: * Enhance for loop: * */ public class loops { }
UTF-8
Java
305
java
loops.java
Java
[]
null
[]
package loopsDemo; /* What are loops: loop is general concepts in any programming language which will allow you to run * certain piece of code to run multiple times. * * For loop: * While loop: * Do While loop: * Enhance for loop: * */ public class loops { }
305
0.616393
0.616393
15
18.333334
26.876673
100
false
false
0
0
0
0
0
0
0.066667
false
false
12
9881505e24582f8b86f2382f0a2490bac2b48354
20,761,871,911,584
535e5d97d44fd42fca2a6fc68b3b566046ffa6c2
/android/support/v4/view/bb.java
697d986aa55f8487bc5474ddbcacdfdd196540ea
[]
no_license
eric-lanita/BigRoadTruckingLogbookApp_v21.0.12_source_from_JADX
https://github.com/eric-lanita/BigRoadTruckingLogbookApp_v21.0.12_source_from_JADX
47566c288bc89777184b73ef0eb199b61de39f82
fb84301d90ec083ce06c68a3828cf99d8855c007
refs/heads/master
2021-09-01T07:02:52.500000
2017-12-25T15:06:05
2017-12-25T15:06:05
115,346,008
0
3
null
null
null
null
null
null
null
null
null
null
null
null
null
package android.support.v4.view; import android.view.View; public interface bb { void mo326a(View view); void mo327b(View view); void mo328c(View view); }
UTF-8
Java
171
java
bb.java
Java
[]
null
[]
package android.support.v4.view; import android.view.View; public interface bb { void mo326a(View view); void mo327b(View view); void mo328c(View view); }
171
0.695906
0.637427
11
14.545455
13.316863
32
false
false
0
0
0
0
0
0
0.454545
false
false
12
70cb05ebc8d061df309f95e2ec4494a1537cbcaa
29,996,051,603,797
0ae6a4a0edb5a6d36df6c00de32d927ec6ef6b3a
/Clp_Data_Struct/.svn/pristine/40/4041dc2f33c4b950906551444b4aeb120318333f.svn-base
899eee6bfbe715b456de76c08beef52fa96d0cf8
[]
no_license
415502155/Java
https://github.com/415502155/Java
910fc3d81e0a07e39405f771e7508ad080c86825
972e5a362a11c2e90f294e07b1bf0884373dc085
refs/heads/master
2022-12-25T01:28:23.664000
2021-03-30T07:14:51
2021-03-30T07:14:51
97,439,827
0
1
null
false
2022-12-16T09:41:22
2017-07-17T05:52:59
2021-03-30T07:19:47
2022-12-16T09:41:17
174,306
0
1
61
Java
false
false
package com.bestinfo.bean.business; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; /** * 投注机信息 */ public class TmnInfo implements Serializable { private static final long serialVersionUID = -7368010059937151297L; private Integer terminal_serial_no;//投注机序号 private Integer terminal_id;//投注机号 private Integer terminal_phy_id;//物理卡号 private Integer terminal_initial_time;//投注机初始化时间 private String safe_card_id;//加密芯片 private Integer city_id;//地市编号 private Integer district_id;//所属区县 private String station_name;//站点名称 private String terminal_address;//站点地址 private String station_phone;//站点电话 private String owner_name;//户主名 private String owner_phone;//负责人电话 private String linkman;//联系人 private String linkman_phone;//联系人电话 private Date regist_date;//注册时间 private Integer software_id;//软件类型 private Integer upgrade_mark;//升级标记 private String software_version;//软件版本 private Integer terminal_type;//终端类型 private Integer terminal_status;//终端状态 private Integer agentfee_type;//代销费内扣方式 private Integer tmn_sale_deduct;//销售注销实时扣款 private Integer tmn_cash_deduct;//兑奖实时扣款 private Integer comm_type;//通讯方式 private String dial_name;//拨号帐户 private String dial_pwd;//拨号密码 private String account_id;//默认扣款帐户 private String dealer_id;//代销商编号 private Integer terminal_syn_no;//终端同步字 private String terminal_value_str;//终端设备使用价值 private BigDecimal terminal_value;//终端设备使用价值 private String local_terminal_id;//本地终端编号 private String public_key;//通讯密钥 private Integer notice_syn_no;//终端新通知 private Integer station_rank;//站点等级 //终端信息列表展示页面中,显示名称列所用字段 private String city_name;//城市名称 private String district_name;//区县名称 private String software_name;//软件名称 // private Integer province_id;//省编号 public String getLinkman_phone() { return linkman_phone; } public void setLinkman_phone(String linkman_phone) { this.linkman_phone = linkman_phone; } public Integer getTerminal_serial_no() { return terminal_serial_no; } public void setTerminal_serial_no(Integer terminal_serial_no) { this.terminal_serial_no = terminal_serial_no; } public Integer getTerminal_id() { return terminal_id; } public void setTerminal_id(Integer terminal_id) { this.terminal_id = terminal_id; } public Integer getTerminal_phy_id() { return terminal_phy_id; } public void setTerminal_phy_id(Integer terminal_phy_id) { this.terminal_phy_id = terminal_phy_id; } public Integer getTerminal_initial_time() { return terminal_initial_time; } public void setTerminal_initial_time(Integer terminal_initial_time) { this.terminal_initial_time = terminal_initial_time; } public String getSafe_card_id() { return safe_card_id; } public void setSafe_card_id(String safe_card_id) { this.safe_card_id = safe_card_id; } public Integer getCity_id() { return city_id; } public void setCity_id(Integer city_id) { this.city_id = city_id; } public Integer getDistrict_id() { return district_id; } public void setDistrict_id(Integer district_id) { this.district_id = district_id; } public String getStation_name() { return station_name; } public void setStation_name(String station_name) { this.station_name = station_name; } public String getTerminal_address() { return terminal_address; } public void setTerminal_address(String terminal_address) { this.terminal_address = terminal_address; } public String getStation_phone() { return station_phone; } public void setStation_phone(String station_phone) { this.station_phone = station_phone; } public String getOwner_name() { return owner_name; } public void setOwner_name(String owner_name) { this.owner_name = owner_name; } public String getOwner_phone() { return owner_phone; } public void setOwner_phone(String owner_phone) { this.owner_phone = owner_phone; } public String getLinkman() { return linkman; } public void setLinkman(String linkman) { this.linkman = linkman; } public Date getRegist_date() { return regist_date; } public void setRegist_date(Date regist_date) { this.regist_date = regist_date; } public Integer getSoftware_id() { return software_id; } public void setSoftware_id(Integer software_id) { this.software_id = software_id; } public Integer getUpgrade_mark() { return upgrade_mark; } public void setUpgrade_mark(Integer upgrade_mark) { this.upgrade_mark = upgrade_mark; } public String getSoftware_version() { return software_version; } public void setSoftware_version(String software_version) { this.software_version = software_version; } public Integer getTerminal_type() { return terminal_type; } public void setTerminal_type(Integer terminal_type) { this.terminal_type = terminal_type; } public Integer getTerminal_status() { return terminal_status; } public void setTerminal_status(Integer terminal_status) { this.terminal_status = terminal_status; } public Integer getAgentfee_type() { return agentfee_type; } public void setAgentfee_type(Integer agentfee_type) { this.agentfee_type = agentfee_type; } public Integer getTmn_sale_deduct() { return tmn_sale_deduct; } public void setTmn_sale_deduct(Integer tmn_sale_deduct) { this.tmn_sale_deduct = tmn_sale_deduct; } public Integer getTmn_cash_deduct() { return tmn_cash_deduct; } public void setTmn_cash_deduct(Integer tmn_cash_deduct) { this.tmn_cash_deduct = tmn_cash_deduct; } public Integer getComm_type() { return comm_type; } public void setComm_type(Integer comm_type) { this.comm_type = comm_type; } public String getDial_name() { return dial_name; } public void setDial_name(String dial_name) { this.dial_name = dial_name; } public String getDial_pwd() { return dial_pwd; } public void setDial_pwd(String dial_pwd) { this.dial_pwd = dial_pwd; } public String getAccount_id() { return account_id; } public void setAccount_id(String account_id) { this.account_id = account_id; } public String getDealer_id() { return dealer_id; } public void setDealer_id(String dealer_id) { this.dealer_id = dealer_id; } public Integer getTerminal_syn_no() { return terminal_syn_no; } public void setTerminal_syn_no(Integer terminal_syn_no) { this.terminal_syn_no = terminal_syn_no; } public String getCity_name() { return city_name; } public void setCity_name(String city_name) { this.city_name = city_name; } public String getDistrict_name() { return district_name; } public void setDistrict_name(String district_name) { this.district_name = district_name; } // public Integer getProvince_id() { // return province_id; // } // // public void setProvince_id(Integer province_id) { // this.province_id = province_id; // } public String getSoftware_name() { return software_name; } public void setSoftware_name(String software_name) { this.software_name = software_name; } public String getTerminal_value_str() { return terminal_value_str; } public void setTerminal_value_str(String terminal_value_str) { this.terminal_value_str = terminal_value_str; } public BigDecimal getTerminal_value() { return terminal_value; } public void setTerminal_value(BigDecimal terminal_value) { this.terminal_value = terminal_value; } public String getLocal_terminal_id() { return local_terminal_id; } public void setLocal_terminal_id(String local_terminal_id) { this.local_terminal_id = local_terminal_id; } public String getPublic_key() { return public_key; } public void setPublic_key(String public_key) { this.public_key = public_key; } public Integer getNotice_syn_no() { return notice_syn_no; } public void setNotice_syn_no(Integer notice_syn_no) { this.notice_syn_no = notice_syn_no; } public Integer getStation_rank() { return station_rank; } public void setStation_rank(Integer station_rank) { this.station_rank = station_rank; } public static void main(String[] args) { System.out.println(1 | 16); System.out.println(0 & 0xffffffef); } }
UTF-8
Java
9,549
4041dc2f33c4b950906551444b4aeb120318333f.svn-base
Java
[]
null
[]
package com.bestinfo.bean.business; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; /** * 投注机信息 */ public class TmnInfo implements Serializable { private static final long serialVersionUID = -7368010059937151297L; private Integer terminal_serial_no;//投注机序号 private Integer terminal_id;//投注机号 private Integer terminal_phy_id;//物理卡号 private Integer terminal_initial_time;//投注机初始化时间 private String safe_card_id;//加密芯片 private Integer city_id;//地市编号 private Integer district_id;//所属区县 private String station_name;//站点名称 private String terminal_address;//站点地址 private String station_phone;//站点电话 private String owner_name;//户主名 private String owner_phone;//负责人电话 private String linkman;//联系人 private String linkman_phone;//联系人电话 private Date regist_date;//注册时间 private Integer software_id;//软件类型 private Integer upgrade_mark;//升级标记 private String software_version;//软件版本 private Integer terminal_type;//终端类型 private Integer terminal_status;//终端状态 private Integer agentfee_type;//代销费内扣方式 private Integer tmn_sale_deduct;//销售注销实时扣款 private Integer tmn_cash_deduct;//兑奖实时扣款 private Integer comm_type;//通讯方式 private String dial_name;//拨号帐户 private String dial_pwd;//拨号密码 private String account_id;//默认扣款帐户 private String dealer_id;//代销商编号 private Integer terminal_syn_no;//终端同步字 private String terminal_value_str;//终端设备使用价值 private BigDecimal terminal_value;//终端设备使用价值 private String local_terminal_id;//本地终端编号 private String public_key;//通讯密钥 private Integer notice_syn_no;//终端新通知 private Integer station_rank;//站点等级 //终端信息列表展示页面中,显示名称列所用字段 private String city_name;//城市名称 private String district_name;//区县名称 private String software_name;//软件名称 // private Integer province_id;//省编号 public String getLinkman_phone() { return linkman_phone; } public void setLinkman_phone(String linkman_phone) { this.linkman_phone = linkman_phone; } public Integer getTerminal_serial_no() { return terminal_serial_no; } public void setTerminal_serial_no(Integer terminal_serial_no) { this.terminal_serial_no = terminal_serial_no; } public Integer getTerminal_id() { return terminal_id; } public void setTerminal_id(Integer terminal_id) { this.terminal_id = terminal_id; } public Integer getTerminal_phy_id() { return terminal_phy_id; } public void setTerminal_phy_id(Integer terminal_phy_id) { this.terminal_phy_id = terminal_phy_id; } public Integer getTerminal_initial_time() { return terminal_initial_time; } public void setTerminal_initial_time(Integer terminal_initial_time) { this.terminal_initial_time = terminal_initial_time; } public String getSafe_card_id() { return safe_card_id; } public void setSafe_card_id(String safe_card_id) { this.safe_card_id = safe_card_id; } public Integer getCity_id() { return city_id; } public void setCity_id(Integer city_id) { this.city_id = city_id; } public Integer getDistrict_id() { return district_id; } public void setDistrict_id(Integer district_id) { this.district_id = district_id; } public String getStation_name() { return station_name; } public void setStation_name(String station_name) { this.station_name = station_name; } public String getTerminal_address() { return terminal_address; } public void setTerminal_address(String terminal_address) { this.terminal_address = terminal_address; } public String getStation_phone() { return station_phone; } public void setStation_phone(String station_phone) { this.station_phone = station_phone; } public String getOwner_name() { return owner_name; } public void setOwner_name(String owner_name) { this.owner_name = owner_name; } public String getOwner_phone() { return owner_phone; } public void setOwner_phone(String owner_phone) { this.owner_phone = owner_phone; } public String getLinkman() { return linkman; } public void setLinkman(String linkman) { this.linkman = linkman; } public Date getRegist_date() { return regist_date; } public void setRegist_date(Date regist_date) { this.regist_date = regist_date; } public Integer getSoftware_id() { return software_id; } public void setSoftware_id(Integer software_id) { this.software_id = software_id; } public Integer getUpgrade_mark() { return upgrade_mark; } public void setUpgrade_mark(Integer upgrade_mark) { this.upgrade_mark = upgrade_mark; } public String getSoftware_version() { return software_version; } public void setSoftware_version(String software_version) { this.software_version = software_version; } public Integer getTerminal_type() { return terminal_type; } public void setTerminal_type(Integer terminal_type) { this.terminal_type = terminal_type; } public Integer getTerminal_status() { return terminal_status; } public void setTerminal_status(Integer terminal_status) { this.terminal_status = terminal_status; } public Integer getAgentfee_type() { return agentfee_type; } public void setAgentfee_type(Integer agentfee_type) { this.agentfee_type = agentfee_type; } public Integer getTmn_sale_deduct() { return tmn_sale_deduct; } public void setTmn_sale_deduct(Integer tmn_sale_deduct) { this.tmn_sale_deduct = tmn_sale_deduct; } public Integer getTmn_cash_deduct() { return tmn_cash_deduct; } public void setTmn_cash_deduct(Integer tmn_cash_deduct) { this.tmn_cash_deduct = tmn_cash_deduct; } public Integer getComm_type() { return comm_type; } public void setComm_type(Integer comm_type) { this.comm_type = comm_type; } public String getDial_name() { return dial_name; } public void setDial_name(String dial_name) { this.dial_name = dial_name; } public String getDial_pwd() { return dial_pwd; } public void setDial_pwd(String dial_pwd) { this.dial_pwd = dial_pwd; } public String getAccount_id() { return account_id; } public void setAccount_id(String account_id) { this.account_id = account_id; } public String getDealer_id() { return dealer_id; } public void setDealer_id(String dealer_id) { this.dealer_id = dealer_id; } public Integer getTerminal_syn_no() { return terminal_syn_no; } public void setTerminal_syn_no(Integer terminal_syn_no) { this.terminal_syn_no = terminal_syn_no; } public String getCity_name() { return city_name; } public void setCity_name(String city_name) { this.city_name = city_name; } public String getDistrict_name() { return district_name; } public void setDistrict_name(String district_name) { this.district_name = district_name; } // public Integer getProvince_id() { // return province_id; // } // // public void setProvince_id(Integer province_id) { // this.province_id = province_id; // } public String getSoftware_name() { return software_name; } public void setSoftware_name(String software_name) { this.software_name = software_name; } public String getTerminal_value_str() { return terminal_value_str; } public void setTerminal_value_str(String terminal_value_str) { this.terminal_value_str = terminal_value_str; } public BigDecimal getTerminal_value() { return terminal_value; } public void setTerminal_value(BigDecimal terminal_value) { this.terminal_value = terminal_value; } public String getLocal_terminal_id() { return local_terminal_id; } public void setLocal_terminal_id(String local_terminal_id) { this.local_terminal_id = local_terminal_id; } public String getPublic_key() { return public_key; } public void setPublic_key(String public_key) { this.public_key = public_key; } public Integer getNotice_syn_no() { return notice_syn_no; } public void setNotice_syn_no(Integer notice_syn_no) { this.notice_syn_no = notice_syn_no; } public Integer getStation_rank() { return station_rank; } public void setStation_rank(Integer station_rank) { this.station_rank = station_rank; } public static void main(String[] args) { System.out.println(1 | 16); System.out.println(0 & 0xffffffef); } }
9,549
0.639939
0.63731
370
23.672974
20.51087
73
false
false
0
0
0
0
0
0
0.337838
false
false
12
6e0f46b4062653b7ec89f475ef696f909959f359
14,963,666,076,220
a3be3a9ba432af585152dbcd2412e0b826b8374d
/api/src/main/java/org/mabartos/api/annotations/HasRoleInHome.java
6e7ac733b08fd77b0f0133b44d2cfd6d2be20d1c
[ "Apache-2.0" ]
permissive
mabartos/bartOS-server-core
https://github.com/mabartos/bartOS-server-core
bfb4ec82e87d8b893a6e5c3438d45925a134c12e
52cfe1c0f3a3313554bc4d58591a7a3bfff2facc
refs/heads/main
2023-05-01T14:58:36.243000
2021-02-19T14:45:37
2021-02-19T14:45:37
364,658,504
0
0
Apache-2.0
true
2021-05-05T17:39:12
2021-05-05T17:39:11
2021-04-11T09:13:55
2021-02-19T14:45:23
110
0
0
0
null
false
false
/* * Copyright (c) 2020. * Martin Bartos * SmartHome BartOS * All rights reserved. */ package org.mabartos.api.annotations; import org.mabartos.api.common.UserRole; import javax.ws.rs.NameBinding; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @NameBinding @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.METHOD}) public @interface HasRoleInHome { UserRole minRole() default UserRole.HOME_CHILD; UserRole[] roles() default {}; boolean orIsOwner() default false; }
UTF-8
Java
628
java
HasRoleInHome.java
Java
[ { "context": "/*\n * Copyright (c) 2020.\n * Martin Bartos\n * SmartHome BartOS\n * All rights reserved.\n */\n\n", "end": 42, "score": 0.9998475909233093, "start": 29, "tag": "NAME", "value": "Martin Bartos" } ]
null
[]
/* * Copyright (c) 2020. * <NAME> * SmartHome BartOS * All rights reserved. */ package org.mabartos.api.annotations; import org.mabartos.api.common.UserRole; import javax.ws.rs.NameBinding; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @NameBinding @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.METHOD}) public @interface HasRoleInHome { UserRole minRole() default UserRole.HOME_CHILD; UserRole[] roles() default {}; boolean orIsOwner() default false; }
621
0.767516
0.761146
27
22.25926
17.50046
51
false
false
0
0
0
0
0
0
0.407407
false
false
12
bc080a9eb83d749f47f0295ee3eca8247c8cb2fa
26,817,775,866,137
06cc5ec55ee0970e45d476745613bebf2aea5e9e
/mud/MUDServerInterface.java
4c5b5547a31c4bfb4a482fd03f745953ba0798f7
[]
no_license
DinisDimitris/cs3524MUD
https://github.com/DinisDimitris/cs3524MUD
ddcf1797d2d3e5079a3edd3408e1883cf28291bb
c46351c93c73e1b8f9d23a4b788627cfe6a5c144
refs/heads/main
2023-04-14T06:17:11.407000
2021-04-28T17:45:08
2021-04-28T17:45:08
359,200,694
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package mud; import java.rmi.Remote; import java.rmi.RemoteException; public interface MUDServerInterface extends Remote { Boolean intializeGame(String GameName) throws RemoteException; Boolean createMUDs(int numberofgames) throws RemoteException; String getStartLocation(String MUDName) throws RemoteException; String showServers() throws RemoteException; int addPlayer(String name, String mudInstance) throws RemoteException; String getSummary(String MUDName) throws RemoteException; String moveThing(String MUDName,String location, String dir,String thing) throws RemoteException; String showUsers(String MUDNamme) throws RemoteException; String showLocation(String MUDName, String location) throws RemoteException; String showLocationPlayers(String MUDName, String location) throws RemoteException; String showLocationItems(String MUDName, String location) throws RemoteException; String pickItem(String MUDName, String location, String username,String item) throws RemoteException; String showUserItems(String MUDName, String user) throws RemoteException; String removeUser(String MUDName, String user, String location) throws RemoteException; void addClient(String clientName, MUDClientInterface client) throws RemoteException; String sendMessageTo(String sender, String recipient, String message) throws RemoteException; MUD findPlayer(String name) throws RemoteException; }
UTF-8
Java
1,454
java
MUDServerInterface.java
Java
[]
null
[]
package mud; import java.rmi.Remote; import java.rmi.RemoteException; public interface MUDServerInterface extends Remote { Boolean intializeGame(String GameName) throws RemoteException; Boolean createMUDs(int numberofgames) throws RemoteException; String getStartLocation(String MUDName) throws RemoteException; String showServers() throws RemoteException; int addPlayer(String name, String mudInstance) throws RemoteException; String getSummary(String MUDName) throws RemoteException; String moveThing(String MUDName,String location, String dir,String thing) throws RemoteException; String showUsers(String MUDNamme) throws RemoteException; String showLocation(String MUDName, String location) throws RemoteException; String showLocationPlayers(String MUDName, String location) throws RemoteException; String showLocationItems(String MUDName, String location) throws RemoteException; String pickItem(String MUDName, String location, String username,String item) throws RemoteException; String showUserItems(String MUDName, String user) throws RemoteException; String removeUser(String MUDName, String user, String location) throws RemoteException; void addClient(String clientName, MUDClientInterface client) throws RemoteException; String sendMessageTo(String sender, String recipient, String message) throws RemoteException; MUD findPlayer(String name) throws RemoteException; }
1,454
0.811554
0.811554
23
62.217392
30.099771
105
false
false
0
0
0
0
0
0
1.565217
false
false
12
095d2164552db175ce71b80d8da1bd70562e182b
22,660,247,473,695
66e52fc7111d35d26f56dd2870c5f8edab702061
/app/src/main/java/com/example/rusili/solidexamples/s/after/AreaCalculatorOutput.java
1df8a3bd4640a1364476a7245b8f63256bd5d387
[]
no_license
STaverasDev/SOLIDExamples
https://github.com/STaverasDev/SOLIDExamples
319340373665cf2eaa9795145f39d0af56108ba6
36162521311f748c62fcf7fbd5d7380b8bdaca47
refs/heads/master
2020-03-17T01:57:57.501000
2018-05-12T17:49:21
2018-05-12T17:49:21
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.rusili.solidexamples.s.after; public class AreaCalculatorOutput { public void printArea(double area) { // Print area } }
UTF-8
Java
158
java
AreaCalculatorOutput.java
Java
[ { "context": "package com.example.rusili.solidexamples.s.after;\n\npublic class AreaCalculat", "end": 26, "score": 0.541714608669281, "start": 23, "tag": "USERNAME", "value": "ili" } ]
null
[]
package com.example.rusili.solidexamples.s.after; public class AreaCalculatorOutput { public void printArea(double area) { // Print area } }
158
0.702532
0.702532
8
18.875
18.850979
49
false
false
0
0
0
0
0
0
0.125
false
false
12
3d13aac2c33202f9de779dfcfe1cc32abb51fbec
24,713,241,846,429
e939c1a576daf7dbf9a8fec6d5be3ecea8fd5fd2
/extensions/vector/src/arc/graphics/vector/PointStyle.java
f98973857c79ac7a256f1de9eb906e518b6f0bf5
[]
no_license
irfanmauuu/Arc
https://github.com/irfanmauuu/Arc
4c9210671515de61463fa3d351fe3517493c1679
6a8eb57007ff1b0ae465fbfe9983edb585964823
refs/heads/master
2022-11-16T18:28:07.349000
2020-06-29T23:32:16
2020-06-29T23:32:16
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package arc.graphics.vector; public enum PointStyle{ circle, square }
UTF-8
Java
75
java
PointStyle.java
Java
[]
null
[]
package arc.graphics.vector; public enum PointStyle{ circle, square }
75
0.746667
0.746667
5
14
11.471704
28
false
false
0
0
0
0
0
0
0.4
false
false
12
02b118743522dcb7cb96907f1cc7746f70d717ff
9,277,129,376,366
514b2c078d4a908735bbf39c1de47afb3dd369c0
/src/main/java/tatai/numberModel/MaoriNumber.java
253211c3e658e9dbad106193a3940c62cc1618e7
[]
no_license
ZainAzimullah/Tatai
https://github.com/ZainAzimullah/Tatai
414e4334bee2dd1d319abdf32063a7836c328df6
d9e8303c08cc350c53547679f2273671c6945949
refs/heads/master
2021-07-19T04:02:11.913000
2017-10-26T00:27:26
2017-10-26T00:27:26
102,675,469
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package tatai.numberModel; import java.util.HashMap; import java.util.Map; import tatai.exceptions.TataiException; import tatai.expression.Operand; // This class represents a Maori number/English number pairing public class MaoriNumber extends Operand implements Comparable<MaoriNumber> { // private strings used to store the actual integer and the maori form of the // integer for what 'this' is asked to represent private String _maoriName; private Integer _number; // public constructor used toe generate the maori form of a given integer // argument public MaoriNumber(int number) { // checking if the number is valid () if ((number <= 0) || (number > 99)) { // if the number is invalid ( integer is < 0 or integer is > 99) then throw a // new tatai exception throw new TataiException("Invalid number"); } // otherwise assign the field used to track the actual integer to the input // integer argument _number = number; // call a private method to identify what maori words corresponds with the // integer setMaoriName(number); } public int getDigits() { return _number; } // method used to compare two MaoriNumber Objects, this is done by comparing the // integer values they are representing @Override public int compareTo(MaoriNumber otherNumber) { return _number.compareTo(otherNumber._number); } // method used to determine if two MaoriNumber objects, each representing an // integer, are the same @Override public boolean equals(Object otherNumber) { if (!(otherNumber instanceof MaoriNumber)) { // if the other object we are trying to compare MoariNumber is not an instance // of a MaoriNumber then throw new tatai exception as they are not comparable throw new TataiException("Trying to compare non-MaoriNumber to MaoriNumber"); } // else compare the two integers the MaoriNumber object is representing return _number.equals(((MaoriNumber) otherNumber)._number); } // returns the maori representation of the integer 'this' object is representing @Override public String toString() { return _maoriName; } // Work out what the Maori word is for a given integer private void setMaoriName(int number) { // determine if the integer is 10 if (number == 10) { // if the integer is 10 then set the maori name as 10 and return _maoriName = "tekau"; return; } // setting up a HashMap to allocate a maori word for every number Map<Integer, String> map = new HashMap<>(); map.put(1, "tahi"); map.put(2, "rua"); map.put(3, "toru"); map.put(4, "whaa"); map.put(5, "rima"); map.put(6, "ono"); map.put(7, "whitu"); map.put(8, "waru"); map.put(9, "iwa"); // if the integer is less than 10 then if (number < 10) { // just allocate one word to the integer _maoriName = map.get(number); } // otherwise if the integer is >10 then else { // determine what the 10's and 1's digit is int tens = number / 10; int ones = number % 10; // if the integer's 1's digit is a "0" then just append a space and "tekau" to // the end of the maori word for the 10's digit if (ones == 0) { _maoriName = map.get(tens) + " tekau"; return; } // otherwise in the 10's digit is a "1" append the Maori word for the 1's digit // to "tekau ma " if (tens == 1) { _maoriName = "tekau maa " + map.get(ones); return; } // otherwise if none of the above apply to the integer in question then set the // maori word for the integer as the maori word for the 10's digit followed by // "tekau ma " then followed by the maori word for the 1's digit _maoriName = map.get(tens) + " tekau maa "; _maoriName += map.get(ones); } } }
UTF-8
Java
3,700
java
MaoriNumber.java
Java
[]
null
[]
package tatai.numberModel; import java.util.HashMap; import java.util.Map; import tatai.exceptions.TataiException; import tatai.expression.Operand; // This class represents a Maori number/English number pairing public class MaoriNumber extends Operand implements Comparable<MaoriNumber> { // private strings used to store the actual integer and the maori form of the // integer for what 'this' is asked to represent private String _maoriName; private Integer _number; // public constructor used toe generate the maori form of a given integer // argument public MaoriNumber(int number) { // checking if the number is valid () if ((number <= 0) || (number > 99)) { // if the number is invalid ( integer is < 0 or integer is > 99) then throw a // new tatai exception throw new TataiException("Invalid number"); } // otherwise assign the field used to track the actual integer to the input // integer argument _number = number; // call a private method to identify what maori words corresponds with the // integer setMaoriName(number); } public int getDigits() { return _number; } // method used to compare two MaoriNumber Objects, this is done by comparing the // integer values they are representing @Override public int compareTo(MaoriNumber otherNumber) { return _number.compareTo(otherNumber._number); } // method used to determine if two MaoriNumber objects, each representing an // integer, are the same @Override public boolean equals(Object otherNumber) { if (!(otherNumber instanceof MaoriNumber)) { // if the other object we are trying to compare MoariNumber is not an instance // of a MaoriNumber then throw new tatai exception as they are not comparable throw new TataiException("Trying to compare non-MaoriNumber to MaoriNumber"); } // else compare the two integers the MaoriNumber object is representing return _number.equals(((MaoriNumber) otherNumber)._number); } // returns the maori representation of the integer 'this' object is representing @Override public String toString() { return _maoriName; } // Work out what the Maori word is for a given integer private void setMaoriName(int number) { // determine if the integer is 10 if (number == 10) { // if the integer is 10 then set the maori name as 10 and return _maoriName = "tekau"; return; } // setting up a HashMap to allocate a maori word for every number Map<Integer, String> map = new HashMap<>(); map.put(1, "tahi"); map.put(2, "rua"); map.put(3, "toru"); map.put(4, "whaa"); map.put(5, "rima"); map.put(6, "ono"); map.put(7, "whitu"); map.put(8, "waru"); map.put(9, "iwa"); // if the integer is less than 10 then if (number < 10) { // just allocate one word to the integer _maoriName = map.get(number); } // otherwise if the integer is >10 then else { // determine what the 10's and 1's digit is int tens = number / 10; int ones = number % 10; // if the integer's 1's digit is a "0" then just append a space and "tekau" to // the end of the maori word for the 10's digit if (ones == 0) { _maoriName = map.get(tens) + " tekau"; return; } // otherwise in the 10's digit is a "1" append the Maori word for the 1's digit // to "tekau ma " if (tens == 1) { _maoriName = "tekau maa " + map.get(ones); return; } // otherwise if none of the above apply to the integer in question then set the // maori word for the integer as the maori word for the 10's digit followed by // "tekau ma " then followed by the maori word for the 1's digit _maoriName = map.get(tens) + " tekau maa "; _maoriName += map.get(ones); } } }
3,700
0.688108
0.674865
121
29.578512
26.461809
82
false
false
0
0
0
0
0
0
2.049587
false
false
12
ac6e70ef074e789a57032cc288f575dcb0c8769b
29,180,007,835,161
bf1fe720ce931e6aac68886b812538c96238bb8e
/src/main/java/sofistik/AnalysisNorm.java
80169d9c1bb09207e0748af26eeda8723e460680
[]
no_license
BatiGencho/SofiNCM
https://github.com/BatiGencho/SofiNCM
f719f71b4d269dd11578b494a6ea9feccd01f567
1b4919c3be0a39354af0be46cce45cbc01a6438c
refs/heads/master
2021-01-01T04:56:27.915000
2018-05-16T10:27:39
2018-05-16T10:27:39
58,495,035
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package sofistik; public class AnalysisNorm { int m_id; int m_dc; int m_Country; int m_Code; int m_Year; int m_Class; String m_normText; int m_Wind; int m_Snow; int m_Seis; int m_Dummy; float m_Altitude; float m_Version; AnalysisNorm() { //constructor this.m_id = -1; this.m_dc = -1; this.m_Country = -1; this.m_Code = -1; this.m_Year = -1; this.m_Class = -1; this.m_normText = new String(""); this.m_Wind = -1; this.m_Snow = -1; this.m_Seis = -1; this.m_Dummy = -1; this.m_Altitude = -1.0f; this.m_Version = -1.0f; } //native method native void getDataForNorm(); }
UTF-8
Java
624
java
AnalysisNorm.java
Java
[]
null
[]
package sofistik; public class AnalysisNorm { int m_id; int m_dc; int m_Country; int m_Code; int m_Year; int m_Class; String m_normText; int m_Wind; int m_Snow; int m_Seis; int m_Dummy; float m_Altitude; float m_Version; AnalysisNorm() { //constructor this.m_id = -1; this.m_dc = -1; this.m_Country = -1; this.m_Code = -1; this.m_Year = -1; this.m_Class = -1; this.m_normText = new String(""); this.m_Wind = -1; this.m_Snow = -1; this.m_Seis = -1; this.m_Dummy = -1; this.m_Altitude = -1.0f; this.m_Version = -1.0f; } //native method native void getDataForNorm(); }
624
0.599359
0.576923
38
15.421053
8.836621
36
false
false
0
0
0
0
0
0
2.078947
false
false
12
f42fd39f0b3d6f34d125f573b4bf8dd703ddfaf0
1,743,756,779,307
d528f3854c4831b95c1b0f390b50dfe6f64ab9db
/TradinGame/tests/DAO/PostgresServiceDAOTest.java
1c18a7f20777d9fda08c541adc6f615a3b1e85f4
[]
no_license
Mukary/TradinGame
https://github.com/Mukary/TradinGame
828c174d7cc0a8dc23326991d9039535172ed395
53d47b7d00093905832b2472066535342e996e6e
refs/heads/master
2021-01-19T13:14:41.086000
2017-03-30T21:03:39
2017-03-30T21:03:39
79,941,572
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package DAO; import factories.AbstractDAOFactory; import factories.PostgresDAOFactory; import models.Service; import org.junit.Test; import java.sql.Date; import static org.junit.Assert.*; /** * Created by bouygueq on 29/03/2017. */ public class PostgresServiceDAOTest { //Creates DAOfactory AbstractDAOFactory daoFactory = AbstractDAOFactory.getFactory(AbstractDAOFactory.POSTGRES_DAO_FACTORY); //Creates userDAO object with factory; PostgresServiceDAO serviceDaoTest = (PostgresServiceDAO) daoFactory.getDao(PostgresDAOFactory.SERVICE_DAO); java.util.Date utilDate = new java.util.Date(); java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime()); Service newServiceTest = new Service(1, "descriptionTest", sqlDate, "userTest", "serviceTypeTest", "gameTest", "userTest"); @Test public void create() throws Exception { assertEquals(1, serviceDaoTest.create(newServiceTest)); } }
UTF-8
Java
940
java
PostgresServiceDAOTest.java
Java
[ { "context": "port static org.junit.Assert.*;\n\n/**\n * Created by bouygueq on 29/03/2017.\n */\npublic class PostgresServiceDA", "end": 219, "score": 0.9997113943099976, "start": 211, "tag": "USERNAME", "value": "bouygueq" } ]
null
[]
package DAO; import factories.AbstractDAOFactory; import factories.PostgresDAOFactory; import models.Service; import org.junit.Test; import java.sql.Date; import static org.junit.Assert.*; /** * Created by bouygueq on 29/03/2017. */ public class PostgresServiceDAOTest { //Creates DAOfactory AbstractDAOFactory daoFactory = AbstractDAOFactory.getFactory(AbstractDAOFactory.POSTGRES_DAO_FACTORY); //Creates userDAO object with factory; PostgresServiceDAO serviceDaoTest = (PostgresServiceDAO) daoFactory.getDao(PostgresDAOFactory.SERVICE_DAO); java.util.Date utilDate = new java.util.Date(); java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime()); Service newServiceTest = new Service(1, "descriptionTest", sqlDate, "userTest", "serviceTypeTest", "gameTest", "userTest"); @Test public void create() throws Exception { assertEquals(1, serviceDaoTest.create(newServiceTest)); } }
940
0.752128
0.741489
30
30.366667
34.373909
127
false
false
0
0
0
0
0
0
0.7
false
false
12
68dbc066d75ea37e6a6a80e81613dd16a083a992
9,706,626,109,518
aeef2494b283012ed619870c4275e7d015f4017a
/sdk/java/src/main/java/com/pulumi/gcp/pubsub/outputs/GetSubscriptionExpirationPolicy.java
e847930ed8d0334780b5a100b6320a7579316817
[ "BSD-3-Clause", "MPL-2.0", "Apache-2.0" ]
permissive
pulumi/pulumi-gcp
https://github.com/pulumi/pulumi-gcp
d4fd3f80c3df5290edaf33eb5eafe34e6699d0ff
7deea0a50a4ee5ab7bd722a83eca01707e298f85
refs/heads/master
2023-08-31T07:12:45.921000
2023-08-31T06:16:27
2023-08-31T06:16:27
97,485,806
160
63
Apache-2.0
false
2023-09-14T19:49:36
2017-07-17T14:28:37
2023-09-09T05:01:08
2023-09-14T19:49:35
159,678
149
50
173
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.gcp.pubsub.outputs; import com.pulumi.core.annotations.CustomType; import java.lang.String; import java.util.Objects; @CustomType public final class GetSubscriptionExpirationPolicy { private String ttl; private GetSubscriptionExpirationPolicy() {} public String ttl() { return this.ttl; } public static Builder builder() { return new Builder(); } public static Builder builder(GetSubscriptionExpirationPolicy defaults) { return new Builder(defaults); } @CustomType.Builder public static final class Builder { private String ttl; public Builder() {} public Builder(GetSubscriptionExpirationPolicy defaults) { Objects.requireNonNull(defaults); this.ttl = defaults.ttl; } @CustomType.Setter public Builder ttl(String ttl) { this.ttl = Objects.requireNonNull(ttl); return this; } public GetSubscriptionExpirationPolicy build() { final var o = new GetSubscriptionExpirationPolicy(); o.ttl = ttl; return o; } } }
UTF-8
Java
1,301
java
GetSubscriptionExpirationPolicy.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.gcp.pubsub.outputs; import com.pulumi.core.annotations.CustomType; import java.lang.String; import java.util.Objects; @CustomType public final class GetSubscriptionExpirationPolicy { private String ttl; private GetSubscriptionExpirationPolicy() {} public String ttl() { return this.ttl; } public static Builder builder() { return new Builder(); } public static Builder builder(GetSubscriptionExpirationPolicy defaults) { return new Builder(defaults); } @CustomType.Builder public static final class Builder { private String ttl; public Builder() {} public Builder(GetSubscriptionExpirationPolicy defaults) { Objects.requireNonNull(defaults); this.ttl = defaults.ttl; } @CustomType.Setter public Builder ttl(String ttl) { this.ttl = Objects.requireNonNull(ttl); return this; } public GetSubscriptionExpirationPolicy build() { final var o = new GetSubscriptionExpirationPolicy(); o.ttl = ttl; return o; } } }
1,301
0.641814
0.641814
46
27.282608
22.111048
81
false
false
0
0
0
0
0
0
0.391304
false
false
12
caa72fbe089f250df03766dff66b0571e69a0465
15,762,529,999,260
5455616ff886a0d2eff030d232879ba00225f284
/app/src/main/java/com/lauren/simplenews/login/UserBean.java
5b032ac5c3dad8bdf8fa5ac7cb2aa8e90a0830ee
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
Newsapp2021/bm
https://github.com/Newsapp2021/bm
48fbd96cb07a4db38801f17df28497ae3c609eaf
e459a638cd3d48f1ace01a0b80f2653820c18909
refs/heads/master
2023-02-04T17:36:37.028000
2021-01-02T02:33:25
2021-01-02T02:33:25
326,091,379
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lauren.simplenews.login; import android.arch.persistence.room.ColumnInfo; import android.arch.persistence.room.Entity; import android.arch.persistence.room.PrimaryKey; @Entity(tableName = "users") public class UserBean { @PrimaryKey(autoGenerate = true) private Integer userid; @ColumnInfo(name = "name") private String name; @ColumnInfo(name = "password") private String password; private String description;//积分 private Integer type; public Integer getUserid() { return userid; } public void setUserid(Integer userid) { this.userid = userid; } public String getName() { return name; } public void setName(String name) { this.name = name == null ? null : name.trim(); } public String getPassword() { return password; } public void setPassword(String password) { this.password = password == null ? null : password.trim(); } public String getDescription() { return description; } public void setDescription(String description) { this.description = description == null ? null : description.trim(); } public Integer getType() { return type; } public void setType(Integer type) { this.type = type; } }
UTF-8
Java
1,319
java
UserBean.java
Java
[]
null
[]
package com.lauren.simplenews.login; import android.arch.persistence.room.ColumnInfo; import android.arch.persistence.room.Entity; import android.arch.persistence.room.PrimaryKey; @Entity(tableName = "users") public class UserBean { @PrimaryKey(autoGenerate = true) private Integer userid; @ColumnInfo(name = "name") private String name; @ColumnInfo(name = "password") private String password; private String description;//积分 private Integer type; public Integer getUserid() { return userid; } public void setUserid(Integer userid) { this.userid = userid; } public String getName() { return name; } public void setName(String name) { this.name = name == null ? null : name.trim(); } public String getPassword() { return password; } public void setPassword(String password) { this.password = password == null ? null : password.trim(); } public String getDescription() { return description; } public void setDescription(String description) { this.description = description == null ? null : description.trim(); } public Integer getType() { return type; } public void setType(Integer type) { this.type = type; } }
1,319
0.639544
0.639544
59
21.305084
19.156141
75
false
false
0
0
0
0
0
0
0.322034
false
false
12
acf6a3d2cdb451714da3f7f5299aab83fad5766b
11,708,080,913,075
89c0c1c6dacc16605fd7fb33828851c2e152a855
/src/main/java/com/lf/dao/CrudMapper.java
a795f15b86a9859eb741151bef7ac80ba4a588a7
[]
no_license
chopperLiu/LFT
https://github.com/chopperLiu/LFT
950b80f0e95a1cae8a5ec1e842c2dd14c584ea66
f0045cbd26d69f9728416184a262f4bb6c251008
refs/heads/master
2018-02-17T09:13:50.948000
2018-01-17T11:10:46
2018-01-17T11:10:46
64,578,465
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lf.dao; import com.lf.common.BaseMapper; import java.util.List; /** * Created by fu liu on 9/19/2016. */ public interface CrudMapper<T> extends BaseMapper { /** * 获取单条数据 * @param id * @return */ T get(String id); /** * 获取单条数据 * @param entity * @return */ T get(T entity); /** * 查询数据列表,如果需要分页,请设置分页对象,如:entity.setPage(new Page<T>()); * @param entity * @return */ List<T> findList(T entity); /** * 查询所有数据列表 * @param entity * @return */ List<T> findAllList(T entity); /** * 分页查询数据 * @param entity * @return */ List<T> findListPage(T entity); /** * 查询所有数据列表 * @see public List<T> findAllList(T entity) * @return */ List<T> findAllList(); /** * 插入数据 * @param entity * @return */ int insert(T entity); /** * 根据属性查询数据 * @param entity * @return */ int insertSelective(T entity); /** * 更新数据 * @param entity * @return */ int update(T entity); int updateByPrimaryKeySelective(T entity); /** * 删除数据(一般为逻辑删除,更新del_flag字段为1) * @param id * @see public int delete(T entity) * @return */ @Deprecated int delete(String id); /** * 删除数据(一般为逻辑删除,更新del_flag字段为1) * @param entity * @return */ int delete(T entity); }
UTF-8
Java
1,671
java
CrudMapper.java
Java
[ { "context": "Mapper;\n\nimport java.util.List;\n\n/**\n * Created by fu liu on 9/19/2016.\n */\npublic interface CrudMapper<T> ", "end": 103, "score": 0.999190628528595, "start": 97, "tag": "NAME", "value": "fu liu" } ]
null
[]
package com.lf.dao; import com.lf.common.BaseMapper; import java.util.List; /** * Created by <NAME> on 9/19/2016. */ public interface CrudMapper<T> extends BaseMapper { /** * 获取单条数据 * @param id * @return */ T get(String id); /** * 获取单条数据 * @param entity * @return */ T get(T entity); /** * 查询数据列表,如果需要分页,请设置分页对象,如:entity.setPage(new Page<T>()); * @param entity * @return */ List<T> findList(T entity); /** * 查询所有数据列表 * @param entity * @return */ List<T> findAllList(T entity); /** * 分页查询数据 * @param entity * @return */ List<T> findListPage(T entity); /** * 查询所有数据列表 * @see public List<T> findAllList(T entity) * @return */ List<T> findAllList(); /** * 插入数据 * @param entity * @return */ int insert(T entity); /** * 根据属性查询数据 * @param entity * @return */ int insertSelective(T entity); /** * 更新数据 * @param entity * @return */ int update(T entity); int updateByPrimaryKeySelective(T entity); /** * 删除数据(一般为逻辑删除,更新del_flag字段为1) * @param id * @see public int delete(T entity) * @return */ @Deprecated int delete(String id); /** * 删除数据(一般为逻辑删除,更新del_flag字段为1) * @param entity * @return */ int delete(T entity); }
1,671
0.506565
0.500346
91
14.901099
12.807154
61
false
false
0
0
0
0
0
0
0.175824
false
false
12
880fbc606a21bca2a1d50d5e9bb1753eda0d00a1
28,853,590,358,914
8bac6c3a49ccd63b16e4369348f0594d3a11d0bf
/src/test/java/test/hedera/sdk/common/HederaTransactionReceiptTest.java
958e10b72e6aeec640d6c4c86469367312d5a1bb
[ "Apache-2.0" ]
permissive
swswsw/hedera-sdk-java
https://github.com/swswsw/hedera-sdk-java
e634aba896afbee63727787a8902ded8a145096e
f122c30235a63ac3ca5dabc1349d4bfacc116996
refs/heads/master
2020-04-01T14:58:08.436000
2018-10-16T23:47:01
2018-10-16T23:47:01
153,315,337
0
0
Apache-2.0
true
2018-10-16T16:09:27
2018-10-16T16:09:26
2018-10-16T15:45:33
2018-10-16T05:48:02
398
0
0
0
null
false
null
package test.hedera.sdk.common; import static org.junit.jupiter.api.Assertions.assertEquals; import com.hedera.sdk.common.HederaAccountID; import com.hedera.sdk.common.HederaContractID; import com.hedera.sdk.common.HederaFileID; import com.hedera.sdk.common.HederaPrecheckResult; import com.hedera.sdk.common.HederaTransactionReceipt; import com.hedera.sdk.common.HederaTransactionStatus; import com.hederahashgraph.api.proto.java.NodeTransactionPrecheckCode; import com.hederahashgraph.api.proto.java.ResponseHeader; import com.hederahashgraph.api.proto.java.TransactionGetReceiptResponse; import com.hederahashgraph.api.proto.java.TransactionReceipt; import com.hederahashgraph.api.proto.java.TransactionStatus; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; class HederaTransactionReceiptTest { @Test @DisplayName("TestHederaTransactionReceipt") void test() { HederaTransactionReceipt masterReceipt = new HederaTransactionReceipt(); masterReceipt.accountID = new HederaAccountID(1, 2, 3); masterReceipt.contractID = new HederaContractID(4, 5, 6); masterReceipt.fileID = new HederaFileID(7, 8, 9); masterReceipt.transactionStatus = HederaTransactionStatus.SUCCESS; assertEquals(1, masterReceipt.accountID.shardNum); assertEquals(2, masterReceipt.accountID.realmNum); assertEquals(3, masterReceipt.accountID.accountNum); assertEquals(4, masterReceipt.contractID.shardNum); assertEquals(5, masterReceipt.contractID.realmNum); assertEquals(6, masterReceipt.contractID.contractNum); assertEquals(7, masterReceipt.fileID.shardNum); assertEquals(8, masterReceipt.fileID.realmNum); assertEquals(9, masterReceipt.fileID.fileNum); assertEquals(HederaTransactionStatus.SUCCESS, masterReceipt.transactionStatus); // build one from protobuf HederaTransactionReceipt receipt = new HederaTransactionReceipt(masterReceipt.getProtobuf()); assertEquals(1, receipt.accountID.shardNum); assertEquals(2, receipt.accountID.realmNum); assertEquals(3, receipt.accountID.accountNum); assertEquals(4, receipt.contractID.shardNum); assertEquals(5, receipt.contractID.realmNum); assertEquals(6, receipt.contractID.contractNum); assertEquals(7, receipt.fileID.shardNum); assertEquals(8, receipt.fileID.realmNum); assertEquals(9, receipt.fileID.fileNum); assertEquals(HederaTransactionStatus.SUCCESS, receipt.transactionStatus); TransactionGetReceiptResponse.Builder receiptResponse = TransactionGetReceiptResponse.newBuilder(); receiptResponse.setHeader(ResponseHeader.newBuilder().setNodeTransactionPrecheckCode(NodeTransactionPrecheckCode.DUPLICATE)); receiptResponse.setReceipt(TransactionReceipt.newBuilder().setAccountID(new HederaAccountID(1, 2, 3).getProtobuf())); receipt = new HederaTransactionReceipt(receiptResponse.build()); assertEquals(HederaPrecheckResult.DUPLICATE, receipt.nodePrecheck); receiptResponse.setHeader(ResponseHeader.newBuilder().setNodeTransactionPrecheckCode(NodeTransactionPrecheckCode.INSUFFICIENT_BALANCE)); receiptResponse.setReceipt(TransactionReceipt.newBuilder().setStatus(TransactionStatus.FAIL_BALANCE).setFileID(new HederaFileID(1, 2, 3).getProtobuf())); receipt = new HederaTransactionReceipt(receiptResponse.build()); assertEquals(HederaPrecheckResult.INSUFFICIENT_BALANCE, receipt.nodePrecheck); assertEquals(HederaTransactionStatus.FAIL_BALANCE, receipt.transactionStatus); receiptResponse.setHeader(ResponseHeader.newBuilder().setNodeTransactionPrecheckCode(NodeTransactionPrecheckCode.INSUFFICIENT_FEE)); receiptResponse.setReceipt(TransactionReceipt.newBuilder().setStatus(TransactionStatus.FAIL_FEE).setContractID(new HederaContractID(1, 2, 3).getProtobuf())); receipt = new HederaTransactionReceipt(receiptResponse.build()); assertEquals(HederaPrecheckResult.INSUFFICIENT_FEE, receipt.nodePrecheck); assertEquals(HederaTransactionStatus.FAIL_FEE, receipt.transactionStatus); receiptResponse.setHeader(ResponseHeader.newBuilder().setNodeTransactionPrecheckCode(NodeTransactionPrecheckCode.INVALID_ACCOUNT)); receiptResponse.setReceipt(TransactionReceipt.newBuilder().setStatus(TransactionStatus.FAIL_INVALID)); receipt = new HederaTransactionReceipt(receiptResponse.build()); assertEquals(HederaPrecheckResult.INVALID_ACCOUNT, receipt.nodePrecheck); assertEquals(HederaTransactionStatus.FAIL_INVALID, receipt.transactionStatus); receiptResponse.setHeader(ResponseHeader.newBuilder().setNodeTransactionPrecheckCode(NodeTransactionPrecheckCode.INVALID_TRANSACTION)); receiptResponse.setReceipt(TransactionReceipt.newBuilder().setStatus(TransactionStatus.SUCCESS)); receipt = new HederaTransactionReceipt(receiptResponse.build()); assertEquals(HederaPrecheckResult.INVALID_TRANSACTION, receipt.nodePrecheck); assertEquals(HederaTransactionStatus.SUCCESS, receipt.transactionStatus); TransactionReceipt.Builder receiptProto = TransactionReceipt.newBuilder(); receiptProto.setStatus(TransactionStatus.FAIL_BALANCE); receipt = new HederaTransactionReceipt(receiptProto.build()); assertEquals(HederaTransactionStatus.FAIL_BALANCE, receipt.transactionStatus); TransactionReceipt receiptP = receipt.getProtobuf(); assertEquals(receiptP.getStatus(), receiptProto.getStatus()); receiptProto = TransactionReceipt.newBuilder(); receiptProto.setStatus(TransactionStatus.FAIL_FEE); receipt = new HederaTransactionReceipt(receiptProto.build()); assertEquals(HederaTransactionStatus.FAIL_FEE, receipt.transactionStatus); receiptP = receipt.getProtobuf(); assertEquals(receiptP.getStatus(), receiptProto.getStatus()); receiptProto = TransactionReceipt.newBuilder(); receiptProto.setStatus(TransactionStatus.FAIL_INVALID); receipt = new HederaTransactionReceipt(receiptProto.build()); assertEquals(HederaTransactionStatus.FAIL_INVALID, receipt.transactionStatus); receiptP = receipt.getProtobuf(); assertEquals(receiptP.getStatus(), receiptProto.getStatus()); receiptProto = TransactionReceipt.newBuilder(); receiptProto.setStatus(TransactionStatus.SUCCESS); receipt = new HederaTransactionReceipt(receiptProto.build()); assertEquals(HederaTransactionStatus.SUCCESS, receipt.transactionStatus); receiptP = receipt.getProtobuf(); assertEquals(receiptP.getStatus(), receiptProto.getStatus()); receiptProto = TransactionReceipt.newBuilder(); receiptProto.setStatus(TransactionStatus.UNKNOWN); receipt = new HederaTransactionReceipt(receiptProto.build()); assertEquals(HederaTransactionStatus.UNKNOWN, receipt.transactionStatus); receiptP = receipt.getProtobuf(); assertEquals(receiptP.getStatus(), receiptProto.getStatus()); HederaTransactionStatus status = HederaTransactionStatus.SUCCESS; HederaAccountID account = new HederaAccountID(1, 2, 3); HederaFileID file = new HederaFileID(4, 5, 6); HederaContractID contract = new HederaContractID(7, 8, 9); receipt = new HederaTransactionReceipt(status, account, file, contract); assertEquals(status, receipt.transactionStatus); assertEquals(account.shardNum, receipt.accountID.shardNum); assertEquals(account.realmNum, receipt.accountID.realmNum); assertEquals(account.accountNum, receipt.accountID.accountNum); assertEquals(file.shardNum, receipt.fileID.shardNum); assertEquals(file.realmNum, receipt.fileID.realmNum); assertEquals(file.fileNum, receipt.fileID.fileNum); assertEquals(contract.shardNum, receipt.contractID.shardNum); assertEquals(contract.realmNum, receipt.contractID.realmNum); assertEquals(contract.contractNum, receipt.contractID.contractNum); } }
UTF-8
Java
7,596
java
HederaTransactionReceiptTest.java
Java
[]
null
[]
package test.hedera.sdk.common; import static org.junit.jupiter.api.Assertions.assertEquals; import com.hedera.sdk.common.HederaAccountID; import com.hedera.sdk.common.HederaContractID; import com.hedera.sdk.common.HederaFileID; import com.hedera.sdk.common.HederaPrecheckResult; import com.hedera.sdk.common.HederaTransactionReceipt; import com.hedera.sdk.common.HederaTransactionStatus; import com.hederahashgraph.api.proto.java.NodeTransactionPrecheckCode; import com.hederahashgraph.api.proto.java.ResponseHeader; import com.hederahashgraph.api.proto.java.TransactionGetReceiptResponse; import com.hederahashgraph.api.proto.java.TransactionReceipt; import com.hederahashgraph.api.proto.java.TransactionStatus; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; class HederaTransactionReceiptTest { @Test @DisplayName("TestHederaTransactionReceipt") void test() { HederaTransactionReceipt masterReceipt = new HederaTransactionReceipt(); masterReceipt.accountID = new HederaAccountID(1, 2, 3); masterReceipt.contractID = new HederaContractID(4, 5, 6); masterReceipt.fileID = new HederaFileID(7, 8, 9); masterReceipt.transactionStatus = HederaTransactionStatus.SUCCESS; assertEquals(1, masterReceipt.accountID.shardNum); assertEquals(2, masterReceipt.accountID.realmNum); assertEquals(3, masterReceipt.accountID.accountNum); assertEquals(4, masterReceipt.contractID.shardNum); assertEquals(5, masterReceipt.contractID.realmNum); assertEquals(6, masterReceipt.contractID.contractNum); assertEquals(7, masterReceipt.fileID.shardNum); assertEquals(8, masterReceipt.fileID.realmNum); assertEquals(9, masterReceipt.fileID.fileNum); assertEquals(HederaTransactionStatus.SUCCESS, masterReceipt.transactionStatus); // build one from protobuf HederaTransactionReceipt receipt = new HederaTransactionReceipt(masterReceipt.getProtobuf()); assertEquals(1, receipt.accountID.shardNum); assertEquals(2, receipt.accountID.realmNum); assertEquals(3, receipt.accountID.accountNum); assertEquals(4, receipt.contractID.shardNum); assertEquals(5, receipt.contractID.realmNum); assertEquals(6, receipt.contractID.contractNum); assertEquals(7, receipt.fileID.shardNum); assertEquals(8, receipt.fileID.realmNum); assertEquals(9, receipt.fileID.fileNum); assertEquals(HederaTransactionStatus.SUCCESS, receipt.transactionStatus); TransactionGetReceiptResponse.Builder receiptResponse = TransactionGetReceiptResponse.newBuilder(); receiptResponse.setHeader(ResponseHeader.newBuilder().setNodeTransactionPrecheckCode(NodeTransactionPrecheckCode.DUPLICATE)); receiptResponse.setReceipt(TransactionReceipt.newBuilder().setAccountID(new HederaAccountID(1, 2, 3).getProtobuf())); receipt = new HederaTransactionReceipt(receiptResponse.build()); assertEquals(HederaPrecheckResult.DUPLICATE, receipt.nodePrecheck); receiptResponse.setHeader(ResponseHeader.newBuilder().setNodeTransactionPrecheckCode(NodeTransactionPrecheckCode.INSUFFICIENT_BALANCE)); receiptResponse.setReceipt(TransactionReceipt.newBuilder().setStatus(TransactionStatus.FAIL_BALANCE).setFileID(new HederaFileID(1, 2, 3).getProtobuf())); receipt = new HederaTransactionReceipt(receiptResponse.build()); assertEquals(HederaPrecheckResult.INSUFFICIENT_BALANCE, receipt.nodePrecheck); assertEquals(HederaTransactionStatus.FAIL_BALANCE, receipt.transactionStatus); receiptResponse.setHeader(ResponseHeader.newBuilder().setNodeTransactionPrecheckCode(NodeTransactionPrecheckCode.INSUFFICIENT_FEE)); receiptResponse.setReceipt(TransactionReceipt.newBuilder().setStatus(TransactionStatus.FAIL_FEE).setContractID(new HederaContractID(1, 2, 3).getProtobuf())); receipt = new HederaTransactionReceipt(receiptResponse.build()); assertEquals(HederaPrecheckResult.INSUFFICIENT_FEE, receipt.nodePrecheck); assertEquals(HederaTransactionStatus.FAIL_FEE, receipt.transactionStatus); receiptResponse.setHeader(ResponseHeader.newBuilder().setNodeTransactionPrecheckCode(NodeTransactionPrecheckCode.INVALID_ACCOUNT)); receiptResponse.setReceipt(TransactionReceipt.newBuilder().setStatus(TransactionStatus.FAIL_INVALID)); receipt = new HederaTransactionReceipt(receiptResponse.build()); assertEquals(HederaPrecheckResult.INVALID_ACCOUNT, receipt.nodePrecheck); assertEquals(HederaTransactionStatus.FAIL_INVALID, receipt.transactionStatus); receiptResponse.setHeader(ResponseHeader.newBuilder().setNodeTransactionPrecheckCode(NodeTransactionPrecheckCode.INVALID_TRANSACTION)); receiptResponse.setReceipt(TransactionReceipt.newBuilder().setStatus(TransactionStatus.SUCCESS)); receipt = new HederaTransactionReceipt(receiptResponse.build()); assertEquals(HederaPrecheckResult.INVALID_TRANSACTION, receipt.nodePrecheck); assertEquals(HederaTransactionStatus.SUCCESS, receipt.transactionStatus); TransactionReceipt.Builder receiptProto = TransactionReceipt.newBuilder(); receiptProto.setStatus(TransactionStatus.FAIL_BALANCE); receipt = new HederaTransactionReceipt(receiptProto.build()); assertEquals(HederaTransactionStatus.FAIL_BALANCE, receipt.transactionStatus); TransactionReceipt receiptP = receipt.getProtobuf(); assertEquals(receiptP.getStatus(), receiptProto.getStatus()); receiptProto = TransactionReceipt.newBuilder(); receiptProto.setStatus(TransactionStatus.FAIL_FEE); receipt = new HederaTransactionReceipt(receiptProto.build()); assertEquals(HederaTransactionStatus.FAIL_FEE, receipt.transactionStatus); receiptP = receipt.getProtobuf(); assertEquals(receiptP.getStatus(), receiptProto.getStatus()); receiptProto = TransactionReceipt.newBuilder(); receiptProto.setStatus(TransactionStatus.FAIL_INVALID); receipt = new HederaTransactionReceipt(receiptProto.build()); assertEquals(HederaTransactionStatus.FAIL_INVALID, receipt.transactionStatus); receiptP = receipt.getProtobuf(); assertEquals(receiptP.getStatus(), receiptProto.getStatus()); receiptProto = TransactionReceipt.newBuilder(); receiptProto.setStatus(TransactionStatus.SUCCESS); receipt = new HederaTransactionReceipt(receiptProto.build()); assertEquals(HederaTransactionStatus.SUCCESS, receipt.transactionStatus); receiptP = receipt.getProtobuf(); assertEquals(receiptP.getStatus(), receiptProto.getStatus()); receiptProto = TransactionReceipt.newBuilder(); receiptProto.setStatus(TransactionStatus.UNKNOWN); receipt = new HederaTransactionReceipt(receiptProto.build()); assertEquals(HederaTransactionStatus.UNKNOWN, receipt.transactionStatus); receiptP = receipt.getProtobuf(); assertEquals(receiptP.getStatus(), receiptProto.getStatus()); HederaTransactionStatus status = HederaTransactionStatus.SUCCESS; HederaAccountID account = new HederaAccountID(1, 2, 3); HederaFileID file = new HederaFileID(4, 5, 6); HederaContractID contract = new HederaContractID(7, 8, 9); receipt = new HederaTransactionReceipt(status, account, file, contract); assertEquals(status, receipt.transactionStatus); assertEquals(account.shardNum, receipt.accountID.shardNum); assertEquals(account.realmNum, receipt.accountID.realmNum); assertEquals(account.accountNum, receipt.accountID.accountNum); assertEquals(file.shardNum, receipt.fileID.shardNum); assertEquals(file.realmNum, receipt.fileID.realmNum); assertEquals(file.fileNum, receipt.fileID.fileNum); assertEquals(contract.shardNum, receipt.contractID.shardNum); assertEquals(contract.realmNum, receipt.contractID.realmNum); assertEquals(contract.contractNum, receipt.contractID.contractNum); } }
7,596
0.822933
0.817009
148
50.324326
34.525787
159
false
false
0
0
0
0
0
0
2.70946
false
false
12
ece009c98f71cfbe8621220e1ba86d5339e292b1
16,870,631,547,600
ac2b3f1226ff57c1655e1308cb11948d50b9cf38
/app/src/main/java/com/konusarakogren/m/mobil/json/responsemodel/login/Remark.java
ec3b454b0a7ca01c80bf751ff0eea22296ba6630
[]
no_license
dotdeveloper/KonusarakOgrenMobil
https://github.com/dotdeveloper/KonusarakOgrenMobil
2a9c83a8f8bca3c778f26df1255aa6435c53c707
3cd0e4ef7e21abd3a2781a16bbbcb3630ef33565
refs/heads/master
2016-09-25T11:29:10.167000
2016-08-30T07:13:50
2016-08-30T07:13:50
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.konusarakogren.m.mobil.json.responsemodel.login; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class Remark { @SerializedName("html") @Expose private String html; public String getHtml() { return html; } public Remark setHtml(String html) { this.html = html; return this; } }
UTF-8
Java
401
java
Remark.java
Java
[]
null
[]
package com.konusarakogren.m.mobil.json.responsemodel.login; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class Remark { @SerializedName("html") @Expose private String html; public String getHtml() { return html; } public Remark setHtml(String html) { this.html = html; return this; } }
401
0.673317
0.673317
21
18.095238
17.957369
60
false
false
0
0
0
0
0
0
0.333333
false
false
12
f9ad3c829e405d1d16e97053df3f9e90cc8ee6c2
24,489,903,530,987
6739cb999f96f2ae84cdddfa90ed009117240a8f
/JAVA2020/JavaM_Chapter05_Example/Ex02.java
655285871f40e0a0a7ec11d63f7586b7105e16ff
[]
no_license
ITneko/Java
https://github.com/ITneko/Java
1081554c640b028a18f300214e50efa1c44566b3
d6231bebc770c08fe7181c2cee578c05d604017f
refs/heads/master
2023-01-19T18:49:00.800000
2020-11-26T08:35:33
2020-11-26T08:35:33
255,066,769
3
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package JavaM_Chapter05_Example; public class Ex02 { public static void main(String[] args) { IPTV iptv = new IPTV("192.1.1.2", 32,2048); iptv.printProperty(); } }
UTF-8
Java
175
java
Ex02.java
Java
[ { "context": "oid main(String[] args) {\n\t\tIPTV iptv = new IPTV(\"192.1.1.2\", 32,2048);\n\t\t\n\t\tiptv.printProperty();\n\t}\n\n}", "end": 130, "score": 0.999755322933197, "start": 121, "tag": "IP_ADDRESS", "value": "192.1.1.2" } ]
null
[]
package JavaM_Chapter05_Example; public class Ex02 { public static void main(String[] args) { IPTV iptv = new IPTV("172.16.31.10", 32,2048); iptv.printProperty(); } }
178
0.668571
0.577143
11
15
16.933023
45
false
false
0
0
0
0
0
0
1.181818
false
false
12
4b4ef431ca8ac2c0903b1feeb76a657fd1d96a38
28,845,000,366,140
9784461caad16155b8775f3d8e08bbbebcf892dd
/src/main/java/firstblog/blog/service/AdminService.java
f2a6e25eb820b477511872e418f5160af36a57f6
[]
no_license
niksan43t0/memeSite
https://github.com/niksan43t0/memeSite
ca2f1a93b12eecba424b6b1e9ce6e778bb4ed8a5
4f7e15e74efd646923d19d544c79d66713245bf7
refs/heads/master
2021-07-15T02:23:01.662000
2017-10-20T12:25:14
2017-10-20T12:25:14
107,646,921
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package firstblog.blog.service; import firstblog.blog.bindingModel.UserEditBindingModel; import org.springframework.ui.Model; public interface AdminService { String loadUserList(Model model); String loadEditPage(Model model, Integer userId); String editUser(UserEditBindingModel userEditBindingModel, Integer userId); String loadDeletePage(Model model, Integer userId); String deleteUser(Integer userId, String memesDelete); }
UTF-8
Java
449
java
AdminService.java
Java
[]
null
[]
package firstblog.blog.service; import firstblog.blog.bindingModel.UserEditBindingModel; import org.springframework.ui.Model; public interface AdminService { String loadUserList(Model model); String loadEditPage(Model model, Integer userId); String editUser(UserEditBindingModel userEditBindingModel, Integer userId); String loadDeletePage(Model model, Integer userId); String deleteUser(Integer userId, String memesDelete); }
449
0.804009
0.804009
12
36.416668
24.577965
79
false
false
0
0
0
0
0
0
1
false
false
12
4778e60e2e6225e36d90df66881a86e77c4602b3
30,124,900,620,284
bf8b1aab25193befdb8f6ba33c120e1a9a647d23
/app/src/main/java/cn/edu/pku/hyq/app/restaurants/model/MeiTuan.java
203b7df124dcdb21cae9ca1f9cb877d1da89e7c1
[]
no_license
Actasclown/Restaurantss
https://github.com/Actasclown/Restaurantss
f5ab6e560bdc55de334a640cecd97bd2c2990e11
9d983391a8cbb68473d4e4a47a46f3029a891e4b
refs/heads/master
2021-01-19T19:19:33.062000
2017-04-20T10:21:28
2017-04-20T10:21:28
88,412,868
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.edu.pku.hyq.app.restaurants.model; /** * Created by Yue on 2017/3/20. */ public class MeiTuan { public static final String PACKAGE_NAME = "com.sankuai.meituan"; }
UTF-8
Java
193
java
MeiTuan.java
Java
[ { "context": "u.hyq.app.restaurants.model;\r\n\r\n/**\r\n * Created by Yue on 2017/3/20.\r\n */\r\npublic class MeiTuan {\r\n\r\n ", "end": 71, "score": 0.6953681707382202, "start": 68, "tag": "USERNAME", "value": "Yue" } ]
null
[]
package cn.edu.pku.hyq.app.restaurants.model; /** * Created by Yue on 2017/3/20. */ public class MeiTuan { public static final String PACKAGE_NAME = "com.sankuai.meituan"; }
193
0.658031
0.621762
10
17.299999
22.627638
68
false
false
0
0
0
0
0
0
0.2
false
false
12
d9f44fe549138bcd6b562cbd5d679c9a1ecf62b3
30,124,900,622,974
55dedd6932970eaf9bca0f6c1591ff03f6d184ad
/src/main/java/com/xavien/demo/DemoAdapter.java
7d47d98d0b0e1de7e8dba6d67d2805366a6fd2b2
[]
no_license
XavienHaung/AndroidDemo
https://github.com/XavienHaung/AndroidDemo
ad0b2e6438b70852e5292a527fd66cb9246b57ab
02417cf7045169ee360101c0c0b25541a61a78f2
refs/heads/master
2021-01-20T08:48:40.776000
2015-04-12T14:06:16
2015-04-12T14:06:16
33,171,777
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.xavien.demo; import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import com.xavien.utils.XLog; import java.util.List; /** * Created by Xavien on 15-4-7. */ public class DemoAdapter extends BaseAdapter { private static final String TAG = "DemoAdapter"; private Context mContext; private List<String> mDataList; public DemoAdapter(Context context, List<String> data){ mContext = context; mDataList = data; } @Override public int getCount() { XLog.i(TAG, "data size " + mDataList.size()); return mDataList.size(); } @Override public Object getItem(int position) { return position >= mDataList.size() ? "" : mDataList.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { TextView textView; if(convertView != null){ textView = (TextView)convertView.getTag(); }else{ textView = new TextView(mContext); textView.setTextSize(24); convertView = textView; convertView.setTag(textView); } textView.setText((String)getItem(position)); return convertView; } }
UTF-8
Java
1,415
java
DemoAdapter.java
Java
[ { "context": "s.XLog;\n\nimport java.util.List;\n\n/**\n * Created by Xavien on 15-4-7.\n */\npublic class DemoAdapter extends B", "end": 262, "score": 0.9971536993980408, "start": 256, "tag": "USERNAME", "value": "Xavien" } ]
null
[]
package com.xavien.demo; import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import com.xavien.utils.XLog; import java.util.List; /** * Created by Xavien on 15-4-7. */ public class DemoAdapter extends BaseAdapter { private static final String TAG = "DemoAdapter"; private Context mContext; private List<String> mDataList; public DemoAdapter(Context context, List<String> data){ mContext = context; mDataList = data; } @Override public int getCount() { XLog.i(TAG, "data size " + mDataList.size()); return mDataList.size(); } @Override public Object getItem(int position) { return position >= mDataList.size() ? "" : mDataList.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { TextView textView; if(convertView != null){ textView = (TextView)convertView.getTag(); }else{ textView = new TextView(mContext); textView.setTextSize(24); convertView = textView; convertView.setTag(textView); } textView.setText((String)getItem(position)); return convertView; } }
1,415
0.638869
0.634629
60
22.583334
19.946838
75
false
false
0
0
0
0
0
0
0.483333
false
false
12
ca59ed8a11b3fa3a2eff249edb3ef05878ea3aee
30,932,354,474,213
f12974d0def40c1067989cb39c91e76a91ac3640
/demo6-libreriavirtual/applibreriavirtualfinal/applibreriavirtual/src/main/java/com/pe/entity/Usuario.java
448407cecf0eccf996315e788666f158326e1629
[ "Apache-2.0" ]
permissive
gitHAMP/spring
https://github.com/gitHAMP/spring
330af060f41580081e6fc8c8b1451d85cd443dc8
321d9a8fbb2aaa25b42a0739ec06ca7c6c66a9a1
refs/heads/master
2018-05-15T13:53:20.302000
2017-07-09T18:01:30
2017-07-09T18:01:30
92,838,726
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.pe.entity; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; @Entity @Table(name="usuarios") public class Usuario { @Id @Column(name="username") private String username; @Column(name="password") private String password; @Column(name="enable") private boolean enable; @OneToMany(mappedBy="usuario",fetch=FetchType.EAGER) private List<Rol> rol = new ArrayList<Rol>(); @OneToMany(mappedBy="usuario",fetch=FetchType.LAZY,cascade = CascadeType.ALL) private List<Movimiento> movimientos; public Usuario() { super(); } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public boolean isEnable() { return enable; } public void setEnable(boolean enable) { this.enable = enable; } public List<Rol> getRol() { return rol; } public void setRol(List<Rol> rol) { this.rol = rol; } public List<Movimiento> getMovimientos() { return movimientos; } public void setMovimientos(List<Movimiento> movimientos) { this.movimientos = movimientos; } }
UTF-8
Java
1,443
java
Usuario.java
Java
[ { "context": "ios\")\npublic class Usuario {\n\n\t@Id\n\t@Column(name=\"username\")\n\tprivate String username;\n\n\t@Column(name=\"passw", "end": 399, "score": 0.9988225102424622, "start": 391, "tag": "USERNAME", "value": "username" }, { "context": "rname\")\n\tprivate String username;\n\n\t@Column(name=\"password\")\n\tprivate String password;\n\n\t@Column(name=\"enabl", "end": 452, "score": 0.9914395809173584, "start": 444, "tag": "PASSWORD", "value": "password" }, { "context": "per();\n\t}\n\n\tpublic String getUsername() {\n\t\treturn username;\n\t}\n\n\tpublic void setUsername(String username) {\n", "end": 836, "score": 0.9360917806625366, "start": 828, "tag": "USERNAME", "value": "username" }, { "context": "d setUsername(String username) {\n\t\tthis.username = username;\n\t}\n\n\tpublic String getPassword() {\n\t\treturn pass", "end": 912, "score": 0.9545314311981201, "start": 904, "tag": "USERNAME", "value": "username" }, { "context": "d setPassword(String password) {\n\t\tthis.password = password;\n\t}\n\n\tpublic boolean isEnable() {\n\t\treturn enable", "end": 1042, "score": 0.9694513082504272, "start": 1034, "tag": "PASSWORD", "value": "password" } ]
null
[]
package com.pe.entity; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; @Entity @Table(name="usuarios") public class Usuario { @Id @Column(name="username") private String username; @Column(name="<PASSWORD>") private String password; @Column(name="enable") private boolean enable; @OneToMany(mappedBy="usuario",fetch=FetchType.EAGER) private List<Rol> rol = new ArrayList<Rol>(); @OneToMany(mappedBy="usuario",fetch=FetchType.LAZY,cascade = CascadeType.ALL) private List<Movimiento> movimientos; public Usuario() { super(); } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = <PASSWORD>; } public boolean isEnable() { return enable; } public void setEnable(boolean enable) { this.enable = enable; } public List<Rol> getRol() { return rol; } public void setRol(List<Rol> rol) { this.rol = rol; } public List<Movimiento> getMovimientos() { return movimientos; } public void setMovimientos(List<Movimiento> movimientos) { this.movimientos = movimientos; } }
1,447
0.735274
0.735274
79
17.265823
17.273458
78
false
false
0
0
0
0
0
0
1.063291
false
false
12
c169893ea4fb0a7d742af83a3cc491664452ec8f
7,232,724,939,519
a403fa24464b70cea4ef7b164326f777e8b77ed7
/test-thrift/src/main/java/service/server/HelloServiceAsyncServer.java
fb970a26f2dd8b928d260fed31661f808b7a1c57
[]
no_license
BUPTAnderson/test-project
https://github.com/BUPTAnderson/test-project
e732667ef44869d26f4201aa195c1ce7fe04f4a9
57c4dd30d5b4c16a747e8bfafb3df438119a5381
refs/heads/master
2022-11-04T12:27:58.707000
2019-07-10T08:33:48
2019-07-10T08:33:48
57,364,442
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package service.server; import org.apache.thrift.protocol.TBinaryProtocol; import org.apache.thrift.server.TNonblockingServer; import org.apache.thrift.server.TServer; import org.apache.thrift.transport.TFramedTransport; import org.apache.thrift.transport.TNonblockingServerSocket; import org.apache.thrift.transport.TNonblockingServerTransport; import org.apache.thrift.transport.TTransportException; import service.demo.Hello; import service.demo.HelloServiceImpl; /** * Created by anderson on 17-6-6. */ public class HelloServiceAsyncServer { /** * 启动 Thrift 异步服务器 * @param arg */ public static void main(String[] arg) { TNonblockingServerTransport serverTransport; try { serverTransport = new TNonblockingServerSocket(10005); Hello.Processor processor = new Hello.Processor( new HelloServiceImpl()); TNonblockingServer.Args args = new TNonblockingServer.Args(serverTransport); args.processor(processor); TBinaryProtocol.Factory proFactory = new TBinaryProtocol.Factory(); // 默认就是使用的TBinaryProtocol.Factory, 可以不设置, 即下面这行代码可以没有 args.protocolFactory(proFactory); TFramedTransport.Factory traFactory = new TFramedTransport.Factory(); // 默认就是使用的TFramedTransport.Factory, 可以不设置, 即下面这行代码可以没有 args.transportFactory(traFactory); TServer server = new TNonblockingServer(args); System.out.println("Start server on port 10005 ..."); server.serve(); } catch (TTransportException e) { e.printStackTrace(); } } }
UTF-8
Java
1,759
java
HelloServiceAsyncServer.java
Java
[ { "context": " service.demo.HelloServiceImpl;\n\n/**\n * Created by anderson on 17-6-6.\n */\npublic class HelloServiceAsyncServ", "end": 495, "score": 0.9989044666290283, "start": 487, "tag": "USERNAME", "value": "anderson" } ]
null
[]
package service.server; import org.apache.thrift.protocol.TBinaryProtocol; import org.apache.thrift.server.TNonblockingServer; import org.apache.thrift.server.TServer; import org.apache.thrift.transport.TFramedTransport; import org.apache.thrift.transport.TNonblockingServerSocket; import org.apache.thrift.transport.TNonblockingServerTransport; import org.apache.thrift.transport.TTransportException; import service.demo.Hello; import service.demo.HelloServiceImpl; /** * Created by anderson on 17-6-6. */ public class HelloServiceAsyncServer { /** * 启动 Thrift 异步服务器 * @param arg */ public static void main(String[] arg) { TNonblockingServerTransport serverTransport; try { serverTransport = new TNonblockingServerSocket(10005); Hello.Processor processor = new Hello.Processor( new HelloServiceImpl()); TNonblockingServer.Args args = new TNonblockingServer.Args(serverTransport); args.processor(processor); TBinaryProtocol.Factory proFactory = new TBinaryProtocol.Factory(); // 默认就是使用的TBinaryProtocol.Factory, 可以不设置, 即下面这行代码可以没有 args.protocolFactory(proFactory); TFramedTransport.Factory traFactory = new TFramedTransport.Factory(); // 默认就是使用的TFramedTransport.Factory, 可以不设置, 即下面这行代码可以没有 args.transportFactory(traFactory); TServer server = new TNonblockingServer(args); System.out.println("Start server on port 10005 ..."); server.serve(); } catch (TTransportException e) { e.printStackTrace(); } } }
1,759
0.692075
0.683606
42
38.357143
24.229874
88
false
false
0
0
0
0
0
0
0.642857
false
false
12
d945a4271c99db2f4467360173284a5a846f13c7
16,621,523,449,089
7c97c5cfe50f7291d61fb0193452f67a2e28c80c
/src/com/vencillio/rs2/content/skill/prayer/Curses.java
776db0b37e0ab15629d92c990778d449b5e25305
[]
no_license
tannermon11/RSPS
https://github.com/tannermon11/RSPS
a3970c0937120f8160dce86825c856b7c14c048c
86fe837e72a504c7c5228b3993530ec2cd4968d6
refs/heads/master
2018-10-22T18:55:43.785000
2018-09-04T04:11:57
2018-09-04T04:11:57
120,994,242
0
3
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.vencillio.rs2.content.skill.prayer; import com.vencillio.core.task.Task; import com.vencillio.core.task.TaskQueue; import com.vencillio.rs2.content.combat.Hit; import com.vencillio.rs2.entity.*; import com.vencillio.rs2.entity.mob.Mob; import com.vencillio.rs2.entity.player.Player; import com.vencillio.rs2.entity.player.net.out.impl.SendMessage; /** * Created by Tanner on 2/4/2018. */ public class Curses { private static Player p; public Curses(Player p) { this.p = p; } public static int random(int range) { return (int) (Math.random() * (range + 1)); } public void applyLeeches(final Entity entity) { boolean performed = false; try { /*// check if entity is dead... if (p.getPrayer().active(PrayerBook.Prayer.LEECHATTACK) && random(20 - (int) p.curseOdds) == 1) { performed = leechAttack(entity); } else if (p.getPrayer().active(PrayerBook.Prayer.LEECHDEFENCE) && random(23 - (int) p.curseOdds) == 1) { performed = leechDefence(entity); } else if (p.getPrayer().active(PrayerBook.Prayer.LEECHSTRENGTH) && random(26 - (int) p.curseOdds) == 1) { performed = leechStrength(entity); } else if (p.getPrayer().active(PrayerBook.Prayer.LEECHRANGED) && random(29 - (int) p.curseOdds) == 1) { performed = leechRanged(entity); } else if (p.getPrayer().active(PrayerBook.Prayer.LEECHMAGIC) && random(32 - (int) p.curseOdds) == 1) { performed = leechMagic(entity); } else if (entity instanceof Player && (p.getPrayer().active(PrayerBook.Prayer.LEECHSPECIAL) && random(32) == 1)) { performed = leechSpecial(entity.getPlayer()); } if (p.getPrayer().active(PrayerBook.Prayer.SAPWARRIOR) && random(10 - (int) p.curseOdds) == 1) { performed = sapWarrior(entity); } else if (p.getPrayer().active(PrayerBook.Prayer.SAPRANGE) && random(13 - (int) p.curseOdds) == 1) { performed = sapRanged(entity); } else if (p.getPrayer().active(PrayerBook.Prayer.SAPMAGE) && random(16 - (int) p.curseOdds) == 1) { performed = sapMagic(entity); } else if (entity instanceof Player && (p.getPrayer().active(PrayerBook.Prayer.SAPSPIRIT) && random(20) == 1)) { performed = sapSpirit((Player) entity); }*/ } catch (Exception ex) { p.curseOdds = 0.0; } if (performed) { p.curseOdds = 0.0; } else { p.curseOdds += 0.3; } } private boolean sapWarrior(final Entity entity) { if (entity.attackMultiplier <= 0.90 && entity.defenceMultiplier <= 0.90 && entity.strengthMultiplier <= 0.90) { return false; } final int pX = p.getX(); final int pY = p.getY(); final int oX = entity.getX(); final int oY = entity.getY(); final int offX = (pY - oY) * -1; final int offY = (pX - oX) * -1; p.send(new SendMessage("You drain your opponents Attack, Defence and Strength.")); p.getUpdateFlags().sendAnimation(new Animation(12569)); p.getUpdateFlags().sendGraphic(new Graphic(2214)); TaskQueue.queue(new Task(0) { int delay = 0; public void execute() { if (delay == 0) { //p.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 40, 2215, 25, 25, 0, 0); World.sendProjectile(new Projectile(2215, 1, 0, 40, 25, 25, 50), new Location(pX, pY), 0, (byte) oX, (byte) oY); } else if (delay == 2) { entity.getUpdateFlags().sendGraphic(new Graphic(2216)); if (entity.attackMultiplier > 0.90) { entity.attackMultiplier -= 0.2; if (entity.attackMultiplier < 0.90) { entity.attackMultiplier = 0.90; } } if (entity.defenceMultiplier > 0.90) { entity.defenceMultiplier -= 0.2; if (entity.defenceMultiplier < 0.90) { entity.defenceMultiplier = 0.90; } } if (entity.strengthMultiplier > 0.90) { entity.strengthMultiplier -= 0.2; if (entity.strengthMultiplier < 0.90) { entity.strengthMultiplier = 0.90; } } stop(); } delay++; } @Override public void onStop() { } }); return true; } private boolean sapRanged(final Entity entity) { if (entity.rangedMultiplier <= 0.90 && entity.defenceMultiplier <= 0.90) { return false; } final int pX = p.getX(); final int pY = p.getY(); final int oX = entity.getX(); final int oY = entity.getY(); final int offX = (pY - oY) * -1; final int offY = (pX - oX) * -1; p.send(new SendMessage("You drain your opponents Ranged and Defence.")); p.getUpdateFlags().sendAnimation(new Animation(12569)); p.getUpdateFlags().sendGraphic(new Graphic(2217)); TaskQueue.queue(new Task(0) { int delay = 0; public void execute() { if (delay == 0) { //p.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 40, 2218, 25, 25, 0, 0); World.sendProjectile(new Projectile(2218, 1, 0, 40, 25, 25, 50), new Location(pX,pY), 0, (byte)oX, (byte)oY); } else if (delay == 2) { entity.getUpdateFlags().sendGraphic(new Graphic(2219)); if (entity.rangedMultiplier > 0.90) { entity.rangedMultiplier -= 0.2; if (entity.rangedMultiplier < 0.90) { entity.rangedMultiplier = 0.90; } } if (entity.defenceMultiplier > 0.90) { entity.defenceMultiplier -= 0.2; if (entity.defenceMultiplier < 0.90) { entity.defenceMultiplier = 0.90; } } stop(); } delay++; } @Override public void onStop() { } }); return true; } private boolean sapMagic(final Entity entity) { if (entity.attackMultiplier <= 0.90 && entity.defenceMultiplier <= 0.90) { return false; } final int pX = p.getX(); final int pY = p.getY(); final int oX = entity.getX(); final int oY = entity.getY(); final int offX = (pY - oY) * -1; final int offY = (pX - oX) * -1; p.send(new SendMessage("You drain your opponents Magic and Defence.")); p.getUpdateFlags().sendAnimation(new Animation(12569)); p.getUpdateFlags().sendGraphic(new Graphic(2220)); TaskQueue.queue(new Task(0) { int delay = 0; public void execute() { if (delay == 0) { //p.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 40, 2221, 25, 25, 0, 0); World.sendProjectile(new Projectile(2221, 1, 0, 40, 25, 25, 50), new Location(pX, pY), 0, (byte) oX, (byte) oY); } else if (delay == 2) { entity.getUpdateFlags().sendGraphic(new Graphic(2222)); if (entity.attackMultiplier > 0.90) { entity.attackMultiplier -= 0.2; if (entity.attackMultiplier < 0.90) { entity.attackMultiplier = 0.90; } } if (entity.defenceMultiplier > 0.90) { entity.defenceMultiplier -= 0.2; if (entity.defenceMultiplier < 0.90) { entity.defenceMultiplier = 0.90; } } stop(); } delay++; } @Override public void onStop() { } }); return true; } private boolean sapSpirit(final Player otherPlayer) { if (otherPlayer.getSpecialAttack().getAmount() <= 1.0) { //Is this right? return false; } final int pX = p.getX(); final int pY = p.getY(); final int oX = otherPlayer.getX(); final int oY = otherPlayer.getY(); final int offX = (pY - oY) * -1; final int offY = (pX - oX) * -1; p.send(new SendMessage("You drain your opponents Special Attack by 10%.")); p.getUpdateFlags().sendAnimation(new Animation(12569)); p.getUpdateFlags().sendGraphic(new Graphic(2223)); TaskQueue.queue(new Task(0) { int delay = 0; public void execute() { if (delay == 0) { //p.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 40, 2224, 25, 25, 0, 0); World.sendProjectile(new Projectile(2224, 1, 0, 40, 25, 25, 50), new Location(pX, pY), 0, (byte) oX, (byte) oY); } else if (delay == 2) { otherPlayer.getUpdateFlags().sendGraphic(new Graphic(2225)); if (otherPlayer.getSpecialAttack().getAmount() > 0.0) { otherPlayer.getSpecialAttack().deduct(1); if (otherPlayer.getSpecialAttack().getAmount() <= 0.0) { otherPlayer.getSpecialAttack().setSpecialAmount(0); } } stop(); } delay++; } @Override public void onStop() { } }); return true; } public static boolean deflectAttack(Entity entity, int damage) { /*if (!p.getPrayer().active(PrayerBook.Prayer.DEFLECTMELEE) && !p.getPrayer().active(PrayerBook.Prayer.DEFLECTMISSILES) && !p.getPrayer().active(PrayerBook.Prayer.DEFLECTMAGIC)) { return; }*/ if (random(2) > 0) { return false; } int deflectedDamage = (int) (damage * .10); if (deflectedDamage <= 0) { return false; } /*if (p.getPrayer().active(PrayerBook.Prayer.DEFLECTMELEE)) { p.getUpdateFlags().sendGraphic(new Graphic(2227)); // melee deflect } else if (p.getPrayer().active(PrayerBook.Prayer.DEFLECTMISSILES)) { p.getUpdateFlags().sendGraphic(new Graphic(2229)); // range deflect } else if (p.getPrayer().active(PrayerBook.Prayer.DEFLECTMAGIC)) { p.getUpdateFlags().sendGraphic(new Graphic(2230)); // mage deflect }*/ //p.getUpdateFlags().sendAnimation(new Animation(12573)); Hit h = new Hit(deflectedDamage); entity.hit(h); return true; //entity.setHitUpdateRequired(true); //entity.setUpdateRequired(true); } public void applySoulSplit(final Player otherPlayer, int damage) {//PvP int maxHp = p.getMaxLevels()[3]; if (p.getSkill().getLevels()[3] < maxHp) { int healAmount = (int) (damage * 0.4); if (p.getSkill().getLevels()[3] + healAmount > maxHp) { p.getLevels()[3] = p.getMaxLevels()[3]; } else { p.getLevels()[3] += healAmount; } p.getSkill().update(3); if (otherPlayer.getLevels()[5] >= 1) { otherPlayer.getLevels()[5]--; otherPlayer.getSkill().update(5); } final int pX = p.getX(); final int pY = p.getY(); final int oX = otherPlayer.getX(); final int oY = otherPlayer.getY(); int offX = (pY - oY) * -1; int offY = (pX - oX) * -1; //p.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 20, 2263, 15, 10, -p.oldPlayerIndex - 1, 0); //-pOldPlayerIndex-1 = lock-on ? World.sendProjectile(new Projectile(2263, 1, 0, 20, 15, 10, 50), new Location(pX,pY), 0, (byte)oX, (byte)oY); TaskQueue.queue(new Task(0) { public void execute() { otherPlayer.getUpdateFlags().sendGraphic(new Graphic(2264)); int offX2 = (oY - pY) * -1; int offY2 = (oX - pX) * -1; //p.getPA().createPlayersProjectile(oX, oY, offX2, offY2, 50, 20, 2263, 15, 10, -p.playerId - 1, 0); World.sendProjectile(new Projectile(2263, 1, 0, 20, 15, 10, 50), new Location(oX,oY), 0, (byte)offX2, (byte)offY2); stop(); } @Override public void onStop() { } }); } } public static void applySoulSplit(final Mob npc, int damage, Player player) {//PvE int maxHp = player.getMaxLevels()[3]; if (player.getSkill().getLevels()[3] < maxHp) { int healAmount = (int) (damage * 0.2); if (player.getSkill().getLevels()[3] + healAmount > maxHp) { player.getLevels()[3] = player.getMaxLevels()[3]; } else { player.getLevels()[3] += healAmount; } player.getSkill().update(3); final int pX = player.getX(); final int pY = player.getY(); final int oX = npc.getX(); final int oY = npc.getY(); int offX = (pY - oY) * -1; int offY = (pX - oX) * -1; //player.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 25, 2263, 15, 10, -player.oldNpcIndex - 1, 0); //World.sendProjectile(new Projectile(280, 1, 0, 25, 15, 10, 50), new Location(pX,pY), 0, (byte)oX, (byte)oY); TaskQueue.queue(new Task(0) { public void execute() { npc.getUpdateFlags().sendGraphic(new Graphic(1177)); int offX2 = (oY - pY) * -1; int offY2 = (oX - pX) * -1; //player.getPA().createPlayersProjectile(oX, oY, offX2, offY2, 50, 25, 2263, 15, 10, -player.playerId - 1, 0); //World.sendProjectile(new Projectile(280, 1, 0, 25, 15, 10, 50), new Location(oX,oY), 0, (byte)offX2, (byte)offY2); stop(); } @Override public void onStop() { } }); } } private boolean leechAttack(final Entity entity) { if (checkLeechMultiplier(p.attackMultiplier, entity.attackMultiplier)) { return false; } final int pX = p.getX(); final int pY = p.getY(); final int oX = entity.getX(); final int oY = entity.getY(); final int offX = (pY - oY) * -1; final int offY = (pX - oX) * -1; p.send(new SendMessage("You leech your opponent's attack.")); p.getUpdateFlags().sendAnimation(new Animation(12575)); TaskQueue.queue(new Task(0) { int delay = 0; public void execute() { if (delay == 0) { //p.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 40, 2231, 25, 35, 0, 0); World.sendProjectile(new Projectile(2231, 1, 0, 40, 25, 35, 50), new Location(pX, pY), 0, (byte) oX, (byte) oY); } else if (delay == 2) { entity.getUpdateFlags().sendGraphic(new Graphic(2232)); if (p.attackMultiplier < 1.10) { p.attackMultiplier += 0.2; if (p.attackMultiplier > 1.10) { p.attackMultiplier = 1.10; } } if (entity.attackMultiplier > 0.85) { entity.attackMultiplier -= 0.2; if (entity.attackMultiplier < 0.85) { entity.attackMultiplier = 0.85; } } stop(); } delay++; } @Override public void onStop() { } }); return true; } private boolean leechRanged(final Entity entity) { if (checkLeechMultiplier(p.rangedMultiplier, entity.rangedMultiplier)) { return false; } final int pX = p.getX(); final int pY = p.getY(); final int oX = entity.getX(); final int oY = entity.getY(); final int offX = (pY - oY) * -1; final int offY = (pX - oX) * -1; p.send(new SendMessage("You leech your opponent's range.")); p.getUpdateFlags().sendAnimation(new Animation(12575)); TaskQueue.queue(new Task(0) { int delay = 0; public void execute() { if (delay == 1) { //p.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 40, 2236, 25, 35, 0, 0); World.sendProjectile(new Projectile(2236, 1, 0, 40, 25, 35, 50), new Location(pX,pY), 0, (byte)oX, (byte)oY); } else if (delay == 2) { entity.getUpdateFlags().sendGraphic(new Graphic(2238)); if (p.rangedMultiplier < 1.10) { p.rangedMultiplier += 0.2; if (p.rangedMultiplier > 1.10) { p.rangedMultiplier = 1.10; } } if (entity.rangedMultiplier > 0.85) { entity.rangedMultiplier -= 0.2; if (entity.rangedMultiplier < 0.85) { entity.rangedMultiplier = 0.85; } } stop(); } delay++; } @Override public void onStop() { } }); return true; } private boolean leechMagic(final Entity entity) { if (checkLeechMultiplier(p.magicMultiplier, entity.magicMultiplier)) { return false; } final int pX = p.getX(); final int pY = p.getY(); final int oX = entity.getX(); final int oY = entity.getY(); final int offX = (pY - oY) * -1; final int offY = (pX - oX) * -1; p.send(new SendMessage("You leech your opponent's magic.")); p.getUpdateFlags().sendAnimation(new Animation(12575)); TaskQueue.queue(new Task(0) { int delay = 0; public void execute() { if (delay == 1) { //p.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 40, 2240, 25, 35, 0, 0); World.sendProjectile(new Projectile(2240, 1, 0, 40, 25, 35, 50), new Location(pX,pY), 0, (byte)oX, (byte)oY); } else if (delay == 2) { entity.getUpdateFlags().sendGraphic(new Graphic(2242)); if (p.magicMultiplier < 1.10) { p.magicMultiplier += 0.2; if (p.magicMultiplier > 1.10) { p.magicMultiplier = 1.10; } } if (entity.magicMultiplier > 0.85) { entity.magicMultiplier -= 0.2; if (entity.magicMultiplier < 0.85) { entity.magicMultiplier = 0.85; } } stop(); } delay++; } @Override public void onStop() { } }); return true; } private boolean leechDefence(final Entity entity) { if (checkLeechMultiplier(p.defenceMultiplier, entity.defenceMultiplier)) { return false; } final int pX = p.getX(); final int pY = p.getY(); final int oX = entity.getX(); final int oY = entity.getY(); final int offX = (pY - oY) * -1; final int offY = (pX - oX) * -1; p.send(new SendMessage("You leech your opponent's defence.")); p.getUpdateFlags().sendAnimation(new Animation(12575)); TaskQueue.queue(new Task(0) { int delay = 0; public void execute() { if (delay == 1) { //p.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 40, 2244, 25, 35, 0, 0); World.sendProjectile(new Projectile(2244, 1, 0, 40, 25, 35, 50), new Location(pX,pY), 0, (byte)oX, (byte)oY); } else if (delay == 2) { entity.getUpdateFlags().sendGraphic(new Graphic(2246)); if (p.defenceMultiplier < 1.10) { p.defenceMultiplier += 0.2; if (p.defenceMultiplier > 1.10) { p.defenceMultiplier = 1.10; } } if (entity.defenceMultiplier > 0.85) { entity.defenceMultiplier -= 0.2; if (entity.defenceMultiplier < 0.85) { entity.defenceMultiplier = 0.85; } } stop(); } delay++; } @Override public void onStop() { } }); return true; } private boolean leechStrength(final Entity entity) { if (checkLeechMultiplier(p.strengthMultiplier, entity.strengthMultiplier)) { return false; } final int pX = p.getX(); final int pY = p.getY(); final int oX = entity.getX(); final int oY = entity.getY(); final int offX = (pY - oY) * -1; final int offY = (pX - oX) * -1; p.send(new SendMessage("You leech your opponent's strength.")); p.getUpdateFlags().sendAnimation(new Animation(12575)); TaskQueue.queue(new Task(0) { int delay = 0; public void execute() { if (delay == 1) { //p.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 40, 2248, 25, 35, 0, 0); World.sendProjectile(new Projectile(2248, 1, 0, 40, 25, 35, 50), new Location(pX,pY), 0, (byte)oX, (byte)oY); } else if (delay == 2) { entity.getUpdateFlags().sendGraphic(new Graphic(2250)); if (p.strengthMultiplier < 1.10) { p.strengthMultiplier += 0.2; if (p.strengthMultiplier > 1.10) { p.strengthMultiplier = 1.10; } } if (entity.strengthMultiplier > 0.85) { entity.strengthMultiplier -= 0.2; if (entity.strengthMultiplier < 0.85) { entity.strengthMultiplier = 0.85; } } stop(); } delay++; } @Override public void onStop() { } }); return true; } private boolean leechSpecial(final Player otherPlayer) { if (p.getSpecialAttack().getAmount() >= 10.0 || otherPlayer.getSpecialAttack().getAmount() <= 0.0) { return false; } final int pX = p.getX(); final int pY = p.getY(); final int oX = otherPlayer.getX(); final int oY = otherPlayer.getY(); final int offX = (pY - oY) * -1; final int offY = (pX - oX) * -1; p.send(new SendMessage("You leech your opponent's special attack.")); p.getUpdateFlags().sendAnimation(new Animation(12575)); TaskQueue.queue(new Task(0) { int delay = 0; public void execute() { if (delay == 1) { //p.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 40, 2256, 25, 35, 0, 0); World.sendProjectile(new Projectile(2256, 1, 0, 40, 25, 35, 50), new Location(pX,pY), 0, (byte)oX, (byte)oY); } else if (delay == 2) { otherPlayer.getUpdateFlags().sendGraphic(new Graphic(2258)); p.getSpecialAttack().add(1); otherPlayer.getSpecialAttack().deduct(1); otherPlayer.send(new SendMessage("Your special attack has been leeched.")); //otherPlayer.getItems().addSpecialBar(otherPlayer.equipment[Player.WEAPON].getId()); //p.getItems().addSpecialBar(p.equipment[Player.WEAPON].getId()); //What is the purpose of this stop(); } delay++; } @Override public void onStop() { } }); return true; } private boolean checkLeechMultiplier(double d, double d2) { if ((d >= 1.10 || d <= 0.85) && (d2 >= 1.10 || d2 <= 0.85)) { return true; } return false; } private double checkMultiplier(double d) { if (d > 1.0) { d -= 0.1; if (d < 1.0) { d = 1.0; } } else if (d < 1.0) { d += 0.1; if (d > 1.0) { d = 1.0; } } return d; } public void checkMultipliers() { /*if (!p.getPrayer().active(PrayerBook.Prayer.LEECHATTACK) && !p.getPrayer().active(PrayerBook.Prayer.SAPWARRIOR)) { p.attackMultiplier = checkMultiplier(p.attackMultiplier); } if (!p.getPrayer().active(PrayerBook.Prayer.LEECHRANGED) && !p.getPrayer().active(PrayerBook.Prayer.SAPRANGE)) { p.rangedMultiplier = checkMultiplier(p.rangedMultiplier); } if (!p.getPrayer().active(PrayerBook.Prayer.LEECHMAGIC) && !p.getPrayer().active(PrayerBook.Prayer.SAPMAGE)) { p.magicMultiplier = checkMultiplier(p.magicMultiplier); } if (!p.getPrayer().active(PrayerBook.Prayer.LEECHDEFENCE) && !p.getPrayer().active(PrayerBook.Prayer.SAPDEFENCE)) { p.defenceMultiplier = checkMultiplier(p.defenceMultiplier); } if (!p.getPrayer().active(PrayerBook.Prayer.LEECHSTRENGTH) && !p.getPrayer().active(PrayerBook.Prayer.SAPSTRENGTH)) { p.strengthMultiplier = checkMultiplier(p.strengthMultiplier); } //p.multiplierDelay = System.currentTimeMillis();/not sure what this is currently*/ } }
UTF-8
Java
21,160
java
Curses.java
Java
[ { "context": "yer.net.out.impl.SendMessage;\n\n\n\n/**\n * Created by Tanner on 2/4/2018.\n */\n\npublic class Curses {\n\tprivate ", "end": 388, "score": 0.9887657165527344, "start": 382, "tag": "NAME", "value": "Tanner" } ]
null
[]
package com.vencillio.rs2.content.skill.prayer; import com.vencillio.core.task.Task; import com.vencillio.core.task.TaskQueue; import com.vencillio.rs2.content.combat.Hit; import com.vencillio.rs2.entity.*; import com.vencillio.rs2.entity.mob.Mob; import com.vencillio.rs2.entity.player.Player; import com.vencillio.rs2.entity.player.net.out.impl.SendMessage; /** * Created by Tanner on 2/4/2018. */ public class Curses { private static Player p; public Curses(Player p) { this.p = p; } public static int random(int range) { return (int) (Math.random() * (range + 1)); } public void applyLeeches(final Entity entity) { boolean performed = false; try { /*// check if entity is dead... if (p.getPrayer().active(PrayerBook.Prayer.LEECHATTACK) && random(20 - (int) p.curseOdds) == 1) { performed = leechAttack(entity); } else if (p.getPrayer().active(PrayerBook.Prayer.LEECHDEFENCE) && random(23 - (int) p.curseOdds) == 1) { performed = leechDefence(entity); } else if (p.getPrayer().active(PrayerBook.Prayer.LEECHSTRENGTH) && random(26 - (int) p.curseOdds) == 1) { performed = leechStrength(entity); } else if (p.getPrayer().active(PrayerBook.Prayer.LEECHRANGED) && random(29 - (int) p.curseOdds) == 1) { performed = leechRanged(entity); } else if (p.getPrayer().active(PrayerBook.Prayer.LEECHMAGIC) && random(32 - (int) p.curseOdds) == 1) { performed = leechMagic(entity); } else if (entity instanceof Player && (p.getPrayer().active(PrayerBook.Prayer.LEECHSPECIAL) && random(32) == 1)) { performed = leechSpecial(entity.getPlayer()); } if (p.getPrayer().active(PrayerBook.Prayer.SAPWARRIOR) && random(10 - (int) p.curseOdds) == 1) { performed = sapWarrior(entity); } else if (p.getPrayer().active(PrayerBook.Prayer.SAPRANGE) && random(13 - (int) p.curseOdds) == 1) { performed = sapRanged(entity); } else if (p.getPrayer().active(PrayerBook.Prayer.SAPMAGE) && random(16 - (int) p.curseOdds) == 1) { performed = sapMagic(entity); } else if (entity instanceof Player && (p.getPrayer().active(PrayerBook.Prayer.SAPSPIRIT) && random(20) == 1)) { performed = sapSpirit((Player) entity); }*/ } catch (Exception ex) { p.curseOdds = 0.0; } if (performed) { p.curseOdds = 0.0; } else { p.curseOdds += 0.3; } } private boolean sapWarrior(final Entity entity) { if (entity.attackMultiplier <= 0.90 && entity.defenceMultiplier <= 0.90 && entity.strengthMultiplier <= 0.90) { return false; } final int pX = p.getX(); final int pY = p.getY(); final int oX = entity.getX(); final int oY = entity.getY(); final int offX = (pY - oY) * -1; final int offY = (pX - oX) * -1; p.send(new SendMessage("You drain your opponents Attack, Defence and Strength.")); p.getUpdateFlags().sendAnimation(new Animation(12569)); p.getUpdateFlags().sendGraphic(new Graphic(2214)); TaskQueue.queue(new Task(0) { int delay = 0; public void execute() { if (delay == 0) { //p.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 40, 2215, 25, 25, 0, 0); World.sendProjectile(new Projectile(2215, 1, 0, 40, 25, 25, 50), new Location(pX, pY), 0, (byte) oX, (byte) oY); } else if (delay == 2) { entity.getUpdateFlags().sendGraphic(new Graphic(2216)); if (entity.attackMultiplier > 0.90) { entity.attackMultiplier -= 0.2; if (entity.attackMultiplier < 0.90) { entity.attackMultiplier = 0.90; } } if (entity.defenceMultiplier > 0.90) { entity.defenceMultiplier -= 0.2; if (entity.defenceMultiplier < 0.90) { entity.defenceMultiplier = 0.90; } } if (entity.strengthMultiplier > 0.90) { entity.strengthMultiplier -= 0.2; if (entity.strengthMultiplier < 0.90) { entity.strengthMultiplier = 0.90; } } stop(); } delay++; } @Override public void onStop() { } }); return true; } private boolean sapRanged(final Entity entity) { if (entity.rangedMultiplier <= 0.90 && entity.defenceMultiplier <= 0.90) { return false; } final int pX = p.getX(); final int pY = p.getY(); final int oX = entity.getX(); final int oY = entity.getY(); final int offX = (pY - oY) * -1; final int offY = (pX - oX) * -1; p.send(new SendMessage("You drain your opponents Ranged and Defence.")); p.getUpdateFlags().sendAnimation(new Animation(12569)); p.getUpdateFlags().sendGraphic(new Graphic(2217)); TaskQueue.queue(new Task(0) { int delay = 0; public void execute() { if (delay == 0) { //p.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 40, 2218, 25, 25, 0, 0); World.sendProjectile(new Projectile(2218, 1, 0, 40, 25, 25, 50), new Location(pX,pY), 0, (byte)oX, (byte)oY); } else if (delay == 2) { entity.getUpdateFlags().sendGraphic(new Graphic(2219)); if (entity.rangedMultiplier > 0.90) { entity.rangedMultiplier -= 0.2; if (entity.rangedMultiplier < 0.90) { entity.rangedMultiplier = 0.90; } } if (entity.defenceMultiplier > 0.90) { entity.defenceMultiplier -= 0.2; if (entity.defenceMultiplier < 0.90) { entity.defenceMultiplier = 0.90; } } stop(); } delay++; } @Override public void onStop() { } }); return true; } private boolean sapMagic(final Entity entity) { if (entity.attackMultiplier <= 0.90 && entity.defenceMultiplier <= 0.90) { return false; } final int pX = p.getX(); final int pY = p.getY(); final int oX = entity.getX(); final int oY = entity.getY(); final int offX = (pY - oY) * -1; final int offY = (pX - oX) * -1; p.send(new SendMessage("You drain your opponents Magic and Defence.")); p.getUpdateFlags().sendAnimation(new Animation(12569)); p.getUpdateFlags().sendGraphic(new Graphic(2220)); TaskQueue.queue(new Task(0) { int delay = 0; public void execute() { if (delay == 0) { //p.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 40, 2221, 25, 25, 0, 0); World.sendProjectile(new Projectile(2221, 1, 0, 40, 25, 25, 50), new Location(pX, pY), 0, (byte) oX, (byte) oY); } else if (delay == 2) { entity.getUpdateFlags().sendGraphic(new Graphic(2222)); if (entity.attackMultiplier > 0.90) { entity.attackMultiplier -= 0.2; if (entity.attackMultiplier < 0.90) { entity.attackMultiplier = 0.90; } } if (entity.defenceMultiplier > 0.90) { entity.defenceMultiplier -= 0.2; if (entity.defenceMultiplier < 0.90) { entity.defenceMultiplier = 0.90; } } stop(); } delay++; } @Override public void onStop() { } }); return true; } private boolean sapSpirit(final Player otherPlayer) { if (otherPlayer.getSpecialAttack().getAmount() <= 1.0) { //Is this right? return false; } final int pX = p.getX(); final int pY = p.getY(); final int oX = otherPlayer.getX(); final int oY = otherPlayer.getY(); final int offX = (pY - oY) * -1; final int offY = (pX - oX) * -1; p.send(new SendMessage("You drain your opponents Special Attack by 10%.")); p.getUpdateFlags().sendAnimation(new Animation(12569)); p.getUpdateFlags().sendGraphic(new Graphic(2223)); TaskQueue.queue(new Task(0) { int delay = 0; public void execute() { if (delay == 0) { //p.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 40, 2224, 25, 25, 0, 0); World.sendProjectile(new Projectile(2224, 1, 0, 40, 25, 25, 50), new Location(pX, pY), 0, (byte) oX, (byte) oY); } else if (delay == 2) { otherPlayer.getUpdateFlags().sendGraphic(new Graphic(2225)); if (otherPlayer.getSpecialAttack().getAmount() > 0.0) { otherPlayer.getSpecialAttack().deduct(1); if (otherPlayer.getSpecialAttack().getAmount() <= 0.0) { otherPlayer.getSpecialAttack().setSpecialAmount(0); } } stop(); } delay++; } @Override public void onStop() { } }); return true; } public static boolean deflectAttack(Entity entity, int damage) { /*if (!p.getPrayer().active(PrayerBook.Prayer.DEFLECTMELEE) && !p.getPrayer().active(PrayerBook.Prayer.DEFLECTMISSILES) && !p.getPrayer().active(PrayerBook.Prayer.DEFLECTMAGIC)) { return; }*/ if (random(2) > 0) { return false; } int deflectedDamage = (int) (damage * .10); if (deflectedDamage <= 0) { return false; } /*if (p.getPrayer().active(PrayerBook.Prayer.DEFLECTMELEE)) { p.getUpdateFlags().sendGraphic(new Graphic(2227)); // melee deflect } else if (p.getPrayer().active(PrayerBook.Prayer.DEFLECTMISSILES)) { p.getUpdateFlags().sendGraphic(new Graphic(2229)); // range deflect } else if (p.getPrayer().active(PrayerBook.Prayer.DEFLECTMAGIC)) { p.getUpdateFlags().sendGraphic(new Graphic(2230)); // mage deflect }*/ //p.getUpdateFlags().sendAnimation(new Animation(12573)); Hit h = new Hit(deflectedDamage); entity.hit(h); return true; //entity.setHitUpdateRequired(true); //entity.setUpdateRequired(true); } public void applySoulSplit(final Player otherPlayer, int damage) {//PvP int maxHp = p.getMaxLevels()[3]; if (p.getSkill().getLevels()[3] < maxHp) { int healAmount = (int) (damage * 0.4); if (p.getSkill().getLevels()[3] + healAmount > maxHp) { p.getLevels()[3] = p.getMaxLevels()[3]; } else { p.getLevels()[3] += healAmount; } p.getSkill().update(3); if (otherPlayer.getLevels()[5] >= 1) { otherPlayer.getLevels()[5]--; otherPlayer.getSkill().update(5); } final int pX = p.getX(); final int pY = p.getY(); final int oX = otherPlayer.getX(); final int oY = otherPlayer.getY(); int offX = (pY - oY) * -1; int offY = (pX - oX) * -1; //p.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 20, 2263, 15, 10, -p.oldPlayerIndex - 1, 0); //-pOldPlayerIndex-1 = lock-on ? World.sendProjectile(new Projectile(2263, 1, 0, 20, 15, 10, 50), new Location(pX,pY), 0, (byte)oX, (byte)oY); TaskQueue.queue(new Task(0) { public void execute() { otherPlayer.getUpdateFlags().sendGraphic(new Graphic(2264)); int offX2 = (oY - pY) * -1; int offY2 = (oX - pX) * -1; //p.getPA().createPlayersProjectile(oX, oY, offX2, offY2, 50, 20, 2263, 15, 10, -p.playerId - 1, 0); World.sendProjectile(new Projectile(2263, 1, 0, 20, 15, 10, 50), new Location(oX,oY), 0, (byte)offX2, (byte)offY2); stop(); } @Override public void onStop() { } }); } } public static void applySoulSplit(final Mob npc, int damage, Player player) {//PvE int maxHp = player.getMaxLevels()[3]; if (player.getSkill().getLevels()[3] < maxHp) { int healAmount = (int) (damage * 0.2); if (player.getSkill().getLevels()[3] + healAmount > maxHp) { player.getLevels()[3] = player.getMaxLevels()[3]; } else { player.getLevels()[3] += healAmount; } player.getSkill().update(3); final int pX = player.getX(); final int pY = player.getY(); final int oX = npc.getX(); final int oY = npc.getY(); int offX = (pY - oY) * -1; int offY = (pX - oX) * -1; //player.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 25, 2263, 15, 10, -player.oldNpcIndex - 1, 0); //World.sendProjectile(new Projectile(280, 1, 0, 25, 15, 10, 50), new Location(pX,pY), 0, (byte)oX, (byte)oY); TaskQueue.queue(new Task(0) { public void execute() { npc.getUpdateFlags().sendGraphic(new Graphic(1177)); int offX2 = (oY - pY) * -1; int offY2 = (oX - pX) * -1; //player.getPA().createPlayersProjectile(oX, oY, offX2, offY2, 50, 25, 2263, 15, 10, -player.playerId - 1, 0); //World.sendProjectile(new Projectile(280, 1, 0, 25, 15, 10, 50), new Location(oX,oY), 0, (byte)offX2, (byte)offY2); stop(); } @Override public void onStop() { } }); } } private boolean leechAttack(final Entity entity) { if (checkLeechMultiplier(p.attackMultiplier, entity.attackMultiplier)) { return false; } final int pX = p.getX(); final int pY = p.getY(); final int oX = entity.getX(); final int oY = entity.getY(); final int offX = (pY - oY) * -1; final int offY = (pX - oX) * -1; p.send(new SendMessage("You leech your opponent's attack.")); p.getUpdateFlags().sendAnimation(new Animation(12575)); TaskQueue.queue(new Task(0) { int delay = 0; public void execute() { if (delay == 0) { //p.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 40, 2231, 25, 35, 0, 0); World.sendProjectile(new Projectile(2231, 1, 0, 40, 25, 35, 50), new Location(pX, pY), 0, (byte) oX, (byte) oY); } else if (delay == 2) { entity.getUpdateFlags().sendGraphic(new Graphic(2232)); if (p.attackMultiplier < 1.10) { p.attackMultiplier += 0.2; if (p.attackMultiplier > 1.10) { p.attackMultiplier = 1.10; } } if (entity.attackMultiplier > 0.85) { entity.attackMultiplier -= 0.2; if (entity.attackMultiplier < 0.85) { entity.attackMultiplier = 0.85; } } stop(); } delay++; } @Override public void onStop() { } }); return true; } private boolean leechRanged(final Entity entity) { if (checkLeechMultiplier(p.rangedMultiplier, entity.rangedMultiplier)) { return false; } final int pX = p.getX(); final int pY = p.getY(); final int oX = entity.getX(); final int oY = entity.getY(); final int offX = (pY - oY) * -1; final int offY = (pX - oX) * -1; p.send(new SendMessage("You leech your opponent's range.")); p.getUpdateFlags().sendAnimation(new Animation(12575)); TaskQueue.queue(new Task(0) { int delay = 0; public void execute() { if (delay == 1) { //p.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 40, 2236, 25, 35, 0, 0); World.sendProjectile(new Projectile(2236, 1, 0, 40, 25, 35, 50), new Location(pX,pY), 0, (byte)oX, (byte)oY); } else if (delay == 2) { entity.getUpdateFlags().sendGraphic(new Graphic(2238)); if (p.rangedMultiplier < 1.10) { p.rangedMultiplier += 0.2; if (p.rangedMultiplier > 1.10) { p.rangedMultiplier = 1.10; } } if (entity.rangedMultiplier > 0.85) { entity.rangedMultiplier -= 0.2; if (entity.rangedMultiplier < 0.85) { entity.rangedMultiplier = 0.85; } } stop(); } delay++; } @Override public void onStop() { } }); return true; } private boolean leechMagic(final Entity entity) { if (checkLeechMultiplier(p.magicMultiplier, entity.magicMultiplier)) { return false; } final int pX = p.getX(); final int pY = p.getY(); final int oX = entity.getX(); final int oY = entity.getY(); final int offX = (pY - oY) * -1; final int offY = (pX - oX) * -1; p.send(new SendMessage("You leech your opponent's magic.")); p.getUpdateFlags().sendAnimation(new Animation(12575)); TaskQueue.queue(new Task(0) { int delay = 0; public void execute() { if (delay == 1) { //p.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 40, 2240, 25, 35, 0, 0); World.sendProjectile(new Projectile(2240, 1, 0, 40, 25, 35, 50), new Location(pX,pY), 0, (byte)oX, (byte)oY); } else if (delay == 2) { entity.getUpdateFlags().sendGraphic(new Graphic(2242)); if (p.magicMultiplier < 1.10) { p.magicMultiplier += 0.2; if (p.magicMultiplier > 1.10) { p.magicMultiplier = 1.10; } } if (entity.magicMultiplier > 0.85) { entity.magicMultiplier -= 0.2; if (entity.magicMultiplier < 0.85) { entity.magicMultiplier = 0.85; } } stop(); } delay++; } @Override public void onStop() { } }); return true; } private boolean leechDefence(final Entity entity) { if (checkLeechMultiplier(p.defenceMultiplier, entity.defenceMultiplier)) { return false; } final int pX = p.getX(); final int pY = p.getY(); final int oX = entity.getX(); final int oY = entity.getY(); final int offX = (pY - oY) * -1; final int offY = (pX - oX) * -1; p.send(new SendMessage("You leech your opponent's defence.")); p.getUpdateFlags().sendAnimation(new Animation(12575)); TaskQueue.queue(new Task(0) { int delay = 0; public void execute() { if (delay == 1) { //p.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 40, 2244, 25, 35, 0, 0); World.sendProjectile(new Projectile(2244, 1, 0, 40, 25, 35, 50), new Location(pX,pY), 0, (byte)oX, (byte)oY); } else if (delay == 2) { entity.getUpdateFlags().sendGraphic(new Graphic(2246)); if (p.defenceMultiplier < 1.10) { p.defenceMultiplier += 0.2; if (p.defenceMultiplier > 1.10) { p.defenceMultiplier = 1.10; } } if (entity.defenceMultiplier > 0.85) { entity.defenceMultiplier -= 0.2; if (entity.defenceMultiplier < 0.85) { entity.defenceMultiplier = 0.85; } } stop(); } delay++; } @Override public void onStop() { } }); return true; } private boolean leechStrength(final Entity entity) { if (checkLeechMultiplier(p.strengthMultiplier, entity.strengthMultiplier)) { return false; } final int pX = p.getX(); final int pY = p.getY(); final int oX = entity.getX(); final int oY = entity.getY(); final int offX = (pY - oY) * -1; final int offY = (pX - oX) * -1; p.send(new SendMessage("You leech your opponent's strength.")); p.getUpdateFlags().sendAnimation(new Animation(12575)); TaskQueue.queue(new Task(0) { int delay = 0; public void execute() { if (delay == 1) { //p.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 40, 2248, 25, 35, 0, 0); World.sendProjectile(new Projectile(2248, 1, 0, 40, 25, 35, 50), new Location(pX,pY), 0, (byte)oX, (byte)oY); } else if (delay == 2) { entity.getUpdateFlags().sendGraphic(new Graphic(2250)); if (p.strengthMultiplier < 1.10) { p.strengthMultiplier += 0.2; if (p.strengthMultiplier > 1.10) { p.strengthMultiplier = 1.10; } } if (entity.strengthMultiplier > 0.85) { entity.strengthMultiplier -= 0.2; if (entity.strengthMultiplier < 0.85) { entity.strengthMultiplier = 0.85; } } stop(); } delay++; } @Override public void onStop() { } }); return true; } private boolean leechSpecial(final Player otherPlayer) { if (p.getSpecialAttack().getAmount() >= 10.0 || otherPlayer.getSpecialAttack().getAmount() <= 0.0) { return false; } final int pX = p.getX(); final int pY = p.getY(); final int oX = otherPlayer.getX(); final int oY = otherPlayer.getY(); final int offX = (pY - oY) * -1; final int offY = (pX - oX) * -1; p.send(new SendMessage("You leech your opponent's special attack.")); p.getUpdateFlags().sendAnimation(new Animation(12575)); TaskQueue.queue(new Task(0) { int delay = 0; public void execute() { if (delay == 1) { //p.getPA().createPlayersProjectile(pX, pY, offX, offY, 50, 40, 2256, 25, 35, 0, 0); World.sendProjectile(new Projectile(2256, 1, 0, 40, 25, 35, 50), new Location(pX,pY), 0, (byte)oX, (byte)oY); } else if (delay == 2) { otherPlayer.getUpdateFlags().sendGraphic(new Graphic(2258)); p.getSpecialAttack().add(1); otherPlayer.getSpecialAttack().deduct(1); otherPlayer.send(new SendMessage("Your special attack has been leeched.")); //otherPlayer.getItems().addSpecialBar(otherPlayer.equipment[Player.WEAPON].getId()); //p.getItems().addSpecialBar(p.equipment[Player.WEAPON].getId()); //What is the purpose of this stop(); } delay++; } @Override public void onStop() { } }); return true; } private boolean checkLeechMultiplier(double d, double d2) { if ((d >= 1.10 || d <= 0.85) && (d2 >= 1.10 || d2 <= 0.85)) { return true; } return false; } private double checkMultiplier(double d) { if (d > 1.0) { d -= 0.1; if (d < 1.0) { d = 1.0; } } else if (d < 1.0) { d += 0.1; if (d > 1.0) { d = 1.0; } } return d; } public void checkMultipliers() { /*if (!p.getPrayer().active(PrayerBook.Prayer.LEECHATTACK) && !p.getPrayer().active(PrayerBook.Prayer.SAPWARRIOR)) { p.attackMultiplier = checkMultiplier(p.attackMultiplier); } if (!p.getPrayer().active(PrayerBook.Prayer.LEECHRANGED) && !p.getPrayer().active(PrayerBook.Prayer.SAPRANGE)) { p.rangedMultiplier = checkMultiplier(p.rangedMultiplier); } if (!p.getPrayer().active(PrayerBook.Prayer.LEECHMAGIC) && !p.getPrayer().active(PrayerBook.Prayer.SAPMAGE)) { p.magicMultiplier = checkMultiplier(p.magicMultiplier); } if (!p.getPrayer().active(PrayerBook.Prayer.LEECHDEFENCE) && !p.getPrayer().active(PrayerBook.Prayer.SAPDEFENCE)) { p.defenceMultiplier = checkMultiplier(p.defenceMultiplier); } if (!p.getPrayer().active(PrayerBook.Prayer.LEECHSTRENGTH) && !p.getPrayer().active(PrayerBook.Prayer.SAPSTRENGTH)) { p.strengthMultiplier = checkMultiplier(p.strengthMultiplier); } //p.multiplierDelay = System.currentTimeMillis();/not sure what this is currently*/ } }
21,160
0.62396
0.579064
676
30.301775
29.588211
181
false
false
0
0
0
0
0
0
3.877219
false
false
12
a34f45c0c2fc0a48144d8d9ea163fd3da4c53d3e
5,927,054,885,665
f819358d669567b1f6fe0a592b9954c8df78670f
/controller/BookController.java
79037a5384038e00e47622bb20161484b43e598c
[]
no_license
Nwabueze/library1
https://github.com/Nwabueze/library1
900f3cab5262098c451ee171cb7aab2a547c5991
09ee71d956d96feecb0f3d8be23a23192a403f4a
refs/heads/master
2023-08-11T19:19:27.557000
2021-10-01T21:23:12
2021-10-01T21:23:12
412,105,044
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.library1.controller; import com.example.library1.model.Book; import com.example.library1.service.IBookService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.method.P; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpSession; import java.util.List; import java.util.UUID; @RequestMapping("library/book") @RestController public class BookController { @Autowired private IBookService bookService; @Autowired public HttpSession session; // Add a new book (Login required) @PostMapping("/add") public int create(@RequestBody Book book){ String isbn = book.getISBN(); String title = book.getTitle(); String author = book.getAuthor(); String year = book.getYear(); if(isbn.trim().isEmpty() || title.trim().isEmpty() || author.trim().isEmpty() || year.trim().isEmpty()) return -1; String email = (String) session.getAttribute("email"); if(email.isEmpty() || email == null) return -2; book.setId(UUID.randomUUID().toString()); return bookService.create(book); } // Find book by title @GetMapping("/find/1/{title}") public List<Book> selectByTitle(@PathVariable String title){ return bookService.selectByTitle(title); } // Find book by author and year @GetMapping("/find/2/{author}/{year}") public List<Book> selectByAuthorAndYear(@PathVariable String author, @PathVariable String year){ return bookService.selectByAuthorAndYear(author, year); } // find all books @GetMapping("/all") public List<Book> allBooks(){ return bookService.allBooks(); } // Check if current user is currently logged in or not @GetMapping("/user") public String getUserEmail(){ String email = (String) session.getAttribute("email"); if(email.isEmpty() || email == null) return null; return email; } }
UTF-8
Java
2,041
java
BookController.java
Java
[]
null
[]
package com.example.library1.controller; import com.example.library1.model.Book; import com.example.library1.service.IBookService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.method.P; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpSession; import java.util.List; import java.util.UUID; @RequestMapping("library/book") @RestController public class BookController { @Autowired private IBookService bookService; @Autowired public HttpSession session; // Add a new book (Login required) @PostMapping("/add") public int create(@RequestBody Book book){ String isbn = book.getISBN(); String title = book.getTitle(); String author = book.getAuthor(); String year = book.getYear(); if(isbn.trim().isEmpty() || title.trim().isEmpty() || author.trim().isEmpty() || year.trim().isEmpty()) return -1; String email = (String) session.getAttribute("email"); if(email.isEmpty() || email == null) return -2; book.setId(UUID.randomUUID().toString()); return bookService.create(book); } // Find book by title @GetMapping("/find/1/{title}") public List<Book> selectByTitle(@PathVariable String title){ return bookService.selectByTitle(title); } // Find book by author and year @GetMapping("/find/2/{author}/{year}") public List<Book> selectByAuthorAndYear(@PathVariable String author, @PathVariable String year){ return bookService.selectByAuthorAndYear(author, year); } // find all books @GetMapping("/all") public List<Book> allBooks(){ return bookService.allBooks(); } // Check if current user is currently logged in or not @GetMapping("/user") public String getUserEmail(){ String email = (String) session.getAttribute("email"); if(email.isEmpty() || email == null) return null; return email; } }
2,041
0.6634
0.659971
67
29.462687
23.567198
111
false
false
0
0
0
0
0
0
0.567164
false
false
12
c91e1059dba72970a2e620ea3b0cd1c2087f736a
9,990,093,948,434
384c99f78b9d10f9669fdbbf88fe1207b8cc6ffb
/src/main/java/ru/job4j/accident/repository/AccidentJdbcTemplate.java
796701444bd0a634f37ef03f918310f7c308a3cb
[]
no_license
DDobrovolskiy/job4j_car_accident
https://github.com/DDobrovolskiy/job4j_car_accident
af3439d8c27a57eceec776bb6d40017ab51907af
06e1bf046734833efaf4a42faaebed9857d44f52
refs/heads/master
2023-07-13T16:48:01.408000
2021-09-16T19:20:53
2021-09-16T19:20:53
404,436,019
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ru.job4j.accident.repository; import lombok.NonNull; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.support.GeneratedKeyHolder; import org.springframework.jdbc.support.KeyHolder; import org.springframework.stereotype.Repository; import ru.job4j.accident.models.Accident; import ru.job4j.accident.models.AccidentType; import ru.job4j.accident.models.Rule; import ru.job4j.accident.models.mappers.AccidentMappers; import ru.job4j.accident.models.mappers.AccidentTypeMappers; import ru.job4j.accident.models.mappers.RuleMappers; import java.sql.PreparedStatement; import java.util.HashSet; import java.util.List; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; //@Repository public class AccidentJdbcTemplate implements AccidentDAO { private final JdbcTemplate jdbc; public AccidentJdbcTemplate(JdbcTemplate jdbc) { this.jdbc = jdbc; } @Override public void addAccident(@NonNull Accident accident) { if (accident.getId() == 0) { KeyHolder keyHolder = new GeneratedKeyHolder(); jdbc.update(connection -> { PreparedStatement ps = connection.prepareStatement( "INSERT INTO accidents " + "(accident_name, accident_text, accident_address, type_id) " + "values (?, ?, ?, ?)", new String[] {"accident_id"}); ps.setString(1, accident.getName()); ps.setString(2, accident.getText()); ps.setString(3, accident.getAddress()); ps.setInt(4, accident.getType().getId()); return ps; }, keyHolder); accident.setId(keyHolder.getKey().intValue()); } else { jdbc.update( "UPDATE accidents SET " + "accident_name = ?, " + "accident_text = ?, " + "accident_address = ?, " + "type_id = ? " + "WHERE accident_id = ?", accident.getName(), accident.getText(), accident.getAddress(), accident.getType().getId(), accident.getId()); deleteAccidentsRules(accident.getId()); } accident.getRules().forEach(rule -> addAccidentsRules(accident.getId(), rule.getId())); } @Override public List<Accident> getAccidents() { var accidents = jdbc.query( "SELECT " + "accident_id, accident_name, accident_text, accident_address, type_id, type_name " + "FROM accidents " + "JOIN accident_types USING(type_id) ", new AccidentMappers()); accidents.forEach(accident -> accident.setRules(getAccidentsRules(accident.getId()))); return accidents; } @Override public Optional<Accident> getAccident(int id) { var accident = jdbc.query( "SELECT " + "accident_id, accident_name, accident_text, accident_address, type_id, type_name " + "FROM accidents " + "JOIN accident_types USING(type_id) " + "WHERE accident_id = ?", new Object[]{id}, new AccidentMappers()) .stream().findAny(); accident.ifPresent(value -> value.setRules(getAccidentsRules(value.getId()))); return accident; } private void addAccidentsRules(int idAccident, int idRule) { jdbc.update( "INSERT INTO accidents_rules (accident_id, rule_id) values (?, ?)", idAccident, idRule); } private void deleteAccidentsRules(int idAccident) { jdbc.update( "DELETE FROM accidents_rules WHERE accident_id = ?", idAccident); } private Set<Rule> getAccidentsRules(int idAccident) { return new HashSet<>(jdbc.query( "SELECT rule_id, rule_name FROM rules " + "JOIN accidents_rules USING(rule_id) " + "WHERE accident_id = ?", new Object[]{idAccident}, new RuleMappers())); } @Override public void addType(@NonNull AccidentType type) { jdbc.update("INSERT INTO accident_types (type_name) values (?)", type.getName()); } @Override public List<AccidentType> getTypes() { return jdbc.query( "SELECT type_id, type_name FROM accident_types", new AccidentTypeMappers()); } @Override public Optional<AccidentType> getType(int id) { return jdbc.query("SELECT type_id, type_name FROM accident_types WHERE type_id = ?", new Object[]{id}, new AccidentTypeMappers()) .stream().findAny(); } @Override public List<Rule> getRules() { return jdbc.query("SELECT rule_id, rule_name FROM rules", new RuleMappers()); } @Override public void addRuler(@NonNull Rule rule) { jdbc.update("INSERT INTO rules (rule_name) values (?)", rule.getName()); } @Override public Optional<Rule> getRule(int id) { return jdbc.query("SELECT rule_id, rule_name FROM rules WHERE rule_id = ?", new Object[]{id}, new RuleMappers()) .stream().findAny(); } }
UTF-8
Java
5,560
java
AccidentJdbcTemplate.java
Java
[]
null
[]
package ru.job4j.accident.repository; import lombok.NonNull; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.support.GeneratedKeyHolder; import org.springframework.jdbc.support.KeyHolder; import org.springframework.stereotype.Repository; import ru.job4j.accident.models.Accident; import ru.job4j.accident.models.AccidentType; import ru.job4j.accident.models.Rule; import ru.job4j.accident.models.mappers.AccidentMappers; import ru.job4j.accident.models.mappers.AccidentTypeMappers; import ru.job4j.accident.models.mappers.RuleMappers; import java.sql.PreparedStatement; import java.util.HashSet; import java.util.List; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; //@Repository public class AccidentJdbcTemplate implements AccidentDAO { private final JdbcTemplate jdbc; public AccidentJdbcTemplate(JdbcTemplate jdbc) { this.jdbc = jdbc; } @Override public void addAccident(@NonNull Accident accident) { if (accident.getId() == 0) { KeyHolder keyHolder = new GeneratedKeyHolder(); jdbc.update(connection -> { PreparedStatement ps = connection.prepareStatement( "INSERT INTO accidents " + "(accident_name, accident_text, accident_address, type_id) " + "values (?, ?, ?, ?)", new String[] {"accident_id"}); ps.setString(1, accident.getName()); ps.setString(2, accident.getText()); ps.setString(3, accident.getAddress()); ps.setInt(4, accident.getType().getId()); return ps; }, keyHolder); accident.setId(keyHolder.getKey().intValue()); } else { jdbc.update( "UPDATE accidents SET " + "accident_name = ?, " + "accident_text = ?, " + "accident_address = ?, " + "type_id = ? " + "WHERE accident_id = ?", accident.getName(), accident.getText(), accident.getAddress(), accident.getType().getId(), accident.getId()); deleteAccidentsRules(accident.getId()); } accident.getRules().forEach(rule -> addAccidentsRules(accident.getId(), rule.getId())); } @Override public List<Accident> getAccidents() { var accidents = jdbc.query( "SELECT " + "accident_id, accident_name, accident_text, accident_address, type_id, type_name " + "FROM accidents " + "JOIN accident_types USING(type_id) ", new AccidentMappers()); accidents.forEach(accident -> accident.setRules(getAccidentsRules(accident.getId()))); return accidents; } @Override public Optional<Accident> getAccident(int id) { var accident = jdbc.query( "SELECT " + "accident_id, accident_name, accident_text, accident_address, type_id, type_name " + "FROM accidents " + "JOIN accident_types USING(type_id) " + "WHERE accident_id = ?", new Object[]{id}, new AccidentMappers()) .stream().findAny(); accident.ifPresent(value -> value.setRules(getAccidentsRules(value.getId()))); return accident; } private void addAccidentsRules(int idAccident, int idRule) { jdbc.update( "INSERT INTO accidents_rules (accident_id, rule_id) values (?, ?)", idAccident, idRule); } private void deleteAccidentsRules(int idAccident) { jdbc.update( "DELETE FROM accidents_rules WHERE accident_id = ?", idAccident); } private Set<Rule> getAccidentsRules(int idAccident) { return new HashSet<>(jdbc.query( "SELECT rule_id, rule_name FROM rules " + "JOIN accidents_rules USING(rule_id) " + "WHERE accident_id = ?", new Object[]{idAccident}, new RuleMappers())); } @Override public void addType(@NonNull AccidentType type) { jdbc.update("INSERT INTO accident_types (type_name) values (?)", type.getName()); } @Override public List<AccidentType> getTypes() { return jdbc.query( "SELECT type_id, type_name FROM accident_types", new AccidentTypeMappers()); } @Override public Optional<AccidentType> getType(int id) { return jdbc.query("SELECT type_id, type_name FROM accident_types WHERE type_id = ?", new Object[]{id}, new AccidentTypeMappers()) .stream().findAny(); } @Override public List<Rule> getRules() { return jdbc.query("SELECT rule_id, rule_name FROM rules", new RuleMappers()); } @Override public void addRuler(@NonNull Rule rule) { jdbc.update("INSERT INTO rules (rule_name) values (?)", rule.getName()); } @Override public Optional<Rule> getRule(int id) { return jdbc.query("SELECT rule_id, rule_name FROM rules WHERE rule_id = ?", new Object[]{id}, new RuleMappers()) .stream().findAny(); } }
5,560
0.563489
0.561331
152
35.578949
25.199604
100
false
false
0
0
0
0
0
0
0.671053
false
false
12
bcec3b0a898897a990fe5d404d25703b0ce5711c
25,580,825,232,436
3ca73ea4be531a60af5198d4df3fd0e448004e8f
/sensei-core/src/main/java/com/senseidb/indexing/activity/RecentlyAddedUids.java
247d90102b6f2c9d43d317d07c14b160eef1975e
[ "Apache-2.0" ]
permissive
bcui/sensei
https://github.com/bcui/sensei
52c21237e8e9aa1f10cc4b7d3dd5d4ce20996ab1
8d39ce930ab2f8a64376c5214a51d76f76a53877
refs/heads/master
2020-12-25T02:49:47.629000
2013-05-23T15:01:17
2013-05-23T15:01:17
1,601,541
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.senseidb.indexing.activity; import java.util.BitSet; import it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet; public class RecentlyAddedUids { private final int capacity; private LongLinkedOpenHashSet elems; public RecentlyAddedUids(int capacity) { this.capacity = capacity; elems = new LongLinkedOpenHashSet(capacity); } public synchronized void add(long uid) { if (elems.size() == capacity) { elems.remove(elems.firstLong()); } elems.add(uid); } public synchronized int markRecentAsFoundInBitSet(long[] uids, BitSet found, int bitSetLength) { if (found.length() == 0) { return 0; } int ret = 0; int index = 0; while (true) { if (index < 0 || index >= bitSetLength) { break; } index = found.nextClearBit(index); if (index < 0 || index >= bitSetLength) { break; } if (elems.contains(uids[index])) { found.set(index); ret++; } else { } index++; } return ret; } protected synchronized void clear() { elems.clear(); } }
UTF-8
Java
1,132
java
RecentlyAddedUids.java
Java
[]
null
[]
package com.senseidb.indexing.activity; import java.util.BitSet; import it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet; public class RecentlyAddedUids { private final int capacity; private LongLinkedOpenHashSet elems; public RecentlyAddedUids(int capacity) { this.capacity = capacity; elems = new LongLinkedOpenHashSet(capacity); } public synchronized void add(long uid) { if (elems.size() == capacity) { elems.remove(elems.firstLong()); } elems.add(uid); } public synchronized int markRecentAsFoundInBitSet(long[] uids, BitSet found, int bitSetLength) { if (found.length() == 0) { return 0; } int ret = 0; int index = 0; while (true) { if (index < 0 || index >= bitSetLength) { break; } index = found.nextClearBit(index); if (index < 0 || index >= bitSetLength) { break; } if (elems.contains(uids[index])) { found.set(index); ret++; } else { } index++; } return ret; } protected synchronized void clear() { elems.clear(); } }
1,132
0.598057
0.592756
50
21.639999
19.217451
98
false
false
0
0
0
0
0
0
0.52
false
false
12
5fede63b070f2f75a50ae39e69a9edd8a8a1a42e
18,872,086,324,278
8ad6d21a043843e48d7b949d893fe43f78de3611
/app/src/main/java/com/example/weijingliu/mtabusclient/NextBusAdapter.java
ddf63560c51e7784542e876d13cb0b6782535d3e
[]
no_license
toliuweijing/MTABusClient
https://github.com/toliuweijing/MTABusClient
f0e31ee1c6253380c155f750ba9ef4881be6a917
98a79e131d4be4623e3a4140a69224706019b992
refs/heads/master
2021-01-22T03:33:32.743000
2016-03-13T16:37:19
2016-03-13T16:37:19
37,490,374
0
0
null
false
2016-03-13T15:35:06
2015-06-15T20:46:07
2015-06-15T20:46:11
2016-03-13T15:35:04
720
0
0
0
Java
null
null
package com.example.weijingliu.mtabusclient; import android.graphics.Color; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.widget.FrameLayout; import android.widget.TextView; import static com.example.weijingliu.mtabusclient.Utils.px; public class NextBusAdapter extends RecyclerView.Adapter<NextBusAdapter.ViewHolder> { @Override public ViewHolder onCreateViewHolder(ViewGroup viewGroup, final int viewType) { final View view = LayoutInflater.from(viewGroup.getContext()) .inflate(R.layout.next_bux_row_layout, viewGroup, false); return new ViewHolder(view); } @Override public void onBindViewHolder(ViewHolder viewHolder, int position) { boolean isPaddingView = position == 0 || position == getItemCount() - 1; if (isPaddingView) { ViewGroup.LayoutParams layoutParams = viewHolder.frameLayout.getLayoutParams(); layoutParams.height = px(50); viewHolder.frameLayout.setLayoutParams(layoutParams); viewHolder.textView.setText(null); viewHolder.lolipopView.setAppearance(LolipopView.APPEARANCE_PADDING); } else { ViewGroup.LayoutParams layoutParams = viewHolder.frameLayout.getLayoutParams(); layoutParams.height = px(100); viewHolder.frameLayout.setLayoutParams(layoutParams); viewHolder.textView.setText(null); viewHolder.textView.setText(String.valueOf(position) + ":00 AM"); viewHolder.lolipopView.setAppearance(LolipopView.APPEARANCE_REGULAR); } int color = (position % 2 == 0) ? Color.parseColor("#D84315") : Color.parseColor("#00695C"); viewHolder.lolipopView.setCircleColor(color); viewHolder.frameLayout.requestLayout(); } @Override public int getItemCount() { return 20; } class ViewHolder extends RecyclerView.ViewHolder { LolipopView lolipopView; TextView textView; FrameLayout frameLayout; public ViewHolder(View view) { super(view); frameLayout = (FrameLayout) view; lolipopView = (LolipopView) view.findViewById(R.id.lolipop); textView = (TextView) view.findViewById(R.id.middle_text); } } }
UTF-8
Java
2,283
java
NextBusAdapter.java
Java
[]
null
[]
package com.example.weijingliu.mtabusclient; import android.graphics.Color; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.widget.FrameLayout; import android.widget.TextView; import static com.example.weijingliu.mtabusclient.Utils.px; public class NextBusAdapter extends RecyclerView.Adapter<NextBusAdapter.ViewHolder> { @Override public ViewHolder onCreateViewHolder(ViewGroup viewGroup, final int viewType) { final View view = LayoutInflater.from(viewGroup.getContext()) .inflate(R.layout.next_bux_row_layout, viewGroup, false); return new ViewHolder(view); } @Override public void onBindViewHolder(ViewHolder viewHolder, int position) { boolean isPaddingView = position == 0 || position == getItemCount() - 1; if (isPaddingView) { ViewGroup.LayoutParams layoutParams = viewHolder.frameLayout.getLayoutParams(); layoutParams.height = px(50); viewHolder.frameLayout.setLayoutParams(layoutParams); viewHolder.textView.setText(null); viewHolder.lolipopView.setAppearance(LolipopView.APPEARANCE_PADDING); } else { ViewGroup.LayoutParams layoutParams = viewHolder.frameLayout.getLayoutParams(); layoutParams.height = px(100); viewHolder.frameLayout.setLayoutParams(layoutParams); viewHolder.textView.setText(null); viewHolder.textView.setText(String.valueOf(position) + ":00 AM"); viewHolder.lolipopView.setAppearance(LolipopView.APPEARANCE_REGULAR); } int color = (position % 2 == 0) ? Color.parseColor("#D84315") : Color.parseColor("#00695C"); viewHolder.lolipopView.setCircleColor(color); viewHolder.frameLayout.requestLayout(); } @Override public int getItemCount() { return 20; } class ViewHolder extends RecyclerView.ViewHolder { LolipopView lolipopView; TextView textView; FrameLayout frameLayout; public ViewHolder(View view) { super(view); frameLayout = (FrameLayout) view; lolipopView = (LolipopView) view.findViewById(R.id.lolipop); textView = (TextView) view.findViewById(R.id.middle_text); } } }
2,283
0.737626
0.727113
67
33.074627
26.166124
85
false
false
0
0
0
0
0
0
0.626866
false
false
12
b8f217b22e5880400fd3baa054db11f0b04c8c96
7,593,502,215,797
e59f9627daf465ffb7efe4997080e326a0747210
/aai-core/src/test/java/org/onap/aai/serialization/db/EdgeRulesTest.java
5dfa12b795044931f8da5086016612969e989d81
[ "Apache-2.0" ]
permissive
onap/aai-aai-common
https://github.com/onap/aai-aai-common
1569550fd6c0fcb9efc1cbd59a3fe7cc2c9a6f3f
d5a889f9661e89289344ed736600bc7222095379
refs/heads/master
2023-08-19T19:31:16.551000
2023-08-16T12:36:00
2023-08-16T12:36:00
115,052,344
3
1
NOASSERTION
false
2023-08-14T12:58:23
2017-12-21T22:23:34
2022-08-17T00:21:38
2023-08-14T12:58:19
13,066
3
2
0
Java
false
false
/** * ============LICENSE_START======================================================= * org.onap.aai * ================================================================================ * Copyright © 2017 AT&T Intellectual Property. 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. * ============LICENSE_END========================================================= * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ package org.onap.aai.serialization.db; import static junit.framework.TestCase.fail; import static org.junit.Assert.assertEquals; import com.google.common.collect.Multimap; import java.util.*; import org.apache.tinkerpop.gremlin.structure.Direction; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.onap.aai.AAISetup; import org.onap.aai.edges.EdgeIngestor; import org.onap.aai.edges.EdgeRule; import org.onap.aai.edges.EdgeRuleQuery; import org.onap.aai.edges.enums.EdgeType; import org.onap.aai.edges.exceptions.AmbiguousRuleChoiceException; import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException; import org.onap.aai.setup.SchemaVersion; import org.springframework.beans.factory.annotation.Autowired; public class EdgeRulesTest extends AAISetup { // set thrown.expect to whatever a specific test needs // this establishes a default of expecting no exceptions to be thrown @Rule public ExpectedException thrown = ExpectedException.none(); @Autowired private EdgeIngestor edgeIngestor; @Test public void verifyOutDirection() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException { EdgeRuleQuery ruleQuery = new EdgeRuleQuery.Builder("cloud-region", "flavor").edgeType(EdgeType.TREE).build(); EdgeRule rule = edgeIngestor.getRule(ruleQuery); assertEquals("out direction", rule.getDirection(), Direction.IN); } @Test public void verifyOutFlippedDirection() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException { EdgeRuleQuery ruleQuery = new EdgeRuleQuery.Builder("flavor", "cloud-region").edgeType(EdgeType.TREE).build(); EdgeRule rule = edgeIngestor.getRule(ruleQuery); assertEquals("in direction", rule.getDirection(), Direction.OUT); } @Test public void verifyMultipleGet() throws EdgeRuleNotFoundException { EdgeRuleQuery ruleQuery = new EdgeRuleQuery.Builder("model-element", "model-ver").edgeType(EdgeType.TREE).build(); Multimap<String, EdgeRule> ruleMap = edgeIngestor.getRules(ruleQuery); for (EdgeRule edgeRule : ruleMap.get("model|model-ver")) { assertEquals("has isA rule", "org.onap.relationships.inventory.IsA", edgeRule.getLabel()); } } @Test public void verifyAllRules() throws EdgeRuleNotFoundException { // This will cause every rule in the real json files to be verified // so if any required properties are missing, the verification builds // will catch it and incorrect rules can't get merged in. for (SchemaVersion v : schemaVersions.getVersions()) { Multimap<String, EdgeRule> all = edgeIngestor.getAllRules(schemaVersions.getDefaultVersion()); // this part verifies the default properties // 1) can have only at most 1 containment edge between same node type pair // 2) if there is at least 1 cousin edge, there must be exactly 1 cousin edge with default=true for (String key : all.keySet()) { Collection<EdgeRule> edgeRuleCollection = all.get(key); boolean foundContainment = false; // can have at most 1 containment rel btwn same pair of node types boolean foundCousin = false; boolean cousinDefault = false; // if there is a cousin edge there must be at least 1 default cousin // defined Set<String> labels = new HashSet<>(); // all edges between the same pair must have different labels int cousinCount = 0; for (EdgeRule rule : edgeRuleCollection) { EdgeRule match = rule; // check containment if (!("NONE".equals(match.getContains()))) { if (foundContainment) { fail("more than one containment edge defined for " + v.toString() + " " + key); } else { foundContainment = true; } } else { // check cousin stuff foundCousin = true; cousinCount++; if (match.isDefault()) { if (!cousinDefault) { cousinDefault = true; } else { fail("more than one cousin edge defined as default for " + v.toString() + " " + key); } } } // check labels String label = match.getLabel(); if (labels.contains(label)) { fail("same label found for multiple edges for " + v.toString() + " " + key); } else { labels.add(label); } } if (foundCousin && !cousinDefault && cousinCount > 1) { fail("there is at least one cousin edge but none are designated the default for " + v.toString() + " " + key); } } } } }
UTF-8
Java
6,339
java
EdgeRulesTest.java
Java
[]
null
[]
/** * ============LICENSE_START======================================================= * org.onap.aai * ================================================================================ * Copyright © 2017 AT&T Intellectual Property. 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. * ============LICENSE_END========================================================= * * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ package org.onap.aai.serialization.db; import static junit.framework.TestCase.fail; import static org.junit.Assert.assertEquals; import com.google.common.collect.Multimap; import java.util.*; import org.apache.tinkerpop.gremlin.structure.Direction; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.onap.aai.AAISetup; import org.onap.aai.edges.EdgeIngestor; import org.onap.aai.edges.EdgeRule; import org.onap.aai.edges.EdgeRuleQuery; import org.onap.aai.edges.enums.EdgeType; import org.onap.aai.edges.exceptions.AmbiguousRuleChoiceException; import org.onap.aai.edges.exceptions.EdgeRuleNotFoundException; import org.onap.aai.setup.SchemaVersion; import org.springframework.beans.factory.annotation.Autowired; public class EdgeRulesTest extends AAISetup { // set thrown.expect to whatever a specific test needs // this establishes a default of expecting no exceptions to be thrown @Rule public ExpectedException thrown = ExpectedException.none(); @Autowired private EdgeIngestor edgeIngestor; @Test public void verifyOutDirection() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException { EdgeRuleQuery ruleQuery = new EdgeRuleQuery.Builder("cloud-region", "flavor").edgeType(EdgeType.TREE).build(); EdgeRule rule = edgeIngestor.getRule(ruleQuery); assertEquals("out direction", rule.getDirection(), Direction.IN); } @Test public void verifyOutFlippedDirection() throws EdgeRuleNotFoundException, AmbiguousRuleChoiceException { EdgeRuleQuery ruleQuery = new EdgeRuleQuery.Builder("flavor", "cloud-region").edgeType(EdgeType.TREE).build(); EdgeRule rule = edgeIngestor.getRule(ruleQuery); assertEquals("in direction", rule.getDirection(), Direction.OUT); } @Test public void verifyMultipleGet() throws EdgeRuleNotFoundException { EdgeRuleQuery ruleQuery = new EdgeRuleQuery.Builder("model-element", "model-ver").edgeType(EdgeType.TREE).build(); Multimap<String, EdgeRule> ruleMap = edgeIngestor.getRules(ruleQuery); for (EdgeRule edgeRule : ruleMap.get("model|model-ver")) { assertEquals("has isA rule", "org.onap.relationships.inventory.IsA", edgeRule.getLabel()); } } @Test public void verifyAllRules() throws EdgeRuleNotFoundException { // This will cause every rule in the real json files to be verified // so if any required properties are missing, the verification builds // will catch it and incorrect rules can't get merged in. for (SchemaVersion v : schemaVersions.getVersions()) { Multimap<String, EdgeRule> all = edgeIngestor.getAllRules(schemaVersions.getDefaultVersion()); // this part verifies the default properties // 1) can have only at most 1 containment edge between same node type pair // 2) if there is at least 1 cousin edge, there must be exactly 1 cousin edge with default=true for (String key : all.keySet()) { Collection<EdgeRule> edgeRuleCollection = all.get(key); boolean foundContainment = false; // can have at most 1 containment rel btwn same pair of node types boolean foundCousin = false; boolean cousinDefault = false; // if there is a cousin edge there must be at least 1 default cousin // defined Set<String> labels = new HashSet<>(); // all edges between the same pair must have different labels int cousinCount = 0; for (EdgeRule rule : edgeRuleCollection) { EdgeRule match = rule; // check containment if (!("NONE".equals(match.getContains()))) { if (foundContainment) { fail("more than one containment edge defined for " + v.toString() + " " + key); } else { foundContainment = true; } } else { // check cousin stuff foundCousin = true; cousinCount++; if (match.isDefault()) { if (!cousinDefault) { cousinDefault = true; } else { fail("more than one cousin edge defined as default for " + v.toString() + " " + key); } } } // check labels String label = match.getLabel(); if (labels.contains(label)) { fail("same label found for multiple edges for " + v.toString() + " " + key); } else { labels.add(label); } } if (foundCousin && !cousinDefault && cousinCount > 1) { fail("there is at least one cousin edge but none are designated the default for " + v.toString() + " " + key); } } } } }
6,339
0.5852
0.582518
149
41.536911
34.724712
118
false
false
0
0
0
0
81
0.02556
0.456376
false
false
12
77bb3c81149b19b661134c2615b62085b7daec04
21,517,786,188,226
b479d8c6a201260675747d69e4efccbba2806d69
/src/test/java/com/example/MockBeansConfig.java
b176e85a7894be0718a19946962371b6ac11804d
[]
no_license
xuminghui/Demo
https://github.com/xuminghui/Demo
252c3fc8fa8b097c9d44e8c1a106db32acc2043d
e0991d8ee1fa7fb7ca16edebfdf26baa6554fe04
refs/heads/master
2020-04-06T07:05:52.475000
2016-09-20T01:18:43
2016-09-20T01:18:43
59,932,059
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example; import org.mockito.Mockito; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import org.springframework.data.domain.Page; import com.example.entity.Book; import com.example.repository.BookRepository; /** * 所有需要Mock的Bean,在这里定义。通过@Primary 在测试时候,注入响应的mock对象即可 * @author xuminghui * */ @Configuration @UsedForTesting public class MockBeansConfig { @Bean @Primary public BookRepository createMockBookRepository() { return Mockito.mock(BookRepository.class); } }
UTF-8
Java
691
java
MockBeansConfig.java
Java
[ { "context": "n,在这里定义。通过@Primary 在测试时候,注入响应的mock对象即可\r\n * @author xuminghui\r\n *\r\n */\r\n@Configuration\r\n@UsedForTesting\r\npublic", "end": 434, "score": 0.9994694590568542, "start": 425, "tag": "USERNAME", "value": "xuminghui" } ]
null
[]
package com.example; import org.mockito.Mockito; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import org.springframework.data.domain.Page; import com.example.entity.Book; import com.example.repository.BookRepository; /** * 所有需要Mock的Bean,在这里定义。通过@Primary 在测试时候,注入响应的mock对象即可 * @author xuminghui * */ @Configuration @UsedForTesting public class MockBeansConfig { @Bean @Primary public BookRepository createMockBookRepository() { return Mockito.mock(BookRepository.class); } }
691
0.781991
0.781991
25
23.4
20.678492
60
false
false
0
0
0
0
0
0
0.6
false
false
12
cc55b9b9369f8401395d8e303d96ed1a75f04022
6,201,932,791,972
0fac63d0f8eedfb5b7b95dbec81c2081d7a621ee
/dto/ad-dto/src/main/java/com/lawu/eshop/ad/constants/AdEgainTypeEnum.java
3e8941631091c1275365054923ee379a20025df9
[]
no_license
moutainhigh/server-3
https://github.com/moutainhigh/server-3
4385ffcee5587d1c1b91f7eb541a7128fbc7ec0f
3845625b954e3e025b3e0896a1c08fe5ecc46753
refs/heads/master
2022-12-28T06:10:56.826000
2019-06-04T08:45:03
2019-06-04T08:45:03
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lawu.eshop.ad.constants; /** * E赚的广告类型 * @author jiangxinjun * @date 2017年7月18日 */ public enum AdEgainTypeEnum { /** * 平面 */ AD_TYPE_FLAT((byte) 0x01), /** * 视频 */ AD_TYPE_VIDEO((byte) 0x02); private Byte val; AdEgainTypeEnum(Byte val) { this.val = val; } public Byte getVal() { return val; } public static AdEgainTypeEnum getEnum(Byte val) { AdEgainTypeEnum[] values = AdEgainTypeEnum.values(); for (AdEgainTypeEnum object : values) { if (object.val.equals(val)) { return object; } } return null; } }
UTF-8
Java
676
java
AdEgainTypeEnum.java
Java
[ { "context": "awu.eshop.ad.constants;\n\n/**\n * E赚的广告类型\n * @author jiangxinjun\n * @date 2017年7月18日\n */\npublic enum AdEgainTypeEn", "end": 75, "score": 0.9200466275215149, "start": 64, "tag": "USERNAME", "value": "jiangxinjun" } ]
null
[]
package com.lawu.eshop.ad.constants; /** * E赚的广告类型 * @author jiangxinjun * @date 2017年7月18日 */ public enum AdEgainTypeEnum { /** * 平面 */ AD_TYPE_FLAT((byte) 0x01), /** * 视频 */ AD_TYPE_VIDEO((byte) 0x02); private Byte val; AdEgainTypeEnum(Byte val) { this.val = val; } public Byte getVal() { return val; } public static AdEgainTypeEnum getEnum(Byte val) { AdEgainTypeEnum[] values = AdEgainTypeEnum.values(); for (AdEgainTypeEnum object : values) { if (object.val.equals(val)) { return object; } } return null; } }
676
0.553846
0.533846
40
15.25
15.412251
57
false
false
0
0
0
0
0
0
0.625
false
false
12
20bc64bba061e90eb186f9936eca1a03b19398f2
31,086,973,293,588
bee95365245ca1670c7e0bed7f0fa08284ab9621
/src/main/java/com/zjf/smdsendspringbootstarter/service/MsgService.java
0d1016f47a0d3ac9dfa603d35320d90ce2a0807a
[]
no_license
flyfeifei66/spring-boot-starter-demo
https://github.com/flyfeifei66/spring-boot-starter-demo
47de8052a816c2e1442dc3cb79542c9d2dd67553
f47c44780f48b19a2bc45de4b4908f2f0ac5f665
refs/heads/master
2022-04-06T15:22:11.772000
2020-03-05T06:35:45
2020-03-05T06:35:45
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.zjf.smdsendspringbootstarter.service; /** * @author zhaojufei */ public class MsgService { private String url; public MsgService(String url) { this.url = url; } public boolean sendMsg(String msg) { System.out.println(String.format("【信息:%s】,已发送至%s", msg, url)); return true; } }
UTF-8
Java
358
java
MsgService.java
Java
[ { "context": ".smdsendspringbootstarter.service;\n\n/**\n * @author zhaojufei\n */\npublic class MsgService {\n private String ", "end": 75, "score": 0.9962913393974304, "start": 66, "tag": "USERNAME", "value": "zhaojufei" } ]
null
[]
package com.zjf.smdsendspringbootstarter.service; /** * @author zhaojufei */ public class MsgService { private String url; public MsgService(String url) { this.url = url; } public boolean sendMsg(String msg) { System.out.println(String.format("【信息:%s】,已发送至%s", msg, url)); return true; } }
358
0.623529
0.623529
18
17.888889
19.604107
70
false
false
0
0
0
0
0
0
0.388889
false
false
12
6848cf92c5f1c81b308cd7d4d291d2047d8e7fc9
27,547,920,250,913
a58de11c8bcd65dbbadae9795f094b93dbde9876
/app/src/main/java/cn/edu/xjtu/se/bookgamma/pretend/Important_part.java
02c9f6c41ddeb9a4025703586ac06cd52e5fd8dc
[]
no_license
XJGamma/BookGamma
https://github.com/XJGamma/BookGamma
977710c4aabe55a49e8dde1ae1d8c4ae7c2971b8
c1bf5a7f70f704316c92da91dc03ef8925b2f5b7
refs/heads/master
2020-04-06T07:10:29.345000
2016-08-30T16:56:25
2016-08-30T16:56:25
61,119,004
1
1
null
false
2016-08-30T16:56:26
2016-06-14T11:56:44
2016-08-28T06:23:50
2016-08-30T16:56:26
4,510
1
1
16
Java
null
null
package cn.edu.xjtu.se.bookgamma.pretend; public class Important_part { private int woman; private int be_good_hand; public Important_part() { woman = 343; be_good_hand = 358; } public void public_place() { own_life_and_point(); System.out.println("work" + woman); } private void own_life_and_point() { System.out.println("large_man" + be_good_hand); } }
UTF-8
Java
432
java
Important_part.java
Java
[]
null
[]
package cn.edu.xjtu.se.bookgamma.pretend; public class Important_part { private int woman; private int be_good_hand; public Important_part() { woman = 343; be_good_hand = 358; } public void public_place() { own_life_and_point(); System.out.println("work" + woman); } private void own_life_and_point() { System.out.println("large_man" + be_good_hand); } }
432
0.587963
0.574074
20
20.549999
16.892233
55
false
false
0
0
0
0
0
0
0.4
false
false
12
b81647fc5a7a1a4dc5b678488c8aa540b237d6ac
27,547,920,252,415
7d85c1f8d9eb086b822b5397d60c37f5c7fdf839
/trunk/java/code/util/src/edu/cmu/ri/createlab/util/commandexecution/ReturnValueCommandStrategy.java
a78f505eb862b3ef9ff2b66874cbf21996cb209c
[]
no_license
svn2github/create-lab-commons
https://github.com/svn2github/create-lab-commons
862e86b5ebb29e5f2682b30ffe92b3d32d96fca1
64f4d896797351f36b04f7c4a32127331c48fd0e
refs/heads/master
2016-09-05T13:04:57.928000
2013-12-15T03:15:24
2013-12-15T03:15:24
20,270,942
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.cmu.ri.createlab.util.commandexecution; /** * @author Chris Bartley (bartley@cmu.edu) */ public interface ReturnValueCommandStrategy<DeviceIOClass, ResponseClass extends CommandResponse, DesiredClass> extends CommandStrategy<DeviceIOClass, ResponseClass>, CommandResponseConverter<ResponseClass, DesiredClass> { }
UTF-8
Java
454
java
ReturnValueCommandStrategy.java
Java
[ { "context": "i.createlab.util.commandexecution;\n\n/**\n * @author Chris Bartley (bartley@cmu.edu)\n */\npublic interface ReturnValu", "end": 81, "score": 0.9998599290847778, "start": 68, "tag": "NAME", "value": "Chris Bartley" }, { "context": ".commandexecution;\n\n/**\n * @author Chris Bartley (bartley@cmu.edu)\n */\npublic interface ReturnValueCommandStrategy<", "end": 98, "score": 0.9999309778213501, "start": 83, "tag": "EMAIL", "value": "bartley@cmu.edu" } ]
null
[]
package edu.cmu.ri.createlab.util.commandexecution; /** * @author <NAME> (<EMAIL>) */ public interface ReturnValueCommandStrategy<DeviceIOClass, ResponseClass extends CommandResponse, DesiredClass> extends CommandStrategy<DeviceIOClass, ResponseClass>, CommandResponseConverter<ResponseClass, DesiredClass> { }
439
0.601322
0.601322
9
49.555557
66.498306
173
false
false
0
0
0
0
0
0
0.666667
false
false
12
8630a4c62d8ed862099d9ee159b0b045bb614aaf
17,274,358,494,359
56b9ae386eef0701e514799eacb3f64a5a2c21f1
/dynamicArrays/src/reverseString.java
2391d25556fd5c06913025597a4c5ac614a0590f
[]
no_license
mkashwah/Data-structures
https://github.com/mkashwah/Data-structures
093cdebba899a844cad811cd6955163baa338caa
4a75b37e1c9377555d108aa120c447779a09bb5f
refs/heads/master
2023-02-07T16:52:54.266000
2020-12-30T09:18:57
2020-12-30T09:18:57
323,255,049
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Arrays; /*String Reverser with complexity O(n)*/ public class reverseString { private static char[] chs; public static String reverseString(String strr){ chs = new char[strr.length()]; //set the char array with length of strr for(int i = 0; i < strr.length(); i++){ chs[i] = strr.charAt(strr.length()-1-i); //reverse the order of strr into chs[] } String finalString = new String(chs); //make string from chs[] return finalString; } }
UTF-8
Java
548
java
reverseString.java
Java
[]
null
[]
import java.util.Arrays; /*String Reverser with complexity O(n)*/ public class reverseString { private static char[] chs; public static String reverseString(String strr){ chs = new char[strr.length()]; //set the char array with length of strr for(int i = 0; i < strr.length(); i++){ chs[i] = strr.charAt(strr.length()-1-i); //reverse the order of strr into chs[] } String finalString = new String(chs); //make string from chs[] return finalString; } }
548
0.589416
0.585766
19
27.842106
31.312119
98
false
false
0
0
0
0
0
0
0.421053
false
false
12
e41e3663fe2a7a9cdd91a87c98a0ef475f4cd912
8,813,272,910,661
d94accab5c710105fcb948907bc187cc1871ff9a
/Router.java
4d24777341d6cb20b49fe079034e32dd6ebfc217
[ "MIT" ]
permissive
dooleyb1/OpenflowNetworkRouting
https://github.com/dooleyb1/OpenflowNetworkRouting
c9b6d7115c9610e8b3c22b4b8394311b94783b0f
daf5de1189e8d5d18afab68c1fcc6aba59c7d7ea
refs/heads/master
2021-03-30T22:19:16.544000
2018-04-10T20:13:46
2018-04-10T20:13:46
124,543,888
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.net.InetSocketAddress; import java.util.Arrays; import java.util.HashMap; import java.util.Map.Entry; public class Router extends Node { int routerPort; DatagramPacket messagePacket; InetSocketAddress controllerAddress; int connectionCount; int[] connections; ControllerInformPacket controllerPacket; /* * Hashmap to reference node names (for printing use) */ HashMap<Integer, String> nodeNames; /* * routingMap == Hashmap to store routing table within * - <Integer> = destination address * - <RoutingElementKey> = object that holds hopCount (cost) and nextHop for each respective destination address; */ HashMap<Integer, RoutingElementKey> routingMap; /* * */ Router(int routerPort) { try { this.routerPort = routerPort; this.messagePacket = null; this.routingMap = new HashMap<Integer, RoutingElementKey>(); this.nodeNames = new HashMap<Integer, String>(); this.controllerAddress = new InetSocketAddress(Node.DEFAULT_DST_NODE, Node.CONTROLLER_PORT); this.connectionCount = 0; //Creates router socket at defined address socket= new DatagramSocket(routerPort); listener.go(); } catch(java.lang.Exception e) {e.printStackTrace();} } public synchronized void start() throws Exception { StdOut.println("Initialising routing map at router (" + this.routerPort + ")..."); this.initialiseRoutingMap(); StdOut.println("Filling in node names in map..."); this.addNodeNames(); StdOut.println("Printing routing map at router (" + this.routerPort + ")...\n"); this.printRoutingMap(); //Inform controller of direct connections StdOut.println("\nInforming controller of connections..."); informController(); StdOut.println("\nWaiting for contact at router(" + this.routerPort + ")..."); this.wait(); } public void addNodeNames() { //Handle network end users names and addresses this.nodeNames.put(NET_18_PORT, "(NET 18)"); this.nodeNames.put(NET_15_PORT, "(NET 15)"); this.nodeNames.put(NET_28_PORT, "(NET 28)"); this.nodeNames.put(NET_7_PORT, "(NET 7)"); this.nodeNames.put(NET_5_PORT, "(NET 5)"); this.nodeNames.put(NET_11_PORT, "(NET 11)"); this.nodeNames.put(NET_21_PORT, "(NET 21)"); this.nodeNames.put(NET_2_PORT, "(NET 2)"); this.nodeNames.put(NET_10_PORT, "(NET 10)"); //Handle network router names and addresses this.nodeNames.put(ROUTER_A_PORT, "(ROUTER A)"); this.nodeNames.put(ROUTER_B_PORT, "(ROUTER B)"); this.nodeNames.put(ROUTER_C_PORT, "(ROUTER C)"); this.nodeNames.put(ROUTER_D_PORT, "(ROUTER D)"); this.nodeNames.put(ROUTER_E_PORT, "(ROUTER E)"); this.nodeNames.put(ROUTER_F_PORT, "(ROUTER F)"); this.nodeNames.put(0, "(NULL)"); } public synchronized void informController() throws IOException { initialiseConnections(); this.controllerPacket = new ControllerInformPacket(this.routerPort, this.connections); DatagramPacket packet = controllerPacket.toDatagramPacket(); packet.setSocketAddress(controllerAddress); socket.send(packet); StdOut.println("Controller informed of connections..."); } /* * Initialises the routing map's of each respective router */ public void initialiseRoutingMap() { //Initialise the distanceMap table for the router switch(this.routerPort) { //For router A do this case ROUTER_A_PORT: this.routingMap.put(NET_18_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_B_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_C_PORT, new RoutingElementKey(0,0)); break; //For router B do this case ROUTER_B_PORT: this.routingMap.put(NET_15_PORT, new RoutingElementKey(0,0)); this.routingMap.put(NET_28_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_A_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_D_PORT, new RoutingElementKey(0,0)); break; //For router 3 do this case ROUTER_C_PORT: this.routingMap.put(NET_10_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_A_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_D_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_E_PORT, new RoutingElementKey(0,0)); break; case ROUTER_D_PORT: this.routingMap.put(NET_7_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_C_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_B_PORT, new RoutingElementKey(0,0)); break; case ROUTER_E_PORT: this.routingMap.put(NET_2_PORT, new RoutingElementKey(0,0)); this.routingMap.put(NET_21_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_C_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_F_PORT, new RoutingElementKey(0,0)); break; case ROUTER_F_PORT: this.routingMap.put(NET_11_PORT, new RoutingElementKey(0,0)); this.routingMap.put(NET_5_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_E_PORT, new RoutingElementKey(0,0)); break; } } /* * Hard codes local connections for each router node */ public void initialiseConnections() { //Initialise the connections for the router switch (this.routerPort) { // For router A do this case ROUTER_A_PORT: this.connectionCount = 3; this.connections = new int[connectionCount]; this.connections[0] = NET_18_PORT; this.connections[1] = ROUTER_B_PORT; this.connections[2] = ROUTER_C_PORT; break; // For router B do this case ROUTER_B_PORT: this.connectionCount = 4; this.connections = new int[connectionCount]; this.connections[0] = NET_15_PORT; this.connections[1] = NET_28_PORT; this.connections[2] = ROUTER_A_PORT; this.connections[3] = ROUTER_D_PORT; break; // For router C do this case ROUTER_C_PORT: this.connectionCount = 4; this.connections = new int[connectionCount]; this.connections[0] = NET_10_PORT; this.connections[1] = ROUTER_A_PORT; this.connections[2] = ROUTER_D_PORT; this.connections[3] = ROUTER_E_PORT; break; // For router D do this case ROUTER_D_PORT: this.connectionCount = 3; this.connections = new int[connectionCount]; this.connections[0] = NET_7_PORT; this.connections[1] = ROUTER_B_PORT; this.connections[2] = ROUTER_C_PORT; break; // For router E do this case ROUTER_E_PORT: this.connectionCount = 4; this.connections = new int[connectionCount]; this.connections[0] = NET_2_PORT; this.connections[1] = NET_21_PORT; this.connections[2] = ROUTER_C_PORT; this.connections[3] = ROUTER_F_PORT; break; // For router F do this case ROUTER_F_PORT: this.connectionCount = 3; this.connections = new int[connectionCount]; this.connections[0] = NET_11_PORT; this.connections[1] = NET_5_PORT; this.connections[2] = ROUTER_E_PORT; break; } StdOut.println("Connections initialised..."); } public void printRoutingMap() { RoutingElementKey routingKey; int destination; int nextHop; int hopCount; StdOut.println("\n***Routing Map for Router" + this.nodeNames.get(this.routerPort) + "***\n"); StdOut.println("Destination | NextHop | HopCount" ); StdOut.println("-------------------------------------------------------"); for(Entry<Integer, RoutingElementKey> entry : this.routingMap.entrySet()) { destination = entry.getKey(); routingKey = entry.getValue(); nextHop = routingKey.nextDest; hopCount = routingKey.hopCount; StdOut.println("" + this.nodeNames.get(destination) + " | " + this.nodeNames.get(nextHop) + " | " + hopCount); } } public void onReceipt(DatagramPacket packet) { try { StdOut.println("\nPacket recieved at router (" + this.routerPort + ")..."); //If packet is from controller, process flow update if(packet.getPort() == CONTROLLER_PORT) { StdOut.println("\nPacket came from controller..."); processControllerUpdate(packet); StdOut.println("\nWaiting for contact at router(" + this.routerPort + ")..."); } //If packet is not from controller, continue with flow else { this.messagePacket = packet; continueTransmission(packet); } } catch(Exception e) {e.printStackTrace();} } /* * continueTransmission() */ public void continueTransmission(DatagramPacket packet) throws IOException, InterruptedException { StringContent content = new StringContent(packet); //If router has routing knowledge of how to get to destination, send packet to next router if(this.routingMap.get(content.getDestination()).nextDest != 0){ StdOut.println("Router knows how to get to destination..."); RoutingElementKey key = routingMap.get(content.getDestination()); int nextHop = key.nextDest; //Set dst port of packet to that of the next router InetSocketAddress nextAddr = new InetSocketAddress(Node.DEFAULT_DST_NODE, nextHop); packet.setSocketAddress(nextAddr); socket.send(packet); //If next hop is an end user do this if(nextHop == NET_18_PORT || nextHop == NET_15_PORT || nextHop == NET_28_PORT || nextHop == NET_7_PORT || nextHop == NET_5_PORT || nextHop == NET_11_PORT || nextHop == NET_21_PORT || nextHop == NET_2_PORT ||nextHop == NET_10_PORT) StdOut.println("\nPacket sent to end user(" + nextHop + ")..."); else StdOut.println("\nPacket sent to next router(" + nextHop + ")..."); StdOut.println("\nWaiting for contact at router(" + this.routerPort + ")..."); } } /* * Processes an update packet received from controller (updates tables etc) * * @param packet - Update packet from controller * @returns void */ public void processControllerUpdate(DatagramPacket packet) throws InterruptedException, IOException{ NodeInformPacket content = new NodeInformPacket(packet); StdOut.println("Processing controller update..."); //Destination is the end goal of the packet int dst = content.getDestinationAddress(); //Extract next hop int nextHop = content.getNextHopAddress(); //Extract hop count int hopCount = content.getHopCount(); RoutingElementKey key = new RoutingElementKey(hopCount,nextHop); this.routingMap.put(dst, key); StdOut.println("Controller update processed successfully..."); StdOut.println("Updating maps...\n"); printRoutingMap(); } /* * Creates controller at defined port */ public static void main(String[] args) { try { //Read port number from console String portArg = args[0]; int routerPortNumber = Integer.parseInt (portArg); //Create router at defined port number StdOut.println("Router (" + routerPortNumber + ")\n\n"); Router router = new Router(routerPortNumber); router.start(); StdOut.println("Program completed"); } catch(java.lang.Exception e) {e.printStackTrace();} } }
UTF-8
Java
11,071
java
Router.java
Java
[]
null
[]
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.net.InetSocketAddress; import java.util.Arrays; import java.util.HashMap; import java.util.Map.Entry; public class Router extends Node { int routerPort; DatagramPacket messagePacket; InetSocketAddress controllerAddress; int connectionCount; int[] connections; ControllerInformPacket controllerPacket; /* * Hashmap to reference node names (for printing use) */ HashMap<Integer, String> nodeNames; /* * routingMap == Hashmap to store routing table within * - <Integer> = destination address * - <RoutingElementKey> = object that holds hopCount (cost) and nextHop for each respective destination address; */ HashMap<Integer, RoutingElementKey> routingMap; /* * */ Router(int routerPort) { try { this.routerPort = routerPort; this.messagePacket = null; this.routingMap = new HashMap<Integer, RoutingElementKey>(); this.nodeNames = new HashMap<Integer, String>(); this.controllerAddress = new InetSocketAddress(Node.DEFAULT_DST_NODE, Node.CONTROLLER_PORT); this.connectionCount = 0; //Creates router socket at defined address socket= new DatagramSocket(routerPort); listener.go(); } catch(java.lang.Exception e) {e.printStackTrace();} } public synchronized void start() throws Exception { StdOut.println("Initialising routing map at router (" + this.routerPort + ")..."); this.initialiseRoutingMap(); StdOut.println("Filling in node names in map..."); this.addNodeNames(); StdOut.println("Printing routing map at router (" + this.routerPort + ")...\n"); this.printRoutingMap(); //Inform controller of direct connections StdOut.println("\nInforming controller of connections..."); informController(); StdOut.println("\nWaiting for contact at router(" + this.routerPort + ")..."); this.wait(); } public void addNodeNames() { //Handle network end users names and addresses this.nodeNames.put(NET_18_PORT, "(NET 18)"); this.nodeNames.put(NET_15_PORT, "(NET 15)"); this.nodeNames.put(NET_28_PORT, "(NET 28)"); this.nodeNames.put(NET_7_PORT, "(NET 7)"); this.nodeNames.put(NET_5_PORT, "(NET 5)"); this.nodeNames.put(NET_11_PORT, "(NET 11)"); this.nodeNames.put(NET_21_PORT, "(NET 21)"); this.nodeNames.put(NET_2_PORT, "(NET 2)"); this.nodeNames.put(NET_10_PORT, "(NET 10)"); //Handle network router names and addresses this.nodeNames.put(ROUTER_A_PORT, "(ROUTER A)"); this.nodeNames.put(ROUTER_B_PORT, "(ROUTER B)"); this.nodeNames.put(ROUTER_C_PORT, "(ROUTER C)"); this.nodeNames.put(ROUTER_D_PORT, "(ROUTER D)"); this.nodeNames.put(ROUTER_E_PORT, "(ROUTER E)"); this.nodeNames.put(ROUTER_F_PORT, "(ROUTER F)"); this.nodeNames.put(0, "(NULL)"); } public synchronized void informController() throws IOException { initialiseConnections(); this.controllerPacket = new ControllerInformPacket(this.routerPort, this.connections); DatagramPacket packet = controllerPacket.toDatagramPacket(); packet.setSocketAddress(controllerAddress); socket.send(packet); StdOut.println("Controller informed of connections..."); } /* * Initialises the routing map's of each respective router */ public void initialiseRoutingMap() { //Initialise the distanceMap table for the router switch(this.routerPort) { //For router A do this case ROUTER_A_PORT: this.routingMap.put(NET_18_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_B_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_C_PORT, new RoutingElementKey(0,0)); break; //For router B do this case ROUTER_B_PORT: this.routingMap.put(NET_15_PORT, new RoutingElementKey(0,0)); this.routingMap.put(NET_28_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_A_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_D_PORT, new RoutingElementKey(0,0)); break; //For router 3 do this case ROUTER_C_PORT: this.routingMap.put(NET_10_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_A_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_D_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_E_PORT, new RoutingElementKey(0,0)); break; case ROUTER_D_PORT: this.routingMap.put(NET_7_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_C_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_B_PORT, new RoutingElementKey(0,0)); break; case ROUTER_E_PORT: this.routingMap.put(NET_2_PORT, new RoutingElementKey(0,0)); this.routingMap.put(NET_21_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_C_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_F_PORT, new RoutingElementKey(0,0)); break; case ROUTER_F_PORT: this.routingMap.put(NET_11_PORT, new RoutingElementKey(0,0)); this.routingMap.put(NET_5_PORT, new RoutingElementKey(0,0)); this.routingMap.put(ROUTER_E_PORT, new RoutingElementKey(0,0)); break; } } /* * Hard codes local connections for each router node */ public void initialiseConnections() { //Initialise the connections for the router switch (this.routerPort) { // For router A do this case ROUTER_A_PORT: this.connectionCount = 3; this.connections = new int[connectionCount]; this.connections[0] = NET_18_PORT; this.connections[1] = ROUTER_B_PORT; this.connections[2] = ROUTER_C_PORT; break; // For router B do this case ROUTER_B_PORT: this.connectionCount = 4; this.connections = new int[connectionCount]; this.connections[0] = NET_15_PORT; this.connections[1] = NET_28_PORT; this.connections[2] = ROUTER_A_PORT; this.connections[3] = ROUTER_D_PORT; break; // For router C do this case ROUTER_C_PORT: this.connectionCount = 4; this.connections = new int[connectionCount]; this.connections[0] = NET_10_PORT; this.connections[1] = ROUTER_A_PORT; this.connections[2] = ROUTER_D_PORT; this.connections[3] = ROUTER_E_PORT; break; // For router D do this case ROUTER_D_PORT: this.connectionCount = 3; this.connections = new int[connectionCount]; this.connections[0] = NET_7_PORT; this.connections[1] = ROUTER_B_PORT; this.connections[2] = ROUTER_C_PORT; break; // For router E do this case ROUTER_E_PORT: this.connectionCount = 4; this.connections = new int[connectionCount]; this.connections[0] = NET_2_PORT; this.connections[1] = NET_21_PORT; this.connections[2] = ROUTER_C_PORT; this.connections[3] = ROUTER_F_PORT; break; // For router F do this case ROUTER_F_PORT: this.connectionCount = 3; this.connections = new int[connectionCount]; this.connections[0] = NET_11_PORT; this.connections[1] = NET_5_PORT; this.connections[2] = ROUTER_E_PORT; break; } StdOut.println("Connections initialised..."); } public void printRoutingMap() { RoutingElementKey routingKey; int destination; int nextHop; int hopCount; StdOut.println("\n***Routing Map for Router" + this.nodeNames.get(this.routerPort) + "***\n"); StdOut.println("Destination | NextHop | HopCount" ); StdOut.println("-------------------------------------------------------"); for(Entry<Integer, RoutingElementKey> entry : this.routingMap.entrySet()) { destination = entry.getKey(); routingKey = entry.getValue(); nextHop = routingKey.nextDest; hopCount = routingKey.hopCount; StdOut.println("" + this.nodeNames.get(destination) + " | " + this.nodeNames.get(nextHop) + " | " + hopCount); } } public void onReceipt(DatagramPacket packet) { try { StdOut.println("\nPacket recieved at router (" + this.routerPort + ")..."); //If packet is from controller, process flow update if(packet.getPort() == CONTROLLER_PORT) { StdOut.println("\nPacket came from controller..."); processControllerUpdate(packet); StdOut.println("\nWaiting for contact at router(" + this.routerPort + ")..."); } //If packet is not from controller, continue with flow else { this.messagePacket = packet; continueTransmission(packet); } } catch(Exception e) {e.printStackTrace();} } /* * continueTransmission() */ public void continueTransmission(DatagramPacket packet) throws IOException, InterruptedException { StringContent content = new StringContent(packet); //If router has routing knowledge of how to get to destination, send packet to next router if(this.routingMap.get(content.getDestination()).nextDest != 0){ StdOut.println("Router knows how to get to destination..."); RoutingElementKey key = routingMap.get(content.getDestination()); int nextHop = key.nextDest; //Set dst port of packet to that of the next router InetSocketAddress nextAddr = new InetSocketAddress(Node.DEFAULT_DST_NODE, nextHop); packet.setSocketAddress(nextAddr); socket.send(packet); //If next hop is an end user do this if(nextHop == NET_18_PORT || nextHop == NET_15_PORT || nextHop == NET_28_PORT || nextHop == NET_7_PORT || nextHop == NET_5_PORT || nextHop == NET_11_PORT || nextHop == NET_21_PORT || nextHop == NET_2_PORT ||nextHop == NET_10_PORT) StdOut.println("\nPacket sent to end user(" + nextHop + ")..."); else StdOut.println("\nPacket sent to next router(" + nextHop + ")..."); StdOut.println("\nWaiting for contact at router(" + this.routerPort + ")..."); } } /* * Processes an update packet received from controller (updates tables etc) * * @param packet - Update packet from controller * @returns void */ public void processControllerUpdate(DatagramPacket packet) throws InterruptedException, IOException{ NodeInformPacket content = new NodeInformPacket(packet); StdOut.println("Processing controller update..."); //Destination is the end goal of the packet int dst = content.getDestinationAddress(); //Extract next hop int nextHop = content.getNextHopAddress(); //Extract hop count int hopCount = content.getHopCount(); RoutingElementKey key = new RoutingElementKey(hopCount,nextHop); this.routingMap.put(dst, key); StdOut.println("Controller update processed successfully..."); StdOut.println("Updating maps...\n"); printRoutingMap(); } /* * Creates controller at defined port */ public static void main(String[] args) { try { //Read port number from console String portArg = args[0]; int routerPortNumber = Integer.parseInt (portArg); //Create router at defined port number StdOut.println("Router (" + routerPortNumber + ")\n\n"); Router router = new Router(routerPortNumber); router.start(); StdOut.println("Program completed"); } catch(java.lang.Exception e) {e.printStackTrace();} } }
11,071
0.684672
0.671213
328
32.75
26.409618
149
false
false
0
0
0
0
0
0
3.112805
false
false
12
35309829e2d6eba05d3602752f31d1e0e0bf5dca
24,970,939,880,401
28568f81132a96f88afe0a6d4ef7bb57f193081f
/UITests/src/main/java/pageObjects/AppNumberPad.java
3d21fbea5b3ae4a8c930752010d80aa393189e8e
[]
no_license
LukeAT/MobileUITests1
https://github.com/LukeAT/MobileUITests1
5cf9b9a68ea991bdc2ca404f4cfe9c8c261c140b
86566eb12c022a4f646cd1462da769097a3e2308
refs/heads/main
2023-05-30T04:04:10.211000
2021-06-20T09:48:55
2021-06-20T09:48:55
378,607,151
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pageObjects; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.PageFactory; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; import io.appium.java_client.pagefactory.AppiumFieldDecorator; import io.appium.java_client.pagefactory.iOSXCUITFindBy; public class AppNumberPad { public AppNumberPad(AppiumDriver driver) { PageFactory.initElements(new AppiumFieldDecorator(driver), this); } @iOSXCUITFindBy(accessibility = "receipt wallet button") @AndroidFindBy(accessibility = "receipt wallet button") private WebElement receiptWalletButton; public WebElement getReceiptWalletButton() { return receiptWalletButton; } @iOSXCUITFindBy(accessibility = "my profile button") @AndroidFindBy(accessibility = "my profile button") private WebElement myProfileButton; public WebElement getMyProfileButton() { return myProfileButton; } @iOSXCUITFindBy(accessibility = "current claims button") @AndroidFindBy(accessibility = "current claims button") private WebElement currentClaimsButton; public WebElement getCurrentClaimsButton() { return currentClaimsButton; } @iOSXCUITFindBy(accessibility = "submitted claims button") @AndroidFindBy(accessibility = "submitted claims button") private WebElement submittedClaimsButton; public WebElement getSubmittedClaimsButton() { return submittedClaimsButton; } @iOSXCUITFindBy(accessibility = "approved claims button") @AndroidFindBy(accessibility = "approved claims button") private WebElement approvedClaimsButton; public WebElement getApprovedClaimsButton() { return approvedClaimsButton; } @iOSXCUITFindBy(accessibility = "gps mileage") @AndroidFindBy(accessibility = "gps mileage") private WebElement gPSMileageButton; public WebElement getGPSMileageButton() { return gPSMileageButton; } @iOSXCUITFindBy(accessibility = "check and pay button") @AndroidFindBy(accessibility = "check and pay button") private WebElement checkAndPayButton; public WebElement getCheckAndPayButton() { return checkAndPayButton; } @iOSXCUITFindBy(accessibility = "sign out button") @AndroidFindBy(accessibility = "sign out button") private WebElement signOutButton; public WebElement getSignOutButton() { return signOutButton; } }
UTF-8
Java
2,340
java
AppNumberPad.java
Java
[]
null
[]
package pageObjects; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.PageFactory; import io.appium.java_client.AppiumDriver; import io.appium.java_client.pagefactory.AndroidFindBy; import io.appium.java_client.pagefactory.AppiumFieldDecorator; import io.appium.java_client.pagefactory.iOSXCUITFindBy; public class AppNumberPad { public AppNumberPad(AppiumDriver driver) { PageFactory.initElements(new AppiumFieldDecorator(driver), this); } @iOSXCUITFindBy(accessibility = "receipt wallet button") @AndroidFindBy(accessibility = "receipt wallet button") private WebElement receiptWalletButton; public WebElement getReceiptWalletButton() { return receiptWalletButton; } @iOSXCUITFindBy(accessibility = "my profile button") @AndroidFindBy(accessibility = "my profile button") private WebElement myProfileButton; public WebElement getMyProfileButton() { return myProfileButton; } @iOSXCUITFindBy(accessibility = "current claims button") @AndroidFindBy(accessibility = "current claims button") private WebElement currentClaimsButton; public WebElement getCurrentClaimsButton() { return currentClaimsButton; } @iOSXCUITFindBy(accessibility = "submitted claims button") @AndroidFindBy(accessibility = "submitted claims button") private WebElement submittedClaimsButton; public WebElement getSubmittedClaimsButton() { return submittedClaimsButton; } @iOSXCUITFindBy(accessibility = "approved claims button") @AndroidFindBy(accessibility = "approved claims button") private WebElement approvedClaimsButton; public WebElement getApprovedClaimsButton() { return approvedClaimsButton; } @iOSXCUITFindBy(accessibility = "gps mileage") @AndroidFindBy(accessibility = "gps mileage") private WebElement gPSMileageButton; public WebElement getGPSMileageButton() { return gPSMileageButton; } @iOSXCUITFindBy(accessibility = "check and pay button") @AndroidFindBy(accessibility = "check and pay button") private WebElement checkAndPayButton; public WebElement getCheckAndPayButton() { return checkAndPayButton; } @iOSXCUITFindBy(accessibility = "sign out button") @AndroidFindBy(accessibility = "sign out button") private WebElement signOutButton; public WebElement getSignOutButton() { return signOutButton; } }
2,340
0.787607
0.787607
82
27.536585
22.492924
67
false
false
0
0
0
0
0
0
1.5
false
false
12
33e5fac772dbd353018c828e30602b070baf1e85
24,970,939,880,376
194e44209e5494bc78378963e15cbfc8ba944373
/src/main/java/thebetweenlands/common/entity/movement/FlyingNodeProcessorBL.java
5b4874c273b569612e855d3056e0c88e68d51bfc
[]
no_license
Angry-Pixel/The-Betweenlands
https://github.com/Angry-Pixel/The-Betweenlands
cf8b8f4b8ac58b047dfbb19911426b81c7f31733
eafac1c217cdf304d477b025708e0dadf82b6953
refs/heads/1.12-fixes
2023-09-01T07:57:27.962000
2023-04-07T19:02:05
2023-04-07T19:02:05
30,657,636
237
125
null
false
2023-09-04T07:18:36
2015-02-11T16:34:13
2023-08-29T19:10:12
2023-09-04T07:18:35
975,776
218
68
207
Java
false
false
package thebetweenlands.common.entity.movement; import java.util.ArrayList; import java.util.List; import java.util.Set; import javax.annotation.Nullable; import com.google.common.collect.Sets; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLiving; import net.minecraft.pathfinding.NodeProcessor; import net.minecraft.pathfinding.PathNodeType; import net.minecraft.pathfinding.PathPoint; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.IBlockAccess; public class FlyingNodeProcessorBL extends NodeProcessor { public int preferredMinHeight = -1; public FlyingNodeProcessorBL() { this.preferredMinHeight = -1; } public FlyingNodeProcessorBL(int preferredMinHeight) { this.preferredMinHeight = preferredMinHeight; } @Override public PathPoint getStart() { int startY = MathHelper.floor(this.entity.getEntityBoundingBox().minY + 0.5D); BlockPos blockpos1 = new BlockPos(this.entity); PathNodeType startNodeType = this.isFree(blockpos1.getX(), startY, blockpos1.getZ()); if (this.entity.getPathPriority(startNodeType) < 0.0F) { Set<BlockPos> set = Sets.<BlockPos>newHashSet(); set.add(new BlockPos(this.entity.getEntityBoundingBox().minX, startY, this.entity.getEntityBoundingBox().minZ)); set.add(new BlockPos(this.entity.getEntityBoundingBox().minX, startY, this.entity.getEntityBoundingBox().maxZ)); set.add(new BlockPos(this.entity.getEntityBoundingBox().maxX, startY, this.entity.getEntityBoundingBox().minZ)); set.add(new BlockPos(this.entity.getEntityBoundingBox().maxX, startY, this.entity.getEntityBoundingBox().maxZ)); for (BlockPos blockpos : set) { PathNodeType pathnodetype = this.isFree(blockpos.getX(), blockpos.getY(), blockpos.getZ());//this.getPathNodeType(this.entity, blockpos); if (pathnodetype != PathNodeType.BLOCKED) { return this.openPoint(blockpos.getX(), blockpos.getY(), blockpos.getZ()); } } } return this.openPoint(blockpos1.getX(), startY, blockpos1.getZ()); } @Override public PathPoint getPathPointToCoords(double x, double y, double z) { return this.openPoint(MathHelper.floor(x - (double) (this.entity.width / 2.0F)), MathHelper.floor(y + 0.5D), MathHelper.floor(z - (double) (this.entity.width / 2.0F))); } @Override public int findPathOptions(PathPoint[] pathOptions, PathPoint currentPoint, PathPoint targetPoint, float maxDistance) { int i = 0; for (EnumFacing enumfacing : EnumFacing.VALUES) { PathPoint pathpoint = this.getAirNode(currentPoint.x + enumfacing.getXOffset(), currentPoint.y + enumfacing.getYOffset(), currentPoint.z + enumfacing.getZOffset(), targetPoint); if (pathpoint != null && !pathpoint.visited && pathpoint.distanceTo(targetPoint) < maxDistance) { pathOptions[i++] = pathpoint; } } return i; } @Override public PathNodeType getPathNodeType(IBlockAccess blockaccessIn, int x, int y, int z, EntityLiving entitylivingIn, int xSize, int ySize, int zSize, boolean canBreakDoorsIn, boolean canEnterDoorsIn) { return this.isFree(x, y, z); } @Override public PathNodeType getPathNodeType(IBlockAccess blockaccessIn, int x, int y, int z) { return this.isFree(x, y, z); } @Nullable private PathPoint getAirNode(int x, int y, int z, PathPoint targetPoint) { PathNodeType pathnodetype = this.isFree(x, y, z); if(pathnodetype == PathNodeType.OPEN) { PathPoint pathPoint = this.openPoint(x, y, z); if(this.preferredMinHeight > 0) { int height = 0; for(int yOff = 0; yOff <= this.preferredMinHeight; yOff++) { PathPoint cached = this.pointMap.lookup(PathPoint.makeHash(x, y - yOff, z)); if(cached != null && cached.visited && cached.nodeType == PathNodeType.BLOCKED) { break; } else if(this.isFree(x, y - yOff, z) == PathNodeType.BLOCKED) { break; } height++; } if(height <= this.preferredMinHeight && height > 0) { double heightCostPenalty = (height / (double)this.preferredMinHeight * 4 + 1) * 2.0D * Math.sqrt(MathHelper.clamp((targetPoint.distanceTo(pathPoint) - height) / (double)height, 0.0D, 1.0D)); pathPoint.costMalus += heightCostPenalty; } } return pathPoint; } return null; } private PathNodeType isFree(int x, int y, int z) { BlockPos.MutableBlockPos checkPos = new BlockPos.MutableBlockPos(); for (int i = x; i < x + this.entitySizeX; ++i) { for (int j = y; j < y + this.entitySizeY; ++j) { for (int k = z; k < z + this.entitySizeZ; ++k) { checkPos.setPos(i, j, k); IBlockState state = this.blockaccess.getBlockState(checkPos); state = state.getActualState(this.blockaccess, checkPos); List<AxisAlignedBB> collidingAABBs = new ArrayList<>(); state.addCollisionBoxToList(this.entity.world, checkPos, new AxisAlignedBB(x, y, z, x + this.entitySizeX, y + this.entitySizeY, z + this.entitySizeZ), collidingAABBs, this.entity, true); if(!collidingAABBs.isEmpty()) { return PathNodeType.BLOCKED; } } } } return PathNodeType.OPEN; } }
UTF-8
Java
5,139
java
FlyingNodeProcessorBL.java
Java
[]
null
[]
package thebetweenlands.common.entity.movement; import java.util.ArrayList; import java.util.List; import java.util.Set; import javax.annotation.Nullable; import com.google.common.collect.Sets; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLiving; import net.minecraft.pathfinding.NodeProcessor; import net.minecraft.pathfinding.PathNodeType; import net.minecraft.pathfinding.PathPoint; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.IBlockAccess; public class FlyingNodeProcessorBL extends NodeProcessor { public int preferredMinHeight = -1; public FlyingNodeProcessorBL() { this.preferredMinHeight = -1; } public FlyingNodeProcessorBL(int preferredMinHeight) { this.preferredMinHeight = preferredMinHeight; } @Override public PathPoint getStart() { int startY = MathHelper.floor(this.entity.getEntityBoundingBox().minY + 0.5D); BlockPos blockpos1 = new BlockPos(this.entity); PathNodeType startNodeType = this.isFree(blockpos1.getX(), startY, blockpos1.getZ()); if (this.entity.getPathPriority(startNodeType) < 0.0F) { Set<BlockPos> set = Sets.<BlockPos>newHashSet(); set.add(new BlockPos(this.entity.getEntityBoundingBox().minX, startY, this.entity.getEntityBoundingBox().minZ)); set.add(new BlockPos(this.entity.getEntityBoundingBox().minX, startY, this.entity.getEntityBoundingBox().maxZ)); set.add(new BlockPos(this.entity.getEntityBoundingBox().maxX, startY, this.entity.getEntityBoundingBox().minZ)); set.add(new BlockPos(this.entity.getEntityBoundingBox().maxX, startY, this.entity.getEntityBoundingBox().maxZ)); for (BlockPos blockpos : set) { PathNodeType pathnodetype = this.isFree(blockpos.getX(), blockpos.getY(), blockpos.getZ());//this.getPathNodeType(this.entity, blockpos); if (pathnodetype != PathNodeType.BLOCKED) { return this.openPoint(blockpos.getX(), blockpos.getY(), blockpos.getZ()); } } } return this.openPoint(blockpos1.getX(), startY, blockpos1.getZ()); } @Override public PathPoint getPathPointToCoords(double x, double y, double z) { return this.openPoint(MathHelper.floor(x - (double) (this.entity.width / 2.0F)), MathHelper.floor(y + 0.5D), MathHelper.floor(z - (double) (this.entity.width / 2.0F))); } @Override public int findPathOptions(PathPoint[] pathOptions, PathPoint currentPoint, PathPoint targetPoint, float maxDistance) { int i = 0; for (EnumFacing enumfacing : EnumFacing.VALUES) { PathPoint pathpoint = this.getAirNode(currentPoint.x + enumfacing.getXOffset(), currentPoint.y + enumfacing.getYOffset(), currentPoint.z + enumfacing.getZOffset(), targetPoint); if (pathpoint != null && !pathpoint.visited && pathpoint.distanceTo(targetPoint) < maxDistance) { pathOptions[i++] = pathpoint; } } return i; } @Override public PathNodeType getPathNodeType(IBlockAccess blockaccessIn, int x, int y, int z, EntityLiving entitylivingIn, int xSize, int ySize, int zSize, boolean canBreakDoorsIn, boolean canEnterDoorsIn) { return this.isFree(x, y, z); } @Override public PathNodeType getPathNodeType(IBlockAccess blockaccessIn, int x, int y, int z) { return this.isFree(x, y, z); } @Nullable private PathPoint getAirNode(int x, int y, int z, PathPoint targetPoint) { PathNodeType pathnodetype = this.isFree(x, y, z); if(pathnodetype == PathNodeType.OPEN) { PathPoint pathPoint = this.openPoint(x, y, z); if(this.preferredMinHeight > 0) { int height = 0; for(int yOff = 0; yOff <= this.preferredMinHeight; yOff++) { PathPoint cached = this.pointMap.lookup(PathPoint.makeHash(x, y - yOff, z)); if(cached != null && cached.visited && cached.nodeType == PathNodeType.BLOCKED) { break; } else if(this.isFree(x, y - yOff, z) == PathNodeType.BLOCKED) { break; } height++; } if(height <= this.preferredMinHeight && height > 0) { double heightCostPenalty = (height / (double)this.preferredMinHeight * 4 + 1) * 2.0D * Math.sqrt(MathHelper.clamp((targetPoint.distanceTo(pathPoint) - height) / (double)height, 0.0D, 1.0D)); pathPoint.costMalus += heightCostPenalty; } } return pathPoint; } return null; } private PathNodeType isFree(int x, int y, int z) { BlockPos.MutableBlockPos checkPos = new BlockPos.MutableBlockPos(); for (int i = x; i < x + this.entitySizeX; ++i) { for (int j = y; j < y + this.entitySizeY; ++j) { for (int k = z; k < z + this.entitySizeZ; ++k) { checkPos.setPos(i, j, k); IBlockState state = this.blockaccess.getBlockState(checkPos); state = state.getActualState(this.blockaccess, checkPos); List<AxisAlignedBB> collidingAABBs = new ArrayList<>(); state.addCollisionBoxToList(this.entity.world, checkPos, new AxisAlignedBB(x, y, z, x + this.entitySizeX, y + this.entitySizeY, z + this.entitySizeZ), collidingAABBs, this.entity, true); if(!collidingAABBs.isEmpty()) { return PathNodeType.BLOCKED; } } } } return PathNodeType.OPEN; } }
5,139
0.724071
0.718233
131
38.236641
43.540951
199
false
false
0
0
0
0
0
0
2.992366
false
false
12
6f0385b62d5e90efb7a36c2a2f75eb5eade9e514
25,915,832,681,786
760c261ea72a6f690b737894d3997152e8112337
/src/java/trith/core/zerop.java
1bcbbf8fe56789be69d0e8432126c6e7231cdd70
[ "Unlicense", "LicenseRef-scancode-public-domain" ]
permissive
helvm/trith
https://github.com/helvm/trith
d39d3de9b49f5fd7e8587c1cfbb3740257a7274f
c8fd0e8e9ac4586ffa0a91c4844787219ae9aaf8
refs/heads/master
2021-05-27T19:22:40.592000
2010-12-02T06:38:20
2010-12-02T06:38:20
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package trith.core; import trith.lang.*; import java.math.BigDecimal; /** * @author Arto Bendiken * @see http://trith.org/core/zerop */ public class zerop extends UnaryOperator<Boolean, BigDecimal> { public static final String URL = "http://trith.org/core/zerop"; public Boolean execute(BigDecimal n) { return Boolean.valueOf(n.compareTo(BigDecimal.ZERO) == 0); } }
UTF-8
Java
386
java
zerop.java
Java
[ { "context": "g.*;\nimport java.math.BigDecimal;\n\n/**\n * @author Arto Bendiken\n * @see http://trith.org/core/zerop\n */\npublic", "end": 101, "score": 0.999886155128479, "start": 88, "tag": "NAME", "value": "Arto Bendiken" } ]
null
[]
package trith.core; import trith.lang.*; import java.math.BigDecimal; /** * @author <NAME> * @see http://trith.org/core/zerop */ public class zerop extends UnaryOperator<Boolean, BigDecimal> { public static final String URL = "http://trith.org/core/zerop"; public Boolean execute(BigDecimal n) { return Boolean.valueOf(n.compareTo(BigDecimal.ZERO) == 0); } }
379
0.707254
0.704663
15
24.733334
23.313705
65
false
false
0
0
0
0
0
0
0.4
false
false
12
ec3a8c0fbddd0419be46a4b14d02081e672fd3bd
19,963,008,048,695
ef0c1514e9af6de3ba4a20e0d01de7cc3a915188
/sdk/eventgrid/microsoft-azure-eventgrid/src/main/java/com/microsoft/azure/eventgrid/models/MediaLiveEventIncomingVideoStreamsOutOfSyncEventData.java
cdb95bb51dcdc50a20f9c6257e14a4b8ff47c70b
[ "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-or-later", "CC0-1.0", "BSD-3-Clause", "UPL-1.0", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "LicenseRef-scancode-generic-cla" ]
permissive
Azure/azure-sdk-for-java
https://github.com/Azure/azure-sdk-for-java
0902d584b42d3654b4ce65b1dad8409f18ddf4bc
789bdc6c065dc44ce9b8b630e2f2e5896b2a7616
refs/heads/main
2023-09-04T09:36:35.821000
2023-09-02T01:53:56
2023-09-02T01:53:56
2,928,948
2,027
2,084
MIT
false
2023-09-14T21:37:15
2011-12-06T23:33:56
2023-09-14T17:19:10
2023-09-14T21:37:14
3,043,660
1,994
1,854
1,435
Java
false
false
/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. */ package com.microsoft.azure.eventgrid.models; import com.fasterxml.jackson.annotation.JsonProperty; /** * Incoming video stream out of synch event data. */ public class MediaLiveEventIncomingVideoStreamsOutOfSyncEventData { /** * Gets the first timestamp received for one of the quality levels. */ @JsonProperty(value = "firstTimestamp", access = JsonProperty.Access.WRITE_ONLY) private String firstTimestamp; /** * Gets the duration of the data chunk with first timestamp. */ @JsonProperty(value = "firstDuration", access = JsonProperty.Access.WRITE_ONLY) private String firstDuration; /** * Gets the timestamp received for some other quality levels. */ @JsonProperty(value = "secondTimestamp", access = JsonProperty.Access.WRITE_ONLY) private String secondTimestamp; /** * Gets the duration of the data chunk with second timestamp. */ @JsonProperty(value = "secondDuration", access = JsonProperty.Access.WRITE_ONLY) private String secondDuration; /** * Gets the timescale in which both the timestamps and durations are * represented. */ @JsonProperty(value = "timescale", access = JsonProperty.Access.WRITE_ONLY) private String timescale; /** * Get gets the first timestamp received for one of the quality levels. * * @return the firstTimestamp value */ public String firstTimestamp() { return this.firstTimestamp; } /** * Get gets the duration of the data chunk with first timestamp. * * @return the firstDuration value */ public String firstDuration() { return this.firstDuration; } /** * Get gets the timestamp received for some other quality levels. * * @return the secondTimestamp value */ public String secondTimestamp() { return this.secondTimestamp; } /** * Get gets the duration of the data chunk with second timestamp. * * @return the secondDuration value */ public String secondDuration() { return this.secondDuration; } /** * Get gets the timescale in which both the timestamps and durations are represented. * * @return the timescale value */ public String timescale() { return this.timescale; } }
UTF-8
Java
2,574
java
MediaLiveEventIncomingVideoStreamsOutOfSyncEventData.java
Java
[]
null
[]
/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. */ package com.microsoft.azure.eventgrid.models; import com.fasterxml.jackson.annotation.JsonProperty; /** * Incoming video stream out of synch event data. */ public class MediaLiveEventIncomingVideoStreamsOutOfSyncEventData { /** * Gets the first timestamp received for one of the quality levels. */ @JsonProperty(value = "firstTimestamp", access = JsonProperty.Access.WRITE_ONLY) private String firstTimestamp; /** * Gets the duration of the data chunk with first timestamp. */ @JsonProperty(value = "firstDuration", access = JsonProperty.Access.WRITE_ONLY) private String firstDuration; /** * Gets the timestamp received for some other quality levels. */ @JsonProperty(value = "secondTimestamp", access = JsonProperty.Access.WRITE_ONLY) private String secondTimestamp; /** * Gets the duration of the data chunk with second timestamp. */ @JsonProperty(value = "secondDuration", access = JsonProperty.Access.WRITE_ONLY) private String secondDuration; /** * Gets the timescale in which both the timestamps and durations are * represented. */ @JsonProperty(value = "timescale", access = JsonProperty.Access.WRITE_ONLY) private String timescale; /** * Get gets the first timestamp received for one of the quality levels. * * @return the firstTimestamp value */ public String firstTimestamp() { return this.firstTimestamp; } /** * Get gets the duration of the data chunk with first timestamp. * * @return the firstDuration value */ public String firstDuration() { return this.firstDuration; } /** * Get gets the timestamp received for some other quality levels. * * @return the secondTimestamp value */ public String secondTimestamp() { return this.secondTimestamp; } /** * Get gets the duration of the data chunk with second timestamp. * * @return the secondDuration value */ public String secondDuration() { return this.secondDuration; } /** * Get gets the timescale in which both the timestamps and durations are represented. * * @return the timescale value */ public String timescale() { return this.timescale; } }
2,574
0.667055
0.667055
93
26.67742
27.41523
89
false
false
0
0
0
0
0
0
0.182796
false
false
12
a6c159cae75dfb9b9ac7d60fb93e34ff79c12e7f
37,735,582,667,356
f324589b57147ab0e402af3f30e72db068a6360c
/vivo-ilha-contestacao/src/br/com/contestacao/controller/cadastros/UsuarioBean.java
9431557fbbdda15a4402568136606854eaa9cb48
[]
no_license
christopherscotini/portfolio-java-projects
https://github.com/christopherscotini/portfolio-java-projects
d6ac4000501ddd84e42d79aba2a9c1542c74a3a1
3bac292b30f5d8672816244e1c60b8412d206366
refs/heads/master
2016-09-05T18:30:15.351000
2014-01-28T11:10:31
2014-01-28T11:10:31
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.contestacao.controller.cadastros; import java.io.Serializable; import java.util.List; import javax.annotation.PostConstruct; import javax.inject.Inject; import javax.inject.Named; import org.omnifaces.cdi.ViewScoped; import org.omnifaces.util.Messages; import br.com.contestacao.model.Perfil; import br.com.contestacao.model.Usuario; import br.com.contestacao.service.PerfilService; import br.com.contestacao.service.UsuarioService; import br.com.contestacao.service.exception.ValidacaoException; import br.com.contestacao.utils.FacesMessages; @ViewScoped @Named public class UsuarioBean implements Serializable { private static final long serialVersionUID = 8817911232036419145L; @Inject private PerfilService perfilService = null; @Inject private UsuarioService usuarioService = null; private List<Perfil> listaPerfis = null; private List<Usuario> listaPesquisa = null; private Long idPerfilCadastro = null; private Usuario usuarioCadastro = null; private Usuario usuarioPesquisa = null; public UsuarioBean() { super(); this.usuarioCadastro = new Usuario(); this.usuarioPesquisa = new Usuario(); } @PostConstruct public void iniciar() { listaPerfis = perfilService.listar(); listaPesquisa = usuarioService.listar(usuarioPesquisa); } public void resetCadastro() { usuarioCadastro = new Usuario(); idPerfilCadastro = null; } public void confirmar() { try { usuarioService.salvar(usuarioCadastro, idPerfilCadastro); } catch (ValidacaoException e) { Messages.addError(null, e.getMessage()); return; } resetCadastro(); listaPesquisa = usuarioService.listar(usuarioPesquisa); FacesMessages.exibirMsgCadastroArmazenadoSucesso(); } public void pesquisar() { listaPesquisa = usuarioService.listar(usuarioPesquisa); if (listaPesquisa == null || listaPesquisa.isEmpty()) { FacesMessages.exibirMsgPesqNenhumRegistroEncontrado(); } } public void editar(Integer indice) { if (indice == null) { FacesMessages.exibirMsgPesqNenhumRegistroSelecionado(); return; } usuarioCadastro = new Usuario(listaPesquisa.get(indice)); idPerfilCadastro = usuarioCadastro.getPerfil().getId(); } public List<Perfil> getListaPerfis() { return listaPerfis; } public void setListaPerfis(List<Perfil> listaPerfis) { this.listaPerfis = listaPerfis; } public Usuario getUsuarioCadastro() { return usuarioCadastro; } public void setUsuarioCadastro(Usuario usuarioCadastro) { this.usuarioCadastro = usuarioCadastro; } public Usuario getUsuarioPesquisa() { return usuarioPesquisa; } public void setUsuarioPesquisa(Usuario usuarioPesquisa) { this.usuarioPesquisa = usuarioPesquisa; } public Long getIdPerfilCadastro() { return idPerfilCadastro; } public void setIdPerfilCadastro(Long idPerfilCadastro) { this.idPerfilCadastro = idPerfilCadastro; } public List<Usuario> getListaPesquisa() { return listaPesquisa; } public void setListaPesquisa(List<Usuario> listaPesquisa) { this.listaPesquisa = listaPesquisa; } }
UTF-8
Java
3,175
java
UsuarioBean.java
Java
[]
null
[]
package br.com.contestacao.controller.cadastros; import java.io.Serializable; import java.util.List; import javax.annotation.PostConstruct; import javax.inject.Inject; import javax.inject.Named; import org.omnifaces.cdi.ViewScoped; import org.omnifaces.util.Messages; import br.com.contestacao.model.Perfil; import br.com.contestacao.model.Usuario; import br.com.contestacao.service.PerfilService; import br.com.contestacao.service.UsuarioService; import br.com.contestacao.service.exception.ValidacaoException; import br.com.contestacao.utils.FacesMessages; @ViewScoped @Named public class UsuarioBean implements Serializable { private static final long serialVersionUID = 8817911232036419145L; @Inject private PerfilService perfilService = null; @Inject private UsuarioService usuarioService = null; private List<Perfil> listaPerfis = null; private List<Usuario> listaPesquisa = null; private Long idPerfilCadastro = null; private Usuario usuarioCadastro = null; private Usuario usuarioPesquisa = null; public UsuarioBean() { super(); this.usuarioCadastro = new Usuario(); this.usuarioPesquisa = new Usuario(); } @PostConstruct public void iniciar() { listaPerfis = perfilService.listar(); listaPesquisa = usuarioService.listar(usuarioPesquisa); } public void resetCadastro() { usuarioCadastro = new Usuario(); idPerfilCadastro = null; } public void confirmar() { try { usuarioService.salvar(usuarioCadastro, idPerfilCadastro); } catch (ValidacaoException e) { Messages.addError(null, e.getMessage()); return; } resetCadastro(); listaPesquisa = usuarioService.listar(usuarioPesquisa); FacesMessages.exibirMsgCadastroArmazenadoSucesso(); } public void pesquisar() { listaPesquisa = usuarioService.listar(usuarioPesquisa); if (listaPesquisa == null || listaPesquisa.isEmpty()) { FacesMessages.exibirMsgPesqNenhumRegistroEncontrado(); } } public void editar(Integer indice) { if (indice == null) { FacesMessages.exibirMsgPesqNenhumRegistroSelecionado(); return; } usuarioCadastro = new Usuario(listaPesquisa.get(indice)); idPerfilCadastro = usuarioCadastro.getPerfil().getId(); } public List<Perfil> getListaPerfis() { return listaPerfis; } public void setListaPerfis(List<Perfil> listaPerfis) { this.listaPerfis = listaPerfis; } public Usuario getUsuarioCadastro() { return usuarioCadastro; } public void setUsuarioCadastro(Usuario usuarioCadastro) { this.usuarioCadastro = usuarioCadastro; } public Usuario getUsuarioPesquisa() { return usuarioPesquisa; } public void setUsuarioPesquisa(Usuario usuarioPesquisa) { this.usuarioPesquisa = usuarioPesquisa; } public Long getIdPerfilCadastro() { return idPerfilCadastro; } public void setIdPerfilCadastro(Long idPerfilCadastro) { this.idPerfilCadastro = idPerfilCadastro; } public List<Usuario> getListaPesquisa() { return listaPesquisa; } public void setListaPesquisa(List<Usuario> listaPesquisa) { this.listaPesquisa = listaPesquisa; } }
3,175
0.737953
0.731969
132
22.05303
21.544991
67
false
false
0
0
0
0
0
0
1.333333
false
false
12
fec890270ed372f827b45a2e69da8cf71fcef5aa
35,313,221,145,853
3fc43d6b4b373d110a08f1c1d0c5d1b9cfc571a6
/src/main/java/com/nicksoddsandends/dao/impl/CostCenterDAOImpl.java
5b228dcf6869f1198176d1b4ca9e1ca1682a97b3
[]
no_license
nicknorm007/SpringHibernateSample
https://github.com/nicknorm007/SpringHibernateSample
1b7f4d50ccb75b3baf55ad67884d5237a6c33fed
0c852985cf151a278b8d51d38e80bd7b7b421f7d
refs/heads/master
2020-12-31T07:33:19.203000
2017-07-17T17:48:54
2017-07-17T17:48:54
58,074,007
0
0
null
false
2016-06-01T15:31:11
2016-05-04T18:15:57
2016-05-04T18:17:31
2016-06-01T15:31:11
42
0
0
0
Java
null
null
package com.nicksoddsandends.dao.impl; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.nicksoddsandends.dao.CostCenterDAO; import com.nicksoddsandends.entity.CostCenter; import com.nicksoddsandends.entity.Employee; import com.nicksoddsandends.entitymanager.GenericEntityInterface; @Repository public class CostCenterDAOImpl implements CostCenterDAO { @Autowired protected GenericEntityInterface<CostCenter> genericEntity; protected EntityManager entityManager; public CostCenterDAOImpl() { System.out.println("CostCenterDAOImpl"); } public EntityManager getEntityManager() { return entityManager; } @PersistenceContext public void setEntityManager(EntityManager entityManager) { this.entityManager = entityManager; } @Override public CostCenter createCostCenter(CostCenter costCenter) { CostCenter c = genericEntity.save(costCenter); return c; } @Override public CostCenter updateCostCenter(CostCenter costCenter) { return null; } @Override public void deleteCostCenter(long id) { CostCenter c = (CostCenter) genericEntity.find(id, CostCenter.class); genericEntity.delete(c); } @Override public List<CostCenter> getAllCostCenters() { List<CostCenter> centers = genericEntity.findAll(CostCenter.class); return centers; } @Override public CostCenter getCostCenter(long id) { CostCenter c = (CostCenter) genericEntity.find(id, CostCenter.class); return c; } @Override public List<CostCenter> getAllCostCenter(String costCenter) { return null; } @Override public List<Employee> getAllEmployeesinCostCenter(CostCenter costCenter) { Query joinQuery = entityManager.createQuery("Select e " + "from Employee e " + "inner join e.costCenters costcenter " + "where costcenter.cost_id in :costId"); joinQuery.setParameter("costId", costCenter.getCost_id() ); @SuppressWarnings("unchecked") List<Employee> emps = joinQuery.getResultList(); return emps; } }
UTF-8
Java
2,217
java
CostCenterDAOImpl.java
Java
[]
null
[]
package com.nicksoddsandends.dao.impl; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.nicksoddsandends.dao.CostCenterDAO; import com.nicksoddsandends.entity.CostCenter; import com.nicksoddsandends.entity.Employee; import com.nicksoddsandends.entitymanager.GenericEntityInterface; @Repository public class CostCenterDAOImpl implements CostCenterDAO { @Autowired protected GenericEntityInterface<CostCenter> genericEntity; protected EntityManager entityManager; public CostCenterDAOImpl() { System.out.println("CostCenterDAOImpl"); } public EntityManager getEntityManager() { return entityManager; } @PersistenceContext public void setEntityManager(EntityManager entityManager) { this.entityManager = entityManager; } @Override public CostCenter createCostCenter(CostCenter costCenter) { CostCenter c = genericEntity.save(costCenter); return c; } @Override public CostCenter updateCostCenter(CostCenter costCenter) { return null; } @Override public void deleteCostCenter(long id) { CostCenter c = (CostCenter) genericEntity.find(id, CostCenter.class); genericEntity.delete(c); } @Override public List<CostCenter> getAllCostCenters() { List<CostCenter> centers = genericEntity.findAll(CostCenter.class); return centers; } @Override public CostCenter getCostCenter(long id) { CostCenter c = (CostCenter) genericEntity.find(id, CostCenter.class); return c; } @Override public List<CostCenter> getAllCostCenter(String costCenter) { return null; } @Override public List<Employee> getAllEmployeesinCostCenter(CostCenter costCenter) { Query joinQuery = entityManager.createQuery("Select e " + "from Employee e " + "inner join e.costCenters costcenter " + "where costcenter.cost_id in :costId"); joinQuery.setParameter("costId", costCenter.getCost_id() ); @SuppressWarnings("unchecked") List<Employee> emps = joinQuery.getResultList(); return emps; } }
2,217
0.762742
0.762742
86
24.77907
24.634727
81
false
false
0
0
0
0
0
0
1.5
false
false
12
cb225e69898d4172d78faff8e3201ca083df80bc
38,190,849,205,474
41954683c5dcfadb2a1e73b9c96c9b02e562e2d6
/AutomationPractice/src/test/java/dataProvider/ExcelDataProvider.java
035fd3c83c15a53f2319f83fd6faa4e9e4b479f9
[]
no_license
SeleniumSK/AutomationFramework1
https://github.com/SeleniumSK/AutomationFramework1
76a7884a9ed9b07ccdb5b65d17253bf78230a631
c8f6538bed677b2ca5bad15597366d9149a0312b
refs/heads/master
2020-12-02T21:16:41.066000
2017-07-05T06:48:22
2017-07-05T06:48:22
96,284,704
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dataProvider; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import testCases.BaseClass; public class ExcelDataProvider { public File src; XSSFWorkbook wb; public ExcelDataProvider() { src = new File(System.getProperty("user.dir")+"/DataFiles/excelSheet.xlsx"); try { FileInputStream fis = new FileInputStream(src); wb = new XSSFWorkbook(fis); } catch (IOException e) { System.out.println("Error in loading the excel "+e.getMessage()); } } //method to get the String Data from the excel sheet public String getExcelData(String sheet, int row, int column) { String data= wb.getSheet(sheet).getRow(row).getCell(column).getStringCellValue(); return data; } //method to get the number of rows public int getNumberOfRows(String sheet) { return wb.getSheet(sheet).getPhysicalNumberOfRows(); } //method to get the number of columns public int getNumberOfColumns(String sheet, int row) { return wb.getSheet(sheet).getRow(row).getPhysicalNumberOfCells(); } //method to write to the data to excel public void setDataToExcel(String sheet, int row, int col, String Value) { wb.getSheet(sheet).getRow(row).createCell(col).setCellValue(Value); } public void writeExcel() { try { wb.write(BaseClass.fout); wb.close(); } catch (IOException e) { System.out.println("Unable to write data in the excel sheet"); System.out.println("The error is "+e.getMessage()); } } }
UTF-8
Java
1,622
java
ExcelDataProvider.java
Java
[]
null
[]
package dataProvider; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import testCases.BaseClass; public class ExcelDataProvider { public File src; XSSFWorkbook wb; public ExcelDataProvider() { src = new File(System.getProperty("user.dir")+"/DataFiles/excelSheet.xlsx"); try { FileInputStream fis = new FileInputStream(src); wb = new XSSFWorkbook(fis); } catch (IOException e) { System.out.println("Error in loading the excel "+e.getMessage()); } } //method to get the String Data from the excel sheet public String getExcelData(String sheet, int row, int column) { String data= wb.getSheet(sheet).getRow(row).getCell(column).getStringCellValue(); return data; } //method to get the number of rows public int getNumberOfRows(String sheet) { return wb.getSheet(sheet).getPhysicalNumberOfRows(); } //method to get the number of columns public int getNumberOfColumns(String sheet, int row) { return wb.getSheet(sheet).getRow(row).getPhysicalNumberOfCells(); } //method to write to the data to excel public void setDataToExcel(String sheet, int row, int col, String Value) { wb.getSheet(sheet).getRow(row).createCell(col).setCellValue(Value); } public void writeExcel() { try { wb.write(BaseClass.fout); wb.close(); } catch (IOException e) { System.out.println("Unable to write data in the excel sheet"); System.out.println("The error is "+e.getMessage()); } } }
1,622
0.681874
0.681874
69
21.507246
24.365349
83
false
false
0
0
0
0
0
0
1.681159
false
false
12
dc6c5989d275b44940ece3f5d8aa8f088577ad07
38,190,849,205,769
35e42c66db628cbdc535dcab4edca5a0274a4f79
/src/com/kstenschke/shifter/utils/DelimiterDetector.java
0dd8687d861235189f78c340cf7cb5006cf0a8bb
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
andre-artus/shifter-plugin
https://github.com/andre-artus/shifter-plugin
2b461b3af9e20a73a72cc6a6d2f174bacb0824bb
f6c38397cf89a9ef735d014df443a40cf0d60064
refs/heads/master
2020-06-27T09:34:04.097000
2019-07-31T19:36:15
2019-07-31T19:36:15
199,914,145
0
0
Apache-2.0
true
2019-07-31T19:36:16
2019-07-31T19:06:59
2019-07-31T19:07:02
2019-07-31T19:36:16
3,309
0
0
0
Java
false
false
/* * Copyright 2011-2019 Kay Stenschke * * 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.kstenschke.shifter.utils; import java.util.List; /** * Utility Class: Detect common delimiter (before newline) of list of lines */ class DelimiterDetector { private boolean findingDelimiterFailed; private char commonDelimiter; private boolean isDelimitedLastLine; /** * Constructor * * @param lines */ DelimiterDetector(List<String> lines) { commonDelimiter = ' '; int amountLines = lines.size(); if (amountLines <= 2) { findingDelimiterFailed = true; return; } int lineLength; findingDelimiterFailed = false; int lineNumber = 0; for (String line : lines) { line = line.trim(); lineLength = line.length(); if (lineLength > 0) { char currentDelimiter = line.charAt(lineLength - 1); if (0 == lineNumber) { commonDelimiter = currentDelimiter; } else { boolean isLastLine = lineNumber == amountLines - 1; if (!isLastLine && currentDelimiter != commonDelimiter) { findingDelimiterFailed = true; } } } lineNumber++; } String lastLine = lines.get(amountLines - 1).trim(); isDelimitedLastLine = lastLine.endsWith(String.valueOf(commonDelimiter)); } /** * @return String|null Common delimiter if found, or null */ String getCommonDelimiter() { return findingDelimiterFailed ? null : String.valueOf(commonDelimiter); } boolean isFoundDelimiter() { return !findingDelimiterFailed; } boolean isDelimitedLastLine() { return !findingDelimiterFailed && isDelimitedLastLine; } }
UTF-8
Java
2,433
java
DelimiterDetector.java
Java
[ { "context": "/*\n * Copyright 2011-2019 Kay Stenschke\n *\n * Licensed under the Apache License, Version ", "end": 39, "score": 0.9998505115509033, "start": 26, "tag": "NAME", "value": "Kay Stenschke" } ]
null
[]
/* * Copyright 2011-2019 <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.kstenschke.shifter.utils; import java.util.List; /** * Utility Class: Detect common delimiter (before newline) of list of lines */ class DelimiterDetector { private boolean findingDelimiterFailed; private char commonDelimiter; private boolean isDelimitedLastLine; /** * Constructor * * @param lines */ DelimiterDetector(List<String> lines) { commonDelimiter = ' '; int amountLines = lines.size(); if (amountLines <= 2) { findingDelimiterFailed = true; return; } int lineLength; findingDelimiterFailed = false; int lineNumber = 0; for (String line : lines) { line = line.trim(); lineLength = line.length(); if (lineLength > 0) { char currentDelimiter = line.charAt(lineLength - 1); if (0 == lineNumber) { commonDelimiter = currentDelimiter; } else { boolean isLastLine = lineNumber == amountLines - 1; if (!isLastLine && currentDelimiter != commonDelimiter) { findingDelimiterFailed = true; } } } lineNumber++; } String lastLine = lines.get(amountLines - 1).trim(); isDelimitedLastLine = lastLine.endsWith(String.valueOf(commonDelimiter)); } /** * @return String|null Common delimiter if found, or null */ String getCommonDelimiter() { return findingDelimiterFailed ? null : String.valueOf(commonDelimiter); } boolean isFoundDelimiter() { return !findingDelimiterFailed; } boolean isDelimitedLastLine() { return !findingDelimiterFailed && isDelimitedLastLine; } }
2,426
0.610358
0.602548
83
28.325302
24.860628
81
false
false
0
0
0
0
0
0
0.373494
false
false
12
80bb52a1b77f0aec9229d7d038a6202464b6ad86
37,323,265,815,487
7f75a5ddce3796c22aa0d94e618112a986aedf52
/Cour/src/com/cdsxt/action/CourseAction.java
10d6dba03c77e31503e49995ea8f8f586865aeda
[]
no_license
BinYangXian/Hig
https://github.com/BinYangXian/Hig
bd1940658d9ea2cc831b0be94046690c65795b72
209d0c8903e62b0e3aeb8aef8b982b4892eb3418
refs/heads/master
2020-12-24T19:51:29.401000
2017-06-20T06:01:04
2017-06-20T06:01:04
86,220,689
0
0
null
false
2017-05-12T13:44:40
2017-03-26T09:16:08
2017-05-12T04:06:00
2017-05-12T13:44:40
120,151
0
0
0
JavaScript
null
null
package com.cdsxt.action; import java.util.List; import com.cdsxt.po.Course; import com.cdsxt.service.CourseService; import com.cdsxt.service.impl.CourseServiceImpl; public class CourseAction { private CourseService courseService = new CourseServiceImpl(); private Course course; private List<Course> courses; public String findAll(){ this.courses = this.courseService.findAll(); return "findAll"; } public String choose(){ this.findAll(); return "choose"; } public String save(){ if(this.course!=null){ this.courseService.save(course); } return "save-success"; } public Course getCourse() { return course; } public void setCourse(Course course) { this.course = course; } public List<Course> getCourses() { return courses; } public void setCourses(List<Course> courses) { this.courses = courses; } }
UTF-8
Java
858
java
CourseAction.java
Java
[]
null
[]
package com.cdsxt.action; import java.util.List; import com.cdsxt.po.Course; import com.cdsxt.service.CourseService; import com.cdsxt.service.impl.CourseServiceImpl; public class CourseAction { private CourseService courseService = new CourseServiceImpl(); private Course course; private List<Course> courses; public String findAll(){ this.courses = this.courseService.findAll(); return "findAll"; } public String choose(){ this.findAll(); return "choose"; } public String save(){ if(this.course!=null){ this.courseService.save(course); } return "save-success"; } public Course getCourse() { return course; } public void setCourse(Course course) { this.course = course; } public List<Course> getCourses() { return courses; } public void setCourses(List<Course> courses) { this.courses = courses; } }
858
0.715618
0.715618
46
17.652174
16.212204
63
false
false
0
0
0
0
0
0
1.434783
false
false
12
889a030d8aea6a4755bad8bc04b31ddf0b5852af
6,219,112,703,317
62f10c8c2c0a54c9c6ffaf73857dfd429a0d1f3c
/Corba2015/Doc/Fichiers CORBA TP1/TP_CORBA_B_V_LPV/src/Convertisseur/EuroPOA.java
827d7077992d8bc05eef2451cf6dfd96f8a7228f
[]
no_license
RemiBoudin/osteopower2015
https://github.com/RemiBoudin/osteopower2015
67e101afd18bbd3230a700f8ef64450ee0dedaee
173ddb4f9156381f75be1238bc0820d945a09922
refs/heads/master
2016-09-02T05:48:59.672000
2015-03-24T16:17:51
2015-03-24T16:17:51
30,884,918
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Convertisseur; /** * <ul> * <li> <b>IDL Source</b> "Convertisseur.idl" * <li> <b>IDL Name</b> ::Convertisseur::Euro * <li> <b>Repository Id</b> IDL:Convertisseur/Euro:1.0 * </ul> * <b>IDL definition:</b> * <pre> * interface Euro { ... }; * </pre> */ public abstract class EuroPOA extends org.omg.PortableServer.Servant implements org.omg.CORBA.portable.InvokeHandler, Convertisseur.EuroOperations { public Convertisseur.Euro _this () { return Convertisseur.EuroHelper.narrow(super._this_object()); } public Convertisseur.Euro _this (org.omg.CORBA.ORB orb) { return Convertisseur.EuroHelper.narrow(super._this_object(orb)); } public java.lang.String[] _all_interfaces (final org.omg.PortableServer.POA poa, final byte[] objectId) { return __ids; } private static java.lang.String[] __ids = { "IDL:Convertisseur/Euro:1.0" }; private static java.util.Dictionary _methods = new java.util.Hashtable(); static { _methods.put("_get_taux", new int[] { 0, 0 }); _methods.put("_set_taux", new int[] { 0, 1 }); _methods.put("_get_devise", new int[] { 0, 2 }); _methods.put("_set_devise", new int[] { 0, 3 }); _methods.put("toEuro", new int[] { 0, 4 }); _methods.put("toDevise", new int[] { 0, 5 }); } public org.omg.CORBA.portable.OutputStream _invoke (java.lang.String opName, org.omg.CORBA.portable.InputStream _input, org.omg.CORBA.portable.ResponseHandler handler) { int[] method = (int[]) _methods.get(opName); if (method == null) { throw new org.omg.CORBA.BAD_OPERATION(); } switch (method[0]) { case 0: { return Convertisseur.EuroPOA._invoke(this, method[1], _input, handler); } } throw new org.omg.CORBA.BAD_OPERATION(2, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } public static org.omg.CORBA.portable.OutputStream _invoke (Convertisseur.EuroOperations _self, int _method_id, org.omg.CORBA.portable.InputStream _input, org.omg.CORBA.portable.ResponseHandler _handler) { org.omg.CORBA.portable.OutputStream _output = null; { switch (_method_id) { case 0: { double _result = _self.taux(); _output = _handler.createReply(); _output.write_double((double)_result); return _output; } case 1: { double arg0; arg0 = _input.read_double(); _self.taux(arg0); _output = _handler.createReply(); return _output; } case 2: { java.lang.String _result = _self.devise(); _output = _handler.createReply(); _output.write_string((java.lang.String)_result); return _output; } case 3: { java.lang.String arg0; arg0 = _input.read_string(); _self.devise(arg0); _output = _handler.createReply(); return _output; } case 4: { double devise; devise = _input.read_double(); double _result = _self.toEuro(devise); _output = _handler.createReply(); _output.write_double((double)_result); return _output; } case 5: { double euro; euro = _input.read_double(); double _result = _self.toDevise(euro); _output = _handler.createReply(); _output.write_double((double)_result); return _output; } } throw new org.omg.CORBA.BAD_OPERATION(2, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } } }
UTF-8
Java
3,748
java
EuroPOA.java
Java
[]
null
[]
package Convertisseur; /** * <ul> * <li> <b>IDL Source</b> "Convertisseur.idl" * <li> <b>IDL Name</b> ::Convertisseur::Euro * <li> <b>Repository Id</b> IDL:Convertisseur/Euro:1.0 * </ul> * <b>IDL definition:</b> * <pre> * interface Euro { ... }; * </pre> */ public abstract class EuroPOA extends org.omg.PortableServer.Servant implements org.omg.CORBA.portable.InvokeHandler, Convertisseur.EuroOperations { public Convertisseur.Euro _this () { return Convertisseur.EuroHelper.narrow(super._this_object()); } public Convertisseur.Euro _this (org.omg.CORBA.ORB orb) { return Convertisseur.EuroHelper.narrow(super._this_object(orb)); } public java.lang.String[] _all_interfaces (final org.omg.PortableServer.POA poa, final byte[] objectId) { return __ids; } private static java.lang.String[] __ids = { "IDL:Convertisseur/Euro:1.0" }; private static java.util.Dictionary _methods = new java.util.Hashtable(); static { _methods.put("_get_taux", new int[] { 0, 0 }); _methods.put("_set_taux", new int[] { 0, 1 }); _methods.put("_get_devise", new int[] { 0, 2 }); _methods.put("_set_devise", new int[] { 0, 3 }); _methods.put("toEuro", new int[] { 0, 4 }); _methods.put("toDevise", new int[] { 0, 5 }); } public org.omg.CORBA.portable.OutputStream _invoke (java.lang.String opName, org.omg.CORBA.portable.InputStream _input, org.omg.CORBA.portable.ResponseHandler handler) { int[] method = (int[]) _methods.get(opName); if (method == null) { throw new org.omg.CORBA.BAD_OPERATION(); } switch (method[0]) { case 0: { return Convertisseur.EuroPOA._invoke(this, method[1], _input, handler); } } throw new org.omg.CORBA.BAD_OPERATION(2, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } public static org.omg.CORBA.portable.OutputStream _invoke (Convertisseur.EuroOperations _self, int _method_id, org.omg.CORBA.portable.InputStream _input, org.omg.CORBA.portable.ResponseHandler _handler) { org.omg.CORBA.portable.OutputStream _output = null; { switch (_method_id) { case 0: { double _result = _self.taux(); _output = _handler.createReply(); _output.write_double((double)_result); return _output; } case 1: { double arg0; arg0 = _input.read_double(); _self.taux(arg0); _output = _handler.createReply(); return _output; } case 2: { java.lang.String _result = _self.devise(); _output = _handler.createReply(); _output.write_string((java.lang.String)_result); return _output; } case 3: { java.lang.String arg0; arg0 = _input.read_string(); _self.devise(arg0); _output = _handler.createReply(); return _output; } case 4: { double devise; devise = _input.read_double(); double _result = _self.toEuro(devise); _output = _handler.createReply(); _output.write_double((double)_result); return _output; } case 5: { double euro; euro = _input.read_double(); double _result = _self.toDevise(euro); _output = _handler.createReply(); _output.write_double((double)_result); return _output; } } throw new org.omg.CORBA.BAD_OPERATION(2, org.omg.CORBA.CompletionStatus.COMPLETED_NO); } } }
3,748
0.557898
0.549093
114
30.877193
28.498426
111
false
false
0
0
0
0
0
0
0.640351
false
false
12
21792c6e19f7da61bd2d4dec1e19ee68970ed169
9,380,208,639,650
9d5b9d57a6a119e0c9abec68516c9f458cb14aa6
/src/SP1/cs6301/g26/util/Timer.java
7a51e17b3318e1ab67c76c3e14a6000c16f091b3
[ "MIT" ]
permissive
sharath-c-n/ImplementationAdvDataStructures
https://github.com/sharath-c-n/ImplementationAdvDataStructures
bf7bc9648d450cc6724d6eb29ab2984e5ab8cb2a
9a00b177c0fd1d9733f569a331f0fb0e673947ba
refs/heads/master
2022-11-02T00:49:14.295000
2022-10-27T12:19:47
2022-10-27T12:19:47
101,363,547
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package cs6301.g26.util; /** * This class is used to calculate the time interval between start and stop call * @author Sharath */ public class Timer { private long startTime; private long endTime; private long memAvailable; private long memUsed; public void start() { clear(); startTime = System.nanoTime(); } public void stop() { endTime = System.nanoTime(); memAvailable = Runtime.getRuntime().totalMemory(); memUsed = memAvailable - Runtime.getRuntime().freeMemory(); } public long getTime() { if (startTime == 0) { return 0; } if (endTime == 0) { stop(); } return (endTime - startTime) / 1000000; } public void clear() { startTime = endTime = 0; } public long getMemAvailable() { return memAvailable; } public long getMemUsed() { return memUsed; } public String toString(){ return "Time: " + getTime() + " msec.\n" + "Memory: " + (memUsed/1048576) + " MB / " + (memAvailable/1048576) + " MB."; } }
UTF-8
Java
1,155
java
Timer.java
Java
[ { "context": "me interval between start and stop call\n * @author Sharath\n */\n\npublic class Timer {\n private long startT", "end": 129, "score": 0.9995735287666321, "start": 122, "tag": "NAME", "value": "Sharath" } ]
null
[]
package cs6301.g26.util; /** * This class is used to calculate the time interval between start and stop call * @author Sharath */ public class Timer { private long startTime; private long endTime; private long memAvailable; private long memUsed; public void start() { clear(); startTime = System.nanoTime(); } public void stop() { endTime = System.nanoTime(); memAvailable = Runtime.getRuntime().totalMemory(); memUsed = memAvailable - Runtime.getRuntime().freeMemory(); } public long getTime() { if (startTime == 0) { return 0; } if (endTime == 0) { stop(); } return (endTime - startTime) / 1000000; } public void clear() { startTime = endTime = 0; } public long getMemAvailable() { return memAvailable; } public long getMemUsed() { return memUsed; } public String toString(){ return "Time: " + getTime() + " msec.\n" + "Memory: " + (memUsed/1048576) + " MB / " + (memAvailable/1048576) + " MB."; } }
1,155
0.543723
0.516883
53
20.792454
19.227886
80
false
false
0
0
0
0
0
0
0.320755
false
false
12
5cd0d884b19a7f1708a68f43b4a04ed6c756427c
38,560,216,385,598
8181362d19d6eafafd4da349855834e49c80894c
/pmph-web-official/src/main/java/com/ai/ecp/busi/rwgw/controller/LinkController.java
325eb599162ef59e365da9082fbe555f90999a15
[]
no_license
lhllhl2/Lpmph
https://github.com/lhllhl2/Lpmph
05530a4d2d899668e0704de44ce7d96475912de6
d33e18d75a1dc6214b925618264eb5090c63ff46
refs/heads/master
2020-07-11T01:14:46.236000
2019-08-26T07:11:09
2019-08-26T07:11:09
204,416,295
1
1
null
false
2020-07-01T18:56:32
2019-08-26T07:03:37
2019-10-22T09:03:53
2020-07-01T18:56:32
33,883
1
1
1
JavaScript
false
false
package com.ai.ecp.busi.rwgw.controller; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Resource; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import com.ai.ecp.base.controller.EcpBaseController; import com.ai.ecp.cms.dubbo.dto.CmsLinkReqDTO; import com.ai.ecp.cms.dubbo.dto.CmsLinkRespDTO; import com.ai.ecp.cms.dubbo.interfaces.ICmsLinkRSV; import com.ai.ecp.cms.dubbo.util.CmsConstants; import com.ai.paas.utils.LogUtil; import com.ai.paas.utils.StringUtil; /**人卫官网-广告 * Project Name:ecp-web-manage <br> * Description: <br> * Date:2015年8月17日下午6:54:49 <br> * * @version * @since JDK 1.6 */ @Controller @RequestMapping(value = "/link") public class LinkController extends EcpBaseController { private static String MODULE = LinkController.class.getName(); @Resource(name = "cmsLinkRSV") private ICmsLinkRSV cmsLinkRSV; /** * qryLinkList:(查询广告列表). <br/> * TODO(这里描述这个方法适用条件 – 可选).<br/> * TODO(这里描述这个方法的执行流程 – 可选).<br/> * TODO(这里描述这个方法的使用方法 – 可选).<br/> * TODO(这里描述这个方法的注意事项 – 可选).<br/> * * @param model * @param placeId * @param linkType * @param status * @return * @throws Exception * @since JDK 1.6 */ @RequestMapping(value = "/querylink") @ResponseBody public Map<String,Object> qryLinkList(Model model,@RequestParam(value="siteId",required=true) String siteId){ LogUtil.info(MODULE, "==========model:" + ";"); Map<String,Object> resultMap = new HashMap<String,Object>(); List<CmsLinkRespDTO> respList = null; CmsLinkReqDTO reqDTO = new CmsLinkReqDTO(); try{//查询状态为有效的链接。 if(StringUtil.isNotEmpty(siteId) && !siteId.equalsIgnoreCase("undefined")) reqDTO.setSiteId(Long.valueOf(siteId)); reqDTO.setStatus(CmsConstants.ParamStatus.CMS_PARAMSTATUS_1); respList = cmsLinkRSV.queryCmsLinkList(reqDTO); // 1. 判断入参 }catch(Exception err){ LogUtil.error(MODULE, "查询友情链接出现异常:",err); } // 4. 返回结果 resultMap.put("respList", respList); return resultMap; } }
UTF-8
Java
2,635
java
LinkController.java
Java
[]
null
[]
package com.ai.ecp.busi.rwgw.controller; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Resource; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import com.ai.ecp.base.controller.EcpBaseController; import com.ai.ecp.cms.dubbo.dto.CmsLinkReqDTO; import com.ai.ecp.cms.dubbo.dto.CmsLinkRespDTO; import com.ai.ecp.cms.dubbo.interfaces.ICmsLinkRSV; import com.ai.ecp.cms.dubbo.util.CmsConstants; import com.ai.paas.utils.LogUtil; import com.ai.paas.utils.StringUtil; /**人卫官网-广告 * Project Name:ecp-web-manage <br> * Description: <br> * Date:2015年8月17日下午6:54:49 <br> * * @version * @since JDK 1.6 */ @Controller @RequestMapping(value = "/link") public class LinkController extends EcpBaseController { private static String MODULE = LinkController.class.getName(); @Resource(name = "cmsLinkRSV") private ICmsLinkRSV cmsLinkRSV; /** * qryLinkList:(查询广告列表). <br/> * TODO(这里描述这个方法适用条件 – 可选).<br/> * TODO(这里描述这个方法的执行流程 – 可选).<br/> * TODO(这里描述这个方法的使用方法 – 可选).<br/> * TODO(这里描述这个方法的注意事项 – 可选).<br/> * * @param model * @param placeId * @param linkType * @param status * @return * @throws Exception * @since JDK 1.6 */ @RequestMapping(value = "/querylink") @ResponseBody public Map<String,Object> qryLinkList(Model model,@RequestParam(value="siteId",required=true) String siteId){ LogUtil.info(MODULE, "==========model:" + ";"); Map<String,Object> resultMap = new HashMap<String,Object>(); List<CmsLinkRespDTO> respList = null; CmsLinkReqDTO reqDTO = new CmsLinkReqDTO(); try{//查询状态为有效的链接。 if(StringUtil.isNotEmpty(siteId) && !siteId.equalsIgnoreCase("undefined")) reqDTO.setSiteId(Long.valueOf(siteId)); reqDTO.setStatus(CmsConstants.ParamStatus.CMS_PARAMSTATUS_1); respList = cmsLinkRSV.queryCmsLinkList(reqDTO); // 1. 判断入参 }catch(Exception err){ LogUtil.error(MODULE, "查询友情链接出现异常:",err); } // 4. 返回结果 resultMap.put("respList", respList); return resultMap; } }
2,635
0.670252
0.662391
79
29.594936
22.648396
113
false
false
0
0
0
0
0
0
0.531646
false
false
12
fdbe65df127cdd9fcdfb0f7ef7a4c9d4338d7f73
38,766,374,821,661
32966277737e4547e636b6b60caf9baa0a89cfc0
/src/main/java/pl/edu/pw/bgtTracker/api/tables/ExpensesController.java
8c17b6c72daae52c69e4284e44d8de7b69fed645
[]
no_license
bgtTracker/bgtTracker
https://github.com/bgtTracker/bgtTracker
abc44eecdaeb4e825aa45acdac126ff2edfbed3b
b479aec96c74f0ab8173d5786f7a063a3b4f1584
refs/heads/main
2023-03-15T01:01:40.682000
2021-03-14T12:49:26
2021-03-14T13:10:00
311,171,832
0
1
null
false
2020-12-10T12:50:49
2020-11-08T23:00:49
2020-12-10T09:04:17
2020-12-10T12:50:48
671
0
1
0
JavaScript
false
false
package pl.edu.pw.bgtTracker.api.tables; //import org.json.JSONObject; import net.minidev.json.JSONObject; import org.springframework.http.MediaType; import org.springframework.security.core.Authentication; import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.RestController; import pl.edu.pw.bgtTracker.db.entities.AppUser; import pl.edu.pw.bgtTracker.db.repos.UserRepository; @RestController @CrossOrigin public class ExpensesController { private final ExpensesService expensesService; private final UserRepository userRepository; public ExpensesController(ExpensesService expensesService, UserRepository userRepository) { this.expensesService = expensesService; this.userRepository = userRepository; } @GetMapping(value ={"/api/getExpenses"},produces = MediaType.APPLICATION_JSON_VALUE) public JSONObject getExpenseData(Authentication auth){ long id = this.getUserId(auth); return expensesService.getExpenses(id); } @PostMapping("/api/newExpense") public long newExpenseData(Authentication auth, @RequestParam(value = "name") String name, @RequestParam(value="category_id") String category, @RequestParam(value="amount") String amount, @RequestParam String date ,@RequestParam String note) { long usrId = this.getUserId(auth); String newName = name; long newAmount = Long.parseLong(amount); long categoryId = Long.parseLong(category); String newDate = date; String newNote = note; long newId = expensesService.putExpense(usrId, newName, newAmount, categoryId, newDate, newNote); return newId; } @PostMapping("/api/updateExpense") public void updateExpenseData(Authentication auth, @RequestParam(value = "id") String id, @RequestParam(value="name") String name, @RequestParam(value = "category_id") String category, @RequestParam(value="amount") String amount, @RequestParam String date ,@RequestParam String note) { long expenseId = Long.parseLong(id); long usrId = this.getUserId(auth); String newName = name; long newAmount = Long.parseLong(amount); long newCatId = Long.parseLong(category); expensesService.updateExpense(expenseId, usrId, newName,newAmount, newCatId, date, note); } @PostMapping("/api/deleteExpense") public void deleteExpenseData(Authentication auth, @RequestParam(value = "id") String id) { /* Znajduje obiekt w bazie danych i usuwa go */ long expenseId = Long.parseLong(id); expensesService.deleteExpense(expenseId); } private long getUserId(Authentication auth) { AppUser u = userRepository.findByEmail(auth.getName()); return u.getId(); } }
UTF-8
Java
2,801
java
ExpensesController.java
Java
[]
null
[]
package pl.edu.pw.bgtTracker.api.tables; //import org.json.JSONObject; import net.minidev.json.JSONObject; import org.springframework.http.MediaType; import org.springframework.security.core.Authentication; import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.RestController; import pl.edu.pw.bgtTracker.db.entities.AppUser; import pl.edu.pw.bgtTracker.db.repos.UserRepository; @RestController @CrossOrigin public class ExpensesController { private final ExpensesService expensesService; private final UserRepository userRepository; public ExpensesController(ExpensesService expensesService, UserRepository userRepository) { this.expensesService = expensesService; this.userRepository = userRepository; } @GetMapping(value ={"/api/getExpenses"},produces = MediaType.APPLICATION_JSON_VALUE) public JSONObject getExpenseData(Authentication auth){ long id = this.getUserId(auth); return expensesService.getExpenses(id); } @PostMapping("/api/newExpense") public long newExpenseData(Authentication auth, @RequestParam(value = "name") String name, @RequestParam(value="category_id") String category, @RequestParam(value="amount") String amount, @RequestParam String date ,@RequestParam String note) { long usrId = this.getUserId(auth); String newName = name; long newAmount = Long.parseLong(amount); long categoryId = Long.parseLong(category); String newDate = date; String newNote = note; long newId = expensesService.putExpense(usrId, newName, newAmount, categoryId, newDate, newNote); return newId; } @PostMapping("/api/updateExpense") public void updateExpenseData(Authentication auth, @RequestParam(value = "id") String id, @RequestParam(value="name") String name, @RequestParam(value = "category_id") String category, @RequestParam(value="amount") String amount, @RequestParam String date ,@RequestParam String note) { long expenseId = Long.parseLong(id); long usrId = this.getUserId(auth); String newName = name; long newAmount = Long.parseLong(amount); long newCatId = Long.parseLong(category); expensesService.updateExpense(expenseId, usrId, newName,newAmount, newCatId, date, note); } @PostMapping("/api/deleteExpense") public void deleteExpenseData(Authentication auth, @RequestParam(value = "id") String id) { /* Znajduje obiekt w bazie danych i usuwa go */ long expenseId = Long.parseLong(id); expensesService.deleteExpense(expenseId); } private long getUserId(Authentication auth) { AppUser u = userRepository.findByEmail(auth.getName()); return u.getId(); } }
2,801
0.717958
0.717958
73
37.369862
47.028557
287
false
false
0
0
0
0
0
0
0.794521
false
false
12
93af492dda9c8641018de8a542ca3926ca6824eb
28,286,654,619,046
6ec9c0c9f3ba2b84f92efa0af5d793b870d347e3
/QCloudCosXml/cos-android/src/normal/java/com/tencent/cos/xml/model/ci/asr/DescribeSpeechBucketsRequest.java
c5286bce746eeb16a5f2c38a167924325697fd6e
[ "MIT" ]
permissive
tencentyun/qcloud-sdk-android
https://github.com/tencentyun/qcloud-sdk-android
8b5f95c5a1ff0d7d9c5a8622fa00d24e1e33cd5a
71991043df37712c6f13553f03874a78fe4a9a5b
refs/heads/master
2023-08-23T03:04:26.225000
2023-08-16T13:16:31
2023-08-16T13:16:31
102,087,298
28
8
MIT
false
2020-05-08T07:18:06
2017-09-01T07:41:29
2020-05-08T06:53:48
2020-05-08T07:16:33
29,656
27
9
1
Java
false
false
/* * Copyright (c) 2010-2020 Tencent Cloud. 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.tencent.cos.xml.model.ci.asr; import androidx.annotation.NonNull; import com.tencent.cos.xml.CosXmlServiceConfig; import com.tencent.cos.xml.common.RequestMethod; import com.tencent.cos.xml.listener.CosXmlResultListener; import com.tencent.cos.xml.model.CosXmlRequest; import com.tencent.cos.xml.model.ci.GetDescribeMediaBucketsRequest; import com.tencent.qcloud.core.http.RequestBodySerializer; /** * 查询已经开通语音识别功能的存储桶的请求. * @see com.tencent.cos.xml.CosXml#getDescribeMediaBuckets(GetDescribeMediaBucketsRequest) * @see com.tencent.cos.xml.CosXml#getDescribeMediaBucketsAsync(GetDescribeMediaBucketsRequest, CosXmlResultListener) */ final public class DescribeSpeechBucketsRequest extends CosXmlRequest { /** * 地域信息,以“,”分隔字符串,支持 All、ap-shanghai、ap-beijing * 详情请参见 地域与域名 * @param regions 地域信息 */ public void setRegions(@NonNull String regions) { queryParameters.put("regions", regions); } /** * 存储桶名称,以“,”分隔,支持多个存储桶,精确搜索 * @param bucketNames 存储桶名称 */ public void setBucketNames(@NonNull String bucketNames) { queryParameters.put("bucketNames", bucketNames); } /** * 存储桶名称前缀,前缀搜索 * @param bucketName 存储桶名称前缀 */ public void setBucketName(@NonNull String bucketName) { queryParameters.put("bucketName", bucketName); } /** * 第几页 * @param pageNumber 第几页 */ public void setPageNumber(int pageNumber) { queryParameters.put("pageNumber", String.valueOf(pageNumber)); } /** * 每页个数 * @param pageSize 每页个数 */ public void setPageSize(int pageSize) { queryParameters.put("pageSize", String.valueOf(pageSize)); } @Override public String getMethod() { return RequestMethod.GET; } @Override public String getPath(CosXmlServiceConfig config) { return "/asrbucket"; } @Override public RequestBodySerializer getRequestBody() { return null; } @Override public String getRequestHost(CosXmlServiceConfig config) { return String.format("ci.%s.myqcloud.com", config.getRegion()); } }
UTF-8
Java
3,537
java
DescribeSpeechBucketsRequest.java
Java
[]
null
[]
/* * Copyright (c) 2010-2020 Tencent Cloud. 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.tencent.cos.xml.model.ci.asr; import androidx.annotation.NonNull; import com.tencent.cos.xml.CosXmlServiceConfig; import com.tencent.cos.xml.common.RequestMethod; import com.tencent.cos.xml.listener.CosXmlResultListener; import com.tencent.cos.xml.model.CosXmlRequest; import com.tencent.cos.xml.model.ci.GetDescribeMediaBucketsRequest; import com.tencent.qcloud.core.http.RequestBodySerializer; /** * 查询已经开通语音识别功能的存储桶的请求. * @see com.tencent.cos.xml.CosXml#getDescribeMediaBuckets(GetDescribeMediaBucketsRequest) * @see com.tencent.cos.xml.CosXml#getDescribeMediaBucketsAsync(GetDescribeMediaBucketsRequest, CosXmlResultListener) */ final public class DescribeSpeechBucketsRequest extends CosXmlRequest { /** * 地域信息,以“,”分隔字符串,支持 All、ap-shanghai、ap-beijing * 详情请参见 地域与域名 * @param regions 地域信息 */ public void setRegions(@NonNull String regions) { queryParameters.put("regions", regions); } /** * 存储桶名称,以“,”分隔,支持多个存储桶,精确搜索 * @param bucketNames 存储桶名称 */ public void setBucketNames(@NonNull String bucketNames) { queryParameters.put("bucketNames", bucketNames); } /** * 存储桶名称前缀,前缀搜索 * @param bucketName 存储桶名称前缀 */ public void setBucketName(@NonNull String bucketName) { queryParameters.put("bucketName", bucketName); } /** * 第几页 * @param pageNumber 第几页 */ public void setPageNumber(int pageNumber) { queryParameters.put("pageNumber", String.valueOf(pageNumber)); } /** * 每页个数 * @param pageSize 每页个数 */ public void setPageSize(int pageSize) { queryParameters.put("pageSize", String.valueOf(pageSize)); } @Override public String getMethod() { return RequestMethod.GET; } @Override public String getPath(CosXmlServiceConfig config) { return "/asrbucket"; } @Override public RequestBodySerializer getRequestBody() { return null; } @Override public String getRequestHost(CosXmlServiceConfig config) { return String.format("ci.%s.myqcloud.com", config.getRegion()); } }
3,537
0.710057
0.707641
101
31.782179
29.911289
118
false
false
0
0
0
0
0
0
0.475248
false
false
12
88801a1f04e63d44a0095e88e62020887ba202d9
23,673,859,740,752
9c1ce7205f32523c13000557f73396b4e5a614bb
/src/com/dbc/leecode/Algorithm/Solution31_40/Solution39.java
dfb7fbdc407ca553f7e77fb0363900ff891ad56d
[]
no_license
DengBoCong/AlgorithmProject
https://github.com/DengBoCong/AlgorithmProject
5646d401ca4fbd275ca1472b6acaba3a40d8a328
c2eca8f45cbc8dca6501c1f2542c18520bd3a4e4
refs/heads/master
2020-09-22T11:33:36.088000
2020-05-27T12:54:28
2020-05-27T12:54:28
225,175,852
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dbc.leecode.Algorithm.Solution31_40; public class Solution39 { public static String countAndSay(int n) { String str = ""; String res = "1"; for(int i = 1; i < n; i++){ str = res; res = ""; for(int j = 0; j < str.length();){ int c = 0, k = j; while(k < str.length() && str.charAt(k) == str.charAt(j)){ k++; c++; } res = res + c + str.charAt(j); j = k; } } return res; } public String countAndSayS2(int n) { String str = "1"; for (int i = 2; i <= n; i++) { StringBuilder builder = new StringBuilder(); char pre = str.charAt(0); int count = 1; for (int j = 1; j < str.length(); j++) { char c = str.charAt(j); if (c == pre) { count++; } else { builder.append(count).append(pre); pre = c; count = 1; } } builder.append(count).append(pre); str = builder.toString(); } return str; } }
UTF-8
Java
1,277
java
Solution39.java
Java
[]
null
[]
package com.dbc.leecode.Algorithm.Solution31_40; public class Solution39 { public static String countAndSay(int n) { String str = ""; String res = "1"; for(int i = 1; i < n; i++){ str = res; res = ""; for(int j = 0; j < str.length();){ int c = 0, k = j; while(k < str.length() && str.charAt(k) == str.charAt(j)){ k++; c++; } res = res + c + str.charAt(j); j = k; } } return res; } public String countAndSayS2(int n) { String str = "1"; for (int i = 2; i <= n; i++) { StringBuilder builder = new StringBuilder(); char pre = str.charAt(0); int count = 1; for (int j = 1; j < str.length(); j++) { char c = str.charAt(j); if (c == pre) { count++; } else { builder.append(count).append(pre); pre = c; count = 1; } } builder.append(count).append(pre); str = builder.toString(); } return str; } }
1,277
0.372749
0.359436
45
27.377777
16.560043
74
false
false
0
0
0
0
0
0
0.711111
false
false
12
723245e7346539db73cd7c1bb257ca8045853842
30,133,490,565,889
489bcaeb67b2858cf7d939fc297f7d1ea9399daa
/TDDIntelliJIDEA/src/test/java/org/codingdojo/kata/CalculatorTest.java
1819d2963329c570fe639a2f5214e0112f6d1791
[ "MIT" ]
permissive
escray/TDDTrainingCamp
https://github.com/escray/TDDTrainingCamp
0639e9e48fa601b1032950a5db52a67e0a1f381a
f0bf764b7e1a77b7cb40703059101d34d5f48b98
refs/heads/master
2020-07-14T17:24:52.970000
2019-12-29T03:58:52
2019-12-29T03:58:52
205,362,431
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.codingdojo.kata; import org.junit.Assert; import org.junit.Test; import static org.hamcrest.CoreMatchers.is; public class CalculatorTest { @Test public void should_add_two_numbers() { Calculator cal = new Calculator(); int result = cal.add(1, 2); Assert.assertThat(result, is(3)); } }
UTF-8
Java
336
java
CalculatorTest.java
Java
[]
null
[]
package org.codingdojo.kata; import org.junit.Assert; import org.junit.Test; import static org.hamcrest.CoreMatchers.is; public class CalculatorTest { @Test public void should_add_two_numbers() { Calculator cal = new Calculator(); int result = cal.add(1, 2); Assert.assertThat(result, is(3)); } }
336
0.669643
0.660714
15
21.4
16.744352
43
false
false
0
0
0
0
0
0
0.6
false
false
12
0b34ec94b4a5333f1a664c17f7161b94704f1070
15,994,458,229,153
f03ba877aff91ecd86294a5688fa8cd94fb148b0
/aula-5/src/main/java/org/acelera/brasil/PersonRepository.java
b2383dde4c1989e143b713e5365eb1bf4177972a
[ "Apache-2.0" ]
permissive
diegoesilveira/acelera-dev-brasil-2019-01
https://github.com/diegoesilveira/acelera-dev-brasil-2019-01
829dbead0b027239c764399f5ad416f932ac6eee
13d60af7be211cc21ca9b0930d380e4043d14a96
refs/heads/master
2020-05-18T13:05:21.767000
2019-04-05T01:03:57
2019-04-05T01:03:57
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.acelera.brasil; import org.springframework.data.mongodb.repository.MongoRepository; public interface PersonRepository extends MongoRepository<Person, String> { Person findByNome(String nome); }
UTF-8
Java
212
java
PersonRepository.java
Java
[]
null
[]
package org.acelera.brasil; import org.springframework.data.mongodb.repository.MongoRepository; public interface PersonRepository extends MongoRepository<Person, String> { Person findByNome(String nome); }
212
0.820755
0.820755
7
29.285715
29.436199
75
false
false
0
0
0
0
0
0
0.571429
false
false
12
f0efd5ff40592c79718e3bd37f91ba1f346fb550
1,769,526,572,406
4b6e663af2fc0af48cd2e05a8a4f356cf4c16cbe
/tetragon-util/src/main/java/com/yarachkin/tetragon/tetragonutil/common/IdGenerator.java
c13a053ccd1a0220448e1e3ff958db0bbcc4c982
[]
no_license
IvanYarochkin/tetragon
https://github.com/IvanYarochkin/tetragon
9a128232c199934f3e760bfb71f0cbba0ee27c1d
7ae315a028fa06c0bb359ab6451e64f5f7cdeaee
refs/heads/master
2021-08-16T19:38:10.034000
2017-10-15T16:44:50
2017-10-15T16:44:50
106,036,622
0
0
null
false
2017-10-15T07:37:40
2017-10-06T18:19:38
2017-10-08T17:11:20
2017-10-15T07:37:40
116
0
0
0
Java
null
null
package com.yarachkin.tetragon.tetragonutil.common; public final class IdGenerator { private static long tetragonId = 0; private static long pointId = 0; private static boolean isTest = false; private IdGenerator() { } public static void setIsTest(boolean isTest) { IdGenerator.isTest = isTest; } public static long generateTetragonId() { return isTest ? 1L : ++tetragonId; } public static long generatePointId() { return isTest ? 1L : ++pointId; } }
UTF-8
Java
526
java
IdGenerator.java
Java
[]
null
[]
package com.yarachkin.tetragon.tetragonutil.common; public final class IdGenerator { private static long tetragonId = 0; private static long pointId = 0; private static boolean isTest = false; private IdGenerator() { } public static void setIsTest(boolean isTest) { IdGenerator.isTest = isTest; } public static long generateTetragonId() { return isTest ? 1L : ++tetragonId; } public static long generatePointId() { return isTest ? 1L : ++pointId; } }
526
0.655894
0.648289
24
20.916666
19.796709
51
false
false
0
0
0
0
0
0
0.291667
false
false
12
a6385d58adedc7656d8e1543b0618a0c278fee77
1,769,526,571,067
af58eabf5360cb82082e1b0590696b627118d5a3
/yunfu-db/src/main/java/com/zhongmei/yunfu/orm/IDBHelperFunc.java
362f4b2370a0a6abb80ec1c3c38dc0d21ae51d1d
[]
no_license
sengeiou/marketing-app
https://github.com/sengeiou/marketing-app
f4b670f3996ba190decd2f1b8e4a276eb53b8b2a
278f3da95584e2ab7d97dff1a067db848e70a9f3
refs/heads/master
2020-06-07T01:51:25.743000
2019-06-20T08:58:28
2019-06-20T08:58:28
192,895,799
0
1
null
true
2019-06-20T09:59:09
2019-06-20T09:59:08
2019-06-20T08:59:14
2019-06-20T08:59:12
43,023
0
0
0
null
false
false
package com.zhongmei.yunfu.orm; /** * Created by demo on 2018/12/15 */ public interface IDBHelperFunc { boolean contains(Class cls); DatabaseHelper getHelper(); void releaseHelper(DatabaseHelper helper); }
UTF-8
Java
224
java
IDBHelperFunc.java
Java
[ { "context": "package com.zhongmei.yunfu.orm;\n\n/**\n * Created by demo on 2018/12/15\n */\n\npublic interface IDBHelperFunc", "end": 55, "score": 0.996762752532959, "start": 51, "tag": "USERNAME", "value": "demo" } ]
null
[]
package com.zhongmei.yunfu.orm; /** * Created by demo on 2018/12/15 */ public interface IDBHelperFunc { boolean contains(Class cls); DatabaseHelper getHelper(); void releaseHelper(DatabaseHelper helper); }
224
0.714286
0.678571
13
16.23077
16.880365
46
false
false
0
0
0
0
0
0
0.307692
false
false
12
1847a97906eb79a0b043ad994c8db1a8836376ac
23,441,931,572,690
ce817a72c51034f3f79c572a5adcd8e746c4a6d2
/src/string/PatternMatching.java
14521b18f0fc561755744a20a8742f472561637a
[]
no_license
shreyansh791/JavaInterviewQuestions
https://github.com/shreyansh791/JavaInterviewQuestions
197587b764836030d91786cd1cfb9be382ebfa60
a28092ad66f1fe11ec7cb30b030e5b6cdb476de7
refs/heads/master
2023-04-29T19:13:24.247000
2018-01-06T18:36:45
2018-01-06T18:36:45
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package string; public class PatternMatching { public static void main(String[] args) { String s = "naveenreddynaveenreddygjhghjvhhghgvghvhgvred"; int count = 0; String tocheck = "red"; int v=s.indexOf(tocheck); while (v != -1) { count++; v = s.indexOf(tocheck, v+1); } System.out.println(count); } }
UTF-8
Java
334
java
PatternMatching.java
Java
[]
null
[]
package string; public class PatternMatching { public static void main(String[] args) { String s = "naveenreddynaveenreddygjhghjvhhghgvghvhgvred"; int count = 0; String tocheck = "red"; int v=s.indexOf(tocheck); while (v != -1) { count++; v = s.indexOf(tocheck, v+1); } System.out.println(count); } }
334
0.643713
0.634731
19
16.578947
16.297613
60
false
false
0
0
0
0
0
0
1.947368
false
false
12
79a17372372146b0ba2d56f072622c5cb2513837
11,828,339,968,963
aca834898388d39b5bfc61c0e7e6f437ab0ce62e
/app/src/main/java/com/faqih/md/locate/MainActivity.java
3caa9b15ac7f22825a8e5e90535df5c4066766d4
[]
no_license
faqih-md/Locate
https://github.com/faqih-md/Locate
a43f3d6c5cef7c09c982e957f4ef5bc1bc1c7ebc
092b07d5c89d4d644a9d9b8cf9e8c5d87d0b6eb6
refs/heads/master
2019-04-03T07:36:10.238000
2016-09-08T16:34:21
2016-09-08T16:34:21
67,388,624
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.faqih.md.locate; import android.content.Intent; import android.content.res.Configuration; import android.os.Bundle; import android.support.design.widget.NavigationView; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.MenuItem; import com.faqih.md.locate.fragments.HomeFragment; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { private NavigationView navigationView; private DrawerLayout drawerLayout; private ActionBarDrawerToggle actionBarDrawerToggle; Toolbar toolbar; private TabLayout tabLayout; private ViewPager viewPager; private int[] tabIcons = { R.drawable.ic_home, R.drawable.ic_group, R.drawable.ic_chat }; private String userId; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); userId = getIntent().getExtras().getString(getString(R.string.userId)); toolbar = (Toolbar) findViewById(R.id.toolbar); setupToolbar(); viewPager = (ViewPager) findViewById(R.id.viewpager); setupViewPager(viewPager); tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(viewPager); setupTabIcons(); navigationView = (NavigationView) findViewById(R.id.navigation); drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout); setupDrawerContent(navigationView); actionBarDrawerToggle = setupDrawerToggle(); drawerLayout.addDrawerListener(actionBarDrawerToggle); selectDrawerItem(navigationView.getMenu().getItem(0)); } private void setupDrawerContent(final NavigationView navigationView) { navigationView.setNavigationItemSelectedListener( new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem menuItem) { selectDrawerItem(menuItem); return true; } }); } private ActionBarDrawerToggle setupDrawerToggle() { return new ActionBarDrawerToggle(this, drawerLayout, getToolbar(), R.string.drawer_open, R.string.drawer_close); } public void selectDrawerItem(MenuItem menuItem) { switch (menuItem.getItemId()) { case R.id.menu_home: break; case R.id.menu_member: break; case R.id.menu_maps: break; case R.id.menu_exit: exit(); break; default: break; } menuItem.setChecked(true); getToolbar().setTitle(menuItem.getTitle()); drawerLayout.closeDrawers(); } private void exit(){ startActivity(new Intent(this, SignInActivity.class)); overridePendingTransition(R.anim.activity_animation_back_left_in, R.anim.activity_animation_back_rigt_out); this.finish(); } @Override public void onBackPressed() { } @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); actionBarDrawerToggle.syncState(); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); actionBarDrawerToggle.onConfigurationChanged(newConfig); } @Override public boolean onOptionsItemSelected(MenuItem item) { return actionBarDrawerToggle.onOptionsItemSelected(item) || super.onOptionsItemSelected(item); } protected void setupToolbar() { if (toolbar != null) { setSupportActionBar(toolbar); if(getSupportActionBar()!=null){ getSupportActionBar().setDisplayShowHomeEnabled(true); } } } public Toolbar getToolbar() { return toolbar; } private void setupTabIcons() { tabLayout.getTabAt(0).setIcon(tabIcons[0]); tabLayout.getTabAt(1).setIcon(tabIcons[1]); tabLayout.getTabAt(2).setIcon(tabIcons[2]); } private void setupViewPager(ViewPager viewPager) { ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager()); adapter.addFragment(new HomeFragment().newInstance(this, userId)); adapter.addFragment(new HomeFragment().newInstance(this, userId)); adapter.addFragment(new HomeFragment().newInstance(this, userId)); viewPager.setAdapter(adapter); } class ViewPagerAdapter extends FragmentPagerAdapter { private final List<Fragment> mFragmentList = new ArrayList<>(); public ViewPagerAdapter(FragmentManager manager) { super(manager); } @Override public Fragment getItem(int position) { return mFragmentList.get(position); } @Override public int getCount() { return mFragmentList.size(); } public void addFragment(Fragment fragment) { mFragmentList.add(fragment); } @Override public CharSequence getPageTitle(int position) { return null; } } }
UTF-8
Java
5,740
java
MainActivity.java
Java
[]
null
[]
package com.faqih.md.locate; import android.content.Intent; import android.content.res.Configuration; import android.os.Bundle; import android.support.design.widget.NavigationView; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.MenuItem; import com.faqih.md.locate.fragments.HomeFragment; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { private NavigationView navigationView; private DrawerLayout drawerLayout; private ActionBarDrawerToggle actionBarDrawerToggle; Toolbar toolbar; private TabLayout tabLayout; private ViewPager viewPager; private int[] tabIcons = { R.drawable.ic_home, R.drawable.ic_group, R.drawable.ic_chat }; private String userId; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); userId = getIntent().getExtras().getString(getString(R.string.userId)); toolbar = (Toolbar) findViewById(R.id.toolbar); setupToolbar(); viewPager = (ViewPager) findViewById(R.id.viewpager); setupViewPager(viewPager); tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(viewPager); setupTabIcons(); navigationView = (NavigationView) findViewById(R.id.navigation); drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout); setupDrawerContent(navigationView); actionBarDrawerToggle = setupDrawerToggle(); drawerLayout.addDrawerListener(actionBarDrawerToggle); selectDrawerItem(navigationView.getMenu().getItem(0)); } private void setupDrawerContent(final NavigationView navigationView) { navigationView.setNavigationItemSelectedListener( new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem menuItem) { selectDrawerItem(menuItem); return true; } }); } private ActionBarDrawerToggle setupDrawerToggle() { return new ActionBarDrawerToggle(this, drawerLayout, getToolbar(), R.string.drawer_open, R.string.drawer_close); } public void selectDrawerItem(MenuItem menuItem) { switch (menuItem.getItemId()) { case R.id.menu_home: break; case R.id.menu_member: break; case R.id.menu_maps: break; case R.id.menu_exit: exit(); break; default: break; } menuItem.setChecked(true); getToolbar().setTitle(menuItem.getTitle()); drawerLayout.closeDrawers(); } private void exit(){ startActivity(new Intent(this, SignInActivity.class)); overridePendingTransition(R.anim.activity_animation_back_left_in, R.anim.activity_animation_back_rigt_out); this.finish(); } @Override public void onBackPressed() { } @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); actionBarDrawerToggle.syncState(); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); actionBarDrawerToggle.onConfigurationChanged(newConfig); } @Override public boolean onOptionsItemSelected(MenuItem item) { return actionBarDrawerToggle.onOptionsItemSelected(item) || super.onOptionsItemSelected(item); } protected void setupToolbar() { if (toolbar != null) { setSupportActionBar(toolbar); if(getSupportActionBar()!=null){ getSupportActionBar().setDisplayShowHomeEnabled(true); } } } public Toolbar getToolbar() { return toolbar; } private void setupTabIcons() { tabLayout.getTabAt(0).setIcon(tabIcons[0]); tabLayout.getTabAt(1).setIcon(tabIcons[1]); tabLayout.getTabAt(2).setIcon(tabIcons[2]); } private void setupViewPager(ViewPager viewPager) { ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager()); adapter.addFragment(new HomeFragment().newInstance(this, userId)); adapter.addFragment(new HomeFragment().newInstance(this, userId)); adapter.addFragment(new HomeFragment().newInstance(this, userId)); viewPager.setAdapter(adapter); } class ViewPagerAdapter extends FragmentPagerAdapter { private final List<Fragment> mFragmentList = new ArrayList<>(); public ViewPagerAdapter(FragmentManager manager) { super(manager); } @Override public Fragment getItem(int position) { return mFragmentList.get(position); } @Override public int getCount() { return mFragmentList.size(); } public void addFragment(Fragment fragment) { mFragmentList.add(fragment); } @Override public CharSequence getPageTitle(int position) { return null; } } }
5,740
0.659582
0.656969
185
30.032433
25.514788
121
false
false
0
0
0
0
0
0
0.502703
false
false
12
8d1e7ac93d69f6c1be1bd12886f2244c90b37f4f
4,655,744,552,310
1a7afbc02149ab93b146590d9495faaa68001f2d
/updatedemolib/src/main/java/com/jason/framework/updatedemolib/impl/ForcedUpdateStrategy.java
f2c092e1bc94a82526183cea6a78507deba80c26
[]
no_license
JasonLeeZJU/UpdateDemo
https://github.com/JasonLeeZJU/UpdateDemo
18c05b7665749e52953b1ae0be507ea0928a2a6c
1987960c66c9170b526d6abc9c42c459d0ebaa0b
refs/heads/master
2020-03-21T21:55:17.122000
2018-07-03T01:53:24
2018-07-03T01:53:24
139,093,447
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (c) 2018. * JasonLee * OpenAccess All rights reserved. */ package com.jason.framework.updatedemolib.impl; import com.jason.framework.updatedemolib.base.UpdateStrategy; import com.jason.framework.updatedemolib.model.Update; import com.jason.framework.updatedemolib.base.UpdateStrategy; import com.jason.framework.updatedemolib.model.Update; /** * 当为强制更新时,将会强制使用此更新策略。 * * <p>此更新策略的表现为:<br> * 当下载完成后。强制显示下载完成后的界面通知,其他的通知策略默认不变。 * * @author JasonLee on 2018/9/25. */ public class ForcedUpdateStrategy implements UpdateStrategy { private UpdateStrategy delegate; public ForcedUpdateStrategy(UpdateStrategy delegate) { this.delegate = delegate; } @Override public boolean isShowUpdateDialog(Update update) { return delegate.isShowUpdateDialog(update); } @Override public boolean isAutoInstall() { return false; } @Override public boolean isShowDownloadDialog() { return delegate.isShowDownloadDialog(); } }
UTF-8
Java
1,148
java
ForcedUpdateStrategy.java
Java
[ { "context": "/*\n * Copyright (c) 2018.\n * JasonLee\n * OpenAccess All rights reserved.\n */\npackage co", "end": 37, "score": 0.8245479464530945, "start": 29, "tag": "NAME", "value": "JasonLee" }, { "context": " 当下载完成后。强制显示下载完成后的界面通知,其他的通知策略默认不变。\n *\n * @author JasonLee on 2018/9/25.\n */\npublic class ForcedUpdateStrate", "end": 478, "score": 0.8137202858924866, "start": 470, "tag": "NAME", "value": "JasonLee" } ]
null
[]
/* * Copyright (c) 2018. * JasonLee * OpenAccess All rights reserved. */ package com.jason.framework.updatedemolib.impl; import com.jason.framework.updatedemolib.base.UpdateStrategy; import com.jason.framework.updatedemolib.model.Update; import com.jason.framework.updatedemolib.base.UpdateStrategy; import com.jason.framework.updatedemolib.model.Update; /** * 当为强制更新时,将会强制使用此更新策略。 * * <p>此更新策略的表现为:<br> * 当下载完成后。强制显示下载完成后的界面通知,其他的通知策略默认不变。 * * @author JasonLee on 2018/9/25. */ public class ForcedUpdateStrategy implements UpdateStrategy { private UpdateStrategy delegate; public ForcedUpdateStrategy(UpdateStrategy delegate) { this.delegate = delegate; } @Override public boolean isShowUpdateDialog(Update update) { return delegate.isShowUpdateDialog(update); } @Override public boolean isAutoInstall() { return false; } @Override public boolean isShowDownloadDialog() { return delegate.isShowDownloadDialog(); } }
1,148
0.722549
0.711765
44
22.181818
21.701773
61
false
false
0
0
0
0
0
0
0.227273
false
false
12
43f529ffb69c9b47cbcbf0aca9a7d5fa8488fa05
27,436,251,103,729
6ec3c368fc1d6739ec252db4bf24017131386ef3
/src/main/java/com/ondrejkoula/dto/error/ParentNotFoundErrorDetailDto.java
63966deec0808a2528e84de32c395714663b118f
[]
no_license
koulaond/Workoutz
https://github.com/koulaond/Workoutz
77bae14e75d9f9e05bc1e7eb0e9cb85cc19b9ade
796aa433e5f6b0bb8d8c16b5bd4dd304f3b10e8f
refs/heads/master
2022-09-27T20:09:05.244000
2022-09-14T21:09:40
2022-09-14T21:09:40
235,193,775
0
0
null
false
2021-11-28T19:28:41
2020-01-20T20:33:13
2021-11-28T19:28:10
2021-11-28T19:28:07
48
0
0
0
Java
false
false
package com.ondrejkoula.dto.error; import lombok.Builder; import lombok.Getter; @Getter public class ParentNotFoundErrorDetailDto extends ErrorDetailDto { private final Long id; private final String type; @Builder public ParentNotFoundErrorDetailDto(String errorMessage, String messageCode, Long id, String type) { super(errorMessage, messageCode); this.id = id; this.type = type; } }
UTF-8
Java
434
java
ParentNotFoundErrorDetailDto.java
Java
[]
null
[]
package com.ondrejkoula.dto.error; import lombok.Builder; import lombok.Getter; @Getter public class ParentNotFoundErrorDetailDto extends ErrorDetailDto { private final Long id; private final String type; @Builder public ParentNotFoundErrorDetailDto(String errorMessage, String messageCode, Long id, String type) { super(errorMessage, messageCode); this.id = id; this.type = type; } }
434
0.718894
0.718894
19
21.842106
25.884893
104
false
false
0
0
0
0
0
0
0.631579
false
false
12
3787adb68c02290bc2b8fd45eb25096fd26c9367
32,057,635,931,251
eeb9a8f1e57e43bea2cec30a449b273921e705d8
/src/ArrayList/exercise.java
987ab9872a0be3ecd1f3e5c748b6498998fa6625
[]
no_license
hakimliver/practice
https://github.com/hakimliver/practice
6457a09d3d409464648605056e394b04432dd3d0
53fddb15a6d1d3f640fb72393bc8b659f32add12
refs/heads/main
2023-04-17T09:09:10.108000
2021-04-29T21:51:47
2021-04-29T21:51:47
362,954,629
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ArrayList; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Scanner; public class exercise { public static void main(String[] args) { // create a list of unique elements taken from the user // then sort and print these elements //exp: user enters 1 8 9 2 6 6 1 3 5 5 // but you print only 1 2 3 5 6 8 9 ArrayList<Integer>numbers =new ArrayList<>(); System.out.println("enter 5 numbers "); Scanner input =new Scanner(System.in); for (int i=0;i<5;i++) { int temp = input.nextInt(); if (!numbers.contains(temp)) numbers.add(temp); } Collections.sort(numbers); System.out.println(numbers); } }
UTF-8
Java
795
java
exercise.java
Java
[]
null
[]
package ArrayList; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Scanner; public class exercise { public static void main(String[] args) { // create a list of unique elements taken from the user // then sort and print these elements //exp: user enters 1 8 9 2 6 6 1 3 5 5 // but you print only 1 2 3 5 6 8 9 ArrayList<Integer>numbers =new ArrayList<>(); System.out.println("enter 5 numbers "); Scanner input =new Scanner(System.in); for (int i=0;i<5;i++) { int temp = input.nextInt(); if (!numbers.contains(temp)) numbers.add(temp); } Collections.sort(numbers); System.out.println(numbers); } }
795
0.602516
0.577358
29
26.413794
18.960062
63
false
false
0
0
0
0
0
0
0.482759
false
false
12
d02b2f5b5ea6ddb4fbf4fc330722fedad3982c4f
3,719,441,715,111
458128fb19b3eb12973c885a8a12cb3f14e01f38
/spring-cloud-gcp-samples/spring-cloud-gcp-data-datastore-sample/src/main/java/com/example/TransactionalRepositoryService.java
314d39fca2b2312d05edb7d6d2515c3cec0f4105
[ "Apache-2.0" ]
permissive
GoogleCloudPlatform/spring-cloud-gcp
https://github.com/GoogleCloudPlatform/spring-cloud-gcp
612f913408ec83fce4eb0110f3c6da07b90725a5
c92260f1b583575436a61ec8f6fb2252737cd43f
refs/heads/main
2023-08-18T18:42:31.426000
2023-08-15T17:31:31
2023-08-15T17:31:31
257,984,305
342
275
Apache-2.0
false
2023-09-14T18:22:34
2020-04-22T18:19:22
2023-09-14T13:38:18
2023-09-14T18:22:33
32,109
337
264
129
Java
false
false
/* * Copyright 2017-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example; import java.util.List; import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; /** A transactional service that provides methods run as transactions. */ public class TransactionalRepositoryService { @Autowired private SingerRepository singerRepository; @Transactional public void createAndSaveSingerRelationshipsInTransaction( Singer singer, Band firstBand, List<Band> bands, Set<Instrument> instruments) { singer.setFirstBand(firstBand); singer.setBands(bands); singer.setPersonalInstruments(instruments); this.singerRepository.save(singer); System.out.println( "Relationship links were saved between a singer, bands, and instruments" + " in a single transaction: " + singer); } }
UTF-8
Java
1,493
java
TransactionalRepositoryService.java
Java
[]
null
[]
/* * Copyright 2017-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example; import java.util.List; import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; /** A transactional service that provides methods run as transactions. */ public class TransactionalRepositoryService { @Autowired private SingerRepository singerRepository; @Transactional public void createAndSaveSingerRelationshipsInTransaction( Singer singer, Band firstBand, List<Band> bands, Set<Instrument> instruments) { singer.setFirstBand(firstBand); singer.setBands(bands); singer.setPersonalInstruments(instruments); this.singerRepository.save(singer); System.out.println( "Relationship links were saved between a singer, bands, and instruments" + " in a single transaction: " + singer); } }
1,493
0.748158
0.740121
44
32.93182
28.270927
85
false
false
0
0
0
0
0
0
0.477273
false
false
12
bd114b0f0abb336721334f5fa2cbd0b138465c41
24,927,990,222,425
6c65b892e2f931ff0c67d2932b0bd4f3368baaad
/app/src/main/java/com/mao/cn/learnDevelopProject/utils/tools/PathU.java
51f0f7adc95ec1d16953fadbc233c155d6e1b876
[]
no_license
maoai-xianyu/LearnDevelopProject
https://github.com/maoai-xianyu/LearnDevelopProject
e262bac7e2db7c8d0de7c977ad96bed5870277e6
5efafab1df566a92792304811e67f7a1e4ed87d1
refs/heads/master
2021-07-21T16:12:47.862000
2020-10-24T03:41:34
2020-10-24T03:41:34
137,330,396
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mao.cn.learnDevelopProject.utils.tools; import com.mao.cn.learnDevelopProject.LearnDevelopApplication; import java.io.File; public class PathU { private static PathU instance = null; private File assetsFile; private File testVideoPath; private File files; private File blurPath; private static String filePath; private File resourcePath; public File getTestVideoPath() { return testVideoPath; } public void setTestVideoPath(File testVideoPath) { this.testVideoPath = testVideoPath; } public static String getFilePath() { return filePath; } public static void setFilePath(String filePath) { PathU.filePath = filePath; } public File getFiles() { return files; } public String getFilesPath() { return files.getPath(); } public File getBlurPath() { return blurPath; } public File getResourceFile() { return resourcePath; } public String getResourcePath() { return resourcePath.getPath(); } private PathU() { } public static PathU getInstance() { if (instance == null) { instance = new PathU(); } return instance; } public void initDirs() { files = PathUtils.getInstance().generatePath("", "files", LearnDevelopApplication.context()); blurPath = PathUtils.getInstance().generatePath("", "blur", LearnDevelopApplication.context()); resourcePath = PathUtils.getInstance().generatePath("", "resource", LearnDevelopApplication.context()); assetsFile = PathUtils.getInstance().generatePath("", "files/files", LearnDevelopApplication.context()); } public File getAssetsFile() { return assetsFile; } public static String filePath() { if (StringU.isEmpty(filePath)) { filePath = PathU.getInstance().getAssetsFile().getPath(); } return filePath; } }
UTF-8
Java
1,994
java
PathU.java
Java
[]
null
[]
package com.mao.cn.learnDevelopProject.utils.tools; import com.mao.cn.learnDevelopProject.LearnDevelopApplication; import java.io.File; public class PathU { private static PathU instance = null; private File assetsFile; private File testVideoPath; private File files; private File blurPath; private static String filePath; private File resourcePath; public File getTestVideoPath() { return testVideoPath; } public void setTestVideoPath(File testVideoPath) { this.testVideoPath = testVideoPath; } public static String getFilePath() { return filePath; } public static void setFilePath(String filePath) { PathU.filePath = filePath; } public File getFiles() { return files; } public String getFilesPath() { return files.getPath(); } public File getBlurPath() { return blurPath; } public File getResourceFile() { return resourcePath; } public String getResourcePath() { return resourcePath.getPath(); } private PathU() { } public static PathU getInstance() { if (instance == null) { instance = new PathU(); } return instance; } public void initDirs() { files = PathUtils.getInstance().generatePath("", "files", LearnDevelopApplication.context()); blurPath = PathUtils.getInstance().generatePath("", "blur", LearnDevelopApplication.context()); resourcePath = PathUtils.getInstance().generatePath("", "resource", LearnDevelopApplication.context()); assetsFile = PathUtils.getInstance().generatePath("", "files/files", LearnDevelopApplication.context()); } public File getAssetsFile() { return assetsFile; } public static String filePath() { if (StringU.isEmpty(filePath)) { filePath = PathU.getInstance().getAssetsFile().getPath(); } return filePath; } }
1,994
0.639418
0.639418
84
22.738094
25.607439
112
false
false
0
0
0
0
0
0
0.428571
false
false
12
632301685638df3cb4b10e3845e491635ffbf97d
10,943,576,719,563
9df4a20bffb3d1fd0f31dc5d2b4b1f6ca6456cc5
/src/main/java/Main.java
613c249fb23317793366a67d2f1036067e5a8cfe
[]
no_license
tebscito/Arrays
https://github.com/tebscito/Arrays
feae03d44227e2dfcf7f795277fdbea923925f12
c19a4aa2e5d22867e6643367deef7b4d112043eb
refs/heads/master
2021-07-09T14:53:59.128000
2017-10-09T03:04:46
2017-10-09T03:04:46
106,230,350
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.HashMap; import java.util.Map; import java.util.TreeMap; public class Main { public static void main(String[] args) { String param1[] = {"Argentina","Brazil", "Peru", "Venezuela"}; String param2[] = {"Argentina","Brazil", "Peru", "Venezuela"}; System.out.println(diffs(param1, param2)); } /* Metodo que recibe dos arrays de tipo String. Si todos los elementos son iguales, retorna un map con los elementos ordenados alfabeticamente De lo contrario, si hay elementos diferentes, retorna un map con estos elementos diferentes. */ public static Map diffs (String[] list1, String[] list2) { int same = 0; for (int i = 0; i <= list1.length-1; i++) { for(int j = 0; j <= list2.length-1; j++) { if (list1[i].equals(list2[j])){ same++; break; } } } boolean differentFound = false; String [] equ=new String[same]; String [] diff=new String[list1.length]; int p=0; for (int i = 0; i <= list1.length-1; i++) { boolean foundElement = false; for(int j = 0; j <= list2.length-1; j++) { if (list1[i].equals(list2[j])) { equ[p]= list1[i]+""; p++; foundElement = true; } } if(foundElement == false){ differentFound = true; diff[i]=list1[i]; } } if(differentFound == false){ System.out.println("Los elementos son iguales --> Devolver hasmap ordenado"); Map<String, Integer> mapEquals = new HashMap<String, Integer>(); for (int i = 0; i < list1.length; i++) { mapEquals.put(list1[i], list1[i].length()); } Map mapOrdenado = new TreeMap(mapEquals); return mapOrdenado; }else{ System.out.println("Los elementos son diferentes --> Devolver elementos diferentes"); Map<String, Integer> mapDifferents = new HashMap<String, Integer>(); for (int i = 0; i < diff.length; i++) { if(diff[i]!=null){ mapDifferents.put(diff[i], diff[i].length()); } } return mapDifferents; } } }
UTF-8
Java
2,403
java
Main.java
Java
[]
null
[]
import java.util.HashMap; import java.util.Map; import java.util.TreeMap; public class Main { public static void main(String[] args) { String param1[] = {"Argentina","Brazil", "Peru", "Venezuela"}; String param2[] = {"Argentina","Brazil", "Peru", "Venezuela"}; System.out.println(diffs(param1, param2)); } /* Metodo que recibe dos arrays de tipo String. Si todos los elementos son iguales, retorna un map con los elementos ordenados alfabeticamente De lo contrario, si hay elementos diferentes, retorna un map con estos elementos diferentes. */ public static Map diffs (String[] list1, String[] list2) { int same = 0; for (int i = 0; i <= list1.length-1; i++) { for(int j = 0; j <= list2.length-1; j++) { if (list1[i].equals(list2[j])){ same++; break; } } } boolean differentFound = false; String [] equ=new String[same]; String [] diff=new String[list1.length]; int p=0; for (int i = 0; i <= list1.length-1; i++) { boolean foundElement = false; for(int j = 0; j <= list2.length-1; j++) { if (list1[i].equals(list2[j])) { equ[p]= list1[i]+""; p++; foundElement = true; } } if(foundElement == false){ differentFound = true; diff[i]=list1[i]; } } if(differentFound == false){ System.out.println("Los elementos son iguales --> Devolver hasmap ordenado"); Map<String, Integer> mapEquals = new HashMap<String, Integer>(); for (int i = 0; i < list1.length; i++) { mapEquals.put(list1[i], list1[i].length()); } Map mapOrdenado = new TreeMap(mapEquals); return mapOrdenado; }else{ System.out.println("Los elementos son diferentes --> Devolver elementos diferentes"); Map<String, Integer> mapDifferents = new HashMap<String, Integer>(); for (int i = 0; i < diff.length; i++) { if(diff[i]!=null){ mapDifferents.put(diff[i], diff[i].length()); } } return mapDifferents; } } }
2,403
0.505202
0.491885
65
35.969231
27.825262
143
false
false
0
0
0
0
0
0
0.876923
false
false
12
f7033c406e82fd68907b0a413763c77a21125903
21,440,476,784,176
a0f217606f96eb0a910e7303ae014179caa91edc
/src/Tester.java
b204250662ee91dc0d1ab5757ebc2695f8ed90f0
[]
no_license
neo-nie/RAP
https://github.com/neo-nie/RAP
b62d89d981d0fd5bfed82594420cee26c2947545
00fbd8db14f501552a86526ba0b5933514776976
refs/heads/master
2021-05-27T03:44:40.779000
2014-05-24T08:50:25
2014-05-24T08:50:25
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import com.taobao.rigel.rap.common.StringUtils; public class Tester { /** * @param args */ public static void main(String[] args) { /** int num = 1; Pattern p = Pattern.compile(Patterns.MOCK_TEMPLATE_PATTERN); Matcher matcher = p.matcher("${page=1008}"); while (matcher.find()) { System.out.println("找到的第" + num++ + "组"); int c = matcher.groupCount(); while (c-- > 0 ? true : false) { System.out.println("[" + c + "] " + matcher.group(c)); } } */ System.out.println(StringUtils.chineseToUnicode("123测试一下aaa")); } }
UTF-8
Java
580
java
Tester.java
Java
[]
null
[]
import com.taobao.rigel.rap.common.StringUtils; public class Tester { /** * @param args */ public static void main(String[] args) { /** int num = 1; Pattern p = Pattern.compile(Patterns.MOCK_TEMPLATE_PATTERN); Matcher matcher = p.matcher("${page=1008}"); while (matcher.find()) { System.out.println("找到的第" + num++ + "组"); int c = matcher.groupCount(); while (c-- > 0 ? true : false) { System.out.println("[" + c + "] " + matcher.group(c)); } } */ System.out.println(StringUtils.chineseToUnicode("123测试一下aaa")); } }
580
0.608541
0.592527
27
19.814816
21.660746
65
false
false
0
0
0
0
0
0
1.740741
false
false
12
421bb9171b17c6cd4756eb35da350e18572df9b5
19,516,331,436,660
04d6513eaa355520ba6863029c3e3a15259e2177
/swagger-springmvc-example/src/main/java/com/yakuza/swagger/springmvc/example/configuration/ApplicationInitializer.java
d358d0815d20ac155089f46c902e3ab9780056f5
[ "Unlicense" ]
permissive
githubyatsura/tutorials
https://github.com/githubyatsura/tutorials
d383dfc386c408bc70366d06e1b2a8b88852e6a2
e2b0df770c18c345e7ac4767ecc43c27388a4074
refs/heads/master
2021-01-18T02:06:07.243000
2017-08-09T14:12:21
2017-08-09T14:12:21
80,717,450
0
0
Unlicense
false
2020-03-05T16:23:29
2017-02-02T11:09:09
2017-02-02T12:56:15
2020-03-05T16:23:27
28
0
0
1
Java
false
false
package com.yakuza.swagger.springmvc.example.configuration; import com.yakuza.swagger.springmvc.example.Constants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.filter.CharacterEncodingFilter; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; import javax.servlet.Filter; /** * Sample of application initializer. */ public class ApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { //Define logger. private static final Logger LOG = LoggerFactory.getLogger(ApplicationInitializer.class); //Define mapping template. private static final String MAPPING_TEMPLATE = "%s/*"; /** * Constructor. */ public ApplicationInitializer() { LOG.info("Created."); } /** * Get root application context classes. * * @return */ @Override protected Class<?>[] getRootConfigClasses() { return null; } /** * Get servlet application context classes. * * @return */ @Override protected Class<?>[] getServletConfigClasses() { return new Class[]{WebConfig.class}; } /** * Get servlet mappings. * * @return */ @Override protected String[] getServletMappings() { return new String[]{String.format(MAPPING_TEMPLATE, Constants.SERVICE_URL_V1)}; } /** * Get servlet filters. * * @return */ @Override protected Filter[] getServletFilters() { //Define character encoding filter. CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter(); characterEncodingFilter.setEncoding("UTF-8"); return new Filter[]{characterEncodingFilter}; } }
UTF-8
Java
1,806
java
ApplicationInitializer.java
Java
[]
null
[]
package com.yakuza.swagger.springmvc.example.configuration; import com.yakuza.swagger.springmvc.example.Constants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.filter.CharacterEncodingFilter; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; import javax.servlet.Filter; /** * Sample of application initializer. */ public class ApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { //Define logger. private static final Logger LOG = LoggerFactory.getLogger(ApplicationInitializer.class); //Define mapping template. private static final String MAPPING_TEMPLATE = "%s/*"; /** * Constructor. */ public ApplicationInitializer() { LOG.info("Created."); } /** * Get root application context classes. * * @return */ @Override protected Class<?>[] getRootConfigClasses() { return null; } /** * Get servlet application context classes. * * @return */ @Override protected Class<?>[] getServletConfigClasses() { return new Class[]{WebConfig.class}; } /** * Get servlet mappings. * * @return */ @Override protected String[] getServletMappings() { return new String[]{String.format(MAPPING_TEMPLATE, Constants.SERVICE_URL_V1)}; } /** * Get servlet filters. * * @return */ @Override protected Filter[] getServletFilters() { //Define character encoding filter. CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter(); characterEncodingFilter.setEncoding("UTF-8"); return new Filter[]{characterEncodingFilter}; } }
1,806
0.672757
0.670543
71
24.450705
26.234472
100
false
false
0
0
0
0
0
0
0.239437
false
false
12
dbd6a2de26ac989515f69612cfe7856f1fb1c025
10,453,950,435,410
33fba7fb2ad84a82a13d3ca7833a986b0872e13c
/src/main/java/com/epam/as/solarsystem/entityold/factory/PlanetFactory.java
007f167ac2367078553694fef3e781d23d64cc80
[]
no_license
AlexeySlepenkov/WEB-StarSystem
https://github.com/AlexeySlepenkov/WEB-StarSystem
3ab4110a7333f008b2f7d8a078cef89b94475d63
fce69248163a4d7f7137ff2da7ec060aa26c3aac
refs/heads/master
2016-08-04T15:29:47.844000
2014-08-09T11:05:32
2014-08-09T11:05:32
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.epam.as.solarsystem.entityold.factory; import com.epam.as.solarsystem.entityold.Planet; import com.epam.as.solarsystem.entityold.UninhabitedPlanet; import com.epam.as.solarsystem.util.NameGenerator; import com.epam.as.solarsystem.util.PropertyManager; import java.util.Arrays; import java.util.Random; import static com.epam.as.solarsystem.entityold.AstronomicalObject.MineralResource; public class PlanetFactory { /** * @param id * @param type Depends on Uninhabited or Inhabited planet need. * @param <T> * @return */ public static <T extends Planet> Planet create(int id, Class<T> type) { PropertyManager pm = new PropertyManager("config.properties"); Random rnd = new Random(); double planetMass = pm.getDoubleProperty("min.Planet.Mass") + (pm.getDoubleProperty("max.Planet.Mass") - pm.getDoubleProperty("min.Planet.Mass")) * rnd.nextDouble(); if (type.getName().contains("InhabitedPlanet")) { return new Planet.Builder() .id(id) .name(NameGenerator.generate()) .mass(planetMass) .population(rnd.nextInt(pm.getIntProperty("max.Planet.Population"))) .hasAtmosphere(rnd.nextBoolean()) .buildInhabitedPlanet(); } if (type.getName().contains("UninhabitedPlanet")) { return new Planet.Builder() .id(id) .name(NameGenerator.generate()) .mass(planetMass) .hasAtmosphere(rnd.nextBoolean()) .mineralResources(Arrays.asList(MineralResource.values()[rnd.nextInt(MineralResource.values().length)])) .buildUnInhabitedPlanet(); } return new UninhabitedPlanet(); } }
UTF-8
Java
1,840
java
PlanetFactory.java
Java
[]
null
[]
package com.epam.as.solarsystem.entityold.factory; import com.epam.as.solarsystem.entityold.Planet; import com.epam.as.solarsystem.entityold.UninhabitedPlanet; import com.epam.as.solarsystem.util.NameGenerator; import com.epam.as.solarsystem.util.PropertyManager; import java.util.Arrays; import java.util.Random; import static com.epam.as.solarsystem.entityold.AstronomicalObject.MineralResource; public class PlanetFactory { /** * @param id * @param type Depends on Uninhabited or Inhabited planet need. * @param <T> * @return */ public static <T extends Planet> Planet create(int id, Class<T> type) { PropertyManager pm = new PropertyManager("config.properties"); Random rnd = new Random(); double planetMass = pm.getDoubleProperty("min.Planet.Mass") + (pm.getDoubleProperty("max.Planet.Mass") - pm.getDoubleProperty("min.Planet.Mass")) * rnd.nextDouble(); if (type.getName().contains("InhabitedPlanet")) { return new Planet.Builder() .id(id) .name(NameGenerator.generate()) .mass(planetMass) .population(rnd.nextInt(pm.getIntProperty("max.Planet.Population"))) .hasAtmosphere(rnd.nextBoolean()) .buildInhabitedPlanet(); } if (type.getName().contains("UninhabitedPlanet")) { return new Planet.Builder() .id(id) .name(NameGenerator.generate()) .mass(planetMass) .hasAtmosphere(rnd.nextBoolean()) .mineralResources(Arrays.asList(MineralResource.values()[rnd.nextInt(MineralResource.values().length)])) .buildUnInhabitedPlanet(); } return new UninhabitedPlanet(); } }
1,840
0.622283
0.622283
48
37.354168
34.139717
173
false
false
0
0
0
0
0
0
0.3125
false
false
12
ec5e8a5fd46406197efe869047a67ea6d5cd3132
11,819,750,054,964
426f7fb38bb42d6856bc47b09d568e55a73e3ffa
/src/test/java/Element/UploadDownload.java
7a50e43761ef8f86cd9214fcbc3036eec6761900
[]
no_license
supriya1patil/ProjectSelenium01
https://github.com/supriya1patil/ProjectSelenium01
6cf83e9723caa565a3a48166fec58c14acfe3526
96328292845418061341645945ed7899956662b7
refs/heads/master
2023-09-02T06:23:48.254000
2021-11-21T10:27:33
2021-11-21T10:27:33
430,343,496
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Element; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; public class UploadDownload { WebDriver driver = new ChromeDriver(); @BeforeClass public void openBrowser() throws Exception { System.out.println("Open Chrome Browser"); driver.get("https://demoqa.com/upload-download"); } @Test public void downLoad() { driver.findElement(By.id("downloadButton")).click(); System.out.println("File Downloaded"); } public void upload() { driver.findElement(By.id("uploadPicture")).sendKeys("C:\\Users\\Supriya\\Desktop\\Tausha.jpg"); } }
UTF-8
Java
772
java
UploadDownload.java
Java
[]
null
[]
package Element; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; public class UploadDownload { WebDriver driver = new ChromeDriver(); @BeforeClass public void openBrowser() throws Exception { System.out.println("Open Chrome Browser"); driver.get("https://demoqa.com/upload-download"); } @Test public void downLoad() { driver.findElement(By.id("downloadButton")).click(); System.out.println("File Downloaded"); } public void upload() { driver.findElement(By.id("uploadPicture")).sendKeys("C:\\Users\\Supriya\\Desktop\\Tausha.jpg"); } }
772
0.686529
0.686529
29
25.620689
24.140985
103
false
false
0
0
0
0
0
0
0.413793
false
false
12
b5b7d9bf0acbcbe0d393ac5b0e591cd4072338ce
17,961,553,259,035
7f862af13ab302c4ed2a28e8f1cd151051f7aec9
/failed/failed/MinMax.java
5153bff4520fc85904396923d3c39e9ccfac1b49
[]
no_license
mgtcardenas/FANORONA
https://github.com/mgtcardenas/FANORONA
51fe83297720b8b269b05e355a96f8b54e3b1e71
4b24fa5cef644223fb4fac1acc33ed1233df3744
refs/heads/master
2020-05-16T05:07:17.169000
2019-04-27T04:19:59
2019-04-27T04:19:59
182,804,686
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package failed; import java.util.Collections; import java.util.LinkedList; import java.util.List; public class MinMax { private static State selectMaxChild(List<State> children) { LinkedList<State> candidates; State maxChild; Collections.sort(children); Collections.reverse(children); candidates = new LinkedList<>(); maxChild = children.get(0); candidates.add(maxChild); for (int i = 1; i < children.size(); i++) if (maxChild.getPayoff() == children.get(i).getPayoff()) candidates.add(children.get(i)); else break; return (candidates.size() > 1) ? candidates.get((int) (Math.random() * candidates.size())) : candidates.get(0); }// end selectMaxChild public static State miniMaxEasy(State state) { LinkedList<State> children; LinkedList<State> grandChildren; State minGrandChild; state.expansion(true); children = state.getChildren(); // expansion // for (int i = 0; i < children.size(); i++) // Min // { // children.get(i).expansion(false); // grandChildren = children.get(i).getChildren(); // expansion of each child // // for (int j = 0; j < grandChildren.size(); j++) // grandChildren.get(j).payOffFunction(); // calculate the payoff of each grand child // // Collections.sort(grandChildren); // minGrandChild = grandChildren.get(0); // children.get(i).setPayoff(minGrandChild.getPayoff()); // inheritance of the minimal payoff value // }// end for - i return selectMaxChild(children); }// end minMaxEasy }// end MinMax - class
UTF-8
Java
1,538
java
MinMax.java
Java
[]
null
[]
package failed; import java.util.Collections; import java.util.LinkedList; import java.util.List; public class MinMax { private static State selectMaxChild(List<State> children) { LinkedList<State> candidates; State maxChild; Collections.sort(children); Collections.reverse(children); candidates = new LinkedList<>(); maxChild = children.get(0); candidates.add(maxChild); for (int i = 1; i < children.size(); i++) if (maxChild.getPayoff() == children.get(i).getPayoff()) candidates.add(children.get(i)); else break; return (candidates.size() > 1) ? candidates.get((int) (Math.random() * candidates.size())) : candidates.get(0); }// end selectMaxChild public static State miniMaxEasy(State state) { LinkedList<State> children; LinkedList<State> grandChildren; State minGrandChild; state.expansion(true); children = state.getChildren(); // expansion // for (int i = 0; i < children.size(); i++) // Min // { // children.get(i).expansion(false); // grandChildren = children.get(i).getChildren(); // expansion of each child // // for (int j = 0; j < grandChildren.size(); j++) // grandChildren.get(j).payOffFunction(); // calculate the payoff of each grand child // // Collections.sort(grandChildren); // minGrandChild = grandChildren.get(0); // children.get(i).setPayoff(minGrandChild.getPayoff()); // inheritance of the minimal payoff value // }// end for - i return selectMaxChild(children); }// end minMaxEasy }// end MinMax - class
1,538
0.675553
0.671001
54
27.481482
25.456383
113
false
false
0
0
0
0
0
0
2.5
false
false
12
f882be2ed49d543a9e9c072b8bc4782a56357f35
23,304,492,580,667
f6b961f25225075c49ab53a5b6d2bf808c35422b
/src/sorting/CompoundComparator.java
9b110ec97c228eb660acb2d54c9f05913ecc7c29
[]
no_license
LaurentiuGabriel/algorithms
https://github.com/LaurentiuGabriel/algorithms
d9feb2892e863b976f41aff4b1737f73b72771b8
7fec2a3c3ee986636a327132b59848b2d8a7dde3
refs/heads/master
2021-04-13T08:44:04.055000
2020-03-29T08:44:59
2020-03-29T08:44:59
249,149,530
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package sorting; import dataStructures.ArrayList; import dataStructures.List; import iteration.Iterator; public class CompoundComparator implements Comparator { private final List _comparators = new ArrayList(); public void addComparator(Comparator comparator) { assert comparator != null : "omparator can’t be null"; assert comparator != this : "can’t add comparator to itself"; _comparators.add(comparator); } public int compare(Object left, Object right) { int result = 0; Iterator i = _comparators.iterator(); for (i.first(); !i.isDone(); i.next()) { result = ((Comparator) i.current()).compare(left, right); if (result != 0) { break; } } return result; } }
UTF-8
Java
805
java
CompoundComparator.java
Java
[]
null
[]
package sorting; import dataStructures.ArrayList; import dataStructures.List; import iteration.Iterator; public class CompoundComparator implements Comparator { private final List _comparators = new ArrayList(); public void addComparator(Comparator comparator) { assert comparator != null : "omparator can’t be null"; assert comparator != this : "can’t add comparator to itself"; _comparators.add(comparator); } public int compare(Object left, Object right) { int result = 0; Iterator i = _comparators.iterator(); for (i.first(); !i.isDone(); i.next()) { result = ((Comparator) i.current()).compare(left, right); if (result != 0) { break; } } return result; } }
805
0.612984
0.610487
27
28.703703
22.492493
69
false
false
0
0
0
0
0
0
0.62963
false
false
12
1f9141721a8717d6646ef29aa278d83bdf0cdd77
2,241,972,967,041
cee07e9b756aad102d8689b7f0db92d611ed5ab5
/src_6/org/benf/cfr/tests/LoopTest40d.java
26734f64218dc9e742565d71a23bfb9c221c5c7c
[ "MIT" ]
permissive
leibnitz27/cfr_tests
https://github.com/leibnitz27/cfr_tests
b85ab71940ae13fbea6948a8cc168b71f811abfd
b3aa4312e3dc0716708673b90cc0a8399e5f83e2
refs/heads/master
2022-09-04T02:45:26.282000
2022-08-11T06:14:39
2022-08-11T06:14:39
184,790,061
11
5
MIT
false
2022-02-24T07:07:46
2019-05-03T16:49:01
2021-10-01T08:29:04
2022-02-24T07:07:45
918
8
5
2
Java
false
false
package org.benf.cfr.tests; /** * Created by IntelliJ IDEA. * User: lee * Date: 07/06/2011 * Time: 06:24 * To change this template use File | Settings | File Templates. */ public class LoopTest40d { int[] fn(int []i) { return i; } public void test(int [] xs) { for (int i : fn(xs)) { System.out.println(i); } fn(xs); } }
UTF-8
Java
394
java
LoopTest40d.java
Java
[ { "context": ".tests;\n\n/**\n * Created by IntelliJ IDEA.\n * User: lee\n * Date: 07/06/2011\n * Time: 06:24\n * To change t", "end": 74, "score": 0.9989433288574219, "start": 71, "tag": "USERNAME", "value": "lee" } ]
null
[]
package org.benf.cfr.tests; /** * Created by IntelliJ IDEA. * User: lee * Date: 07/06/2011 * Time: 06:24 * To change this template use File | Settings | File Templates. */ public class LoopTest40d { int[] fn(int []i) { return i; } public void test(int [] xs) { for (int i : fn(xs)) { System.out.println(i); } fn(xs); } }
394
0.525381
0.489848
23
16.130434
15.089024
64
false
false
0
0
0
0
0
0
0.26087
false
false
12
5819cc50ac984582ef272dc8818a5669a219f8ab
6,777,458,394,732
87bdf68f02223510c69dc5ef183369b080825a7b
/src/main/java/com/mp/apms/app/bean/AppBillItem.java
cf18045a6b06ce1e830653931d48c66daee05d9f
[]
no_license
272711697/apms
https://github.com/272711697/apms
a598a8d135cb693ca6002a5f43287a20f72b54fb
347a2b70ed148548a773f701dcd5eb6c04b8c8d5
refs/heads/master
2016-09-06T11:45:15.860000
2015-06-03T09:07:53
2015-06-03T09:07:53
33,874,593
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mp.apms.app.bean; public class AppBillItem { private String id; private String appId; private String appSequence; private String appName; private String packageName; private String sequence; private String name; private String price; private String payMode; private String dayTimes; private String monthTimes; private String payRule; private String payRuleName; private String billingTip; private String inTime; private String remark; private String statusTime; private String status; private String operId; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getAppId() { return appId; } public void setAppId(String appId) { this.appId = appId; } public String getAppSequence() { return appSequence; } public void setAppSequence(String appSequence) { this.appSequence = appSequence; } public String getAppName() { return appName; } public void setAppName(String appName) { this.appName = appName; } public String getPackageName() { return packageName; } public void setPackageName(String packageName) { this.packageName = packageName; } public String getSequence() { return sequence; } public void setSequence(String sequence) { this.sequence = sequence; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } public String getPayMode() { return payMode; } public void setPayMode(String payMode) { this.payMode = payMode; } public String getDayTimes() { return dayTimes; } public void setDayTimes(String dayTimes) { this.dayTimes = dayTimes; } public String getMonthTimes() { return monthTimes; } public void setMonthTimes(String monthTimes) { this.monthTimes = monthTimes; } public String getPayRule() { return payRule; } public void setPayRule(String payRule) { this.payRule = payRule; } public String getBillingTip() { return billingTip; } public void setBillingTip(String billingTip) { this.billingTip = billingTip; } public String getInTime() { return inTime; } public void setInTime(String inTime) { this.inTime = inTime; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public String getPayRuleName() { return payRuleName; } public void setPayRuleName(String payRuleName) { this.payRuleName = payRuleName; } public String getStatusTime() { return statusTime; } public void setStatusTime(String statusTime) { this.statusTime = statusTime; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getOperId() { return operId; } public void setOperId(String operId) { this.operId = operId; } }
UTF-8
Java
3,931
java
AppBillItem.java
Java
[]
null
[]
package com.mp.apms.app.bean; public class AppBillItem { private String id; private String appId; private String appSequence; private String appName; private String packageName; private String sequence; private String name; private String price; private String payMode; private String dayTimes; private String monthTimes; private String payRule; private String payRuleName; private String billingTip; private String inTime; private String remark; private String statusTime; private String status; private String operId; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getAppId() { return appId; } public void setAppId(String appId) { this.appId = appId; } public String getAppSequence() { return appSequence; } public void setAppSequence(String appSequence) { this.appSequence = appSequence; } public String getAppName() { return appName; } public void setAppName(String appName) { this.appName = appName; } public String getPackageName() { return packageName; } public void setPackageName(String packageName) { this.packageName = packageName; } public String getSequence() { return sequence; } public void setSequence(String sequence) { this.sequence = sequence; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } public String getPayMode() { return payMode; } public void setPayMode(String payMode) { this.payMode = payMode; } public String getDayTimes() { return dayTimes; } public void setDayTimes(String dayTimes) { this.dayTimes = dayTimes; } public String getMonthTimes() { return monthTimes; } public void setMonthTimes(String monthTimes) { this.monthTimes = monthTimes; } public String getPayRule() { return payRule; } public void setPayRule(String payRule) { this.payRule = payRule; } public String getBillingTip() { return billingTip; } public void setBillingTip(String billingTip) { this.billingTip = billingTip; } public String getInTime() { return inTime; } public void setInTime(String inTime) { this.inTime = inTime; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public String getPayRuleName() { return payRuleName; } public void setPayRuleName(String payRuleName) { this.payRuleName = payRuleName; } public String getStatusTime() { return statusTime; } public void setStatusTime(String statusTime) { this.statusTime = statusTime; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getOperId() { return operId; } public void setOperId(String operId) { this.operId = operId; } }
3,931
0.53625
0.53625
232
14.943966
14.54871
50
false
false
0
0
0
0
0
0
0.25
false
false
12
fa405242f8907c7ea7bfcc4b0aedce0f993344a2
11,192,684,810,722
42778f45a3db7eb137a4d1f097183abf5c9c0d1c
/src/main/java/axion/test/AxionDummyClass.java
a098b267a96f198cafdd33daf0aef6246b984528
[]
no_license
llacki/test_axion_plugin
https://github.com/llacki/test_axion_plugin
86a34b00044fc0034ff3b86e387f1eedfdad267e
d790be394c4587c3da876c37690fdd9a60184356
refs/heads/master
2016-09-06T16:40:20.772000
2015-09-03T19:52:24
2015-09-03T19:52:24
41,862,756
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package axion.test; public class AxionDummyClass { public boolean startsWithUpperCase(String stringToCheck){ if (isNotEmpty(stringToCheck) && Character.isUpperCase(stringToCheck.charAt(0))){ return true; } return false; } private boolean isNotEmpty(String stringToCheck) { if (stringToCheck != null && stringToCheck.length() > 0) { return true; } return false; } }
UTF-8
Java
411
java
AxionDummyClass.java
Java
[]
null
[]
package axion.test; public class AxionDummyClass { public boolean startsWithUpperCase(String stringToCheck){ if (isNotEmpty(stringToCheck) && Character.isUpperCase(stringToCheck.charAt(0))){ return true; } return false; } private boolean isNotEmpty(String stringToCheck) { if (stringToCheck != null && stringToCheck.length() > 0) { return true; } return false; } }
411
0.686131
0.681265
21
18.571428
24.064539
86
false
false
0
0
0
0
0
0
1.428571
false
false
12
d7f4c48a55f1d1f34582a5cfd12024f48f70b605
876,173,374,756
cee5014ad81e9d60c92d7b20571e5650d22c0022
/app/src/main/java/com/danielsanso/favyourfragments/SplashActivity.java
d466d1f152c4cf28c6bfe1231b05d1e2fb6f5cb4
[]
no_license
daniSanso/FavYourFragments
https://github.com/daniSanso/FavYourFragments
5080c2ea2b277071f063e9b6452fb1c0780322fd
72e0b981c8bb667291ccf8993a57b739d2d3d0cc
refs/heads/master
2021-04-27T19:15:36.036000
2018-03-14T19:43:19
2018-03-14T19:43:19
122,354,375
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.danielsanso.favyourfragments; import android.content.Intent; import android.os.Handler; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ImageView; import android.widget.ProgressBar; import com.felipecsl.gifimageview.library.GifImageView; import org.apache.commons.io.IOUtils; import java.io.IOException; import java.io.InputStream; public class SplashActivity extends AppCompatActivity { private GifImageView gifImageView; private ProgressBar progressBar; int i = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); // getSupportActionBar().hide();//quita el action bar gifImageView = (GifImageView) findViewById(R.id.gifimageview); progressBar = (ProgressBar)findViewById(R.id.progressBar) ; progressBar.setVisibility(progressBar.VISIBLE); try{ InputStream inputStream =getAssets().open("SplashF.gif"); byte[] bytes = IOUtils.toByteArray(inputStream); gifImageView.setBytes(bytes); gifImageView.startAnimation(); } catch (IOException ex) { } //esperamos 5 segundos? new Handler().postDelayed(new Runnable() { @Override public void run() { SplashActivity.this.startActivity(new Intent(SplashActivity.this, login.class)); SplashActivity.this.finish(); } },4000); //Estos son 5 segundos } //Animation anim = AnimationUtils.loadAnimation(this, R.anim.splash_anim); //img.startAnimation(anim); }
UTF-8
Java
1,804
java
SplashActivity.java
Java
[ { "context": "package com.danielsanso.favyourfragments;\n\nimport android.content.Intent;", "end": 23, "score": 0.9884130358695984, "start": 12, "tag": "USERNAME", "value": "danielsanso" } ]
null
[]
package com.danielsanso.favyourfragments; import android.content.Intent; import android.os.Handler; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ImageView; import android.widget.ProgressBar; import com.felipecsl.gifimageview.library.GifImageView; import org.apache.commons.io.IOUtils; import java.io.IOException; import java.io.InputStream; public class SplashActivity extends AppCompatActivity { private GifImageView gifImageView; private ProgressBar progressBar; int i = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); // getSupportActionBar().hide();//quita el action bar gifImageView = (GifImageView) findViewById(R.id.gifimageview); progressBar = (ProgressBar)findViewById(R.id.progressBar) ; progressBar.setVisibility(progressBar.VISIBLE); try{ InputStream inputStream =getAssets().open("SplashF.gif"); byte[] bytes = IOUtils.toByteArray(inputStream); gifImageView.setBytes(bytes); gifImageView.startAnimation(); } catch (IOException ex) { } //esperamos 5 segundos? new Handler().postDelayed(new Runnable() { @Override public void run() { SplashActivity.this.startActivity(new Intent(SplashActivity.this, login.class)); SplashActivity.this.finish(); } },4000); //Estos son 5 segundos } //Animation anim = AnimationUtils.loadAnimation(this, R.anim.splash_anim); //img.startAnimation(anim); }
1,804
0.686807
0.682373
58
30.103449
23.813709
96
false
false
0
0
0
0
0
0
0.586207
false
false
12
ee16b7c86e4c00d0e482253e39b08e032c8db988
24,060,406,829,895
2886d89168a50c72f470f18b538f31296a5e886f
/AndroidThreeClassDemo/src/com/scxh/android/pattern/Observer.java
2b12e6517584eab19711d66313348aa5886ee801
[]
no_license
yihu0817/AndroidThreeClass
https://github.com/yihu0817/AndroidThreeClass
3a5da435d20c8a7b30274b6510de29410efdf3ae
921ab8c890de953342c7f417c40e6fe3ed488e7f
refs/heads/master
2021-01-25T07:27:39.562000
2015-08-14T07:30:06
2015-08-14T07:30:06
32,369,233
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.scxh.android.pattern; public interface Observer { public void update(String blog); }
UTF-8
Java
101
java
Observer.java
Java
[]
null
[]
package com.scxh.android.pattern; public interface Observer { public void update(String blog); }
101
0.762376
0.762376
5
19.4
15.704777
36
false
false
0
0
0
0
0
0
0.4
false
false
12
1afa446d9e4768b14c8870643b71415499df2e88
566,935,683,591
0d5b5fd68c33856d826148ca6e22a353958ebcdc
/app/src/main/java/com/bluestel/travelmatrics/FirebaseUtl.java
41d6e7c6cd833ad6f8a0f68436c4e4a851ab0039
[]
no_license
thejoecodes/Travelmantics
https://github.com/thejoecodes/Travelmantics
3bf51301e85a89a556fa3f3dc01acf26bf831d45
bf5af7c81a4e04a30267db27db00fa30b3d8d396
refs/heads/master
2020-06-23T13:27:57.800000
2019-07-29T11:11:55
2019-07-29T11:11:55
198,637,283
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bluestel.travelmatrics; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import java.util.ArrayList; public class FirebaseUtl { public static FirebaseDatabase sFirebaseDatabase; public static DatabaseReference sDatabaseReference; private static FirebaseUtl sFirebaseUtl; public static ArrayList<TravelDeal> sDeals; private FirebaseUtl(){}; public static void openFbReference (String ref){ if (sFirebaseUtl == null){ sFirebaseUtl = new FirebaseUtl(); sFirebaseDatabase = FirebaseDatabase.getInstance(); sDeals = new ArrayList<TravelDeal>(); } sDatabaseReference = sFirebaseDatabase.getReference().child(ref); } }
UTF-8
Java
777
java
FirebaseUtl.java
Java
[]
null
[]
package com.bluestel.travelmatrics; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import java.util.ArrayList; public class FirebaseUtl { public static FirebaseDatabase sFirebaseDatabase; public static DatabaseReference sDatabaseReference; private static FirebaseUtl sFirebaseUtl; public static ArrayList<TravelDeal> sDeals; private FirebaseUtl(){}; public static void openFbReference (String ref){ if (sFirebaseUtl == null){ sFirebaseUtl = new FirebaseUtl(); sFirebaseDatabase = FirebaseDatabase.getInstance(); sDeals = new ArrayList<TravelDeal>(); } sDatabaseReference = sFirebaseDatabase.getReference().child(ref); } }
777
0.727156
0.727156
24
31.375
23.437529
73
false
false
0
0
0
0
0
0
0.541667
false
false
12
00ad0aae1db8dbaf6f7ce7140e76bd7cf31f487c
2,929,167,700,556
8b3f3938559fb65912fe152abf99294b094bacda
/src/main/java/com/klt/thread/mutex/MutexTread3.java
0736e35ca5ab9adfcada56989dd31b925873596d
[]
no_license
mooska7/Thread
https://github.com/mooska7/Thread
c4bf5d9333a54e65c9cf0bd31595b414dddc3093
61c1092251faecdd35663ce469151595d1f6a620
refs/heads/master
2020-03-11T00:52:43.289000
2018-04-27T02:48:02
2018-04-27T02:48:02
129,674,499
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.klt.thread.mutex; import com.klt.thread.mutex.pojo.Account; public class MutexTread3 { public static void main(String[] args) { Account account = new Account("mooska", 6000); MutexTread3 thread = new MutexTread3(); new Thread(new Runnable() { @Override public void run() { while (true) { try { Thread.sleep(10); new Outputer().output("mooska"); } catch (InterruptedException e) { e.printStackTrace(); } } } }).start(); new Thread() { @Override public void run() { while (true) { try { Thread.sleep(10); Outputer.output4("tiantian"); } catch (InterruptedException e) { e.printStackTrace(); } } } }.start(); } static class Outputer { // 互斥的 // public synchronized void output(String name) { // for (int i = 0; i < name.length(); i++) { // System.out.print(name.charAt(i)); // } // System.out.println(); // } // 不互斥的 // public void output(String name) { // synchronized (name) { // for (int i = 0; i < name.length(); i++) { // System.out.print(name.charAt(i)); // } // System.out.println(); // } // } // 互斥的 // public void output(String name) { // String temp = ""; // synchronized (temp) { // for (int i = 0; i < name.length(); i++) { // System.out.print(name.charAt(i)); // } // System.out.println(); // } // } // 互斥的 // private String color = "dodo"; // public void output(String name) { // synchronized (color) { // for (int i = 0; i < name.length(); i++) { // System.out.print(name.charAt(i)); // } // System.out.println(); // } // } // 互斥的 字节码对象 public void output(String name) { synchronized (Outputer.class) { for (int i = 0; i < name.length(); i++) { System.out.print(name.charAt(i)); } System.out.println(); } } // 互斥的 字节码对象 public synchronized static void output4(String name) { for (int i = 0; i < name.length(); i++) { System.out.print(name.charAt(i)); } System.out.println(); } } }
UTF-8
Java
2,116
java
MutexTread3.java
Java
[ { "context": "String[] args) {\n\t\tAccount account = new Account(\"mooska\", 6000);\n\t\tMutexTread3 thread = new MutexTread3()", "end": 182, "score": 0.9932293891906738, "start": 176, "tag": "USERNAME", "value": "mooska" } ]
null
[]
package com.klt.thread.mutex; import com.klt.thread.mutex.pojo.Account; public class MutexTread3 { public static void main(String[] args) { Account account = new Account("mooska", 6000); MutexTread3 thread = new MutexTread3(); new Thread(new Runnable() { @Override public void run() { while (true) { try { Thread.sleep(10); new Outputer().output("mooska"); } catch (InterruptedException e) { e.printStackTrace(); } } } }).start(); new Thread() { @Override public void run() { while (true) { try { Thread.sleep(10); Outputer.output4("tiantian"); } catch (InterruptedException e) { e.printStackTrace(); } } } }.start(); } static class Outputer { // 互斥的 // public synchronized void output(String name) { // for (int i = 0; i < name.length(); i++) { // System.out.print(name.charAt(i)); // } // System.out.println(); // } // 不互斥的 // public void output(String name) { // synchronized (name) { // for (int i = 0; i < name.length(); i++) { // System.out.print(name.charAt(i)); // } // System.out.println(); // } // } // 互斥的 // public void output(String name) { // String temp = ""; // synchronized (temp) { // for (int i = 0; i < name.length(); i++) { // System.out.print(name.charAt(i)); // } // System.out.println(); // } // } // 互斥的 // private String color = "dodo"; // public void output(String name) { // synchronized (color) { // for (int i = 0; i < name.length(); i++) { // System.out.print(name.charAt(i)); // } // System.out.println(); // } // } // 互斥的 字节码对象 public void output(String name) { synchronized (Outputer.class) { for (int i = 0; i < name.length(); i++) { System.out.print(name.charAt(i)); } System.out.println(); } } // 互斥的 字节码对象 public synchronized static void output4(String name) { for (int i = 0; i < name.length(); i++) { System.out.print(name.charAt(i)); } System.out.println(); } } }
2,116
0.555394
0.546161
98
20
15.83396
57
false
false
0
0
0
0
0
0
2.826531
false
false
12
70ee4e127a4db7d25b6200f129bb2ba7320d81ad
4,733,053,966,882
fcd424b92e4ab67f0ae869124a1c80118d3bccbb
/app/src/main/java/positioning/indoor/se/ipsapp/services/IntroduceService.java
9f53a3b5d0d7bfb813b08ef71c18b6f397c8c85f
[]
no_license
HampusEngstrom/IPSApp
https://github.com/HampusEngstrom/IPSApp
b8f24e5b4b66a1fbc0e55899b591a9f8f41c5a42
a752484962f07e9c0bd19b30f12ec3138d047f39
refs/heads/master
2019-06-28T16:35:09.298000
2015-06-12T12:59:31
2015-06-12T12:59:31
32,798,834
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package positioning.indoor.se.ipsapp.services; import android.app.IntentService; import android.content.Intent; import com.android.volley.VolleyError; import de.greenrobot.event.EventBus; import positioning.indoor.se.ipsapp.Api; import positioning.indoor.se.ipsapp.Controller; import positioning.indoor.se.ipsapp.online.events.ErrorEvent; import positioning.indoor.se.ipsapp.online.events.IntroductionEvent; import positioning.indoor.se.ipsapp.Param; /** * Created by Hampus on 2015-03-31. */ public class IntroduceService extends IntentService{ public static final String SENDER = "SENDER"; public static final String NAME = "name"; /** * Creates an IntentService. Invoked by your subclass's constructor. */ public IntroduceService() { super("IntroduceService"); } @Override public void onCreate() { super.onCreate(); if(!EventBus.getDefault().isRegistered(this)) EventBus.getDefault().register(this); } @Override public void onDestroy() { if(EventBus.getDefault().isRegistered(this)) EventBus.getDefault().unregister(this); super.onDestroy(); } @Override protected void onHandleIntent(Intent intent) { final String senderId = intent.getExtras().getString(SENDER); Param p = new Param(); p.put("id", Controller.MAC_ADDRESS); p.put("name", intent.getExtras().getString("name")); Api api = Controller.getRequestHandlerInstance(); api.introduce(new Api.RequestListener<String>() { @Override public void onSuccess(String response) { EventBus.getDefault().post(new IntroductionEvent(senderId, response)); } @Override public void onError(VolleyError error) { EventBus.getDefault().post(new ErrorEvent(senderId, error.getMessage())); } }, p); } public void onEvent(String Event) { } }
UTF-8
Java
2,007
java
IntroduceService.java
Java
[ { "context": "tioning.indoor.se.ipsapp.Param;\n\n/**\n * Created by Hampus on 2015-03-31.\n */\npublic class IntroduceService ", "end": 479, "score": 0.9481158256530762, "start": 473, "tag": "NAME", "value": "Hampus" } ]
null
[]
package positioning.indoor.se.ipsapp.services; import android.app.IntentService; import android.content.Intent; import com.android.volley.VolleyError; import de.greenrobot.event.EventBus; import positioning.indoor.se.ipsapp.Api; import positioning.indoor.se.ipsapp.Controller; import positioning.indoor.se.ipsapp.online.events.ErrorEvent; import positioning.indoor.se.ipsapp.online.events.IntroductionEvent; import positioning.indoor.se.ipsapp.Param; /** * Created by Hampus on 2015-03-31. */ public class IntroduceService extends IntentService{ public static final String SENDER = "SENDER"; public static final String NAME = "name"; /** * Creates an IntentService. Invoked by your subclass's constructor. */ public IntroduceService() { super("IntroduceService"); } @Override public void onCreate() { super.onCreate(); if(!EventBus.getDefault().isRegistered(this)) EventBus.getDefault().register(this); } @Override public void onDestroy() { if(EventBus.getDefault().isRegistered(this)) EventBus.getDefault().unregister(this); super.onDestroy(); } @Override protected void onHandleIntent(Intent intent) { final String senderId = intent.getExtras().getString(SENDER); Param p = new Param(); p.put("id", Controller.MAC_ADDRESS); p.put("name", intent.getExtras().getString("name")); Api api = Controller.getRequestHandlerInstance(); api.introduce(new Api.RequestListener<String>() { @Override public void onSuccess(String response) { EventBus.getDefault().post(new IntroductionEvent(senderId, response)); } @Override public void onError(VolleyError error) { EventBus.getDefault().post(new ErrorEvent(senderId, error.getMessage())); } }, p); } public void onEvent(String Event) { } }
2,007
0.653712
0.649726
82
23.475609
24.549713
89
false
false
0
0
0
0
0
0
0.365854
false
false
12
d2497bbcb38402ae42316c4b57b121895645a1da
6,193,342,849,455
f3882add3c8755dca66a7fa62e4cc6d730c49b47
/src/main/java/com/perhammer/joshua/registration/RegistrationNotFoundException.java
c248d642152976e58196f1e7473f7f97d0e4e380
[]
no_license
perhammer/restgames
https://github.com/perhammer/restgames
44c960ae96df4f978b571a82e4c7cfc1a55689a0
dcd67d05d316a2e74fb439fc756e0a1cb4e13f33
refs/heads/main
2021-06-18T12:14:13.257000
2019-01-18T22:18:41
2019-01-18T22:18:41
164,393,309
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.perhammer.joshua.registration; public class RegistrationNotFoundException extends RuntimeException { public RegistrationNotFoundException(Long id) { super("Registration id "+id+" not found"); } }
UTF-8
Java
225
java
RegistrationNotFoundException.java
Java
[]
null
[]
package com.perhammer.joshua.registration; public class RegistrationNotFoundException extends RuntimeException { public RegistrationNotFoundException(Long id) { super("Registration id "+id+" not found"); } }
225
0.755556
0.755556
7
31.142857
26.357046
69
false
false
0
0
0
0
0
0
0.285714
false
false
12
6927a9ed7f01552c00b273439aded28cbef1b720
23,235,773,078,117
d463e82f8f9c71213f95e8744d2316d0adfb9755
/scan-mms-computing/ij.src/ij/plugin/frame/LineWidthAdjuster.java
65528ed9f5d6fd002e867c8770a79261bc39254e
[]
no_license
wahid-nwr/docArchive
https://github.com/wahid-nwr/docArchive
b3a7d7ecf5d69a7483786fc9758e3c4d1520134d
058e58bb45d91877719c8f9b560100ed78e6746d
refs/heads/master
2020-03-14T07:06:09.629000
2018-05-01T18:23:55
2018-05-01T18:23:55
131,496,664
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* */ package ij.plugin.frame; /* */ /* */ import ij.IJ; /* */ import ij.ImagePlus; /* */ import ij.Prefs; /* */ import ij.WindowManager; /* */ import ij.gui.GUI; /* */ import ij.gui.Line; /* */ import ij.gui.PolygonRoi; /* */ import ij.gui.Roi; /* */ import ij.plugin.PlugIn; /* */ import ij.util.Tools; /* */ import java.awt.Checkbox; /* */ import java.awt.GridBagConstraints; /* */ import java.awt.GridBagLayout; /* */ import java.awt.Insets; /* */ import java.awt.Panel; /* */ import java.awt.Point; /* */ import java.awt.Scrollbar; /* */ import java.awt.TextField; /* */ import java.awt.event.AdjustmentEvent; /* */ import java.awt.event.AdjustmentListener; /* */ import java.awt.event.ItemEvent; /* */ import java.awt.event.ItemListener; /* */ import java.awt.event.TextEvent; /* */ import java.awt.event.TextListener; /* */ import java.awt.event.WindowEvent; /* */ /* */ public class LineWidthAdjuster extends PlugInFrame /* */ implements PlugIn, Runnable, AdjustmentListener, TextListener, ItemListener /* */ { /* */ public static final String LOC_KEY = "line.loc"; /* 18 */ int sliderRange = 300; /* */ Scrollbar slider; /* */ int value; /* */ boolean setText; /* */ static LineWidthAdjuster instance; /* */ Thread thread; /* */ boolean done; /* */ TextField tf; /* */ Checkbox checkbox; /* */ /* */ public LineWidthAdjuster() /* */ { /* 29 */ super("Line Width"); /* 30 */ if (instance != null) { /* 31 */ WindowManager.toFront(instance); /* 32 */ return; /* */ } /* 34 */ WindowManager.addWindow(this); /* 35 */ instance = this; /* 36 */ this.slider = new Scrollbar(0, Line.getWidth(), 1, 1, this.sliderRange + 1); /* 37 */ this.slider.setFocusable(false); /* */ /* 39 */ Panel panel = new Panel(); /* 40 */ int margin = IJ.isMacOSX() ? 5 : 0; /* 41 */ GridBagLayout grid = new GridBagLayout(); /* 42 */ GridBagConstraints c = new GridBagConstraints(); /* 43 */ panel.setLayout(grid); /* 44 */ c.gridx = 0; c.gridy = 0; /* 45 */ c.gridwidth = 1; /* 46 */ c.ipadx = 100; /* 47 */ c.insets = new Insets(margin, 15, margin, 5); /* 48 */ c.anchor = 10; /* 49 */ grid.setConstraints(this.slider, c); /* 50 */ panel.add(this.slider); /* 51 */ c.ipadx = 0; /* 52 */ c.gridx = 1; /* 53 */ c.insets = new Insets(margin, 5, margin, 15); /* 54 */ this.tf = new TextField("" + Line.getWidth(), 4); /* 55 */ this.tf.addTextListener(this); /* 56 */ grid.setConstraints(this.tf, c); /* 57 */ panel.add(this.tf); /* */ /* 59 */ c.gridx = 2; /* 60 */ c.insets = new Insets(margin, 25, margin, 5); /* 61 */ this.checkbox = new Checkbox("Spline Fit", isSplineFit()); /* 62 */ this.checkbox.addItemListener(this); /* 63 */ panel.add(this.checkbox); /* */ /* 65 */ add(panel, "Center"); /* 66 */ this.slider.addAdjustmentListener(this); /* 67 */ this.slider.setUnitIncrement(1); /* */ /* 69 */ pack(); /* 70 */ Point loc = Prefs.getLocation("line.loc"); /* 71 */ if (loc != null) /* 72 */ setLocation(loc); /* */ else /* 74 */ GUI.center(this); /* 75 */ setResizable(false); /* 76 */ show(); /* 77 */ this.thread = new Thread(this, "LineWidthAdjuster"); /* 78 */ this.thread.start(); /* 79 */ setup(); /* 80 */ addKeyListener(IJ.getInstance()); /* */ } /* */ /* */ public synchronized void adjustmentValueChanged(AdjustmentEvent e) { /* 84 */ this.value = this.slider.getValue(); /* 85 */ this.setText = true; /* 86 */ notify(); /* */ } /* */ /* */ public synchronized void textValueChanged(TextEvent e) { /* 90 */ int width = (int)Tools.parseDouble(this.tf.getText(), -1.0D); /* */ /* 92 */ if (width == -1) return; /* 93 */ if (width < 0) width = 1; /* 94 */ if (width != Line.getWidth()) { /* 95 */ this.slider.setValue(width); /* 96 */ this.value = width; /* 97 */ notify(); /* */ } /* */ } /* */ /* */ void setup() { /* */ } /* */ /* */ public void run() { /* 105 */ while (!this.done) /* 106 */ synchronized (this) { /* */ try { wait(); } catch (InterruptedException e) { /* */ } /* 109 */ if (this.done) return; /* 110 */ Line.setWidth(this.value); /* 111 */ if (this.setText) this.tf.setText("" + this.value); /* 112 */ this.setText = false; /* 113 */ updateRoi(); /* */ } /* */ } /* */ /* */ private static void updateRoi() /* */ { /* 119 */ ImagePlus imp = WindowManager.getCurrentImage(); /* 120 */ if (imp != null) { /* 121 */ Roi roi = imp.getRoi(); /* 122 */ if ((roi != null) && (roi.isLine())) { /* 123 */ roi.updateWideLine(Line.getWidth()); imp.draw(); return; /* */ } /* */ } /* 125 */ if (Roi.previousRoi == null) return; /* 126 */ int id = Roi.previousRoi.getImageID(); /* 127 */ if (id >= 0) return; /* 128 */ imp = WindowManager.getImage(id); /* 129 */ if (imp == null) return; /* 130 */ Roi roi = imp.getRoi(); /* 131 */ if ((roi != null) && (roi.isLine())) { /* 132 */ roi.updateWideLine(Line.getWidth()); /* 133 */ imp.draw(); /* */ } /* */ } /* */ /* */ boolean isSplineFit() { /* 138 */ ImagePlus imp = WindowManager.getCurrentImage(); /* 139 */ if (imp == null) return false; /* 140 */ Roi roi = imp.getRoi(); /* 141 */ if (roi == null) return false; /* 142 */ if (!(roi instanceof PolygonRoi)) return false; /* 143 */ return ((PolygonRoi)roi).isSplineFit(); /* */ } /* */ /* */ public void close() /* */ { /* 148 */ super.close(); /* 149 */ instance = null; /* 150 */ this.done = true; /* 151 */ Prefs.saveLocation("line.loc", getLocation()); /* 152 */ synchronized (this) { notify(); } /* */ } /* */ /* */ public void windowActivated(WindowEvent e) { /* 156 */ super.windowActivated(e); /* 157 */ this.checkbox.setState(isSplineFit()); /* */ } /* */ /* */ public void itemStateChanged(ItemEvent e) { /* 161 */ boolean selected = e.getStateChange() == 1; /* 162 */ ImagePlus imp = WindowManager.getCurrentImage(); /* 163 */ if (imp == null) { /* 164 */ this.checkbox.setState(false); return; /* 165 */ }Roi roi = imp.getRoi(); /* 166 */ if ((roi == null) || (!(roi instanceof PolygonRoi))) { /* 167 */ this.checkbox.setState(false); return; /* 168 */ }int type = roi.getType(); /* 169 */ if ((type == 3) || (type == 7)) { /* 170 */ this.checkbox.setState(false); return; /* 171 */ }PolygonRoi poly = (PolygonRoi)roi; /* 172 */ boolean splineFit = poly.isSplineFit(); /* 173 */ if ((selected) && (!splineFit)) { /* 174 */ poly.fitSpline(); imp.draw(); /* 175 */ } else if ((!selected) && (splineFit)) { /* 176 */ poly.removeSplineFit(); imp.draw(); /* */ } /* */ } /* */ /* 180 */ public static void update() { if (instance == null) return; /* 181 */ instance.checkbox.setState(instance.isSplineFit()); /* 182 */ int sliderWidth = instance.slider.getValue(); /* 183 */ int lineWidth = Line.getWidth(); /* 184 */ if ((lineWidth != sliderWidth) && (lineWidth <= 200)) { /* 185 */ instance.slider.setValue(lineWidth); /* 186 */ instance.tf.setText("" + lineWidth); /* */ } /* */ } /* */ } /* Location: /home/wahid/Downloads/webscanning/ij.jar * Qualified Name: ij.plugin.frame.LineWidthAdjuster * JD-Core Version: 0.6.2 */
UTF-8
Java
7,940
java
LineWidthAdjuster.java
Java
[]
null
[]
/* */ package ij.plugin.frame; /* */ /* */ import ij.IJ; /* */ import ij.ImagePlus; /* */ import ij.Prefs; /* */ import ij.WindowManager; /* */ import ij.gui.GUI; /* */ import ij.gui.Line; /* */ import ij.gui.PolygonRoi; /* */ import ij.gui.Roi; /* */ import ij.plugin.PlugIn; /* */ import ij.util.Tools; /* */ import java.awt.Checkbox; /* */ import java.awt.GridBagConstraints; /* */ import java.awt.GridBagLayout; /* */ import java.awt.Insets; /* */ import java.awt.Panel; /* */ import java.awt.Point; /* */ import java.awt.Scrollbar; /* */ import java.awt.TextField; /* */ import java.awt.event.AdjustmentEvent; /* */ import java.awt.event.AdjustmentListener; /* */ import java.awt.event.ItemEvent; /* */ import java.awt.event.ItemListener; /* */ import java.awt.event.TextEvent; /* */ import java.awt.event.TextListener; /* */ import java.awt.event.WindowEvent; /* */ /* */ public class LineWidthAdjuster extends PlugInFrame /* */ implements PlugIn, Runnable, AdjustmentListener, TextListener, ItemListener /* */ { /* */ public static final String LOC_KEY = "line.loc"; /* 18 */ int sliderRange = 300; /* */ Scrollbar slider; /* */ int value; /* */ boolean setText; /* */ static LineWidthAdjuster instance; /* */ Thread thread; /* */ boolean done; /* */ TextField tf; /* */ Checkbox checkbox; /* */ /* */ public LineWidthAdjuster() /* */ { /* 29 */ super("Line Width"); /* 30 */ if (instance != null) { /* 31 */ WindowManager.toFront(instance); /* 32 */ return; /* */ } /* 34 */ WindowManager.addWindow(this); /* 35 */ instance = this; /* 36 */ this.slider = new Scrollbar(0, Line.getWidth(), 1, 1, this.sliderRange + 1); /* 37 */ this.slider.setFocusable(false); /* */ /* 39 */ Panel panel = new Panel(); /* 40 */ int margin = IJ.isMacOSX() ? 5 : 0; /* 41 */ GridBagLayout grid = new GridBagLayout(); /* 42 */ GridBagConstraints c = new GridBagConstraints(); /* 43 */ panel.setLayout(grid); /* 44 */ c.gridx = 0; c.gridy = 0; /* 45 */ c.gridwidth = 1; /* 46 */ c.ipadx = 100; /* 47 */ c.insets = new Insets(margin, 15, margin, 5); /* 48 */ c.anchor = 10; /* 49 */ grid.setConstraints(this.slider, c); /* 50 */ panel.add(this.slider); /* 51 */ c.ipadx = 0; /* 52 */ c.gridx = 1; /* 53 */ c.insets = new Insets(margin, 5, margin, 15); /* 54 */ this.tf = new TextField("" + Line.getWidth(), 4); /* 55 */ this.tf.addTextListener(this); /* 56 */ grid.setConstraints(this.tf, c); /* 57 */ panel.add(this.tf); /* */ /* 59 */ c.gridx = 2; /* 60 */ c.insets = new Insets(margin, 25, margin, 5); /* 61 */ this.checkbox = new Checkbox("Spline Fit", isSplineFit()); /* 62 */ this.checkbox.addItemListener(this); /* 63 */ panel.add(this.checkbox); /* */ /* 65 */ add(panel, "Center"); /* 66 */ this.slider.addAdjustmentListener(this); /* 67 */ this.slider.setUnitIncrement(1); /* */ /* 69 */ pack(); /* 70 */ Point loc = Prefs.getLocation("line.loc"); /* 71 */ if (loc != null) /* 72 */ setLocation(loc); /* */ else /* 74 */ GUI.center(this); /* 75 */ setResizable(false); /* 76 */ show(); /* 77 */ this.thread = new Thread(this, "LineWidthAdjuster"); /* 78 */ this.thread.start(); /* 79 */ setup(); /* 80 */ addKeyListener(IJ.getInstance()); /* */ } /* */ /* */ public synchronized void adjustmentValueChanged(AdjustmentEvent e) { /* 84 */ this.value = this.slider.getValue(); /* 85 */ this.setText = true; /* 86 */ notify(); /* */ } /* */ /* */ public synchronized void textValueChanged(TextEvent e) { /* 90 */ int width = (int)Tools.parseDouble(this.tf.getText(), -1.0D); /* */ /* 92 */ if (width == -1) return; /* 93 */ if (width < 0) width = 1; /* 94 */ if (width != Line.getWidth()) { /* 95 */ this.slider.setValue(width); /* 96 */ this.value = width; /* 97 */ notify(); /* */ } /* */ } /* */ /* */ void setup() { /* */ } /* */ /* */ public void run() { /* 105 */ while (!this.done) /* 106 */ synchronized (this) { /* */ try { wait(); } catch (InterruptedException e) { /* */ } /* 109 */ if (this.done) return; /* 110 */ Line.setWidth(this.value); /* 111 */ if (this.setText) this.tf.setText("" + this.value); /* 112 */ this.setText = false; /* 113 */ updateRoi(); /* */ } /* */ } /* */ /* */ private static void updateRoi() /* */ { /* 119 */ ImagePlus imp = WindowManager.getCurrentImage(); /* 120 */ if (imp != null) { /* 121 */ Roi roi = imp.getRoi(); /* 122 */ if ((roi != null) && (roi.isLine())) { /* 123 */ roi.updateWideLine(Line.getWidth()); imp.draw(); return; /* */ } /* */ } /* 125 */ if (Roi.previousRoi == null) return; /* 126 */ int id = Roi.previousRoi.getImageID(); /* 127 */ if (id >= 0) return; /* 128 */ imp = WindowManager.getImage(id); /* 129 */ if (imp == null) return; /* 130 */ Roi roi = imp.getRoi(); /* 131 */ if ((roi != null) && (roi.isLine())) { /* 132 */ roi.updateWideLine(Line.getWidth()); /* 133 */ imp.draw(); /* */ } /* */ } /* */ /* */ boolean isSplineFit() { /* 138 */ ImagePlus imp = WindowManager.getCurrentImage(); /* 139 */ if (imp == null) return false; /* 140 */ Roi roi = imp.getRoi(); /* 141 */ if (roi == null) return false; /* 142 */ if (!(roi instanceof PolygonRoi)) return false; /* 143 */ return ((PolygonRoi)roi).isSplineFit(); /* */ } /* */ /* */ public void close() /* */ { /* 148 */ super.close(); /* 149 */ instance = null; /* 150 */ this.done = true; /* 151 */ Prefs.saveLocation("line.loc", getLocation()); /* 152 */ synchronized (this) { notify(); } /* */ } /* */ /* */ public void windowActivated(WindowEvent e) { /* 156 */ super.windowActivated(e); /* 157 */ this.checkbox.setState(isSplineFit()); /* */ } /* */ /* */ public void itemStateChanged(ItemEvent e) { /* 161 */ boolean selected = e.getStateChange() == 1; /* 162 */ ImagePlus imp = WindowManager.getCurrentImage(); /* 163 */ if (imp == null) { /* 164 */ this.checkbox.setState(false); return; /* 165 */ }Roi roi = imp.getRoi(); /* 166 */ if ((roi == null) || (!(roi instanceof PolygonRoi))) { /* 167 */ this.checkbox.setState(false); return; /* 168 */ }int type = roi.getType(); /* 169 */ if ((type == 3) || (type == 7)) { /* 170 */ this.checkbox.setState(false); return; /* 171 */ }PolygonRoi poly = (PolygonRoi)roi; /* 172 */ boolean splineFit = poly.isSplineFit(); /* 173 */ if ((selected) && (!splineFit)) { /* 174 */ poly.fitSpline(); imp.draw(); /* 175 */ } else if ((!selected) && (splineFit)) { /* 176 */ poly.removeSplineFit(); imp.draw(); /* */ } /* */ } /* */ /* 180 */ public static void update() { if (instance == null) return; /* 181 */ instance.checkbox.setState(instance.isSplineFit()); /* 182 */ int sliderWidth = instance.slider.getValue(); /* 183 */ int lineWidth = Line.getWidth(); /* 184 */ if ((lineWidth != sliderWidth) && (lineWidth <= 200)) { /* 185 */ instance.slider.setValue(lineWidth); /* 186 */ instance.tf.setText("" + lineWidth); /* */ } /* */ } /* */ } /* Location: /home/wahid/Downloads/webscanning/ij.jar * Qualified Name: ij.plugin.frame.LineWidthAdjuster * JD-Core Version: 0.6.2 */
7,940
0.511587
0.469899
211
36.635071
18.147488
90
false
false
0
0
0
0
0
0
0.819905
false
false
12
94a7422dc1312a886094f4b6b8a910dc2303da63
23,742,579,219,690
8133880267e173838d1ca6ea57fb5567b1a6e2df
/app/src/main/java/com/example/yaz_1_1/DAO/StudentDao.java
8f382f1d63734e13212666de7c9ced6a4ee47879
[]
no_license
halanch599/Spring-21-YAZ-Mobile-Uygulama
https://github.com/halanch599/Spring-21-YAZ-Mobile-Uygulama
279a4974ecf810cf82c464f1ad72f44a33b9e870
53701d70fd375bc52dae85258802ea1a1060a842
refs/heads/master
2023-04-21T01:39:10.135000
2021-05-11T07:40:32
2021-05-11T07:40:32
341,493,377
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.yaz_1_1.DAO; import androidx.lifecycle.LiveData; import androidx.room.Dao; import androidx.room.Delete; import androidx.room.Insert; import androidx.room.Query; import androidx.room.Update; import com.example.yaz_1_1.Entities.Student; import java.util.List; @Dao public interface StudentDao { @Query("SELECT * FROM Student") public LiveData<List<Student>> getAllStudents(); @Query("SELECT * FROM Student WHERE studentID = :id") public LiveData<List<Student>> getStudentById(int id); @Query("SELECT * FROM Student WHERE First_Name LIKE :name OR Last_Name LIKE :name ORDER BY First_Name, Last_Name") public LiveData<List<Student>> getStudentByName(String name); @Insert public void insert(Student student); // @Insert // public void insert(Student... student); @Delete public void delete(Student student); @Query("DELETE FROM Student") public void deleteAll(); @Update public void update(Student student); }
UTF-8
Java
1,005
java
StudentDao.java
Java
[]
null
[]
package com.example.yaz_1_1.DAO; import androidx.lifecycle.LiveData; import androidx.room.Dao; import androidx.room.Delete; import androidx.room.Insert; import androidx.room.Query; import androidx.room.Update; import com.example.yaz_1_1.Entities.Student; import java.util.List; @Dao public interface StudentDao { @Query("SELECT * FROM Student") public LiveData<List<Student>> getAllStudents(); @Query("SELECT * FROM Student WHERE studentID = :id") public LiveData<List<Student>> getStudentById(int id); @Query("SELECT * FROM Student WHERE First_Name LIKE :name OR Last_Name LIKE :name ORDER BY First_Name, Last_Name") public LiveData<List<Student>> getStudentByName(String name); @Insert public void insert(Student student); // @Insert // public void insert(Student... student); @Delete public void delete(Student student); @Query("DELETE FROM Student") public void deleteAll(); @Update public void update(Student student); }
1,005
0.715423
0.711443
41
23.512196
24.618179
118
false
false
0
0
0
0
0
0
0.439024
false
false
12
ad1d3dab07acb4030e86c0a5d1da23fd918a5462
27,127,013,449,444
9fc56c4d0921691a6f3d39100af7f653b912dbff
/service/src/main/java/com/appirio/service/MemberServiceConfiguration.java
cadcc5594533df09dbe71b1293238c2f28c7145a
[]
no_license
mhikeo-tc/ap-member-microservice
https://github.com/mhikeo-tc/ap-member-microservice
bbd639d69e19fb7998a999f6020f095e72237327
871c2e1c26082a2414a92d25cb7c760cc518fc17
refs/heads/master
2020-03-22T00:47:57.633000
2018-07-04T13:17:26
2018-07-04T13:17:26
139,264,866
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (C) 2016 TopCoder Inc., All Rights Reserved. */ package com.appirio.service; import com.appirio.clients.BaseClientConfiguration; import com.appirio.service.supply.resources.SupplyDatasourceFactory; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; import lombok.Setter; import javax.validation.Valid; import javax.validation.constraints.NotNull; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Configuration class used to load the member-service.yaml file * * <p> * v1.1 - TOPCODER - ADD SUGGEST BY HANDLE API FOR MEMBER SERVICE * <ol> * <li>Added elasticSearchUrl and maxMemberSuggestions properties</li> * </ol> * </p> * * @author mdesiderio, TCSASSEMBLER * @version 1.1 */ public class MemberServiceConfiguration extends BaseAppConfiguration { /** * Datasources */ @Valid @NotNull @JsonProperty private List<SupplyDatasourceFactory> databases = new ArrayList<SupplyDatasourceFactory>(); @Getter @Setter private String fileServiceDomain; @Getter @Setter private String dynamoDBUrl; @Getter @Setter private String memberEsIndex; @Getter @Setter private String photoURLDomain; /** * The URL of elastic search server */ @Getter @Setter private String elasticSearchUrl; /** * The maximum number of suggestions to return */ @Getter @Setter private Integer maxMemberSuggestions; /** * Url of elasticsearch */ @Getter @Setter private String elasticsearchUrl; /** * Default limit elasticsearch */ @Getter @Setter private Integer elasticsearchDefaultLimit; /** * Default limit of elasticsearch for admin search */ @Getter @Setter private Integer elasticsearchDefaultAdminLimit; /** *Flag to enable cache for nested filter of elasticsearch */ @Getter @Setter private Boolean elasticsearchCacheNestedFilter; /** * The event bus service client config field */ @Valid @NotNull @Getter @Setter private BaseClientConfiguration eventBusServiceClientConfig = new BaseClientConfiguration(); /** * The email verification config field */ @Valid @NotNull @Getter @Setter private EmailVerificationConfiguration emailVerificationConfig; /** * Get the data source factory * * @return Data source factory */ public List<SupplyDatasourceFactory> getDatabases() { return databases; } @NotNull @JsonProperty @Getter @Setter private Map<String,String> eventStrategies = new HashMap<>(); }
UTF-8
Java
2,774
java
MemberServiceConfiguration.java
Java
[ { "context": "ons properties</li>\n * </ol>\n * </p>\n *\n * @author mdesiderio, TCSASSEMBLER\n * @version 1.1\n */\npublic class Me", "end": 756, "score": 0.9996438026428223, "start": 746, "tag": "USERNAME", "value": "mdesiderio" }, { "context": "es</li>\n * </ol>\n * </p>\n *\n * @author mdesiderio, TCSASSEMBLER\n * @version 1.1\n */\npublic class MemberServiceCon", "end": 770, "score": 0.993553638458252, "start": 758, "tag": "USERNAME", "value": "TCSASSEMBLER" } ]
null
[]
/* * Copyright (C) 2016 TopCoder Inc., All Rights Reserved. */ package com.appirio.service; import com.appirio.clients.BaseClientConfiguration; import com.appirio.service.supply.resources.SupplyDatasourceFactory; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; import lombok.Setter; import javax.validation.Valid; import javax.validation.constraints.NotNull; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Configuration class used to load the member-service.yaml file * * <p> * v1.1 - TOPCODER - ADD SUGGEST BY HANDLE API FOR MEMBER SERVICE * <ol> * <li>Added elasticSearchUrl and maxMemberSuggestions properties</li> * </ol> * </p> * * @author mdesiderio, TCSASSEMBLER * @version 1.1 */ public class MemberServiceConfiguration extends BaseAppConfiguration { /** * Datasources */ @Valid @NotNull @JsonProperty private List<SupplyDatasourceFactory> databases = new ArrayList<SupplyDatasourceFactory>(); @Getter @Setter private String fileServiceDomain; @Getter @Setter private String dynamoDBUrl; @Getter @Setter private String memberEsIndex; @Getter @Setter private String photoURLDomain; /** * The URL of elastic search server */ @Getter @Setter private String elasticSearchUrl; /** * The maximum number of suggestions to return */ @Getter @Setter private Integer maxMemberSuggestions; /** * Url of elasticsearch */ @Getter @Setter private String elasticsearchUrl; /** * Default limit elasticsearch */ @Getter @Setter private Integer elasticsearchDefaultLimit; /** * Default limit of elasticsearch for admin search */ @Getter @Setter private Integer elasticsearchDefaultAdminLimit; /** *Flag to enable cache for nested filter of elasticsearch */ @Getter @Setter private Boolean elasticsearchCacheNestedFilter; /** * The event bus service client config field */ @Valid @NotNull @Getter @Setter private BaseClientConfiguration eventBusServiceClientConfig = new BaseClientConfiguration(); /** * The email verification config field */ @Valid @NotNull @Getter @Setter private EmailVerificationConfiguration emailVerificationConfig; /** * Get the data source factory * * @return Data source factory */ public List<SupplyDatasourceFactory> getDatabases() { return databases; } @NotNull @JsonProperty @Getter @Setter private Map<String,String> eventStrategies = new HashMap<>(); }
2,774
0.670512
0.667628
136
19.397058
21.117765
96
false
false
0
0
0
0
0
0
0.220588
false
false
12
c7fe37a97adaaec89290c0fcc800c665bd943230
4,209,067,963,280
cd272800860a126946dd2f026a00fcd08e92da02
/src/prototype/crawler/form/CrawledResource.java
322420418d8575c3543eff69431d1bf93c59f51e
[]
no_license
javarouka/WebCralwer
https://github.com/javarouka/WebCralwer
34052c2fca4184d646235e1bf5466c1209b53b2c
731f289c5bf67e496159fc2d398fa040debd0ca4
refs/heads/master
2016-05-28T20:06:29.408000
2013-05-10T18:04:57
2013-05-10T18:04:57
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package prototype.crawler.form; import java.io.Serializable; import java.sql.Timestamp; /** * 다운로드 리소스 Value Object * @author rouxrouka * */ public class CrawledResource implements Serializable { private static final long serialVersionUID = -6728805099064083178L; /** * 리소스아이디 */ private int id; /** * 리소스가 발견된 URL 문자열의 해쉬값 */ private String tovisitHash; /** * 리소스 용량 */ private long length; /** * 리소스의 출처 도메인 */ private String domainName; /** * 리소스가 발견된 페이지의 URL */ private String pageURL; /** * 리소스의 URL */ private String url; /** * MIME 타입 */ private String contentType; /** * 리소스 처리 상태. * kr.co.sds.dspider.form.prop.FetchProgress 참고 * */ private String progress; /** * 리소스가 저장된 로컬 패스 */ private String localPath; /** * 리소스가 입력된 시간 */ private Timestamp insertTime; /** * 리소스가 업데이트 된 시간 */ private Timestamp updateTime; /** * 리소스 URL의 해쉬값 */ private String hash; /** * 리소스 컨텐트 자체의 해쉬값 */ private String contentHash; /** * 국적 */ private String country; /** * 국적코드 */ private String countryCode; @Override public String toString() { return "url: " + url + "(" + localPath + ")"; } public String getPageURL() { return pageURL; } public void setPageURL(String pageURL) { this.pageURL = pageURL; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } public String getCountryCode() { return countryCode; } public void setCountryCode(String countryCode) { this.countryCode = countryCode; } public String getContentHash() { return contentHash; } public void setContentHash(String contentHash) { this.contentHash = contentHash; } public String getHash() { return hash; } public void setHash(String hash) { this.hash = hash; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getTovisitHash() { return tovisitHash; } public void setTovisitHash(String tovisitHash) { this.tovisitHash = tovisitHash; } public String getDomainName() { return domainName; } public void setDomainName(String domainName) { this.domainName = domainName; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getContentType() { return contentType; } public void setContentType(String contentType) { this.contentType = contentType; } public String getProgress() { return progress; } public void setProgress(String progress) { this.progress = progress; } public Timestamp getInsertTime() { return insertTime; } public void setInsertTime(Timestamp insertTime) { this.insertTime = insertTime; } public Timestamp getUpdateTime() { return updateTime; } public void setUpdateTime(Timestamp updateTime) { this.updateTime = updateTime; } public String getLocalPath() { return localPath; } public void setLocalPath(String localPath) { this.localPath = localPath; } public long getLength() { return length; } public void setLength(long length) { this.length = length; } }
UTF-8
Java
3,395
java
CrawledResource.java
Java
[ { "context": "imestamp;\n\n/**\n * 다운로드 리소스 Value Object\n * @author rouxrouka\n *\n */\npublic class CrawledResource implements Se", "end": 139, "score": 0.9996632933616638, "start": 130, "tag": "USERNAME", "value": "rouxrouka" } ]
null
[]
package prototype.crawler.form; import java.io.Serializable; import java.sql.Timestamp; /** * 다운로드 리소스 Value Object * @author rouxrouka * */ public class CrawledResource implements Serializable { private static final long serialVersionUID = -6728805099064083178L; /** * 리소스아이디 */ private int id; /** * 리소스가 발견된 URL 문자열의 해쉬값 */ private String tovisitHash; /** * 리소스 용량 */ private long length; /** * 리소스의 출처 도메인 */ private String domainName; /** * 리소스가 발견된 페이지의 URL */ private String pageURL; /** * 리소스의 URL */ private String url; /** * MIME 타입 */ private String contentType; /** * 리소스 처리 상태. * kr.co.sds.dspider.form.prop.FetchProgress 참고 * */ private String progress; /** * 리소스가 저장된 로컬 패스 */ private String localPath; /** * 리소스가 입력된 시간 */ private Timestamp insertTime; /** * 리소스가 업데이트 된 시간 */ private Timestamp updateTime; /** * 리소스 URL의 해쉬값 */ private String hash; /** * 리소스 컨텐트 자체의 해쉬값 */ private String contentHash; /** * 국적 */ private String country; /** * 국적코드 */ private String countryCode; @Override public String toString() { return "url: " + url + "(" + localPath + ")"; } public String getPageURL() { return pageURL; } public void setPageURL(String pageURL) { this.pageURL = pageURL; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } public String getCountryCode() { return countryCode; } public void setCountryCode(String countryCode) { this.countryCode = countryCode; } public String getContentHash() { return contentHash; } public void setContentHash(String contentHash) { this.contentHash = contentHash; } public String getHash() { return hash; } public void setHash(String hash) { this.hash = hash; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getTovisitHash() { return tovisitHash; } public void setTovisitHash(String tovisitHash) { this.tovisitHash = tovisitHash; } public String getDomainName() { return domainName; } public void setDomainName(String domainName) { this.domainName = domainName; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getContentType() { return contentType; } public void setContentType(String contentType) { this.contentType = contentType; } public String getProgress() { return progress; } public void setProgress(String progress) { this.progress = progress; } public Timestamp getInsertTime() { return insertTime; } public void setInsertTime(Timestamp insertTime) { this.insertTime = insertTime; } public Timestamp getUpdateTime() { return updateTime; } public void setUpdateTime(Timestamp updateTime) { this.updateTime = updateTime; } public String getLocalPath() { return localPath; } public void setLocalPath(String localPath) { this.localPath = localPath; } public long getLength() { return length; } public void setLength(long length) { this.length = length; } }
3,395
0.675135
0.669101
187
15.839572
15.00039
68
false
false
0
0
0
0
0
0
1.363636
false
false
12
e0a482745775a67a09feb741ac561714b3ebcac6
29,669,634,081,542
b73e908763e7aec1297894f7424fbe26e8b8d475
/src/main/java/com/voya/web/model/AccountValidationRequest.java
d435a595a642e0279bcec4eab30a5ed8e0909771
[]
no_license
shiva1991/Account-Validation-service-POC
https://github.com/shiva1991/Account-Validation-service-POC
e02733f43585dd72d635b3e6976350b8b837d2ca
6ece9885d67f98ceca36901c71ce34dfaad955d3
refs/heads/master
2020-03-21T03:59:16.412000
2018-06-20T20:58:35
2018-06-20T20:58:35
138,084,299
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.voya.web.model; /** * Created by manoharc on 03/06/17. */ public class AccountValidationRequest extends VoyaModal { private String lineOfBusiness; private String systemIdentifier; private String function; private String correlationId; // private AccountValidationParameters accountValidationParameters; public AccountValidationRequest() { } public AccountValidationRequest(String lineOfBusiness, String systemIdentifier, String function, String correlationId) { this.lineOfBusiness = lineOfBusiness; this.systemIdentifier = systemIdentifier; this.function = function; this.correlationId = correlationId; // this.accountValidationParameters = accountValidationParameters; } public String getLineOfBusiness() { return lineOfBusiness; } public void setLineOfBusiness(String lineOfBusiness) { this.lineOfBusiness = lineOfBusiness; } public String getSystemIdentifier() { return systemIdentifier; } public void setSystemIdentifier(String systemIdentifier) { this.systemIdentifier = systemIdentifier; } public String getFunction() { return function; } public void setFunction(String function) { this.function = function; } public String getCorrelationId() { return correlationId; } public void setCorrelationId(String correlationId) { this.correlationId = correlationId; } // public AccountValidationParameters getAccountValidationParameters() { // return accountValidationParameters; // } // // public void setAccountValidationParameters(AccountValidationParameters accountValidationParameters) { // this.accountValidationParameters = accountValidationParameters; // } }
UTF-8
Java
1,820
java
AccountValidationRequest.java
Java
[ { "context": "package com.voya.web.model;\n\n/**\n * Created by manoharc on 03/06/17.\n */\npublic class AccountValidationRe", "end": 55, "score": 0.9995511174201965, "start": 47, "tag": "USERNAME", "value": "manoharc" } ]
null
[]
package com.voya.web.model; /** * Created by manoharc on 03/06/17. */ public class AccountValidationRequest extends VoyaModal { private String lineOfBusiness; private String systemIdentifier; private String function; private String correlationId; // private AccountValidationParameters accountValidationParameters; public AccountValidationRequest() { } public AccountValidationRequest(String lineOfBusiness, String systemIdentifier, String function, String correlationId) { this.lineOfBusiness = lineOfBusiness; this.systemIdentifier = systemIdentifier; this.function = function; this.correlationId = correlationId; // this.accountValidationParameters = accountValidationParameters; } public String getLineOfBusiness() { return lineOfBusiness; } public void setLineOfBusiness(String lineOfBusiness) { this.lineOfBusiness = lineOfBusiness; } public String getSystemIdentifier() { return systemIdentifier; } public void setSystemIdentifier(String systemIdentifier) { this.systemIdentifier = systemIdentifier; } public String getFunction() { return function; } public void setFunction(String function) { this.function = function; } public String getCorrelationId() { return correlationId; } public void setCorrelationId(String correlationId) { this.correlationId = correlationId; } // public AccountValidationParameters getAccountValidationParameters() { // return accountValidationParameters; // } // // public void setAccountValidationParameters(AccountValidationParameters accountValidationParameters) { // this.accountValidationParameters = accountValidationParameters; // } }
1,820
0.715934
0.712637
63
27.888889
27.807793
124
false
false
0
0
0
0
0
0
0.380952
false
false
12
0b4b1a260628ddb1efadb648308f7ba4db1c5c9c
20,770,461,876,883
a5a34aa8653c348c515f0e43bc705fa57c6a30bd
/app/src/main/java/com/centerm/epos/ebi/present/ContractQueryPresent.java
8f01880133517cf9b816979b25ea433004ec9566
[]
no_license
bitian123/HandSetWisdomCashier
https://github.com/bitian123/HandSetWisdomCashier
e36e5c06954a498cca6efdae7852a9835c32dcb2
c5379bcdb2aab19b96d20c83b1da4d1444b667d4
refs/heads/master
2022-12-13T05:25:29.541000
2020-09-12T00:59:03
2020-09-12T00:59:03
294,842,298
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.centerm.epos.ebi.present; import android.annotation.SuppressLint; import com.centerm.cpay.midsdk.dev.DeviceFactory; import com.centerm.cpay.midsdk.dev.EnumDeviceType; import com.centerm.cpay.midsdk.dev.define.IBarCodeScanner; import com.centerm.epos.base.BaseTradePresent; import com.centerm.epos.base.ITradeView; import com.centerm.epos.common.Settings; import com.centerm.epos.ebi.transaction.EbiContractQueryTrade; import com.centerm.epos.present.transaction.IScanQRCode; import com.centerm.epos.transcation.pos.constant.TradeInformationTag; import java.text.SimpleDateFormat; import java.util.Date; /** * author:liubit</br> * date:2019/9/2</br> * @author 16240 */ public class ContractQueryPresent extends BaseTradePresent implements IScanQRCode { private String tradeDate; public ContractQueryPresent(ITradeView mTradeView) { super(mTradeView); SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); tradeDate = formatter.format(new Date()); } @SuppressLint("StaticFieldLeak") public void queryContractInfo() { transDatas.put(TradeInformationTag.TRANS_TIME, tradeDate.substring(8, 14)); transDatas.put(TradeInformationTag.TRANS_DATE, tradeDate.substring(4, 8)); new EbiContractQueryTrade().execute(mTradeView,ContractQueryPresent.this); } @Override public void onStartScanCode() { if (!Settings.bIsSettingBlueTheme()) { IBarCodeScanner dev = (IBarCodeScanner) DeviceFactory.getInstance().getDevice(EnumDeviceType.BAR_CODE_SCANNER_DEV); if (dev == null) { return; } dev.scanBarCode(mTradeView.getHostActivity()); } else { new com.centerm.epos.transcation.pos.manager.ScanCodeTrade().scanBarCode(mTradeView.getHostActivity()); } } @Override public void onGetScanCode(String code) { transDatas.put(TradeInformationTag.SCAN_CODE, code); } }
UTF-8
Java
2,049
java
ContractQueryPresent.java
Java
[ { "context": "Format;\r\nimport java.util.Date;\r\n\r\n/**\r\n * author:liubit</br>\r\n * date:2019/9/2</br>\r\n * @author 16240\r\n *", "end": 653, "score": 0.999669075012207, "start": 647, "tag": "USERNAME", "value": "liubit" }, { "context": "or:liubit</br>\r\n * date:2019/9/2</br>\r\n * @author 16240\r\n */\r\npublic class ContractQueryPresent extends B", "end": 699, "score": 0.9981517791748047, "start": 694, "tag": "USERNAME", "value": "16240" } ]
null
[]
package com.centerm.epos.ebi.present; import android.annotation.SuppressLint; import com.centerm.cpay.midsdk.dev.DeviceFactory; import com.centerm.cpay.midsdk.dev.EnumDeviceType; import com.centerm.cpay.midsdk.dev.define.IBarCodeScanner; import com.centerm.epos.base.BaseTradePresent; import com.centerm.epos.base.ITradeView; import com.centerm.epos.common.Settings; import com.centerm.epos.ebi.transaction.EbiContractQueryTrade; import com.centerm.epos.present.transaction.IScanQRCode; import com.centerm.epos.transcation.pos.constant.TradeInformationTag; import java.text.SimpleDateFormat; import java.util.Date; /** * author:liubit</br> * date:2019/9/2</br> * @author 16240 */ public class ContractQueryPresent extends BaseTradePresent implements IScanQRCode { private String tradeDate; public ContractQueryPresent(ITradeView mTradeView) { super(mTradeView); SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); tradeDate = formatter.format(new Date()); } @SuppressLint("StaticFieldLeak") public void queryContractInfo() { transDatas.put(TradeInformationTag.TRANS_TIME, tradeDate.substring(8, 14)); transDatas.put(TradeInformationTag.TRANS_DATE, tradeDate.substring(4, 8)); new EbiContractQueryTrade().execute(mTradeView,ContractQueryPresent.this); } @Override public void onStartScanCode() { if (!Settings.bIsSettingBlueTheme()) { IBarCodeScanner dev = (IBarCodeScanner) DeviceFactory.getInstance().getDevice(EnumDeviceType.BAR_CODE_SCANNER_DEV); if (dev == null) { return; } dev.scanBarCode(mTradeView.getHostActivity()); } else { new com.centerm.epos.transcation.pos.manager.ScanCodeTrade().scanBarCode(mTradeView.getHostActivity()); } } @Override public void onGetScanCode(String code) { transDatas.put(TradeInformationTag.SCAN_CODE, code); } }
2,049
0.701318
0.693509
60
32.150002
30.479406
127
false
false
0
0
0
0
0
0
0.516667
false
false
12
7e60f13609d3dee6454217c78154b7abb4af68c2
8,074,538,573,924
b0bd538b4767cbb429608e73f57aa29cdae2b7cb
/SeleniumSessions/src/testNGFramework/GoogleImplicitWait.java
ac492b8660ffef0381b3c3672af528f97e361a9c
[]
no_license
Kamila006/SeleniumPrograms
https://github.com/Kamila006/SeleniumPrograms
8cb73c782efe1b6e97dd0af01b64bb2618fbdf18
c097055b1ea05846587012e7b2dc7bae32fdeb29
refs/heads/master
2022-12-24T13:09:41.591000
2020-10-13T03:20:21
2020-10-13T03:20:21
291,387,220
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package testNGFramework; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.interactions.Actions; import org.testng.annotations.Test; public class GoogleImplicitWait { WebDriver driver; @Test public void a_pageLoad() { System.setProperty("webdriver.chrome.driver", "E://seleniumAutomation//Essentials//chromedriver_win32//chromedriver.exe"); driver = new ChromeDriver(); driver.get("https://www.google.com/"); driver.manage().window().maximize(); } @Test public void b_search() { driver.findElement(By.name("q")).sendKeys("kamila"); Actions act = new Actions(driver); act.sendKeys(Keys.ENTER).build().perform(); driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); driver.findElement(By.xpath("//h3[contains(text(),'KAMILA (@kamilaofficiel)')]")).click(); } }
UTF-8
Java
1,002
java
GoogleImplicitWait.java
Java
[ { "context": "\n\t{\r\n\t\tdriver.findElement(By.name(\"q\")).sendKeys(\"kamila\");\r\n\t\tActions act = new Actions(driver);\r\n\t\t", "end": 734, "score": 0.6770845651626587, "start": 733, "tag": "NAME", "value": "k" }, { "context": "river.findElement(By.xpath(\"//h3[contains(text(),'KAMILA (@kamilaofficiel)')]\")).click();\r\n\t}\r\n\t\r\n\r\n}\r\n", "end": 955, "score": 0.9735653400421143, "start": 949, "tag": "NAME", "value": "KAMILA" }, { "context": "findElement(By.xpath(\"//h3[contains(text(),'KAMILA (@kamilaofficiel)')]\")).click();\r\n\t}\r\n\t\r\n\r\n}\r\n", "end": 972, "score": 0.9997137188911438, "start": 956, "tag": "USERNAME", "value": "(@kamilaofficiel" } ]
null
[]
package testNGFramework; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.interactions.Actions; import org.testng.annotations.Test; public class GoogleImplicitWait { WebDriver driver; @Test public void a_pageLoad() { System.setProperty("webdriver.chrome.driver", "E://seleniumAutomation//Essentials//chromedriver_win32//chromedriver.exe"); driver = new ChromeDriver(); driver.get("https://www.google.com/"); driver.manage().window().maximize(); } @Test public void b_search() { driver.findElement(By.name("q")).sendKeys("kamila"); Actions act = new Actions(driver); act.sendKeys(Keys.ENTER).build().perform(); driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); driver.findElement(By.xpath("//h3[contains(text(),'KAMILA (@kamilaofficiel)')]")).click(); } }
1,002
0.718563
0.714571
33
28.363636
27.712614
124
false
false
0
0
0
0
0
0
1.484848
false
false
12