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
dc94f199b54f2434c652ab93a51e5087521acf4c
12,738,873,036,966
4cdf69dedd2e102c0d682f7343cfc54e163486a6
/video/src/nodebox/video/Video.java
502b233d704a4d2462a3571522dddf9c58b6d0fa
[]
no_license
VijayEluri/scenebuilder
https://github.com/VijayEluri/scenebuilder
2c5810e839d3b64a7643824a3488eec221072508
35cf8fe80c8f4260d9504522a0e535455e56043b
refs/heads/master
2020-05-20T11:09:12.218000
2013-02-19T20:26:35
2013-02-19T20:26:35
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package nodebox.video; import nodebox.node.*; import processing.core.PGraphics; @Description("Plays a video.") @Category("Video") public class Video extends Node { private static final int VIDEO_WIDTH = 320; private static final int VIDEO_HEIGHT = 240; //private static final int VIDEO_FRAME_RATE = 30; public final StringPort pFileName = new StringPort(this, "fileName", Port.Direction.INPUT); public final ImagePort pOutput = new ImagePort(this, "output", Port.Direction.OUTPUT); private processing.video.Movie video; @Override public void execute(Context context, float time) { if (video == null) { video = new processing.video.Movie(getScene().getApplet(), pFileName.get()); } video.read(); pOutput.set(video.get()); } @Override public void draw(PGraphics g, Context context, float time) { g.image(pOutput.get(), VIDEO_WIDTH, VIDEO_HEIGHT); } @Override public void deactivate() { video.stop(); video.dispose(); video = null; } }
UTF-8
Java
1,081
java
Video.java
Java
[]
null
[]
package nodebox.video; import nodebox.node.*; import processing.core.PGraphics; @Description("Plays a video.") @Category("Video") public class Video extends Node { private static final int VIDEO_WIDTH = 320; private static final int VIDEO_HEIGHT = 240; //private static final int VIDEO_FRAME_RATE = 30; public final StringPort pFileName = new StringPort(this, "fileName", Port.Direction.INPUT); public final ImagePort pOutput = new ImagePort(this, "output", Port.Direction.OUTPUT); private processing.video.Movie video; @Override public void execute(Context context, float time) { if (video == null) { video = new processing.video.Movie(getScene().getApplet(), pFileName.get()); } video.read(); pOutput.set(video.get()); } @Override public void draw(PGraphics g, Context context, float time) { g.image(pOutput.get(), VIDEO_WIDTH, VIDEO_HEIGHT); } @Override public void deactivate() { video.stop(); video.dispose(); video = null; } }
1,081
0.646623
0.639223
39
26.717949
25.967384
95
false
false
0
0
0
0
0
0
0.666667
false
false
12
8bb51b5ed63d71201897316bf45e711526b73828
343,597,409,963
5fc1b82b0e9d75bb00007b5d979b7d46214bd413
/app/models/Permissao.java
c90417a3382e49f6314716589bb0abc487e0edd7
[]
no_license
djuniorscjr/sse
https://github.com/djuniorscjr/sse
de61bd92cbeaf085ca9ca1e5c88372bf6f98b9dd
e3d55b4404896d3cbfa9732298cce6314ca42feb
refs/heads/master
2021-01-13T00:16:15.931000
2015-07-16T10:02:01
2015-07-16T10:02:01
36,746,377
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package models; /** * Created by Domingos Junior on 29/05/2015. */ public enum Permissao { ADMINISTRADOR ("Administrador"), COORDENADOR ("Coordenador"), PROFESSOR_DISCIPLINA ("Professor da Disciplina"), PROFESSOR_ORIENTADOR ("Professor Orientador"), ALUNO ("Aluno"), SEM_ACESSO ("Sem Acesso"); public String descricao; private Permissao(String descricao){ this.descricao = descricao; } @Override public String toString() { return "Permissao{" + "descricao='" + descricao + '\'' + '}'; } }
UTF-8
Java
650
java
Permissao.java
Java
[ { "context": "package models;\n\n/**\n * Created by Domingos Junior on 29/05/2015.\n */\npublic enum Permissao {\n AD", "end": 50, "score": 0.9998737573623657, "start": 35, "tag": "NAME", "value": "Domingos Junior" } ]
null
[]
package models; /** * Created by <NAME> on 29/05/2015. */ public enum Permissao { ADMINISTRADOR ("Administrador"), COORDENADOR ("Coordenador"), PROFESSOR_DISCIPLINA ("Professor da Disciplina"), PROFESSOR_ORIENTADOR ("Professor Orientador"), ALUNO ("Aluno"), SEM_ACESSO ("Sem Acesso"); public String descricao; private Permissao(String descricao){ this.descricao = descricao; } @Override public String toString() { return "Permissao{" + "descricao='" + descricao + '\'' + '}'; } }
641
0.544615
0.532308
26
24
19.106987
56
false
false
0
0
0
0
0
0
0.384615
false
false
12
c0dbea98ae261ea73000960bfc430dfea0f58755
6,339,371,755,992
c19779e4354a0ffc87e16a876556680e3c04649c
/src/main/java/com/yanzhongxin/zhihu/async/handler/LoginExceptionHandler.java
4848b2fd0aaea99c52481bd9376b3ecc2bc241c4
[]
no_license
zxc-98/zhihu-1
https://github.com/zxc-98/zhihu-1
967acbaf0264a96f4d479a09c163f4314e04a5bc
079090d1b4116a2910749a47f71d03f0b932cd0e
refs/heads/master
2022-02-27T16:27:21.285000
2019-02-14T12:20:52
2019-02-14T12:20:52
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yanzhongxin.zhihu.async.handler; import com.yanzhongxin.zhihu.async.EventHandler; import com.yanzhongxin.zhihu.async.EventModel; import com.yanzhongxin.zhihu.async.EventType; import com.yanzhongxin.zhihu.util.MailSender; import com.yanzhongxin.zhihu.util.SendEmailUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @Component public class LoginExceptionHandler implements EventHandler { @Override public void doHandle(EventModel model) { // xxxx判断发现这个用户登陆异常 /* Map<String, Object> map = new HashMap<String, Object>(); map.put("username", model.getExt("username")); mailSender.sendWithHTMLTemplate(model.getExt("email"), "登陆IP异常", "mails/login_exception.html", map); */ //SendEmailUtil.sendMail(model.getExt("email"),"知乎账号安全提醒","知乎网管理员提醒:尊敬的知友"+model.getExt("username")+"您的账号异常登录,如非本人操作,请尽快修改密码"); } @Override public List<EventType> getSupportEventTypes() { return Arrays.asList(EventType.LOGIN); } }
UTF-8
Java
1,279
java
LoginExceptionHandler.java
Java
[ { "context": "ect>();\n map.put(\"username\", model.getExt(\"username\"));\n mailSender.sendWithHTMLTemplate(model", "end": 774, "score": 0.9509596824645996, "start": 766, "tag": "USERNAME", "value": "username" } ]
null
[]
package com.yanzhongxin.zhihu.async.handler; import com.yanzhongxin.zhihu.async.EventHandler; import com.yanzhongxin.zhihu.async.EventModel; import com.yanzhongxin.zhihu.async.EventType; import com.yanzhongxin.zhihu.util.MailSender; import com.yanzhongxin.zhihu.util.SendEmailUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @Component public class LoginExceptionHandler implements EventHandler { @Override public void doHandle(EventModel model) { // xxxx判断发现这个用户登陆异常 /* Map<String, Object> map = new HashMap<String, Object>(); map.put("username", model.getExt("username")); mailSender.sendWithHTMLTemplate(model.getExt("email"), "登陆IP异常", "mails/login_exception.html", map); */ //SendEmailUtil.sendMail(model.getExt("email"),"知乎账号安全提醒","知乎网管理员提醒:尊敬的知友"+model.getExt("username")+"您的账号异常登录,如非本人操作,请尽快修改密码"); } @Override public List<EventType> getSupportEventTypes() { return Arrays.asList(EventType.LOGIN); } }
1,279
0.74503
0.74503
39
28.666666
31.037888
135
false
false
0
0
0
0
0
0
0.641026
false
false
12
29fb54dbd733900110464fa93451d8a517f67277
6,339,371,753,220
9ef9bfce2b3958ba74e5c6917a2a579ca87579ff
/src/SortStack.java
36433ccbf6dc03b7b8916118973e4486a98332f0
[]
no_license
Nourico/JavaSandbox
https://github.com/Nourico/JavaSandbox
74107580db834a6f0368234a9903cec0f7a3c74a
1ddf61bf5f019b479f076113dbdc640878c2e231
refs/heads/master
2021-09-11T15:56:04.460000
2018-04-09T16:25:33
2018-04-09T16:25:33
113,335,891
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Stack; public class SortStack { public static Stack sort(Stack<Integer> s){ if (!s.isEmpty()) { int v = s.pop(); sort(s); sink (v, s); } return s; } public static void sink(int num, Stack<Integer> s) { if (!s.isEmpty() && num < s.peek()) { int v = s.pop(); sink(num, s); s.push(v); } if (s.isEmpty() || num > s.peek()) s.push(num); } public static void main(String[] args) { Stack<Integer> s = new Stack<>(); s.push(11); s.push(2); s.push(32); s.push(3); s.push(41); sort(s); System.out.println(); } }
UTF-8
Java
631
java
SortStack.java
Java
[]
null
[]
import java.util.Stack; public class SortStack { public static Stack sort(Stack<Integer> s){ if (!s.isEmpty()) { int v = s.pop(); sort(s); sink (v, s); } return s; } public static void sink(int num, Stack<Integer> s) { if (!s.isEmpty() && num < s.peek()) { int v = s.pop(); sink(num, s); s.push(v); } if (s.isEmpty() || num > s.peek()) s.push(num); } public static void main(String[] args) { Stack<Integer> s = new Stack<>(); s.push(11); s.push(2); s.push(32); s.push(3); s.push(41); sort(s); System.out.println(); } }
631
0.505547
0.492868
39
14.179487
13.850616
53
false
false
0
0
0
0
0
0
2.205128
false
false
12
e99e9c3b746e24d46794efbb3c0d5724a01db13f
25,314,537,265,905
eb9f655206c43c12b497c667ba56a0d358b6bc3a
/platform/core-api/src/com/intellij/psi/tree/ICustomParsingType.java
a7653dc93643374a1b3e27867abce931892d7490
[ "Apache-2.0" ]
permissive
JetBrains/intellij-community
https://github.com/JetBrains/intellij-community
2ed226e200ecc17c037dcddd4a006de56cd43941
05dbd4575d01a213f3f4d69aa4968473f2536142
refs/heads/master
2023-09-03T17:06:37.560000
2023-09-03T11:51:00
2023-09-03T12:12:27
2,489,216
16,288
6,635
Apache-2.0
false
2023-09-12T07:41:58
2011-09-30T13:33:05
2023-09-12T03:37:30
2023-09-12T06:46:46
4,523,919
15,754
4,972
237
null
false
false
/* * Copyright 2000-2016 JetBrains s.r.o. * * 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.intellij.psi.tree; import com.intellij.lang.ASTNode; import com.intellij.util.CharTable; import org.jetbrains.annotations.NotNull; /** * An additional interface to be implemented by {@link IElementType} instances for tokens which are more convenient to parse separately. * Parsing is done when leaf elements are created.<p/> * * Use this for cases similar to {@link ILazyParseableElementType}, but when its default implementation isn't sufficient. * For example, default lazy-parseable elements can't be stub-based (see {@link com.intellij.psi.stubs.IStubElementType}), * while {@link ICustomParsingType} gives you flexibility to achieve that in conjunction with {@link ILazyParseableElementTypeBase}. */ public interface ICustomParsingType { /** * Invoked by {@link com.intellij.lang.PsiBuilder} when it finds a token of this type, * instead of creating the leaf element for it in a default way. * @param text token text * @param table {@link CharTable} object used for interning string in the file * @return a tree element of this type with a given text. */ @NotNull ASTNode parse(@NotNull CharSequence text, @NotNull CharTable table); }
UTF-8
Java
1,787
java
ICustomParsingType.java
Java
[]
null
[]
/* * Copyright 2000-2016 JetBrains s.r.o. * * 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.intellij.psi.tree; import com.intellij.lang.ASTNode; import com.intellij.util.CharTable; import org.jetbrains.annotations.NotNull; /** * An additional interface to be implemented by {@link IElementType} instances for tokens which are more convenient to parse separately. * Parsing is done when leaf elements are created.<p/> * * Use this for cases similar to {@link ILazyParseableElementType}, but when its default implementation isn't sufficient. * For example, default lazy-parseable elements can't be stub-based (see {@link com.intellij.psi.stubs.IStubElementType}), * while {@link ICustomParsingType} gives you flexibility to achieve that in conjunction with {@link ILazyParseableElementTypeBase}. */ public interface ICustomParsingType { /** * Invoked by {@link com.intellij.lang.PsiBuilder} when it finds a token of this type, * instead of creating the leaf element for it in a default way. * @param text token text * @param table {@link CharTable} object used for interning string in the file * @return a tree element of this type with a given text. */ @NotNull ASTNode parse(@NotNull CharSequence text, @NotNull CharTable table); }
1,787
0.753777
0.747062
41
42.585365
39.31485
136
false
false
0
0
0
0
0
0
0.365854
false
false
12
aa831eff5253dbffbd5bce03f55775c3b59fe4d4
3,229,815,409,710
3927a897839cc159fc8523e921f0734d78aa50ea
/Laboration2/src/laboration2/Person.java
d22baef8ec4b492e034f0d5e4908766ab651f337
[]
no_license
seagrove/java_chatt
https://github.com/seagrove/java_chatt
327f90a2ce686bd509c168de4e856908345d4eb0
7659374b590cf9ccf1910b3badd57aae615e7a38
refs/heads/master
2020-04-25T18:20:57.802000
2019-03-18T19:39:02
2019-03-18T19:39:02
172,981,354
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package laboration2; /** * Java II Laboration 1 2016-09-28 * * @author Albin */ public class Person { String nickname; String fullname; String lastIp; /** * Skapar en person * * @param nickname * @param fullname * @param ip */ public void createPerson(String nickname, String fullname, String ip) { this.nickname = nickname; this.fullname = fullname; this.lastIp = ip; } }
UTF-8
Java
486
java
Person.java
Java
[ { "context": " * Java II Laboration 1 2016-09-28\r\n *\r\n * @author Albin\r\n */\r\npublic class Person {\r\n\r\n String nicknam", "end": 85, "score": 0.9993520975112915, "start": 80, "tag": "NAME", "value": "Albin" }, { "context": "**\r\n * Skapar en person\r\n *\r\n ...
null
[]
package laboration2; /** * Java II Laboration 1 2016-09-28 * * @author Albin */ public class Person { String nickname; String fullname; String lastIp; /** * Skapar en person * * @param nickname * @param fullname * @param ip */ public void createPerson(String nickname, String fullname, String ip) { this.nickname = nickname; this.fullname = fullname; this.lastIp = ip; } }
486
0.55144
0.530864
27
16
15.90248
75
false
false
0
0
0
0
0
0
0.333333
false
false
12
6c05c0bb759130a3a4bf5cc85a05c75e32647f98
1,760,936,626,523
981df8aa31bf62db3b9b4e34b5833f95ef4bd590
/xworker_core/src/main/java/xworker/lang/actions/thing/ThingIterator.java
1f03181f32db770face45c3a29afa95cd2696a06
[ "Apache-2.0" ]
permissive
x-meta/xworker
https://github.com/x-meta/xworker
638c7cd935f0a55d81f57e330185fbde9dce9319
430fba081a78b5d3871669bf6fcb1e952ad258b2
refs/heads/master
2022-12-22T11:44:10.363000
2021-10-15T00:57:10
2021-10-15T01:00:24
217,432,322
1
0
Apache-2.0
false
2022-12-12T23:21:16
2019-10-25T02:13:51
2021-10-15T01:31:41
2022-12-12T23:21:14
135,831
0
0
42
Java
false
false
/******************************************************************************* * Copyright 2007-2013 See AUTHORS file. * * 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 xworker.lang.actions.thing; import java.util.Iterator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.xmeta.Category; import org.xmeta.Thing; import org.xmeta.ThingManager; import org.xmeta.World; @SuppressWarnings("unchecked") public class ThingIterator implements Iterator { private static Logger logger = LoggerFactory.getLogger(ThingIterator.class); World world = World.getInstance(); Thing self = null; String[] paths = null; private boolean hasNext = false; Iterator<Thing> currentIter = null; Thing nextThing = null; int pathIndex = 0; public ThingIterator(Thing self, String paths){ this.self = self; this.paths = paths.split("[,]"); initNext(); } private void initNext(){ if(currentIter != null && currentIter.hasNext()){ hasNext = true; return; } while(true){ if(pathIndex >= paths.length){ hasNext = false; return; } String path = paths[pathIndex].trim(); pathIndex++; if("".equals(path)){ continue; } if(path.indexOf(":") != -1){ String thingManagerName = path.substring(0, path.indexOf(":")); path = path.substring(path.indexOf(":") + 1, path.length()); ThingManager thingManager = world.getThingManager(thingManagerName); if(thingManager == null){ logger.info("ThingCollectionIterator: thingManager is null, name=" + thingManagerName + ",thing=" + self.getMetadata().getPath()); continue; }else{ Category category = thingManager.getCategory(path); if(category != null){ Iterator<Thing> iter = category.iterator(true); if(iter.hasNext()){ hasNext = true; currentIter = iter; return; } }else{ Thing thing = thingManager.getThing(path); if(thing != null){ currentIter = null; nextThing = thing; hasNext = true; return; } } } }else{ Object obj = world.get(path); if(obj == null){ logger.info("ThingCollections: the object of path is null, path=" + path + ",thing=" + self.getMetadata().getPath()); continue; }else if(obj instanceof Category){ Iterator<Thing> iter = ((Category) obj).iterator(true); if(iter.hasNext()){ hasNext = true; nextThing = null; currentIter = iter; return; } }else if(obj instanceof Thing){ currentIter = null; nextThing = (Thing) obj; hasNext = true; return; } } } } @Override public boolean hasNext() { return hasNext; } @Override public Thing next() { if(hasNext){ Thing thing = null; if(currentIter != null){ thing = currentIter.next(); }else{ thing = nextThing; nextThing = null; } initNext(); return thing; }else{ return null; } } @Override public void remove() { } }
UTF-8
Java
3,728
java
ThingIterator.java
Java
[]
null
[]
/******************************************************************************* * Copyright 2007-2013 See AUTHORS file. * * 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 xworker.lang.actions.thing; import java.util.Iterator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.xmeta.Category; import org.xmeta.Thing; import org.xmeta.ThingManager; import org.xmeta.World; @SuppressWarnings("unchecked") public class ThingIterator implements Iterator { private static Logger logger = LoggerFactory.getLogger(ThingIterator.class); World world = World.getInstance(); Thing self = null; String[] paths = null; private boolean hasNext = false; Iterator<Thing> currentIter = null; Thing nextThing = null; int pathIndex = 0; public ThingIterator(Thing self, String paths){ this.self = self; this.paths = paths.split("[,]"); initNext(); } private void initNext(){ if(currentIter != null && currentIter.hasNext()){ hasNext = true; return; } while(true){ if(pathIndex >= paths.length){ hasNext = false; return; } String path = paths[pathIndex].trim(); pathIndex++; if("".equals(path)){ continue; } if(path.indexOf(":") != -1){ String thingManagerName = path.substring(0, path.indexOf(":")); path = path.substring(path.indexOf(":") + 1, path.length()); ThingManager thingManager = world.getThingManager(thingManagerName); if(thingManager == null){ logger.info("ThingCollectionIterator: thingManager is null, name=" + thingManagerName + ",thing=" + self.getMetadata().getPath()); continue; }else{ Category category = thingManager.getCategory(path); if(category != null){ Iterator<Thing> iter = category.iterator(true); if(iter.hasNext()){ hasNext = true; currentIter = iter; return; } }else{ Thing thing = thingManager.getThing(path); if(thing != null){ currentIter = null; nextThing = thing; hasNext = true; return; } } } }else{ Object obj = world.get(path); if(obj == null){ logger.info("ThingCollections: the object of path is null, path=" + path + ",thing=" + self.getMetadata().getPath()); continue; }else if(obj instanceof Category){ Iterator<Thing> iter = ((Category) obj).iterator(true); if(iter.hasNext()){ hasNext = true; nextThing = null; currentIter = iter; return; } }else if(obj instanceof Thing){ currentIter = null; nextThing = (Thing) obj; hasNext = true; return; } } } } @Override public boolean hasNext() { return hasNext; } @Override public Thing next() { if(hasNext){ Thing thing = null; if(currentIter != null){ thing = currentIter.next(); }else{ thing = nextThing; nextThing = null; } initNext(); return thing; }else{ return null; } } @Override public void remove() { } }
3,728
0.593884
0.589056
142
24.267605
23.510237
135
false
false
0
0
0
0
0
0
3.232394
false
false
12
f9a4b6ad3003d005fe430d582173db50832333dd
1,322,849,965,066
1124eaf1cbc5d963f5af1e099f2358bac256149d
/Project3_Fitness/Eclipse/Pknu3/src/main/java/com/pknu/notice/vo/ContentVo.java
94cc9c173cc23f911f786ec8589e3a6f49e1a3d8
[]
no_license
dawn-choi/Dawn-Choi
https://github.com/dawn-choi/Dawn-Choi
7eb83875f09af04b61b8b7b350158436999a3ded
cb7da21e39943a17bf68ae4e2403886184836f64
refs/heads/master
2023-01-09T20:46:40.196000
2020-11-09T14:17:21
2020-11-09T14:17:21
293,512,480
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.pknu.notice.vo; public class ContentVo { private String mname; private String regdate; private String menu_name; private String title; private String cont; private String menu_id; public String getMname() { return mname; } public void setMname(String mname) { this.mname = mname; } public String getRegdate() { return regdate; } public void setRegdate(String regdate) { this.regdate = regdate; } public String getMenu_name() { return menu_name; } public void setMenu_name(String menu_name) { this.menu_name = menu_name; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getCont() { return cont; } public void setCont(String cont) { this.cont = cont; } public String getMenu_id() { return menu_id; } public void setMenu_id(String menu_id) { this.menu_id = menu_id; } }
UTF-8
Java
916
java
ContentVo.java
Java
[]
null
[]
package com.pknu.notice.vo; public class ContentVo { private String mname; private String regdate; private String menu_name; private String title; private String cont; private String menu_id; public String getMname() { return mname; } public void setMname(String mname) { this.mname = mname; } public String getRegdate() { return regdate; } public void setRegdate(String regdate) { this.regdate = regdate; } public String getMenu_name() { return menu_name; } public void setMenu_name(String menu_name) { this.menu_name = menu_name; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getCont() { return cont; } public void setCont(String cont) { this.cont = cont; } public String getMenu_id() { return menu_id; } public void setMenu_id(String menu_id) { this.menu_id = menu_id; } }
916
0.686681
0.686681
53
16.283018
13.452049
45
false
false
0
0
0
0
0
0
1.490566
false
false
12
0e4435af759fdb87e6bcfbe15575b55243ed39dd
27,427,661,176,102
f04abf9c30cb7d7d46c44a531b1c21758f351845
/StockManagement/app/src/main/java/avia/stockmanagement/RentItems.java
69afd3893ca2b222a24d2e3199064baea289dd70
[]
no_license
rmit-s3503261-pattarathon-watanakij/AIVA
https://github.com/rmit-s3503261-pattarathon-watanakij/AIVA
55a752ee153b0377add9ac75803899158aa23ee4
3b0f2f68c8a329fc5e6a211af4bc84264c281f65
refs/heads/master
2021-01-10T05:15:08.968000
2015-12-24T08:20:30
2015-12-24T08:20:30
48,521,873
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package avia.stockmanagement; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.view.Menu; import android.view.MenuItem; /** * Created by GT70 on 27-Nov-15. */ public class RentItems extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /* Link with the layout */ setContentView(R.layout.activity_rent); /* Start Implement */ } /* Other Methods */ }
UTF-8
Java
581
java
RentItems.java
Java
[ { "context": "\nimport android.view.MenuItem;\n\n\n/**\n * Created by GT70 on 27-Nov-15.\n */\npublic class RentItems extends ", "end": 254, "score": 0.9994850158691406, "start": 250, "tag": "USERNAME", "value": "GT70" } ]
null
[]
package avia.stockmanagement; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.view.Menu; import android.view.MenuItem; /** * Created by GT70 on 27-Nov-15. */ public class RentItems extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /* Link with the layout */ setContentView(R.layout.activity_rent); /* Start Implement */ } /* Other Methods */ }
581
0.703959
0.690189
30
18.366667
18.721615
54
false
false
0
0
0
0
0
0
0.3
false
false
12
7c6a893c562370f05a1d1d37b3a1a62c5c682a78
13,469,017,465,898
89e420b5007fcc2d3c9dff1d4495b5effc87c8a4
/src/com/test/application/LongestSeq.java
6bc04cb213478692ebe2adbfb7c39ecf798fd230
[]
no_license
sudhir-ahirkar/practice-condign-example
https://github.com/sudhir-ahirkar/practice-condign-example
a2461dec38c5ca40b8662bcc79dbf17eebcfeec8
b5b11222c9cad5247e688206544cc23b05fa44b0
refs/heads/master
2023-02-03T06:58:27.659000
2023-01-30T09:28:17
2023-01-30T09:28:17
195,607,968
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.test.application; public class LongestSeq { // Variables to keep track of maximum // length and starting point of // maximum length. And same for current // length. static void getLongestSeq(int a[], int n) { int maxIdx = 0, maxLen = 0, currLen = 0, currIdx = 0; for (int k = 0; k < n; k++) { if (a[k] > 0) { currLen++; // New sequence, store // beginning index. if (currLen == 1) currIdx = k; } else { if (currLen > maxLen) { maxLen = currLen; maxIdx = currIdx; } currLen = 0; } } if (maxLen > 0) { System.out.print( "Length " + maxLen) ; System.out.print( ",starting index " + maxIdx ); } else System.out.println("No positive sequence detected.") ; return; } // Driver code public static void main (String[] args) { int arr[] = { 1, 2, -3, 2, 3, 4, -6, 1, 2, 3, 4, 5, -8, 5, 6 }; int n = arr.length; getLongestSeq(arr, n); } }
UTF-8
Java
1,140
java
LongestSeq.java
Java
[]
null
[]
package com.test.application; public class LongestSeq { // Variables to keep track of maximum // length and starting point of // maximum length. And same for current // length. static void getLongestSeq(int a[], int n) { int maxIdx = 0, maxLen = 0, currLen = 0, currIdx = 0; for (int k = 0; k < n; k++) { if (a[k] > 0) { currLen++; // New sequence, store // beginning index. if (currLen == 1) currIdx = k; } else { if (currLen > maxLen) { maxLen = currLen; maxIdx = currIdx; } currLen = 0; } } if (maxLen > 0) { System.out.print( "Length " + maxLen) ; System.out.print( ",starting index " + maxIdx ); } else System.out.println("No positive sequence detected.") ; return; } // Driver code public static void main (String[] args) { int arr[] = { 1, 2, -3, 2, 3, 4, -6, 1, 2, 3, 4, 5, -8, 5, 6 }; int n = arr.length; getLongestSeq(arr, n); } }
1,140
0.468421
0.447368
54
20.111111
17.099564
61
false
false
0
0
0
0
0
0
0.685185
false
false
12
bfdcbbaedcdda53c784fd98e53e5b035c73e2397
11,501,922,445,823
69ff70994c9c2f3ae3bb018b1ee4883c122d1130
/src/main/java/poligons/Rectangle.java
c4b9b5c325a265155f04aa17a707779d48055e9b
[]
no_license
ilievieru/Composite
https://github.com/ilievieru/Composite
8ae944f378598fe4fc70e93dafd19625621cbc43
cf57a923937f6fb915d1e1c513d6f88eaa0008ff
refs/heads/master
2020-12-24T20:52:47.853000
2016-05-06T11:41:56
2016-05-06T11:41:56
57,296,219
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/*<summary> This is a specific class witch creates a rectangle. It has two constructors, one for a standard rectangle, and one for a specific rectangle. Also it has a testPoints method witch checks if the points respect certain conditions for creating a rectangle More precise this method checks if the length si different from width. </summary> */ package poligons; import Exceptions.WrongPointsExceptions; import Visitor.Visitor; import base.Point; /** * Created by V3790149 on 4/26/2016. */ public class Rectangle extends Poligon implements java.io.Serializable { public Rectangle(){ } //length is Horizontal length and width is vertical length public Rectangle(float length, float width, Point start) { super(start); this.name = "Rectangle"; this.length = length; this.width = width; points = new Point[4]; points[0] = new Point(start.getX(), start.getY()); points[1] = new Point(start.getX() + length, start.getY()); points[2] = new Point(start.getX() + length, start.getY() - width); points[3] = new Point(start.getX(), start.getY() - width); } public Rectangle(Point[] p) { super(p); this.name = "Rectangle"; if (!testPoints(points)) throw new WrongPointsExceptions("Fail"); } @Override public Boolean testPoints(Point[] points) { if (points[1].getX() - points[0].getX() != points[2].getX() - points[3].getX()) return false; if (points[0].getY() - points[3].getY() != points[1].getY() - points[2].getY()) return false; return true; } public Rectangle setSize(float length, float width){ if(length>0 && width>0){ this.length = length; this.width = width; }else System.out.println("Wrong size! "); Rectangle r = new Rectangle(length,width,start); return r; } @Override public String draw() { String rezultat = "Rectangle:"; System.out.println("Rectangle:"); for (int i = 0; i < points.length; i++) { System.out.println(" Punctul " + i + "(" + points[i].getX() + ", " + points[i].getY() + ")"); rezultat = rezultat + " \nPunctul " + i + "(" + points[i].getX() + ", " + points[i].getY() + ")"; } return rezultat; } @Override public void accept(Visitor visitor) { System.out.println("serializare:\n"); visitor.serialize(this); System.out.println("Deserializare:\n "); visitor.deserialize(this); } }
UTF-8
Java
2,604
java
Rectangle.java
Java
[ { "context": "tor.Visitor;\nimport base.Point;\n\n/**\n * Created by V3790149 on 4/26/2016.\n */\npublic class Rectangle extends ", "end": 478, "score": 0.9992525577545166, "start": 470, "tag": "USERNAME", "value": "V3790149" } ]
null
[]
/*<summary> This is a specific class witch creates a rectangle. It has two constructors, one for a standard rectangle, and one for a specific rectangle. Also it has a testPoints method witch checks if the points respect certain conditions for creating a rectangle More precise this method checks if the length si different from width. </summary> */ package poligons; import Exceptions.WrongPointsExceptions; import Visitor.Visitor; import base.Point; /** * Created by V3790149 on 4/26/2016. */ public class Rectangle extends Poligon implements java.io.Serializable { public Rectangle(){ } //length is Horizontal length and width is vertical length public Rectangle(float length, float width, Point start) { super(start); this.name = "Rectangle"; this.length = length; this.width = width; points = new Point[4]; points[0] = new Point(start.getX(), start.getY()); points[1] = new Point(start.getX() + length, start.getY()); points[2] = new Point(start.getX() + length, start.getY() - width); points[3] = new Point(start.getX(), start.getY() - width); } public Rectangle(Point[] p) { super(p); this.name = "Rectangle"; if (!testPoints(points)) throw new WrongPointsExceptions("Fail"); } @Override public Boolean testPoints(Point[] points) { if (points[1].getX() - points[0].getX() != points[2].getX() - points[3].getX()) return false; if (points[0].getY() - points[3].getY() != points[1].getY() - points[2].getY()) return false; return true; } public Rectangle setSize(float length, float width){ if(length>0 && width>0){ this.length = length; this.width = width; }else System.out.println("Wrong size! "); Rectangle r = new Rectangle(length,width,start); return r; } @Override public String draw() { String rezultat = "Rectangle:"; System.out.println("Rectangle:"); for (int i = 0; i < points.length; i++) { System.out.println(" Punctul " + i + "(" + points[i].getX() + ", " + points[i].getY() + ")"); rezultat = rezultat + " \nPunctul " + i + "(" + points[i].getX() + ", " + points[i].getY() + ")"; } return rezultat; } @Override public void accept(Visitor visitor) { System.out.println("serializare:\n"); visitor.serialize(this); System.out.println("Deserializare:\n "); visitor.deserialize(this); } }
2,604
0.595238
0.583717
76
33.263157
29.843172
130
false
false
0
0
0
0
0
0
0.631579
false
false
12
18ab292c476581332a320187c96e947da4d0f84b
17,832,704,236,963
c4f40a5c8ccee79676914b85d7e2cb42a0b30225
/comparator/src/comparator/runners/JavaZipRunner.java
65e0c9a899a4aab4bc2c82f4a201c97e2cc8db4d
[]
no_license
DRA2840/compareCompacters
https://github.com/DRA2840/compareCompacters
66b35544d9eb4ca4b187b75a94d9112fc739d8fa
523443a3f1cd540f7c4c4d3b3bf6b297524ecab0
refs/heads/master
2016-08-06T04:06:53.432000
2015-09-02T02:49:27
2015-09-02T02:49:27
34,020,124
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package comparator.runners; import java.io.File; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; import org.apache.commons.io.IOUtils; public class JavaZipRunner implements Runner{ public void compress(File input, File output, int compressionLevel) { ZipOutputStream zip; try { zip = new ZipOutputStream(new FileOutputStream(output)); ZipEntry entry = new ZipEntry(input.getPath()); zip.putNextEntry(entry); zip.write(IOUtils.toByteArray(new FileReader(input))); } catch (IOException e) { e.printStackTrace(); } } public String runnerDescription() { return "Java Zip"; } }
UTF-8
Java
724
java
JavaZipRunner.java
Java
[]
null
[]
package comparator.runners; import java.io.File; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; import org.apache.commons.io.IOUtils; public class JavaZipRunner implements Runner{ public void compress(File input, File output, int compressionLevel) { ZipOutputStream zip; try { zip = new ZipOutputStream(new FileOutputStream(output)); ZipEntry entry = new ZipEntry(input.getPath()); zip.putNextEntry(entry); zip.write(IOUtils.toByteArray(new FileReader(input))); } catch (IOException e) { e.printStackTrace(); } } public String runnerDescription() { return "Java Zip"; } }
724
0.744475
0.744475
32
21.625
19.869495
70
false
false
0
0
0
0
0
0
1.59375
false
false
12
e8a0e8992e1b42ad0d9f54b165198def62286b11
15,633,680,979,749
896fabf7f0f4a754ad11f816a853f31b4e776927
/opera-mini-handler-dex2jar.jar/com/admarvel/android/ads/m$x.java
a1f03dca66f437a98c1dad79f5e591d52aecc52c
[]
no_license
messarju/operamin-decompile
https://github.com/messarju/operamin-decompile
f7b803daf80620ec476b354d6aaabddb509bc6da
418f008602f0d0988cf7ebe2ac1741333ba3df83
refs/heads/main
2023-07-04T04:48:46.770000
2021-08-09T12:13:17
2021-08-09T12:04:45
394,273,979
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// // Decompiled by Procyon v0.6-prerelease // package com.admarvel.android.ads; import android.annotation.TargetApi; import com.admarvel.android.util.Logging; import android.util.Log; import java.lang.ref.WeakReference; class m$x implements Runnable { private final WeakReference a; private final WeakReference b; private int c; private int d; private int e; private int f; public m$x(final m m, final d d, final int c, final int d2, final int e, final int f) { this.a = new WeakReference((T)m); this.b = new WeakReference((T)d); this.c = c; this.d = d2; this.e = e; this.f = f; } @TargetApi(14) @Override public void run() { while (true) { while (true) { try { final m m = (m)this.a.get(); final d d = (d)this.b.get(); if (m == null) { break; } if (d == null) { return; } if (m != null) { final a a = (a)m.findViewWithTag((Object)(m.s + "EMBEDDED_VIDEO")); if (a != null) { a.a(this.e, this.f, this.c, this.d); a.i(); return; } break; } } catch (Exception ex) { Logging.log(Log.getStackTraceString((Throwable)ex)); return; } final a a = null; continue; } } } }
UTF-8
Java
1,738
java
m$x.java
Java
[]
null
[]
// // Decompiled by Procyon v0.6-prerelease // package com.admarvel.android.ads; import android.annotation.TargetApi; import com.admarvel.android.util.Logging; import android.util.Log; import java.lang.ref.WeakReference; class m$x implements Runnable { private final WeakReference a; private final WeakReference b; private int c; private int d; private int e; private int f; public m$x(final m m, final d d, final int c, final int d2, final int e, final int f) { this.a = new WeakReference((T)m); this.b = new WeakReference((T)d); this.c = c; this.d = d2; this.e = e; this.f = f; } @TargetApi(14) @Override public void run() { while (true) { while (true) { try { final m m = (m)this.a.get(); final d d = (d)this.b.get(); if (m == null) { break; } if (d == null) { return; } if (m != null) { final a a = (a)m.findViewWithTag((Object)(m.s + "EMBEDDED_VIDEO")); if (a != null) { a.a(this.e, this.f, this.c, this.d); a.i(); return; } break; } } catch (Exception ex) { Logging.log(Log.getStackTraceString((Throwable)ex)); return; } final a a = null; continue; } } } }
1,738
0.411968
0.408516
63
26.587301
18.980053
91
false
false
0
0
0
0
0
0
0.603175
false
false
12
29545a2164c2530a15c1f3c1ddc40021a16338e8
15,195,594,314,063
71f8a5b947940c7cc5e26e18d42e70092c974032
/javayh-health-monitor-client/src/main/java/com/javayh/health/monitor/client/heart/HeartbeatClient.java
b3df02a950326980a666f3fd4c57e3ba2c796afa
[ "Apache-2.0" ]
permissive
shuihuaWu/health-monitor
https://github.com/shuihuaWu/health-monitor
76314af08a138df22c4b95060bf63848f333e69b
b3396e55543a8ba228b035dd542eb902cf4f038d
refs/heads/main
2023-04-10T08:10:29.878000
2021-04-21T07:13:04
2021-04-21T07:13:04
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.javayh.health.monitor.client.heart; import com.javayh.health.monitor.client.handler.ClientHandleInitializer; import com.javayh.health.monitor.client.properties.HeartbeatClientProperties; import io.netty.bootstrap.Bootstrap; import io.netty.channel.ChannelFuture; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; /** * <p> * 客户端 * </p> * * @version 1.0.0 * @author Dylan-haiji * @since 2020/3/10 */ public class HeartbeatClient { private final static Logger LOGGER = LoggerFactory.getLogger(HeartbeatClient.class); private EventLoopGroup group = new NioEventLoopGroup(); private SocketChannel socketChannel; /** * 启动类 * @throws InterruptedException * * @PostConstruct */ public void start(HeartbeatClientProperties properties) throws InterruptedException { Bootstrap bootstrap = new Bootstrap(); /* * NioSocketChannel用于创建客户端通道,而不是NioServerSocketChannel。 * 请注意,我们不像在ServerBootstrap中那样使用childOption(),因为客户端SocketChannel没有父服务器。 */ bootstrap.group(group).channel(NioSocketChannel.class) .handler(new ClientHandleInitializer()); /* * 启动客户端 我们应该调用connect()方法而不是bind()方法。 */ ChannelFuture future = bootstrap .connect(properties.getHost(), properties.getPort()).sync(); if (future.isSuccess()) { LOGGER.info("启动 Java有货 Health Monitor Client 成功"); } socketChannel = (SocketChannel) future.channel(); future.channel().closeFuture().sync(); } /** * 销毁 @PreDestroy */ public void destroy() { group.shutdownGracefully().syncUninterruptibly(); LOGGER.info("关闭 Java有货 Health Monitor Client 成功"); } }
UTF-8
Java
2,076
java
HeartbeatClient.java
Java
[ { "context": "<p>\n * 客户端\n * </p>\n *\n * @version 1.0.0\n * @author Dylan-haiji\n * @since 2020/3/10\n */\npublic class HeartbeatCli", "end": 728, "score": 0.9996223449707031, "start": 717, "tag": "NAME", "value": "Dylan-haiji" } ]
null
[]
package com.javayh.health.monitor.client.heart; import com.javayh.health.monitor.client.handler.ClientHandleInitializer; import com.javayh.health.monitor.client.properties.HeartbeatClientProperties; import io.netty.bootstrap.Bootstrap; import io.netty.channel.ChannelFuture; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; /** * <p> * 客户端 * </p> * * @version 1.0.0 * @author Dylan-haiji * @since 2020/3/10 */ public class HeartbeatClient { private final static Logger LOGGER = LoggerFactory.getLogger(HeartbeatClient.class); private EventLoopGroup group = new NioEventLoopGroup(); private SocketChannel socketChannel; /** * 启动类 * @throws InterruptedException * * @PostConstruct */ public void start(HeartbeatClientProperties properties) throws InterruptedException { Bootstrap bootstrap = new Bootstrap(); /* * NioSocketChannel用于创建客户端通道,而不是NioServerSocketChannel。 * 请注意,我们不像在ServerBootstrap中那样使用childOption(),因为客户端SocketChannel没有父服务器。 */ bootstrap.group(group).channel(NioSocketChannel.class) .handler(new ClientHandleInitializer()); /* * 启动客户端 我们应该调用connect()方法而不是bind()方法。 */ ChannelFuture future = bootstrap .connect(properties.getHost(), properties.getPort()).sync(); if (future.isSuccess()) { LOGGER.info("启动 Java有货 Health Monitor Client 成功"); } socketChannel = (SocketChannel) future.channel(); future.channel().closeFuture().sync(); } /** * 销毁 @PreDestroy */ public void destroy() { group.shutdownGracefully().syncUninterruptibly(); LOGGER.info("关闭 Java有货 Health Monitor Client 成功"); } }
2,076
0.76096
0.754697
69
26.768116
24.658916
86
false
false
0
0
0
0
0
0
1.246377
false
false
12
3cbd6137540f8060b5d0ce9ef6f221941fa1fb6d
21,122,649,201,535
db938541d9caa3e607ca778de4a4950cb17cde6a
/app/src/main/java/com/example/xmn_android/SaleOrderLine.java
6b17bb4e2290e80779fea081bc6591bd6c454cdc
[]
no_license
namminhd/e-store_mobile_app
https://github.com/namminhd/e-store_mobile_app
a9b551dcf04113a853c7190a8d258f78ac3ebd66
b6ca16348f7f8a181d899e4edb9a17bc3001bb67
refs/heads/master
2022-03-07T09:53:06.339000
2019-07-12T16:07:48
2019-07-12T16:07:48
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.xmn_android; import com.google.gson.annotations.SerializedName; import java.sql.Date; public class SaleOrderLine { @SerializedName("id") private Integer id; @SerializedName("product_id") private Integer product_id; @SerializedName("order_id") private Integer order_id; @SerializedName("quantity") private Integer quantity; @SerializedName("price_unit") private float price_unit; public SaleOrderLine(Integer product_id, Integer quantity, float price_unit) { this.product_id = product_id; this.quantity = quantity; this.price_unit = price_unit; } }
UTF-8
Java
644
java
SaleOrderLine.java
Java
[]
null
[]
package com.example.xmn_android; import com.google.gson.annotations.SerializedName; import java.sql.Date; public class SaleOrderLine { @SerializedName("id") private Integer id; @SerializedName("product_id") private Integer product_id; @SerializedName("order_id") private Integer order_id; @SerializedName("quantity") private Integer quantity; @SerializedName("price_unit") private float price_unit; public SaleOrderLine(Integer product_id, Integer quantity, float price_unit) { this.product_id = product_id; this.quantity = quantity; this.price_unit = price_unit; } }
644
0.695652
0.695652
24
25.833334
18.31135
82
false
false
0
0
0
0
0
0
0.541667
false
false
12
7b57c4d9cf72a881b2304a1f0db30e58821a510c
18,863,496,386,782
9681006afc89c9487075325cdde6d3d7199d249b
/src/Number.java
73992e04b8caaada7e8b80e5e53147d7c47cc482
[]
no_license
mohammadtavakoli78/2048
https://github.com/mohammadtavakoli78/2048
4cc9a578f3493c16ae5c138a6a57d479bf5d03af
bb22d5d1d5ffb63d44178cbe50d51ded5122acbf
refs/heads/master
2020-07-28T23:42:37.772000
2019-09-19T15:15:55
2019-09-19T15:15:55
209,583,100
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.awt.*; public class Number { private int number=0; private Color color; public Number(){ this(0); } public Number(int number){ this.number=number; } public int getNumber(){ return number; } public void setNumber(int number){ this.number=number; } public Color getColor(){ switch (number){ case 2 : color=new Color(0x85913D); break; case 4 : color=new Color(0x917E0C); break; case 8 : color=new Color(0x91551E); break; case 16 : color=new Color(0x91446B); break; case 32 : color=new Color(0x914229); break; case 64 : color=new Color(0x5E9091); break; case 128 : color=new Color(0x1B9132); break; case 256 : color=new Color(0x6B7E91); break; case 512 : color=new Color(0x91492B); break; case 1024 : color=new Color(0x918D8A); break; case 2048 : color=new Color(0x910054); break; } return color; } }
UTF-8
Java
1,047
java
Number.java
Java
[]
null
[]
import java.awt.*; public class Number { private int number=0; private Color color; public Number(){ this(0); } public Number(int number){ this.number=number; } public int getNumber(){ return number; } public void setNumber(int number){ this.number=number; } public Color getColor(){ switch (number){ case 2 : color=new Color(0x85913D); break; case 4 : color=new Color(0x917E0C); break; case 8 : color=new Color(0x91551E); break; case 16 : color=new Color(0x91446B); break; case 32 : color=new Color(0x914229); break; case 64 : color=new Color(0x5E9091); break; case 128 : color=new Color(0x1B9132); break; case 256 : color=new Color(0x6B7E91); break; case 512 : color=new Color(0x91492B); break; case 1024 : color=new Color(0x918D8A); break; case 2048 : color=new Color(0x910054); break; } return color; } }
1,047
0.563515
0.47469
35
28.914286
20.08037
57
false
false
0
0
0
0
0
0
0.857143
false
false
12
47e6ecea5f19ae84a71904077cf5a456bbb05b96
30,717,606,168,587
f9814d9b3f49f1c81f6274474d64ce40bcc05bd4
/src/main/java/com/carlkuesters/textscraping/controller/model/WordDTOMapper.java
3071f093494f0072e30ffac4f28a25f99e6ac1e7
[]
no_license
carlkuesters/text-scraping
https://github.com/carlkuesters/text-scraping
b69512a42b4579c8e2e0284b9e55178279b6f3eb
352213378f2b27a270049f1af2b0c79de5d36e51
refs/heads/master
2021-01-08T10:16:16.993000
2021-01-06T10:42:37
2021-01-06T10:42:37
241,999,613
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.carlkuesters.textscraping.controller.model; import com.carlkuesters.textscraping.database.schema.Word; import java.util.List; import java.util.stream.Collectors; public class WordDTOMapper { public List<String> map(List<Word> words) { return words.stream() .map(Word::getWord) .collect(Collectors.toList()); } }
UTF-8
Java
376
java
WordDTOMapper.java
Java
[]
null
[]
package com.carlkuesters.textscraping.controller.model; import com.carlkuesters.textscraping.database.schema.Word; import java.util.List; import java.util.stream.Collectors; public class WordDTOMapper { public List<String> map(List<Word> words) { return words.stream() .map(Word::getWord) .collect(Collectors.toList()); } }
376
0.68617
0.68617
15
24.066668
20.993544
58
false
false
0
0
0
0
0
0
0.333333
false
false
12
dd165435df07d7952ca7538b076746b7124f8d28
12,747,462,968,244
0358988081c056e8d3126e990cbae4d70825d28e
/app/src/main/java/com/example/firebasechatdemo/activities/SettingsActivity.java
f259aa13db819259b0649dee048717855e32e5c4
[]
no_license
etman55/FirebaseChatDemo
https://github.com/etman55/FirebaseChatDemo
2dd5f7bd8e3c3295524047d0948633454ad50e28
2f6dc6b752af624f50f430b259589d7da42e2a3e
refs/heads/master
2021-01-02T08:38:48.482000
2017-08-02T16:30:03
2017-08-02T16:30:03
99,040,053
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.firebasechatdemo.activities; import android.Manifest; import android.app.ProgressDialog; import android.content.Intent; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import com.example.android.firebasechatdemo.R; import com.example.firebasechatdemo.utils.DocumentHelper; import com.example.firebasechatdemo.utils.ImageUtils; import com.example.firebasechatdemo.utils.PicassoCache; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.StorageReference; import com.google.firebase.storage.UploadTask; import com.squareup.picasso.Callback; import com.squareup.picasso.NetworkPolicy; import com.squareup.picasso.Picasso; import java.io.File; import java.util.HashMap; import java.util.Map; import butterknife.Bind; import butterknife.ButterKnife; import butterknife.OnClick; import de.hdodenhof.circleimageview.CircleImageView; public class SettingsActivity extends AppCompatActivity { private static final int PICK_IMAGE = 1; private static final String TAG = SettingsActivity.class.getSimpleName(); private static final int MAX_LENGTH = 10; private static final int MY_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE = 9001; @Bind(R.id.avatar) CircleImageView circleImageView; @Bind(R.id.display_name_txt) TextView mDisplayName; @Bind(R.id.status_txt) TextView mStatus; @Bind(R.id.change_img) Button mChangeImageBtn; @Bind(R.id.change_status) Button mChangeStatusBtn; private Uri imagePath; private DatabaseReference mUserDatabase; private FirebaseUser mCurrentUser; private StorageReference mStorageRef; private ProgressDialog mProgressDialog; private String uId; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); ButterKnife.bind(this); mStorageRef = FirebaseStorage.getInstance().getReferenceFromUrl("gs://fir-chatdemo-14d66.appspot.com/"); mCurrentUser = FirebaseAuth.getInstance().getCurrentUser(); uId = mCurrentUser.getUid(); mUserDatabase = FirebaseDatabase.getInstance().getReference() .child("Users").child(uId); mUserDatabase.keepSynced(true); mUserDatabase.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { String name = dataSnapshot.child("name").getValue().toString(); final String image = dataSnapshot.child("image").getValue().toString(); String status = dataSnapshot.child("status").getValue().toString(); String thumbImage = dataSnapshot.child("thumb_image").getValue().toString(); PicassoCache.get(SettingsActivity.this) .load(image) .networkPolicy(NetworkPolicy.OFFLINE) .placeholder(R.mipmap.default_avatar) .resizeDimen(R.dimen.user_avatar_size, R.dimen.user_avatar_size) .centerCrop() .into(circleImageView, new Callback() { @Override public void onSuccess() { } @Override public void onError() { Picasso.with(SettingsActivity.this) .load(image) .placeholder(R.mipmap.default_avatar) .resizeDimen(R.dimen.user_avatar_size, R.dimen.user_avatar_size) .centerCrop() .into(circleImageView); } }); mDisplayName.setText(name); mStatus.setText(status); } @Override public void onCancelled(DatabaseError databaseError) { } }); } @OnClick(R.id.change_status) void changeStatus() { String status = mStatus.getText().toString().trim(); Intent i = new Intent(SettingsActivity.this, StatusActivity.class); i.putExtra("status", status); startActivity(i); finish(); } @OnClick(R.id.change_img) void changeImage() { if (ContextCompat.checkSelfPermission(SettingsActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(SettingsActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, MY_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE); } else { Intent getIntent = new Intent(Intent.ACTION_GET_CONTENT); getIntent.setType("image/*"); startActivityForResult(getIntent, PICK_IMAGE); } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == PICK_IMAGE) if (resultCode == RESULT_OK) { imagePath = data.getData(); if (data.getData() != null) { showLoading(); String filePath = DocumentHelper.getPath(this, imagePath); final Uri file = Uri.fromFile(new File(ImageUtils.compressImage(filePath))); StorageReference fileStorage = mStorageRef.child("profile_images"). child("profile_" + mCurrentUser.getUid() + ".jpg"); final StorageReference thumbStorage = mStorageRef.child("profile_images") .child("thumbs").child("profile_" + mCurrentUser.getUid() + ".jpg"); fileStorage.putFile(imagePath).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() { @Override public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { final String downloadUrl = taskSnapshot.getDownloadUrl().toString(); UploadTask uploadTask = thumbStorage.putFile(file); uploadTask.addOnCompleteListener(new OnCompleteListener<UploadTask.TaskSnapshot>() { @Override public void onComplete(@NonNull Task<UploadTask.TaskSnapshot> task) { String thumbUrl = task.getResult().getDownloadUrl().toString(); if (task.isSuccessful()) { Map updateHash = new HashMap(); updateHash.put("image", downloadUrl); updateHash.put("thumb_image", thumbUrl); mUserDatabase.updateChildren(updateHash). addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { mProgressDialog.dismiss(); if (!task.isSuccessful()) { Log.d(TAG, "onFailure: " + task.getException()); Toast.makeText(SettingsActivity.this, task.getException().toString(), Toast.LENGTH_SHORT).show(); } } }); } else { Log.d(TAG, "onFailure: " + task.getException()); mProgressDialog.dismiss(); Toast.makeText(SettingsActivity.this, task.getException().toString(), Toast.LENGTH_SHORT).show(); } } }); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception exception) { Log.d(TAG, "onFailure: " + exception.getMessage()); mProgressDialog.dismiss(); Toast.makeText(SettingsActivity.this, exception.getMessage(), Toast.LENGTH_SHORT).show(); } }); } } super.onActivityResult(requestCode, resultCode, data); } private void showLoading() { mProgressDialog = new ProgressDialog(SettingsActivity.this); mProgressDialog.setTitle("Saving Image"); mProgressDialog.setMessage("Loading Please wait!"); mProgressDialog.show(); } @Override public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { switch (requestCode) { case MY_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE: { // If request is cancelled, the result arrays are empty. if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { Intent getIntent = new Intent(Intent.ACTION_GET_CONTENT); getIntent.setType("image/*"); startActivityForResult(getIntent, PICK_IMAGE); } else { Toast.makeText(SettingsActivity.this, "You should grant permission to proceed", Toast.LENGTH_SHORT).show(); } return; } } } }
UTF-8
Java
11,185
java
SettingsActivity.java
Java
[]
null
[]
package com.example.firebasechatdemo.activities; import android.Manifest; import android.app.ProgressDialog; import android.content.Intent; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import com.example.android.firebasechatdemo.R; import com.example.firebasechatdemo.utils.DocumentHelper; import com.example.firebasechatdemo.utils.ImageUtils; import com.example.firebasechatdemo.utils.PicassoCache; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import com.google.firebase.storage.FirebaseStorage; import com.google.firebase.storage.StorageReference; import com.google.firebase.storage.UploadTask; import com.squareup.picasso.Callback; import com.squareup.picasso.NetworkPolicy; import com.squareup.picasso.Picasso; import java.io.File; import java.util.HashMap; import java.util.Map; import butterknife.Bind; import butterknife.ButterKnife; import butterknife.OnClick; import de.hdodenhof.circleimageview.CircleImageView; public class SettingsActivity extends AppCompatActivity { private static final int PICK_IMAGE = 1; private static final String TAG = SettingsActivity.class.getSimpleName(); private static final int MAX_LENGTH = 10; private static final int MY_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE = 9001; @Bind(R.id.avatar) CircleImageView circleImageView; @Bind(R.id.display_name_txt) TextView mDisplayName; @Bind(R.id.status_txt) TextView mStatus; @Bind(R.id.change_img) Button mChangeImageBtn; @Bind(R.id.change_status) Button mChangeStatusBtn; private Uri imagePath; private DatabaseReference mUserDatabase; private FirebaseUser mCurrentUser; private StorageReference mStorageRef; private ProgressDialog mProgressDialog; private String uId; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); ButterKnife.bind(this); mStorageRef = FirebaseStorage.getInstance().getReferenceFromUrl("gs://fir-chatdemo-14d66.appspot.com/"); mCurrentUser = FirebaseAuth.getInstance().getCurrentUser(); uId = mCurrentUser.getUid(); mUserDatabase = FirebaseDatabase.getInstance().getReference() .child("Users").child(uId); mUserDatabase.keepSynced(true); mUserDatabase.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { String name = dataSnapshot.child("name").getValue().toString(); final String image = dataSnapshot.child("image").getValue().toString(); String status = dataSnapshot.child("status").getValue().toString(); String thumbImage = dataSnapshot.child("thumb_image").getValue().toString(); PicassoCache.get(SettingsActivity.this) .load(image) .networkPolicy(NetworkPolicy.OFFLINE) .placeholder(R.mipmap.default_avatar) .resizeDimen(R.dimen.user_avatar_size, R.dimen.user_avatar_size) .centerCrop() .into(circleImageView, new Callback() { @Override public void onSuccess() { } @Override public void onError() { Picasso.with(SettingsActivity.this) .load(image) .placeholder(R.mipmap.default_avatar) .resizeDimen(R.dimen.user_avatar_size, R.dimen.user_avatar_size) .centerCrop() .into(circleImageView); } }); mDisplayName.setText(name); mStatus.setText(status); } @Override public void onCancelled(DatabaseError databaseError) { } }); } @OnClick(R.id.change_status) void changeStatus() { String status = mStatus.getText().toString().trim(); Intent i = new Intent(SettingsActivity.this, StatusActivity.class); i.putExtra("status", status); startActivity(i); finish(); } @OnClick(R.id.change_img) void changeImage() { if (ContextCompat.checkSelfPermission(SettingsActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(SettingsActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, MY_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE); } else { Intent getIntent = new Intent(Intent.ACTION_GET_CONTENT); getIntent.setType("image/*"); startActivityForResult(getIntent, PICK_IMAGE); } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == PICK_IMAGE) if (resultCode == RESULT_OK) { imagePath = data.getData(); if (data.getData() != null) { showLoading(); String filePath = DocumentHelper.getPath(this, imagePath); final Uri file = Uri.fromFile(new File(ImageUtils.compressImage(filePath))); StorageReference fileStorage = mStorageRef.child("profile_images"). child("profile_" + mCurrentUser.getUid() + ".jpg"); final StorageReference thumbStorage = mStorageRef.child("profile_images") .child("thumbs").child("profile_" + mCurrentUser.getUid() + ".jpg"); fileStorage.putFile(imagePath).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() { @Override public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { final String downloadUrl = taskSnapshot.getDownloadUrl().toString(); UploadTask uploadTask = thumbStorage.putFile(file); uploadTask.addOnCompleteListener(new OnCompleteListener<UploadTask.TaskSnapshot>() { @Override public void onComplete(@NonNull Task<UploadTask.TaskSnapshot> task) { String thumbUrl = task.getResult().getDownloadUrl().toString(); if (task.isSuccessful()) { Map updateHash = new HashMap(); updateHash.put("image", downloadUrl); updateHash.put("thumb_image", thumbUrl); mUserDatabase.updateChildren(updateHash). addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { mProgressDialog.dismiss(); if (!task.isSuccessful()) { Log.d(TAG, "onFailure: " + task.getException()); Toast.makeText(SettingsActivity.this, task.getException().toString(), Toast.LENGTH_SHORT).show(); } } }); } else { Log.d(TAG, "onFailure: " + task.getException()); mProgressDialog.dismiss(); Toast.makeText(SettingsActivity.this, task.getException().toString(), Toast.LENGTH_SHORT).show(); } } }); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception exception) { Log.d(TAG, "onFailure: " + exception.getMessage()); mProgressDialog.dismiss(); Toast.makeText(SettingsActivity.this, exception.getMessage(), Toast.LENGTH_SHORT).show(); } }); } } super.onActivityResult(requestCode, resultCode, data); } private void showLoading() { mProgressDialog = new ProgressDialog(SettingsActivity.this); mProgressDialog.setTitle("Saving Image"); mProgressDialog.setMessage("Loading Please wait!"); mProgressDialog.show(); } @Override public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { switch (requestCode) { case MY_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE: { // If request is cancelled, the result arrays are empty. if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { Intent getIntent = new Intent(Intent.ACTION_GET_CONTENT); getIntent.setType("image/*"); startActivityForResult(getIntent, PICK_IMAGE); } else { Toast.makeText(SettingsActivity.this, "You should grant permission to proceed", Toast.LENGTH_SHORT).show(); } return; } } } }
11,185
0.558158
0.556728
234
46.799145
28.527506
129
false
false
0
0
0
0
0
0
0.636752
false
false
12
bf78085bdeaf4a8a9e830a6edbf34966020065b5
34,093,450,402,939
3b046ae6220933ad74aa32001eb11983d2784558
/src/test/java/com/qf/SpringTest.java
4a142adf5f7554b8e876ac5c682d0755963e8a2c
[]
no_license
xubingh/day11.06.53ssm2
https://github.com/xubingh/day11.06.53ssm2
f95aaa1e1ed363cfa95e5a6a0bef122eeedb11cc
a77514192a989a641bea1629b3d131d51738573f
refs/heads/master
2022-12-24T01:01:07.620000
2019-11-08T08:49:59
2019-11-08T08:49:59
220,418,687
0
0
null
false
2022-12-16T00:42:56
2019-11-08T08:12:49
2019-11-08T08:50:16
2022-12-16T00:42:53
146
0
0
9
Java
false
false
package com.qf; import com.qf.entity.Account; import com.qf.service.AccountService; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import java.util.List; public class SpringTest { @Test public void run(){ // 加载配置文件 ApplicationContext ac = new ClassPathXmlApplicationContext("spring-context.xml"); // 获取对象 AccountService as = (AccountService) ac.getBean("accountService",AccountService.class); // 调用方法 as.findByall(); } }
UTF-8
Java
620
java
SpringTest.java
Java
[]
null
[]
package com.qf; import com.qf.entity.Account; import com.qf.service.AccountService; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import java.util.List; public class SpringTest { @Test public void run(){ // 加载配置文件 ApplicationContext ac = new ClassPathXmlApplicationContext("spring-context.xml"); // 获取对象 AccountService as = (AccountService) ac.getBean("accountService",AccountService.class); // 调用方法 as.findByall(); } }
620
0.717905
0.717905
23
24.73913
27.305386
95
false
false
0
0
0
0
0
0
0.478261
false
false
12
566ac2292e12fdfeb68b3432e173ae2afea3d4ed
24,094,766,570,479
61cecb9baa4ae82e4f3df452f60214844ff83802
/Termite/src/intransix/osm/termite/render/edit/EditLayer.java
46f4392918fd75c3ebc414126d3cbea54c91f5e4
[]
no_license
scharada/osm-termite
https://github.com/scharada/osm-termite
9e0bed3f6487e8a93f6c17e8b78c539c3d4377a1
28201a781c71259ebbfcf29b4927112e64f18cd6
refs/heads/master
2021-01-10T20:51:12.921000
2013-10-18T21:46:22
2013-10-18T21:46:22
33,818,774
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package intransix.osm.termite.render.edit; import intransix.osm.termite.map.workingdata.OsmData; import intransix.osm.termite.map.workingdata.OsmWay; import intransix.osm.termite.map.workingdata.OsmNode; import intransix.osm.termite.app.edit.data.VirtualNode; import intransix.osm.termite.app.edit.action.*; import intransix.osm.termite.app.edit.*; import intransix.osm.termite.app.edit.editobject.EditObject; import intransix.osm.termite.app.edit.snapobject.SnapObject; import java.awt.Graphics2D; import java.awt.geom.*; import java.awt.event.*; import intransix.osm.termite.render.MapPanel; import intransix.osm.termite.app.maplayer.MapLayer; import java.util.List; import intransix.osm.termite.app.edit.EditManager; import intransix.osm.termite.app.viewregion.ViewRegionManager; /** * This layer controls the user interaction with the active map data. It is designed * to run with the editor modes for the Select Tool, Node Tool and Way Tool. * * @author sutter */ public class EditLayer extends MapLayer implements MouseListener, MouseMotionListener, KeyListener { //========================= // Properties //========================= // <editor-fold defaultstate="collapsed" desc="Properties"> public final static double SNAP_RADIUS_PIXELS = 4; private EditManager editManager; private OsmData osmData; private StyleInfo styleInfo = new StyleInfo(); private MouseClickAction mouseClickAction; private MouseMoveAction moveMouseMoveAction; private MouseMoveAction snapMouseMoveAction; // </editor-fold> //========================= // Public Methods //========================= public EditLayer(EditManager editManager) { this.editManager = editManager; this.setName("Edit Layer"); this.setOrder(MapLayer.ORDER_EDIT_MARKINGS); } // <editor-fold defaultstate="collapsed" desc="Accessors"> /** This method sets the edit mode. */ public void setMouseClickAction(MouseClickAction mouseClickAction) { this.mouseClickAction = mouseClickAction; } public void setMouseMoveActions(MouseMoveAction moveMouseMoveAction, MouseMoveAction snapMouseMoveAction) { this.moveMouseMoveAction = moveMouseMoveAction; this.snapMouseMoveAction = snapMouseMoveAction; } /** This mode sets the edit layer active. */ @Override public void setActiveState(boolean isActive) { super.setActiveState(isActive); MapPanel mapPanel = this.getMapPanel(); if(mapPanel != null) { if(isActive) { mapPanel.addMouseListener(this); mapPanel.addMouseMotionListener(this); mapPanel.addKeyListener(this); } else { mapPanel.removeMouseListener(this); mapPanel.removeMouseMotionListener(this); mapPanel.removeKeyListener(this); } } } // </editor-fold> // <editor-fold defaultstate="collapsed" desc="Render"> /** This method renders the edit state. */ @Override public void render(Graphics2D g2) { AffineTransform mercatorToPixels = getViewRegionManager().getMercatorToPixels(); Style style; //render selection List<Object> selection = editManager.getSelection(); List<Integer> selectedWayNodes = editManager.getSelectedWayNodes(); style = styleInfo.SELECT_STYLE; for(Object selectObject:selection) { if(selectObject instanceof OsmNode) { EditDrawable.renderPoint(g2, mercatorToPixels, ((OsmNode)selectObject).getPoint(),style); } else if(selectObject instanceof OsmWay) { EditDrawable.renderWay(g2, mercatorToPixels,(OsmWay)selectObject,style); //if this is a unique selected way, plot the selected nodes in the way if(selection.size() == 1) { OsmWay way = (OsmWay)selectObject; for(Integer index:selectedWayNodes) { if((index > -1)&&(index < way.getNodes().size())) { OsmNode node = way.getNodes().get(index); EditDrawable.renderPoint(g2, mercatorToPixels, node.getPoint(),style); } } } } else if(selectObject instanceof VirtualNode) { EditDrawable.renderPoint(g2, mercatorToPixels,((VirtualNode)selectObject).point,style); } } //render hover List<SnapObject> snapObjects = editManager.getSnapObjects(); int activeSnapObject = editManager.getActiveSnapObject(); if((activeSnapObject != -1)&&(activeSnapObject < snapObjects.size())) { //System.out.println(("cnt = " + snapObjects.size() + "; active = " + activeSnapObject)); SnapObject snapObject = snapObjects.get(activeSnapObject); //System.out.println(snapObject); snapObject.render(g2, mercatorToPixels,styleInfo); } //render pending objects List<EditObject> pendingObjects = editManager.getPendingObjects(); for(EditObject editObject:pendingObjects) { editObject.render(g2, mercatorToPixels, styleInfo); } } // </editor-fold> // <editor-fold defaultstate="collapsed" desc="Mouse Listeners"> @Override public void mouseClicked(MouseEvent e) { AffineTransform pixelsToMercator = getViewRegionManager().getPixelsToMercator(); Point2D mouseMerc = new Point2D.Double(e.getX(),e.getY()); pixelsToMercator.transform(mouseMerc, mouseMerc); if(e.getButton() == MouseEvent.BUTTON1) { if(mouseClickAction != null) { //let the mouse edit action handle the press mouseClickAction.mousePressed(mouseMerc,e); } } } @Override public void mouseDragged(MouseEvent e) { //no edit move with mouse drag - explicit move command needed } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { editManager.clearPreview(); } @Override public void mouseMoved(MouseEvent e) { //read mouse location in global coordinates ViewRegionManager viewRegionManager = getViewRegionManager(); AffineTransform pixelsToMercator = viewRegionManager.getPixelsToMercator(); Point2D mouseMerc = new Point2D.Double(e.getX(),e.getY()); pixelsToMercator.transform(mouseMerc, mouseMerc); double scalePixelsPerMerc = viewRegionManager.getZoomScalePixelsPerMerc(); double mercRad = SNAP_RADIUS_PIXELS / scalePixelsPerMerc; double mercRadSq = mercRad * mercRad; //handle a move preview if(moveMouseMoveAction != null) { moveMouseMoveAction.mouseMoved(mouseMerc,mercRadSq,e); } //get the snap nodes for the move if(snapMouseMoveAction != null) { snapMouseMoveAction.mouseMoved(mouseMerc,mercRadSq,e); } } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } // </editor-fold> // <editor-fold defaultstate="collapsed" desc="Key Listener"> /** Handle the key typed event from the text field. */ @Override public void keyTyped(KeyEvent e) { } /** Handle the key-pressed event from the text field. */ @Override public void keyPressed(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_COMMA) { SnapSelectAction snapSelectAction = new SnapSelectAction(editManager); snapSelectAction.nextSnapOject(); } else if(e.getKeyCode() == KeyEvent.VK_PERIOD) { SnapSelectAction snapSelectAction = new SnapSelectAction(editManager); snapSelectAction.previousSnapObject(); } else if(e.getKeyCode() == KeyEvent.VK_M) { SelectEditorMode sem = editManager.getSelectEditorMode(); if(sem.getModeEnabled()) { if(!sem.isInMoveState()) { sem.setMoveState(); } } } else if(e.getKeyCode() == KeyEvent.VK_ESCAPE) { SelectEditorMode sem = editManager.getSelectEditorMode(); if(sem.getModeActive()) { if(sem.isInMoveState()) { sem.setSelectState(); } } else { WayEditorMode wem = editManager.getWayEditorMode(); if(wem.getModeActive()) { wem.resetWayEdit(); } } } else if(e.getKeyCode() == KeyEvent.VK_DELETE) { DeleteSelectionAction deleteSelectionAction = new DeleteSelectionAction(editManager); deleteSelectionAction.deleteSelection(); } } /** Handle the key-released event from the text field. */ @Override public void keyReleased(KeyEvent e) { } // </editor-fold> //============================ // Private Methods //============================ }
UTF-8
Java
8,326
java
EditLayer.java
Java
[ { "context": "ect Tool, Node Tool and Way Tool.\r\n * \r\n * @author sutter\r\n */\r\npublic class EditLayer extends MapLayer imp", "end": 997, "score": 0.9654344320297241, "start": 991, "tag": "USERNAME", "value": "sutter" } ]
null
[]
package intransix.osm.termite.render.edit; import intransix.osm.termite.map.workingdata.OsmData; import intransix.osm.termite.map.workingdata.OsmWay; import intransix.osm.termite.map.workingdata.OsmNode; import intransix.osm.termite.app.edit.data.VirtualNode; import intransix.osm.termite.app.edit.action.*; import intransix.osm.termite.app.edit.*; import intransix.osm.termite.app.edit.editobject.EditObject; import intransix.osm.termite.app.edit.snapobject.SnapObject; import java.awt.Graphics2D; import java.awt.geom.*; import java.awt.event.*; import intransix.osm.termite.render.MapPanel; import intransix.osm.termite.app.maplayer.MapLayer; import java.util.List; import intransix.osm.termite.app.edit.EditManager; import intransix.osm.termite.app.viewregion.ViewRegionManager; /** * This layer controls the user interaction with the active map data. It is designed * to run with the editor modes for the Select Tool, Node Tool and Way Tool. * * @author sutter */ public class EditLayer extends MapLayer implements MouseListener, MouseMotionListener, KeyListener { //========================= // Properties //========================= // <editor-fold defaultstate="collapsed" desc="Properties"> public final static double SNAP_RADIUS_PIXELS = 4; private EditManager editManager; private OsmData osmData; private StyleInfo styleInfo = new StyleInfo(); private MouseClickAction mouseClickAction; private MouseMoveAction moveMouseMoveAction; private MouseMoveAction snapMouseMoveAction; // </editor-fold> //========================= // Public Methods //========================= public EditLayer(EditManager editManager) { this.editManager = editManager; this.setName("Edit Layer"); this.setOrder(MapLayer.ORDER_EDIT_MARKINGS); } // <editor-fold defaultstate="collapsed" desc="Accessors"> /** This method sets the edit mode. */ public void setMouseClickAction(MouseClickAction mouseClickAction) { this.mouseClickAction = mouseClickAction; } public void setMouseMoveActions(MouseMoveAction moveMouseMoveAction, MouseMoveAction snapMouseMoveAction) { this.moveMouseMoveAction = moveMouseMoveAction; this.snapMouseMoveAction = snapMouseMoveAction; } /** This mode sets the edit layer active. */ @Override public void setActiveState(boolean isActive) { super.setActiveState(isActive); MapPanel mapPanel = this.getMapPanel(); if(mapPanel != null) { if(isActive) { mapPanel.addMouseListener(this); mapPanel.addMouseMotionListener(this); mapPanel.addKeyListener(this); } else { mapPanel.removeMouseListener(this); mapPanel.removeMouseMotionListener(this); mapPanel.removeKeyListener(this); } } } // </editor-fold> // <editor-fold defaultstate="collapsed" desc="Render"> /** This method renders the edit state. */ @Override public void render(Graphics2D g2) { AffineTransform mercatorToPixels = getViewRegionManager().getMercatorToPixels(); Style style; //render selection List<Object> selection = editManager.getSelection(); List<Integer> selectedWayNodes = editManager.getSelectedWayNodes(); style = styleInfo.SELECT_STYLE; for(Object selectObject:selection) { if(selectObject instanceof OsmNode) { EditDrawable.renderPoint(g2, mercatorToPixels, ((OsmNode)selectObject).getPoint(),style); } else if(selectObject instanceof OsmWay) { EditDrawable.renderWay(g2, mercatorToPixels,(OsmWay)selectObject,style); //if this is a unique selected way, plot the selected nodes in the way if(selection.size() == 1) { OsmWay way = (OsmWay)selectObject; for(Integer index:selectedWayNodes) { if((index > -1)&&(index < way.getNodes().size())) { OsmNode node = way.getNodes().get(index); EditDrawable.renderPoint(g2, mercatorToPixels, node.getPoint(),style); } } } } else if(selectObject instanceof VirtualNode) { EditDrawable.renderPoint(g2, mercatorToPixels,((VirtualNode)selectObject).point,style); } } //render hover List<SnapObject> snapObjects = editManager.getSnapObjects(); int activeSnapObject = editManager.getActiveSnapObject(); if((activeSnapObject != -1)&&(activeSnapObject < snapObjects.size())) { //System.out.println(("cnt = " + snapObjects.size() + "; active = " + activeSnapObject)); SnapObject snapObject = snapObjects.get(activeSnapObject); //System.out.println(snapObject); snapObject.render(g2, mercatorToPixels,styleInfo); } //render pending objects List<EditObject> pendingObjects = editManager.getPendingObjects(); for(EditObject editObject:pendingObjects) { editObject.render(g2, mercatorToPixels, styleInfo); } } // </editor-fold> // <editor-fold defaultstate="collapsed" desc="Mouse Listeners"> @Override public void mouseClicked(MouseEvent e) { AffineTransform pixelsToMercator = getViewRegionManager().getPixelsToMercator(); Point2D mouseMerc = new Point2D.Double(e.getX(),e.getY()); pixelsToMercator.transform(mouseMerc, mouseMerc); if(e.getButton() == MouseEvent.BUTTON1) { if(mouseClickAction != null) { //let the mouse edit action handle the press mouseClickAction.mousePressed(mouseMerc,e); } } } @Override public void mouseDragged(MouseEvent e) { //no edit move with mouse drag - explicit move command needed } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { editManager.clearPreview(); } @Override public void mouseMoved(MouseEvent e) { //read mouse location in global coordinates ViewRegionManager viewRegionManager = getViewRegionManager(); AffineTransform pixelsToMercator = viewRegionManager.getPixelsToMercator(); Point2D mouseMerc = new Point2D.Double(e.getX(),e.getY()); pixelsToMercator.transform(mouseMerc, mouseMerc); double scalePixelsPerMerc = viewRegionManager.getZoomScalePixelsPerMerc(); double mercRad = SNAP_RADIUS_PIXELS / scalePixelsPerMerc; double mercRadSq = mercRad * mercRad; //handle a move preview if(moveMouseMoveAction != null) { moveMouseMoveAction.mouseMoved(mouseMerc,mercRadSq,e); } //get the snap nodes for the move if(snapMouseMoveAction != null) { snapMouseMoveAction.mouseMoved(mouseMerc,mercRadSq,e); } } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } // </editor-fold> // <editor-fold defaultstate="collapsed" desc="Key Listener"> /** Handle the key typed event from the text field. */ @Override public void keyTyped(KeyEvent e) { } /** Handle the key-pressed event from the text field. */ @Override public void keyPressed(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_COMMA) { SnapSelectAction snapSelectAction = new SnapSelectAction(editManager); snapSelectAction.nextSnapOject(); } else if(e.getKeyCode() == KeyEvent.VK_PERIOD) { SnapSelectAction snapSelectAction = new SnapSelectAction(editManager); snapSelectAction.previousSnapObject(); } else if(e.getKeyCode() == KeyEvent.VK_M) { SelectEditorMode sem = editManager.getSelectEditorMode(); if(sem.getModeEnabled()) { if(!sem.isInMoveState()) { sem.setMoveState(); } } } else if(e.getKeyCode() == KeyEvent.VK_ESCAPE) { SelectEditorMode sem = editManager.getSelectEditorMode(); if(sem.getModeActive()) { if(sem.isInMoveState()) { sem.setSelectState(); } } else { WayEditorMode wem = editManager.getWayEditorMode(); if(wem.getModeActive()) { wem.resetWayEdit(); } } } else if(e.getKeyCode() == KeyEvent.VK_DELETE) { DeleteSelectionAction deleteSelectionAction = new DeleteSelectionAction(editManager); deleteSelectionAction.deleteSelection(); } } /** Handle the key-released event from the text field. */ @Override public void keyReleased(KeyEvent e) { } // </editor-fold> //============================ // Private Methods //============================ }
8,326
0.689767
0.687605
276
28.166666
24.860796
93
false
false
0
0
0
0
0
0
2.141304
false
false
12
1827b16acff76825e696294ab12197db5c896591
9,302,899,207,130
8df8f022ffbace40c96b7e2a9d36982d1d83164f
/src/com/wms3/bms/standard/entity/base/BaseBatch.java
7ac15c7ed5485eff89c88e989e6e796b9f4055bf
[]
no_license
fanliry/lxyy
https://github.com/fanliry/lxyy
cb1dc22ab1f9adc5c20d055e6ab93aca1c84d6f4
9fcbab2a27d6b95a496f3921f77078d3e86de7b0
refs/heads/master
2015-08-22T21:46:47.826000
2015-04-03T12:48:05
2015-04-03T12:48:05
33,361,898
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wms3.bms.standard.entity.base; /** * 描述:批次 * @author hug * */ public class BaseBatch implements java.io.Serializable { private static final long serialVersionUID = -6436760181288458580L; private String batchid; //批次ID private String batchname; //批次名称 private Integer batchlength; //长度 private String useflag; //是否启用 Y:是 N.否 // Constructors /** default constructor */ public BaseBatch() { } /** minimal constructor */ public BaseBatch(String batchname, String useflag) { this.batchname = batchname; this.useflag = useflag; } /** full constructor */ public BaseBatch(String batchname, Integer batchlength, String useflag) { this.batchname = batchname; this.batchlength = batchlength; this.useflag = useflag; } // Property accessors /** * 功能:获得批次ID */ public String getBatchid() { return this.batchid; } /** * 功能:设置批次ID * @param batchid */ public void setBatchid(String batchid) { this.batchid = batchid; } /** * 功能:获得批次名称 * @return */ public String getBatchname() { return this.batchname; } /** * 功能:设置批次名称 * @param batchname */ public void setBatchname(String batchname) { this.batchname = batchname; } /** * 功能:获得长度 * @return */ public Integer getBatchlength() { return this.batchlength; } /** * 功能:设置长度 * @param batchlength */ public void setBatchlength(Integer batchlength) { this.batchlength = batchlength; } /** * 功能:获得是否启用 Y:是 N.否 * @return */ public String getUseflag() { return this.useflag; } /** * 功能:设置是否启用 Y:是 N.否 * @param useflag */ public void setUseflag(String useflag) { this.useflag = useflag; } }
GB18030
Java
2,191
java
BaseBatch.java
Java
[ { "context": "standard.entity.base;\r\n\r\n/**\r\n * 描述:批次\r\n * @author hug\r\n *\r\n */\r\npublic class BaseBatch implements java", "end": 75, "score": 0.9995790123939514, "start": 72, "tag": "USERNAME", "value": "hug" } ]
null
[]
package com.wms3.bms.standard.entity.base; /** * 描述:批次 * @author hug * */ public class BaseBatch implements java.io.Serializable { private static final long serialVersionUID = -6436760181288458580L; private String batchid; //批次ID private String batchname; //批次名称 private Integer batchlength; //长度 private String useflag; //是否启用 Y:是 N.否 // Constructors /** default constructor */ public BaseBatch() { } /** minimal constructor */ public BaseBatch(String batchname, String useflag) { this.batchname = batchname; this.useflag = useflag; } /** full constructor */ public BaseBatch(String batchname, Integer batchlength, String useflag) { this.batchname = batchname; this.batchlength = batchlength; this.useflag = useflag; } // Property accessors /** * 功能:获得批次ID */ public String getBatchid() { return this.batchid; } /** * 功能:设置批次ID * @param batchid */ public void setBatchid(String batchid) { this.batchid = batchid; } /** * 功能:获得批次名称 * @return */ public String getBatchname() { return this.batchname; } /** * 功能:设置批次名称 * @param batchname */ public void setBatchname(String batchname) { this.batchname = batchname; } /** * 功能:获得长度 * @return */ public Integer getBatchlength() { return this.batchlength; } /** * 功能:设置长度 * @param batchlength */ public void setBatchlength(Integer batchlength) { this.batchlength = batchlength; } /** * 功能:获得是否启用 Y:是 N.否 * @return */ public String getUseflag() { return this.useflag; } /** * 功能:设置是否启用 Y:是 N.否 * @param useflag */ public void setUseflag(String useflag) { this.useflag = useflag; } }
2,191
0.546356
0.53644
93
19.709677
16.862238
77
false
false
0
0
0
0
0
0
0.365591
false
false
12
f0c54f81bd134c8fbc94be19d966a6ee33771bb6
498,216,273,597
b50f06ae556430219c888bb9364ac185ffdcac36
/minesweeper-problem/src/main/java/github/com/yadavsudhir405/minesweeper/parser/Command.java
e560ec768df5766dbe525b5a1295ce9c8aaa69aa
[]
no_license
yadavsudhir405/problems-thoughtworks
https://github.com/yadavsudhir405/problems-thoughtworks
8e6b51af0118748bb80f37f5fcff85910649c43b
8edeeb751b68942d71374a624a448bc7bc1ba780
refs/heads/master
2017-12-03T03:09:53.765000
2017-05-19T05:50:24
2017-05-19T05:50:24
85,788,691
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package github.com.yadavsudhir405.minesweeper.parser; /** * @author sudhir * Date:25/3/17 * Time:5:23 PM * Project:minesweeper-problem */ public class Command { private final ActionType actionType; private final Coordinate coordinate; public Command(ActionType actionType, Coordinate coordinate) { this.actionType = actionType; this.coordinate = coordinate; } public boolean isSelectedCommandIsToOpen(){ return actionType==ActionType.OPEN; } public boolean isSelectedCommandIsToFlag(){ return actionType==ActionType.FLAG; } public Coordinate getCoordinate(){ return new Coordinate(coordinate.getX(),coordinate.getY()); } }
UTF-8
Java
736
java
Command.java
Java
[ { "context": "package github.com.yadavsudhir405.minesweeper.parser;\n\n/**\n * @author sudhir\n * ", "end": 33, "score": 0.9992020130157471, "start": 19, "tag": "USERNAME", "value": "yadavsudhir405" }, { "context": "yadavsudhir405.minesweeper.parser;\n\n/**\n * @author sudhir\n * ...
null
[]
package github.com.yadavsudhir405.minesweeper.parser; /** * @author sudhir * Date:25/3/17 * Time:5:23 PM * Project:minesweeper-problem */ public class Command { private final ActionType actionType; private final Coordinate coordinate; public Command(ActionType actionType, Coordinate coordinate) { this.actionType = actionType; this.coordinate = coordinate; } public boolean isSelectedCommandIsToOpen(){ return actionType==ActionType.OPEN; } public boolean isSelectedCommandIsToFlag(){ return actionType==ActionType.FLAG; } public Coordinate getCoordinate(){ return new Coordinate(coordinate.getX(),coordinate.getY()); } }
736
0.675272
0.660326
27
26.25926
21.089918
67
false
false
0
0
0
0
0
0
0.37037
false
false
12
353a65245ae8a3d983173543c9d1956cab07d939
20,048,907,368,151
8267c1d05a77938a847c0d5c5d0d3237aa543e16
/javaFxForm01/src/sample/ChriteriaMsh.java
e750bfcadf6cad780c998170bbfd40e1dd5f2142
[]
no_license
szabopeterakos/java
https://github.com/szabopeterakos/java
e74b502cf70a553124b53d9b8a06c91a62969d4a
27641a930a0a88aef3d5f2df201d672bd46fec9c
refs/heads/master
2021-05-02T08:53:40.939000
2018-03-05T16:31:08
2018-03-05T16:31:08
120,816,248
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package sample; import sun.misc.Regexp; import java.util.Arrays; import java.util.HashSet; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; public class ChriteriaMsh implements Chritertia { Set<String> msh = new HashSet<>(Arrays.asList("a", "e", "i", "o", "u", "á")); @Override public boolean isAble(String c) { Pattern p = Pattern.compile("^[^aeuio\\d\\s\\?\\.\\,\\;\\:]"); Matcher m = p.matcher(c); boolean match = m.matches(); return match; } }
UTF-8
Java
541
java
ChriteriaMsh.java
Java
[]
null
[]
package sample; import sun.misc.Regexp; import java.util.Arrays; import java.util.HashSet; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; public class ChriteriaMsh implements Chritertia { Set<String> msh = new HashSet<>(Arrays.asList("a", "e", "i", "o", "u", "á")); @Override public boolean isAble(String c) { Pattern p = Pattern.compile("^[^aeuio\\d\\s\\?\\.\\,\\;\\:]"); Matcher m = p.matcher(c); boolean match = m.matches(); return match; } }
541
0.622222
0.622222
24
21.5
21.867022
81
false
false
0
0
0
0
0
0
0.791667
false
false
12
e9c65378948d34ee1f66d6dea8856d587581327f
31,868,657,383,082
24b7917701dfaea11dac278903a81c1188a020a1
/Eclipse/src/Minimax.java
5f838e5e0e7759bf811e49ac6c7ea3a8884982a8
[]
no_license
Th3OnlyN00b/Connect3
https://github.com/Th3OnlyN00b/Connect3
d532905364d47956975c31069f575653e22bbd6a
72e102f55935a0cbbb85e485173d3eeffdc61aeb
refs/heads/master
2020-04-01T03:19:44.376000
2018-10-14T13:29:59
2018-10-14T13:29:59
152,817,763
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.*; public class Minimax implements Connect3{ RowTrie loaded = new RowTrie(); int foundn = 0; public int play() { return minimax(new C3(4,5)).lastCol; } public int play(C3 currBoard) { return minimax(currBoard).lastCol; } public UtilBoard minimax(C3 state){ //System.out.println("Minimax called!!!!"); //SEARCH FIRST!!!!!!!!! int[] encR = state.encodeRows(); UtilBoard found = loaded.searchNode(encR); if(found!=null) { foundn++; if(foundn%100000==0) {System.out.println("Found!!!! Num: "+foundn +"Col: " + found.lastCol + " Util: " + found.util + " P1 turn?: "+ state.p1Turn);} return found;} switch(state.winner) { case 1: loaded.insert(encR, 1, state.lastCol); return new UtilBoard(state.lastCol, 1); case 2: loaded.insert(encR, -1, state.lastCol); return new UtilBoard(state.lastCol, -1); } ArrayList<C3> children = state.children(); if(children.size()==0){ loaded.insert(encR, 0, state.lastCol); return new UtilBoard(state.lastCol,0); } UtilBoard bestUtility; if(state.p1Turn){ //Return on 1st 1, otherwise return a tie, if neither is available return first option: util -1 bestUtility = new UtilBoard(children.get(0).lastCol,-1); for(C3 child : children){ UtilBoard util = minimax(child); if(util.util==1){ bestUtility = new UtilBoard(child.lastCol,1); loaded.insert(encR, bestUtility); } //Can't do better than guaranteed 1, return!! else if(util.util==0&&bestUtility.util!=1){ bestUtility = new UtilBoard(child.lastCol,0); } } // System.out.println("Plater 1 Turn!!!" + bestUtility.lastCol); } else{//Return on 1st -1, otherwise return a tie, if neither is available return first option: util 1 bestUtility = new UtilBoard(children.get(0).lastCol,1); for(C3 child: children){ UtilBoard util = minimax(child); if(util.util==-1){bestUtility = new UtilBoard(child.lastCol,-1);} //Can't do better than guaranteed -1, return else if(util.util==0&&bestUtility.util!=-1){ bestUtility = new UtilBoard(child.lastCol,0); loaded.insert(encR, bestUtility); } } // System.out.println("Plater 2 Turn!!!" + bestUtility.lastCol); } loaded.insert(encR, bestUtility); return bestUtility; } }
UTF-8
Java
2,687
java
Minimax.java
Java
[]
null
[]
import java.util.*; public class Minimax implements Connect3{ RowTrie loaded = new RowTrie(); int foundn = 0; public int play() { return minimax(new C3(4,5)).lastCol; } public int play(C3 currBoard) { return minimax(currBoard).lastCol; } public UtilBoard minimax(C3 state){ //System.out.println("Minimax called!!!!"); //SEARCH FIRST!!!!!!!!! int[] encR = state.encodeRows(); UtilBoard found = loaded.searchNode(encR); if(found!=null) { foundn++; if(foundn%100000==0) {System.out.println("Found!!!! Num: "+foundn +"Col: " + found.lastCol + " Util: " + found.util + " P1 turn?: "+ state.p1Turn);} return found;} switch(state.winner) { case 1: loaded.insert(encR, 1, state.lastCol); return new UtilBoard(state.lastCol, 1); case 2: loaded.insert(encR, -1, state.lastCol); return new UtilBoard(state.lastCol, -1); } ArrayList<C3> children = state.children(); if(children.size()==0){ loaded.insert(encR, 0, state.lastCol); return new UtilBoard(state.lastCol,0); } UtilBoard bestUtility; if(state.p1Turn){ //Return on 1st 1, otherwise return a tie, if neither is available return first option: util -1 bestUtility = new UtilBoard(children.get(0).lastCol,-1); for(C3 child : children){ UtilBoard util = minimax(child); if(util.util==1){ bestUtility = new UtilBoard(child.lastCol,1); loaded.insert(encR, bestUtility); } //Can't do better than guaranteed 1, return!! else if(util.util==0&&bestUtility.util!=1){ bestUtility = new UtilBoard(child.lastCol,0); } } // System.out.println("Plater 1 Turn!!!" + bestUtility.lastCol); } else{//Return on 1st -1, otherwise return a tie, if neither is available return first option: util 1 bestUtility = new UtilBoard(children.get(0).lastCol,1); for(C3 child: children){ UtilBoard util = minimax(child); if(util.util==-1){bestUtility = new UtilBoard(child.lastCol,-1);} //Can't do better than guaranteed -1, return else if(util.util==0&&bestUtility.util!=-1){ bestUtility = new UtilBoard(child.lastCol,0); loaded.insert(encR, bestUtility); } } // System.out.println("Plater 2 Turn!!!" + bestUtility.lastCol); } loaded.insert(encR, bestUtility); return bestUtility; } }
2,687
0.561965
0.54224
71
36.84507
30.449982
151
false
false
0
0
0
0
0
0
1.450704
false
false
12
ab353f5eaf18fce127340a6a02c859994fa1f65e
18,846,316,536,433
6f0eafd420c35dc304d5d320ccc5e9b962819bb0
/src/magiccube/ui/ButtonAnimation.java
172c426bf1fe233ebab130020ee33debd903cea2
[]
no_license
anic/magicubes
https://github.com/anic/magicubes
1bae6556b3f889b9657c81fbff6ae574b7f977cb
8f2f1cd514e76dd6beda5b80a63407d4cdaf02c5
refs/heads/master
2020-06-05T07:10:10.733000
2015-03-14T08:07:18
2015-03-14T08:07:18
32,201,699
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package magiccube.ui; import magiccube.game.animation.IAnimation; /** * * @author Administrator */ public class ButtonAnimation implements IAnimation{ public void before_end() { this.button.setSelected(false); } public void before_start(int totalTime) { this.button.setSelected(true); } public void process(int spendTime, int currentTime) { } private AbstractButton button; public ButtonAnimation(AbstractButton btn) { this.button = btn; } }
UTF-8
Java
617
java
ButtonAnimation.java
Java
[ { "context": "cube.game.animation.IAnimation;\n\n/**\n *\n * @author Administrator\n */\npublic class ButtonAnimation implements IAnim", "end": 200, "score": 0.8757296204566956, "start": 187, "tag": "USERNAME", "value": "Administrator" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package magiccube.ui; import magiccube.game.animation.IAnimation; /** * * @author Administrator */ public class ButtonAnimation implements IAnimation{ public void before_end() { this.button.setSelected(false); } public void before_start(int totalTime) { this.button.setSelected(true); } public void process(int spendTime, int currentTime) { } private AbstractButton button; public ButtonAnimation(AbstractButton btn) { this.button = btn; } }
617
0.670989
0.670989
33
17.69697
19.544022
57
false
false
0
0
0
0
0
0
0.272727
false
false
12
04d9ee37e905a44f9886d8d9d1952bdc183d3a99
6,347,961,711,111
43e34335f44cf4426f2678ee0d8a27735095a121
/CS6400-2020-01/src/main/java/edu/gatech/cs6400/team080/project/domain/AdoptionStatusEnum.java
e6e5623b13c30c03d7a8b82d0b9facef2d6daea1
[]
no_license
AprilXiaoyanLiu/Java_React_Website
https://github.com/AprilXiaoyanLiu/Java_React_Website
136ae7a389b7b85798e2e142b97f1f22fa793449
0e9e39d633a50ff84a6f8ada5fcd6397fcb16e9d
refs/heads/main
2023-03-27T08:05:44.685000
2021-03-24T23:31:30
2021-03-24T23:31:30
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.gatech.cs6400.team080.project.domain; public enum AdoptionStatusEnum { not_adopted(0), adopted(1); private final int key; AdoptionStatusEnum(int key) { this.key = key; } public int getKey() { return this.key; } }
UTF-8
Java
279
java
AdoptionStatusEnum.java
Java
[]
null
[]
package edu.gatech.cs6400.team080.project.domain; public enum AdoptionStatusEnum { not_adopted(0), adopted(1); private final int key; AdoptionStatusEnum(int key) { this.key = key; } public int getKey() { return this.key; } }
279
0.605735
0.573477
16
16.5
14.287232
49
false
false
0
0
0
0
0
0
0.375
false
false
12
633a3f128858269705aca311b1c178385cd2ab2c
3,633,542,377,180
03c4a2f7910a9ea5a3715269833ed8cd9362670f
/GedGrupo4/src/main/java/br/upf/ads/topicos/named/SubEventoBean.java
9ae320a888886cfd4601447e645c3c3b0cabd07e
[]
no_license
digobb/GedGrupo4
https://github.com/digobb/GedGrupo4
6725f0642e8e40d3a161b140a10bf0c2de2a92c7
28a719329fd25fff78cec64e4f98ccad7b19ce69
refs/heads/master
2023-06-15T00:54:49.101000
2021-07-05T04:10:14
2021-07-05T04:10:14
367,497,078
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.upf.ads.topicos.named; import java.io.Serializable; import java.util.HashMap; import java.util.List; import javax.faces.bean.RequestScoped; import javax.faces.view.ViewScoped; import javax.inject.Named; import org.primefaces.model.StreamedContent; import br.upf.ads.topicos.entities.Assina; import br.upf.ads.topicos.entities.SubEvento; import br.upf.ads.topicos.jpa.GenericDao; import br.upf.ads.topicos.jsf.JsfUtil; import br.upf.ads.topicos.jsf.TrataException; import br.upf.ads.topicos.relatorios.RelatorioUtil; @Named @ViewScoped public class SubEventoBean implements Serializable { private SubEvento selecionado; // atributo para vinculo com campos do formulário private List<SubEvento> lista; // atributo para vinculo com o datatable da consulta private Boolean editando; // atributo para controlar o painel visível editar ou consultar private GenericDao<SubEvento> dao = new GenericDao<SubEvento>(); private List<Assina> assinantes; public SubEventoBean() throws Exception { super(); setEditando(false); assinantes = new GenericDao<Assina>().createQuery("from Assina"); selecionado = new SubEvento(); carregarLista(); } @Named @RequestScoped public class RelSubEventoBean { public StreamedContent gerarPDF() { try { HashMap parameters = new HashMap(); return RelatorioUtil.gerarStreamRelatorioPDF("WEB-INF/relatorios/SubEvento/SubEvento.jasper", parameters, "SubEvento.pdf"); } catch (Exception e) { e.printStackTrace(); JsfUtil.addErrorMessage(e.getMessage()); return null; } } } public void incluir() { selecionado = new SubEvento(); // cria novo produto setEditando(true); } public void alterar() { setEditando(true); } public void cancelar() { carregarLista(); setSelecionado(null); // para desabilitar os botões alterar e excluir setEditando(false); } public void salvar() { try { setSelecionado( dao.merge(selecionado) ); JsfUtil.addSuccessMessage("Salvo com sucesso!"); carregarLista(); // carregar produtos do BD quando salva algo setEditando(false); } catch (Exception e) { e.printStackTrace(); JsfUtil.addErrorMessage(TrataException.getMensagem(e)); } } public void excluir() { try { dao.remove(selecionado); JsfUtil.addSuccessMessage("Excluído com sucesso!"); setSelecionado(null); // para desabilitar os botões alterar e excluir carregarLista(); // carregar produtos do BD quando salva algo } catch (Exception e) { e.printStackTrace(); JsfUtil.addErrorMessage(TrataException.getMensagem(e)); } } public void carregarLista() { try { lista = dao.createQuery("from SubEvento order by id"); } catch (Exception e) { e.printStackTrace(); JsfUtil.addErrorMessage(TrataException.getMensagem(e)); } } public List<SubEvento> getLista() { return lista; } public void setLista(List<SubEvento> lista) { this.lista = lista; } public SubEvento getSelecionado() { return selecionado; } public void setSelecionado(SubEvento selecionado) { this.selecionado = selecionado; } public Boolean getEditando() { return editando; } public void setEditando(Boolean editando) { this.editando = editando; } public List<Assina> getAssinantes() { return assinantes; } public void setAssinantes(List<Assina> assinantes) { this.assinantes = assinantes; } }
UTF-8
Java
3,380
java
SubEventoBean.java
Java
[]
null
[]
package br.upf.ads.topicos.named; import java.io.Serializable; import java.util.HashMap; import java.util.List; import javax.faces.bean.RequestScoped; import javax.faces.view.ViewScoped; import javax.inject.Named; import org.primefaces.model.StreamedContent; import br.upf.ads.topicos.entities.Assina; import br.upf.ads.topicos.entities.SubEvento; import br.upf.ads.topicos.jpa.GenericDao; import br.upf.ads.topicos.jsf.JsfUtil; import br.upf.ads.topicos.jsf.TrataException; import br.upf.ads.topicos.relatorios.RelatorioUtil; @Named @ViewScoped public class SubEventoBean implements Serializable { private SubEvento selecionado; // atributo para vinculo com campos do formulário private List<SubEvento> lista; // atributo para vinculo com o datatable da consulta private Boolean editando; // atributo para controlar o painel visível editar ou consultar private GenericDao<SubEvento> dao = new GenericDao<SubEvento>(); private List<Assina> assinantes; public SubEventoBean() throws Exception { super(); setEditando(false); assinantes = new GenericDao<Assina>().createQuery("from Assina"); selecionado = new SubEvento(); carregarLista(); } @Named @RequestScoped public class RelSubEventoBean { public StreamedContent gerarPDF() { try { HashMap parameters = new HashMap(); return RelatorioUtil.gerarStreamRelatorioPDF("WEB-INF/relatorios/SubEvento/SubEvento.jasper", parameters, "SubEvento.pdf"); } catch (Exception e) { e.printStackTrace(); JsfUtil.addErrorMessage(e.getMessage()); return null; } } } public void incluir() { selecionado = new SubEvento(); // cria novo produto setEditando(true); } public void alterar() { setEditando(true); } public void cancelar() { carregarLista(); setSelecionado(null); // para desabilitar os botões alterar e excluir setEditando(false); } public void salvar() { try { setSelecionado( dao.merge(selecionado) ); JsfUtil.addSuccessMessage("Salvo com sucesso!"); carregarLista(); // carregar produtos do BD quando salva algo setEditando(false); } catch (Exception e) { e.printStackTrace(); JsfUtil.addErrorMessage(TrataException.getMensagem(e)); } } public void excluir() { try { dao.remove(selecionado); JsfUtil.addSuccessMessage("Excluído com sucesso!"); setSelecionado(null); // para desabilitar os botões alterar e excluir carregarLista(); // carregar produtos do BD quando salva algo } catch (Exception e) { e.printStackTrace(); JsfUtil.addErrorMessage(TrataException.getMensagem(e)); } } public void carregarLista() { try { lista = dao.createQuery("from SubEvento order by id"); } catch (Exception e) { e.printStackTrace(); JsfUtil.addErrorMessage(TrataException.getMensagem(e)); } } public List<SubEvento> getLista() { return lista; } public void setLista(List<SubEvento> lista) { this.lista = lista; } public SubEvento getSelecionado() { return selecionado; } public void setSelecionado(SubEvento selecionado) { this.selecionado = selecionado; } public Boolean getEditando() { return editando; } public void setEditando(Boolean editando) { this.editando = editando; } public List<Assina> getAssinantes() { return assinantes; } public void setAssinantes(List<Assina> assinantes) { this.assinantes = assinantes; } }
3,380
0.730074
0.730074
138
23.456522
23.101891
109
false
false
0
0
0
0
0
0
1.826087
false
false
12
c6fb1bfe695ed7a630e5d579eea5d7d9c09bff79
16,698,832,905,829
affab1e9b0dba98121686cc9aaa08433a30976ce
/Api/src/io/FileInputStreamEx2.java
2c528b6ed13dab820fdec32933410f5683d3e6d3
[]
no_license
jaecheonjaecci/javasource
https://github.com/jaecheonjaecci/javasource
61b47b2b487c054ea3d4d0683158d0ba2be961e9
51146eff741d8a8a252214d4dbf9f50542fa2b10
refs/heads/master
2023-08-24T08:38:58.737000
2021-10-08T09:31:11
2021-10-08T09:31:11
411,899,089
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package io; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class FileInputStreamEx2 { public static void main(String[] args) { /* * FileInputStream fis = null; FileOutputStream fos = null; * * try { fis = new FileInputStream(new File("c:\\temp\\file1.txt")); fos = new * FileOutputStream("c:\\temp\\test1.txt"); * * byte datas[] = new byte[100]; while (fis.read(datas) != -1) { * fos.write(datas); } * * } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException * e) { e.printStackTrace(); } finally { try { fis.close(); fos.close(); } catch * (IOException e) { e.printStackTrace(); } } * */ try { } catch (Exception e) { } } }
UTF-8
Java
817
java
FileInputStreamEx2.java
Java
[]
null
[]
package io; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class FileInputStreamEx2 { public static void main(String[] args) { /* * FileInputStream fis = null; FileOutputStream fos = null; * * try { fis = new FileInputStream(new File("c:\\temp\\file1.txt")); fos = new * FileOutputStream("c:\\temp\\test1.txt"); * * byte datas[] = new byte[100]; while (fis.read(datas) != -1) { * fos.write(datas); } * * } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException * e) { e.printStackTrace(); } finally { try { fis.close(); fos.close(); } catch * (IOException e) { e.printStackTrace(); } } * */ try { } catch (Exception e) { } } }
817
0.638923
0.630355
31
25.354839
26.032917
82
false
false
0
0
0
0
0
0
1.709677
false
false
12
5b214844c217e31cff0d818742a5f3d16c77dad6
21,414,706,981,675
6a1a83296af5228276269d21ea8209b303853cdd
/etl/src/main/java/dk/deffopera/nora/vivo/etl/datasource/connector/ConnectorDataSource.java
443d40369875ce2d2c6e7c70ecf4370407aeb3a8
[]
no_license
RAP-research-output-impact/national-open-research-analytics-vivo
https://github.com/RAP-research-output-impact/national-open-research-analytics-vivo
ac10498f898850b5336b41c58e90d869eb0867e0
2667da047b9ac065de6a33a5bfea9ed6d4ddee2f
refs/heads/master
2023-09-01T10:53:37.666000
2021-08-27T06:55:31
2021-08-27T06:55:31
213,337,814
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dk.deffopera.nora.vivo.etl.datasource.connector; import java.net.URI; import java.net.URISyntaxException; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.rdf.model.Statement; import org.apache.jena.rdf.model.StmtIterator; import org.apache.jena.util.ResourceUtils; import org.apache.jena.vocabulary.RDF; import dk.deffopera.nora.vivo.etl.datasource.DataSourceBase; import dk.deffopera.nora.vivo.etl.datasource.DataSourceConfiguration; import dk.deffopera.nora.vivo.etl.datasource.IteratorWithSize; import dk.deffopera.nora.vivo.etl.datasource.VivoVocabulary; public abstract class ConnectorDataSource extends DataSourceBase { private static final Log log = LogFactory.getLog(ConnectorDataSource.class); /* number of iterator elements to be processed at once in memory before being flushed to a SPARQL endpoint */ protected final static int DEFAULT_BATCH_SIZE = 1; protected final static int TRIPLE_BUFFER_SIZE = 12500; private static final List<String> FILTER_OUT = Arrays.asList( "generalizedXMLtoRDF/0.1", "vitro/0.7#position", "vitro/0.7#value", "XMLSchema-instance"); private static final String FILTER_OUT_RES = "match_nothing"; protected Model result; /** * to be overridden by subclasses * @return Model representing a discrete "record" in the source data, * lifted to RDF but not (necessarily) mapped to the VIVO ontology or * filtered for relevance */ protected abstract IteratorWithSize<Model> getSourceModelIterator(); /** * The number of table rows to be processed at once in memory before * being flushed to a SPARQL endpoint * @return */ protected int getBatchSize() { return DEFAULT_BATCH_SIZE; } /** * to be overridden by subclasses * @param model * @return model filtered to relevant resources according to the query * terms or other criteria */ protected abstract Model filter(Model model); /** * A filter that removes generic statements and types produced by * XML (or JSON) to RDF lifting * @param model * @return model with generic statements removed */ protected Model filterGeneric(Model model) { Model filtered = ModelFactory.createDefaultModel(); StmtIterator sit = model.listStatements(); while(sit.hasNext()) { Statement stmt = sit.next(); if( (RDF.type.equals(stmt.getPredicate())) && (stmt.getObject().isURIResource()) && (stmt.getObject().asResource().getURI().contains(FILTER_OUT.get(0))) ) { continue; } boolean filterPredicate = false; for (String filterOut : FILTER_OUT) { if(stmt.getPredicate().getURI().contains(filterOut)) { filterPredicate = true; break; } } if(filterPredicate) { continue; } if(stmt.getSubject().isURIResource() && stmt.getSubject().getURI().contains(FILTER_OUT_RES)) { continue; } if(stmt.getObject().isURIResource() && stmt.getObject().asResource().getURI().contains(FILTER_OUT_RES)) { continue; } filtered.add(stmt); } return filtered; } /** * to be overridden by subclasses * @param model * @return model with VIVO-compatible statements added */ protected abstract Model mapToVIVO(Model model); @Override public void runIngest() throws InterruptedException { Date currentDateTime = Calendar.getInstance().getTime(); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); String graphTimeSuffix = "-" + df.format(currentDateTime); log.debug("Processing a limit of " + this.getConfiguration().getLimit() + " records"); log.debug("Processing in batches of " + getBatchSize() + " records"); String graphURI = getConfiguration().getResultsGraphURI(); if(!activeEndpointForResults()) { result = ModelFactory.createDefaultModel(); } IteratorWithSize<Model> it = getSourceModelIterator(); try { Integer totalRecords = it.size(); if(totalRecords != null) { this.getStatus().setTotalRecords(totalRecords); log.info(it.size() + " total records"); } Model buffer = ModelFactory.createDefaultModel(); this.getStatus().setMessage("harvesting records"); boolean dataWrittenToEndpoint = false; int count = 0; while(it.hasNext() && count < this.getConfiguration().getLimit()) { try { if(this.getStatus().isStopRequested()) { throw new InterruptedException(); } count++; Model model = mapToVIVO(it.next()); log.debug(model.size() + " statements before filtering"); if(this.getStatus().isStopRequested()) { throw new InterruptedException(); } model = filter(model); log.debug(model.size() + " statements after filtering"); if(this.getStatus().isStopRequested()) { throw new InterruptedException(); } String defaultNamespace = getDefaultNamespace(this.getConfiguration()); // TODO 2019-07-08 revisit because dangerous: rewrites geopolitical abox entities, etc. //if(defaultNamespace != null) { // model = rewriteUris(model, defaultNamespace, getPrefixName()); //} if(this.getStatus().isStopRequested()) { throw new InterruptedException(); } if(activeEndpointForResults()) { buffer.add(model); //if(count % getBatchSize() == 0 || !it.hasNext() if(buffer.size() >= TRIPLE_BUFFER_SIZE || !it.hasNext() || count == this.getConfiguration().getLimit()) { if(buffer.size() > 0) { dataWrittenToEndpoint = true; } log.debug("Adding " + buffer.size() + " triples to endpoint"); addToEndpoint(buffer, graphURI + graphTimeSuffix); buffer.removeAll(); } } else { result.add(model); } this.getStatus().setProcessedRecords(count); if(totalRecords != null && totalRecords > 0) { float completionPercentage = ((float) count / (float) totalRecords) * 100; log.info("Completion percentage " + completionPercentage); this.getStatus().setCompletionPercentage((int) completionPercentage); } } catch (InterruptedException e) { throw(e); // this is the one exception we want to throw } catch (Exception e) { log.error(e, e); this.getStatus().setErrorRecords(this.getStatus().getErrorRecords() + 1); } } boolean skipClearingOldData = false; if(!dataWrittenToEndpoint) { if(totalRecords == null) { skipClearingOldData = true; } else if (this.getStatus().getErrorRecords() > (totalRecords / 5)) { skipClearingOldData = true; } } if(activeEndpointForResults() && !skipClearingOldData) { this.getStatus().setMessage("removing old data"); log.info("removing old data"); List<String> allVersionsOfSource = getGraphsWithBaseURI(graphURI, getSparqlEndpoint()); for(String version : allVersionsOfSource) { if(this.getStatus().isStopRequested()) { throw new InterruptedException(); } if(version.startsWith(graphURI) && !version.endsWith(graphTimeSuffix)) { log.info("Clearing graph " + version); getSparqlEndpoint().clearGraph(version); } } } } finally { if(it != null) { log.info("Closing iterator"); it.close(); } } } protected String getDefaultNamespace(DataSourceConfiguration configuration) { Object o = configuration.getParameterMap().get("Vitro.defaultNamespace"); if(o instanceof String) { return (String) o; } else { return null; } } protected boolean activeEndpointForResults() { return (this.getConfiguration().getEndpointParameters() != null && this.getConfiguration().getResultsGraphURI() != null); } @Override public Model getResult() { return this.result; } protected Model renameByIdentifier(Model m, Property identifier, String namespace, String localNamePrefix) { Map<Resource, String> idMap = new HashMap<Resource, String>(); StmtIterator sit = m.listStatements(null, identifier, (RDFNode) null); while(sit.hasNext()) { Statement stmt = sit.next(); if(stmt.getObject().isLiteral()) { idMap.put(stmt.getSubject(), stripSpaces(stmt.getObject().asLiteral().getLexicalForm())); //stmt.getObject().asLiteral().getLexicalForm()); //stripNonWordChars(stmt.getObject().asLiteral().getLexicalForm())); } } for(Resource res : idMap.keySet()) { ResourceUtils.renameResource( res, namespace + localNamePrefix + idMap.get(res)); } return m; } protected String stripSpaces(String value) { if(value == null) { return value; } else { return value.replaceAll(" ", ""); } } protected String stripNonWordChars(String value) { if(value == null) { return value; } else { return value.replaceAll("\\W", ""); } } protected Model rewriteUris(Model model, String namespace, String localNamePrefix) { Model out = ModelFactory.createDefaultModel(); StmtIterator sit = model.listStatements(); while(sit.hasNext()) { Statement stmt = sit.next(); Resource subj = rewriteResource(stmt.getSubject(), namespace, localNamePrefix); RDFNode obj = stmt.getObject(); if( (!stmt.getPredicate().equals(RDF.type)) && (obj.isURIResource()) ) { obj = rewriteResource(obj.asResource(), namespace, localNamePrefix); } out.add(subj, stmt.getPredicate(), obj); } return out; } protected Resource rewriteResource(Resource res, String namespace, String localNamePrefix) { if(!res.isURIResource()) { return res; } // don't rewrite ORCID iDs, VIVO individuals or resources that are // already in the default namespace if(res.getURI().startsWith(namespace) || res.getURI().contains("orcid.org") || res.getURI().startsWith(VivoVocabulary.VIVO)) { return res; } try { URI uri = new URI(res.getURI()); String newLocalName = localNamePrefix + uri.getPath(); newLocalName = newLocalName.replaceAll("/", "-"); return ResourceFactory.createResource(namespace + newLocalName); } catch (URISyntaxException e) { log.debug(e, e); return res; } } protected abstract String getPrefixName(); }
UTF-8
Java
13,121
java
ConnectorDataSource.java
Java
[]
null
[]
package dk.deffopera.nora.vivo.etl.datasource.connector; import java.net.URI; import java.net.URISyntaxException; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.apache.jena.rdf.model.Property; import org.apache.jena.rdf.model.RDFNode; import org.apache.jena.rdf.model.Resource; import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.rdf.model.Statement; import org.apache.jena.rdf.model.StmtIterator; import org.apache.jena.util.ResourceUtils; import org.apache.jena.vocabulary.RDF; import dk.deffopera.nora.vivo.etl.datasource.DataSourceBase; import dk.deffopera.nora.vivo.etl.datasource.DataSourceConfiguration; import dk.deffopera.nora.vivo.etl.datasource.IteratorWithSize; import dk.deffopera.nora.vivo.etl.datasource.VivoVocabulary; public abstract class ConnectorDataSource extends DataSourceBase { private static final Log log = LogFactory.getLog(ConnectorDataSource.class); /* number of iterator elements to be processed at once in memory before being flushed to a SPARQL endpoint */ protected final static int DEFAULT_BATCH_SIZE = 1; protected final static int TRIPLE_BUFFER_SIZE = 12500; private static final List<String> FILTER_OUT = Arrays.asList( "generalizedXMLtoRDF/0.1", "vitro/0.7#position", "vitro/0.7#value", "XMLSchema-instance"); private static final String FILTER_OUT_RES = "match_nothing"; protected Model result; /** * to be overridden by subclasses * @return Model representing a discrete "record" in the source data, * lifted to RDF but not (necessarily) mapped to the VIVO ontology or * filtered for relevance */ protected abstract IteratorWithSize<Model> getSourceModelIterator(); /** * The number of table rows to be processed at once in memory before * being flushed to a SPARQL endpoint * @return */ protected int getBatchSize() { return DEFAULT_BATCH_SIZE; } /** * to be overridden by subclasses * @param model * @return model filtered to relevant resources according to the query * terms or other criteria */ protected abstract Model filter(Model model); /** * A filter that removes generic statements and types produced by * XML (or JSON) to RDF lifting * @param model * @return model with generic statements removed */ protected Model filterGeneric(Model model) { Model filtered = ModelFactory.createDefaultModel(); StmtIterator sit = model.listStatements(); while(sit.hasNext()) { Statement stmt = sit.next(); if( (RDF.type.equals(stmt.getPredicate())) && (stmt.getObject().isURIResource()) && (stmt.getObject().asResource().getURI().contains(FILTER_OUT.get(0))) ) { continue; } boolean filterPredicate = false; for (String filterOut : FILTER_OUT) { if(stmt.getPredicate().getURI().contains(filterOut)) { filterPredicate = true; break; } } if(filterPredicate) { continue; } if(stmt.getSubject().isURIResource() && stmt.getSubject().getURI().contains(FILTER_OUT_RES)) { continue; } if(stmt.getObject().isURIResource() && stmt.getObject().asResource().getURI().contains(FILTER_OUT_RES)) { continue; } filtered.add(stmt); } return filtered; } /** * to be overridden by subclasses * @param model * @return model with VIVO-compatible statements added */ protected abstract Model mapToVIVO(Model model); @Override public void runIngest() throws InterruptedException { Date currentDateTime = Calendar.getInstance().getTime(); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); String graphTimeSuffix = "-" + df.format(currentDateTime); log.debug("Processing a limit of " + this.getConfiguration().getLimit() + " records"); log.debug("Processing in batches of " + getBatchSize() + " records"); String graphURI = getConfiguration().getResultsGraphURI(); if(!activeEndpointForResults()) { result = ModelFactory.createDefaultModel(); } IteratorWithSize<Model> it = getSourceModelIterator(); try { Integer totalRecords = it.size(); if(totalRecords != null) { this.getStatus().setTotalRecords(totalRecords); log.info(it.size() + " total records"); } Model buffer = ModelFactory.createDefaultModel(); this.getStatus().setMessage("harvesting records"); boolean dataWrittenToEndpoint = false; int count = 0; while(it.hasNext() && count < this.getConfiguration().getLimit()) { try { if(this.getStatus().isStopRequested()) { throw new InterruptedException(); } count++; Model model = mapToVIVO(it.next()); log.debug(model.size() + " statements before filtering"); if(this.getStatus().isStopRequested()) { throw new InterruptedException(); } model = filter(model); log.debug(model.size() + " statements after filtering"); if(this.getStatus().isStopRequested()) { throw new InterruptedException(); } String defaultNamespace = getDefaultNamespace(this.getConfiguration()); // TODO 2019-07-08 revisit because dangerous: rewrites geopolitical abox entities, etc. //if(defaultNamespace != null) { // model = rewriteUris(model, defaultNamespace, getPrefixName()); //} if(this.getStatus().isStopRequested()) { throw new InterruptedException(); } if(activeEndpointForResults()) { buffer.add(model); //if(count % getBatchSize() == 0 || !it.hasNext() if(buffer.size() >= TRIPLE_BUFFER_SIZE || !it.hasNext() || count == this.getConfiguration().getLimit()) { if(buffer.size() > 0) { dataWrittenToEndpoint = true; } log.debug("Adding " + buffer.size() + " triples to endpoint"); addToEndpoint(buffer, graphURI + graphTimeSuffix); buffer.removeAll(); } } else { result.add(model); } this.getStatus().setProcessedRecords(count); if(totalRecords != null && totalRecords > 0) { float completionPercentage = ((float) count / (float) totalRecords) * 100; log.info("Completion percentage " + completionPercentage); this.getStatus().setCompletionPercentage((int) completionPercentage); } } catch (InterruptedException e) { throw(e); // this is the one exception we want to throw } catch (Exception e) { log.error(e, e); this.getStatus().setErrorRecords(this.getStatus().getErrorRecords() + 1); } } boolean skipClearingOldData = false; if(!dataWrittenToEndpoint) { if(totalRecords == null) { skipClearingOldData = true; } else if (this.getStatus().getErrorRecords() > (totalRecords / 5)) { skipClearingOldData = true; } } if(activeEndpointForResults() && !skipClearingOldData) { this.getStatus().setMessage("removing old data"); log.info("removing old data"); List<String> allVersionsOfSource = getGraphsWithBaseURI(graphURI, getSparqlEndpoint()); for(String version : allVersionsOfSource) { if(this.getStatus().isStopRequested()) { throw new InterruptedException(); } if(version.startsWith(graphURI) && !version.endsWith(graphTimeSuffix)) { log.info("Clearing graph " + version); getSparqlEndpoint().clearGraph(version); } } } } finally { if(it != null) { log.info("Closing iterator"); it.close(); } } } protected String getDefaultNamespace(DataSourceConfiguration configuration) { Object o = configuration.getParameterMap().get("Vitro.defaultNamespace"); if(o instanceof String) { return (String) o; } else { return null; } } protected boolean activeEndpointForResults() { return (this.getConfiguration().getEndpointParameters() != null && this.getConfiguration().getResultsGraphURI() != null); } @Override public Model getResult() { return this.result; } protected Model renameByIdentifier(Model m, Property identifier, String namespace, String localNamePrefix) { Map<Resource, String> idMap = new HashMap<Resource, String>(); StmtIterator sit = m.listStatements(null, identifier, (RDFNode) null); while(sit.hasNext()) { Statement stmt = sit.next(); if(stmt.getObject().isLiteral()) { idMap.put(stmt.getSubject(), stripSpaces(stmt.getObject().asLiteral().getLexicalForm())); //stmt.getObject().asLiteral().getLexicalForm()); //stripNonWordChars(stmt.getObject().asLiteral().getLexicalForm())); } } for(Resource res : idMap.keySet()) { ResourceUtils.renameResource( res, namespace + localNamePrefix + idMap.get(res)); } return m; } protected String stripSpaces(String value) { if(value == null) { return value; } else { return value.replaceAll(" ", ""); } } protected String stripNonWordChars(String value) { if(value == null) { return value; } else { return value.replaceAll("\\W", ""); } } protected Model rewriteUris(Model model, String namespace, String localNamePrefix) { Model out = ModelFactory.createDefaultModel(); StmtIterator sit = model.listStatements(); while(sit.hasNext()) { Statement stmt = sit.next(); Resource subj = rewriteResource(stmt.getSubject(), namespace, localNamePrefix); RDFNode obj = stmt.getObject(); if( (!stmt.getPredicate().equals(RDF.type)) && (obj.isURIResource()) ) { obj = rewriteResource(obj.asResource(), namespace, localNamePrefix); } out.add(subj, stmt.getPredicate(), obj); } return out; } protected Resource rewriteResource(Resource res, String namespace, String localNamePrefix) { if(!res.isURIResource()) { return res; } // don't rewrite ORCID iDs, VIVO individuals or resources that are // already in the default namespace if(res.getURI().startsWith(namespace) || res.getURI().contains("orcid.org") || res.getURI().startsWith(VivoVocabulary.VIVO)) { return res; } try { URI uri = new URI(res.getURI()); String newLocalName = localNamePrefix + uri.getPath(); newLocalName = newLocalName.replaceAll("/", "-"); return ResourceFactory.createResource(namespace + newLocalName); } catch (URISyntaxException e) { log.debug(e, e); return res; } } protected abstract String getPrefixName(); }
13,121
0.552092
0.549806
315
40.653969
26.589727
134
false
false
0
0
0
0
0
0
0.55873
false
false
12
ebf01cb1e9a085fb02f6a80892fa23bb0e5bbdcb
25,709,674,285,306
c7eb6878e0479e2a3beaa9e047a5f0772a868ec6
/src/test/java/com/collabnet/ccf/ccfmaster/server/core/update/CoreVersionTest.java
0c09c9ec210358fed3ba77a239fb6c31e81015ac
[]
no_license
jonico/ccfmaster
https://github.com/jonico/ccfmaster
a4fea742245b2842f6ad65e387d69a03a4d33a69
a0eb04309242f7a281156549bcc0e72a450bbe49
refs/heads/master
2022-12-21T15:19:12.047000
2020-02-02T09:23:23
2020-02-02T09:23:23
52,020,440
3
3
null
false
2022-12-15T23:45:09
2016-02-18T16:15:01
2020-02-02T09:23:29
2022-12-15T23:45:06
221,902
3
3
18
Java
false
false
package com.collabnet.ccf.ccfmaster.server.core.update; import org.junit.Test; import com.collabnet.ccf.ccfmaster.config.Version; import static org.junit.Assert.*; public class CoreVersionTest { @Test public void everythingIsGreaterThanNull() { Version v = new Version(0, 0, 0, ""); assertTrue("any version should be newer than null", v.isNewerThan(null)); } @Test public void majorTrumpsMinor() { Version v1 = new Version(1, 0, 0, ""); Version v2 = new Version(0, 1, 0, ""); assertTrue("major should trump minor version", v1.isNewerThan(v2)); } @Test public void minorDecidesEqualMajor() { Version v1 = new Version(1, 1, 0, ""); Version v2 = new Version(1, 0, 0, ""); assertTrue("minor decides when major versions are equal", v1.isNewerThan(v2)); } @Test public void minorTrumpsPatch() { Version v1 = new Version(0, 1, 0, ""); Version v2 = new Version(0, 0, 1, ""); assertTrue("minor should trump patch version", v1.isNewerThan(v2)); } @Test public void patchDecidesEqualMinor() { Version v1 = new Version(0, 1, 1, ""); Version v2 = new Version(0, 1, 0, ""); assertTrue("patch decides when minor versions are equal", v1.isNewerThan(v2)); } }
UTF-8
Java
1,402
java
CoreVersionTest.java
Java
[]
null
[]
package com.collabnet.ccf.ccfmaster.server.core.update; import org.junit.Test; import com.collabnet.ccf.ccfmaster.config.Version; import static org.junit.Assert.*; public class CoreVersionTest { @Test public void everythingIsGreaterThanNull() { Version v = new Version(0, 0, 0, ""); assertTrue("any version should be newer than null", v.isNewerThan(null)); } @Test public void majorTrumpsMinor() { Version v1 = new Version(1, 0, 0, ""); Version v2 = new Version(0, 1, 0, ""); assertTrue("major should trump minor version", v1.isNewerThan(v2)); } @Test public void minorDecidesEqualMajor() { Version v1 = new Version(1, 1, 0, ""); Version v2 = new Version(1, 0, 0, ""); assertTrue("minor decides when major versions are equal", v1.isNewerThan(v2)); } @Test public void minorTrumpsPatch() { Version v1 = new Version(0, 1, 0, ""); Version v2 = new Version(0, 0, 1, ""); assertTrue("minor should trump patch version", v1.isNewerThan(v2)); } @Test public void patchDecidesEqualMinor() { Version v1 = new Version(0, 1, 1, ""); Version v2 = new Version(0, 1, 0, ""); assertTrue("patch decides when minor versions are equal", v1.isNewerThan(v2)); } }
1,402
0.582739
0.552068
46
28.47826
24.387041
81
false
false
0
0
0
0
0
0
1.086957
false
false
12
f7c34a3ec371fd1e7be1862785c05a7cdd03d184
10,050,223,515,136
77634990b8a3614a43e94885a22cf8237a781cc7
/LibD3ApiJavaTest/src/com/luzi82/d3/communityapi/test/CareerProfileTest.java
624dedcf6468f97e0140c05bbfb8cbf0017d0256
[]
no_license
luzi82/LibD3ApiJava
https://github.com/luzi82/LibD3ApiJava
205aca802f3e056a9e6f272d8a2fa1572f503ab4
6d502e28e509375bd251a9fdf37d7e84cdceac87
refs/heads/master
2021-01-20T21:20:42.970000
2014-07-26T10:42:54
2014-07-26T10:42:54
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.luzi82.d3.communityapi.test; import java.io.IOException; import org.junit.Assert; import org.junit.Test; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.luzi82.d3.communityapi.CareerProfile; import com.luzi82.d3.communityapi.Const; import com.luzi82.d3.communityapi.Hero; import com.luzi82.d3.communityapi.IO; public class CareerProfileTest { @Test public void test_000() throws JsonParseException, JsonMappingException, IOException { CareerProfile cp=IO.readCareerProfile("sample/careerprofile_000.json"); Assert.assertEquals(12, cp.heroes.length); Hero hero=cp.heroes[0]; Assert.assertEquals(317, hero.paragonLevel); Assert.assertEquals("LuziCrenata", hero.name); Assert.assertEquals(1784440, hero.id); Assert.assertEquals(70, hero.level); Assert.assertEquals(false, hero.hardcore); Assert.assertEquals(1, hero.gender); Assert.assertEquals("wizard", hero.clazz); Assert.assertEquals(1402106952L, hero.lastUpdated); Assert.assertEquals(Const.GENDER_FEMALE, cp.heroes[0].gender); Assert.assertEquals(Const.CLASS_WIZARD, cp.heroes[0].clazz); Assert.assertEquals(Const.CLASS_WITCHDOCTOR, cp.heroes[1].clazz); Assert.assertEquals(Const.CLASS_CRUSADER, cp.heroes[2].clazz); Assert.assertEquals(Const.CLASS_BARBARIAN, cp.heroes[3].clazz); Assert.assertEquals(Const.CLASS_DEMONHUNTER, cp.heroes[4].clazz); Assert.assertEquals(Const.CLASS_MONK, cp.heroes[5].clazz); Assert.assertEquals(true, cp.heroes[6].hardcore); Assert.assertEquals(1784440,cp.lastHeroPlayed); Assert.assertEquals(1402106952L,cp.lastUpdated); Assert.assertEquals(463614,cp.kills.monsters); Assert.assertEquals(40798,cp.kills.elites); Assert.assertEquals(832,cp.kills.hardcoreMonsters); Assert.assertEquals(0.302f,cp.timePlayed.barbarian,0.0001f); Assert.assertEquals(0.131f,cp.timePlayed.crusader,0.0001f); Assert.assertEquals(0.132f,cp.timePlayed.demonhunter,0.0001f); Assert.assertEquals(0.115f,cp.timePlayed.monk,0.0001f); Assert.assertEquals(0.939f,cp.timePlayed.witchdoctor,0.0001f); Assert.assertEquals(1.0f,cp.timePlayed.wizard,0.0001f); Assert.assertEquals(0,cp.fallenHeroes.length); Assert.assertEquals(317,cp.paragonLevel); Assert.assertEquals(0,cp.paragonLevelHardcore); Assert.assertEquals("luzi82#3202",cp.battleTag); Assert.assertEquals(true,cp.progression.act1); Assert.assertEquals(true,cp.progression.act2); Assert.assertEquals(true,cp.progression.act3); Assert.assertEquals(true,cp.progression.act4); Assert.assertEquals(true,cp.progression.act5); } }
UTF-8
Java
2,633
java
CareerProfileTest.java
Java
[ { "context": "s(317, hero.paragonLevel);\n\t\tAssert.assertEquals(\"LuziCrenata\", hero.name);\n\t\tAssert.assertEquals(1784", "end": 754, "score": 0.64914870262146, "start": 752, "tag": "NAME", "value": "Lu" }, { "context": ", hero.paragonLevel);\n\t\tAssert.assertEquals(\"LuziCrena...
null
[]
package com.luzi82.d3.communityapi.test; import java.io.IOException; import org.junit.Assert; import org.junit.Test; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.luzi82.d3.communityapi.CareerProfile; import com.luzi82.d3.communityapi.Const; import com.luzi82.d3.communityapi.Hero; import com.luzi82.d3.communityapi.IO; public class CareerProfileTest { @Test public void test_000() throws JsonParseException, JsonMappingException, IOException { CareerProfile cp=IO.readCareerProfile("sample/careerprofile_000.json"); Assert.assertEquals(12, cp.heroes.length); Hero hero=cp.heroes[0]; Assert.assertEquals(317, hero.paragonLevel); Assert.assertEquals("LuziCrenata", hero.name); Assert.assertEquals(1784440, hero.id); Assert.assertEquals(70, hero.level); Assert.assertEquals(false, hero.hardcore); Assert.assertEquals(1, hero.gender); Assert.assertEquals("wizard", hero.clazz); Assert.assertEquals(1402106952L, hero.lastUpdated); Assert.assertEquals(Const.GENDER_FEMALE, cp.heroes[0].gender); Assert.assertEquals(Const.CLASS_WIZARD, cp.heroes[0].clazz); Assert.assertEquals(Const.CLASS_WITCHDOCTOR, cp.heroes[1].clazz); Assert.assertEquals(Const.CLASS_CRUSADER, cp.heroes[2].clazz); Assert.assertEquals(Const.CLASS_BARBARIAN, cp.heroes[3].clazz); Assert.assertEquals(Const.CLASS_DEMONHUNTER, cp.heroes[4].clazz); Assert.assertEquals(Const.CLASS_MONK, cp.heroes[5].clazz); Assert.assertEquals(true, cp.heroes[6].hardcore); Assert.assertEquals(1784440,cp.lastHeroPlayed); Assert.assertEquals(1402106952L,cp.lastUpdated); Assert.assertEquals(463614,cp.kills.monsters); Assert.assertEquals(40798,cp.kills.elites); Assert.assertEquals(832,cp.kills.hardcoreMonsters); Assert.assertEquals(0.302f,cp.timePlayed.barbarian,0.0001f); Assert.assertEquals(0.131f,cp.timePlayed.crusader,0.0001f); Assert.assertEquals(0.132f,cp.timePlayed.demonhunter,0.0001f); Assert.assertEquals(0.115f,cp.timePlayed.monk,0.0001f); Assert.assertEquals(0.939f,cp.timePlayed.witchdoctor,0.0001f); Assert.assertEquals(1.0f,cp.timePlayed.wizard,0.0001f); Assert.assertEquals(0,cp.fallenHeroes.length); Assert.assertEquals(317,cp.paragonLevel); Assert.assertEquals(0,cp.paragonLevelHardcore); Assert.assertEquals("luzi82#3202",cp.battleTag); Assert.assertEquals(true,cp.progression.act1); Assert.assertEquals(true,cp.progression.act2); Assert.assertEquals(true,cp.progression.act3); Assert.assertEquals(true,cp.progression.act4); Assert.assertEquals(true,cp.progression.act5); } }
2,633
0.781998
0.723509
68
37.720589
23.639353
86
false
false
0
0
0
0
0
0
2.808824
false
false
12
f7c5a569ba9096470a174d6875a2a25a2c4c24f6
1,125,281,478,422
4053837f3dd1376ed9c679f8107132536c384084
/src/main/java/com/projeto/model/app/Agente.java
f815f0e84b9ac9350755d903f29cc9244996565f
[]
no_license
thiag0santanna/vaksine
https://github.com/thiag0santanna/vaksine
8c9d37e90a80932bcc2065434353375da03db8f5
add96462ba823fd23d70d5273d6f8f7dbc10586d
refs/heads/master
2020-09-13T14:05:08.185000
2019-12-01T21:20:43
2019-12-01T21:20:43
222,809,848
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.projeto.model.app; import java.util.Calendar; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import org.springframework.format.annotation.DateTimeFormat; @Entity public class Agente { @Id @GeneratedValue private Integer matricula; @NotBlank(message="O campo Nome precisa ser preenchido") private String nome; @NotBlank(message="O campo CPF precisa ser preenchido") private String cpf; @NotBlank(message="O campo Rg precisa ser preenchido") private String rg; @NotBlank(message="O campo Email precisa ser preenchido") private String email; @NotNull(message="O campo Data de nascimento precisa ser preenchido") @DateTimeFormat(pattern="dd/MM/yyyy") private Calendar dataNascimento; public Integer getMatricula() { return matricula; } public void setMatricula(Integer matricula) { this.matricula = matricula; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getCpf() { return cpf; } public void setCpf(String cpf) { this.cpf = cpf; } public String getRg() { return rg; } public void setRg(String rg) { this.rg = rg; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public Calendar getDataNascimento() { return dataNascimento; } public void setDataNascimento(Calendar dataNascimento) { this.dataNascimento = dataNascimento; } }
UTF-8
Java
1,581
java
Agente.java
Java
[]
null
[]
package com.projeto.model.app; import java.util.Calendar; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import org.springframework.format.annotation.DateTimeFormat; @Entity public class Agente { @Id @GeneratedValue private Integer matricula; @NotBlank(message="O campo Nome precisa ser preenchido") private String nome; @NotBlank(message="O campo CPF precisa ser preenchido") private String cpf; @NotBlank(message="O campo Rg precisa ser preenchido") private String rg; @NotBlank(message="O campo Email precisa ser preenchido") private String email; @NotNull(message="O campo Data de nascimento precisa ser preenchido") @DateTimeFormat(pattern="dd/MM/yyyy") private Calendar dataNascimento; public Integer getMatricula() { return matricula; } public void setMatricula(Integer matricula) { this.matricula = matricula; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getCpf() { return cpf; } public void setCpf(String cpf) { this.cpf = cpf; } public String getRg() { return rg; } public void setRg(String rg) { this.rg = rg; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public Calendar getDataNascimento() { return dataNascimento; } public void setDataNascimento(Calendar dataNascimento) { this.dataNascimento = dataNascimento; } }
1,581
0.746363
0.746363
72
20.958334
18.555799
70
false
false
0
0
0
0
0
0
1.319444
false
false
12
b63cdbcb049e2a424c0274586760488211558994
4,733,054,010,704
18c3a453f4911d5511164c93a0c1b212f5a588f4
/portal/src/main/java/com/barterAuctions/portal/services/MessageService.java
a41097e168085350156b824b33f2964c84d60b1e
[]
no_license
rhalfaf/BarteAuctionsApplication
https://github.com/rhalfaf/BarteAuctionsApplication
b61de1d6a2f25b9ef2bd06f4bddd6960cff6ef84
bc46223c595b288185695a48b80a641369feca8d
refs/heads/master
2023-02-16T12:18:57.560000
2021-01-15T11:04:12
2021-01-15T11:04:12
310,053,062
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.barterAuctions.portal.services; import com.barterAuctions.portal.models.messages.Message; import com.barterAuctions.portal.repositories.MessagesRepository; import org.springframework.stereotype.Service; import java.time.LocalDateTime; import java.time.LocalTime; import java.util.List; import java.util.stream.Collectors; @Service public class MessageService { final MessagesRepository repository; public MessageService(MessagesRepository repository) { this.repository = repository; } public List<Message> findAllBySender(String sender){ return repository.findAllBySender(sender); } public List<Message> findAllByRecipient(String recipient){ return repository.findAllByRecipient(recipient); } public void sendMessage(Message message){ message.setDateTime(LocalDateTime.now().with(LocalTime.now())); repository.saveAndFlush(message); } public List<Message> getReceiptedMessages(String recipient){ return repository.findAllByRecipient(recipient).stream().filter(Message::isShowRecipient).collect(Collectors.toList()); } public List<Message> getSentMessages(String sender){ return repository.findAllBySender(sender).stream().filter(Message::isShowSender).collect(Collectors.toList()); } public void setMessageAsRead(Long id){ repository.changeMessageReadStatus(id); } public String readMessageById(Long id){ repository.changeMessageReadStatus(id); return repository.returnMessageTextById(id); } public void deleteForRecipient(Long id){ repository.deleteForRecipient(id); } public void deleteForSender(Long id){ repository.deleteForSender(id); } }
UTF-8
Java
1,752
java
MessageService.java
Java
[]
null
[]
package com.barterAuctions.portal.services; import com.barterAuctions.portal.models.messages.Message; import com.barterAuctions.portal.repositories.MessagesRepository; import org.springframework.stereotype.Service; import java.time.LocalDateTime; import java.time.LocalTime; import java.util.List; import java.util.stream.Collectors; @Service public class MessageService { final MessagesRepository repository; public MessageService(MessagesRepository repository) { this.repository = repository; } public List<Message> findAllBySender(String sender){ return repository.findAllBySender(sender); } public List<Message> findAllByRecipient(String recipient){ return repository.findAllByRecipient(recipient); } public void sendMessage(Message message){ message.setDateTime(LocalDateTime.now().with(LocalTime.now())); repository.saveAndFlush(message); } public List<Message> getReceiptedMessages(String recipient){ return repository.findAllByRecipient(recipient).stream().filter(Message::isShowRecipient).collect(Collectors.toList()); } public List<Message> getSentMessages(String sender){ return repository.findAllBySender(sender).stream().filter(Message::isShowSender).collect(Collectors.toList()); } public void setMessageAsRead(Long id){ repository.changeMessageReadStatus(id); } public String readMessageById(Long id){ repository.changeMessageReadStatus(id); return repository.returnMessageTextById(id); } public void deleteForRecipient(Long id){ repository.deleteForRecipient(id); } public void deleteForSender(Long id){ repository.deleteForSender(id); } }
1,752
0.738584
0.738584
60
28.200001
29.125475
127
false
false
0
0
0
0
0
0
0.35
false
false
12
469387f7d7d52a9f30849ae60d00a02c9551c70c
4,097,398,848,922
cebbc3a522a5e9e6bf838c36d783ba72ef036a56
/app/src/main/java/com/vincis/betradict/write_quest.java
ab3d891d965cecec0f13acc3e1df971f611fa0b2
[]
no_license
sidraj000/BetradictAdmin
https://github.com/sidraj000/BetradictAdmin
601d94aeceb8bda92d22c88057bfb7dbb7cc632e
150703d748270be4192d29372df82b6f11fe2ed2
refs/heads/master
2020-05-25T11:56:37.391000
2019-06-21T16:08:34
2019-06-21T16:08:34
187,788,125
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.vincis.betradict; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import com.vincis.betradict.Class.AllQuest; import com.vincis.betradict.Class.Quest; import com.vincis.betradict.Class.User; import com.vincis.betradict.Class.Quest_wall; import com.google.firebase.database.ChildEventListener; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import java.util.ArrayList; import java.util.List; import static android.support.constraint.Constraints.TAG; public class write_quest extends AppCompatActivity { Spinner ptGame; EditText ptQues,ptOpt1,ptOpt2,ptOpt3,tvId,tvGId; TextView tvQuest; Button btnSub,btnEdit; int clickStatus=0; public DatabaseReference mRef; public List<String> mUserIds = new ArrayList<>(); public List<User> mUser = new ArrayList<>( ); public ChildEventListener mChildEventListener; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_write_quest); ptQues=findViewById(R.id.ptQues); ptOpt1=findViewById(R.id.ptOpt1); ptOpt2=findViewById(R.id.ptOpt2); ptOpt3=findViewById(R.id.ptOpt3); btnSub=findViewById(R.id.btnSub); btnEdit=findViewById(R.id.btnEdit); tvId=findViewById(R.id.tvId); tvGId=findViewById(R.id.tvGId); tvQuest=findViewById(R.id.tvQuest); ptGame=findViewById(R.id.ptGame); ArrayAdapter<CharSequence> adapter =ArrayAdapter.createFromResource(this,R.array.Games,R.layout.support_simple_spinner_dropdown_item); ptGame.setAdapter(adapter); tvQuest.setVisibility(View.GONE); btnEdit.setVisibility(View.GONE); mRef = FirebaseDatabase.getInstance().getReference() .child("users"); ChildEventListener childEventListener = new ChildEventListener() { @Override public void onChildAdded(DataSnapshot dataSnapshot, String previousChildName) { Log.d(TAG, "onChildAdded:" + dataSnapshot.getKey()); // A new comment has been added, add it to the displayed list User user = dataSnapshot.getValue(User.class); // [START_EXCLUDE] // Update RecyclerView mUser.add(user); mUserIds.add(user.per.uid); // [END_EXCLUDE] } @Override public void onChildChanged(DataSnapshot dataSnapshot, String previousChildName) { Log.d(TAG, "onChildChanged:" + dataSnapshot.getKey()); // A comment has changed, use the key to determine if we are displaying this // comment and if so displayed the changed comment. User user = dataSnapshot.getValue(User.class); String userKey = dataSnapshot.getKey(); // [START_EXCLUDE] int userIndex = mUserIds.indexOf(userKey); if (userIndex > -1) { // Replace with the new data mUser.set(userIndex, user); // Update the RecyclerView } else { Log.w(TAG, "onChildChanged:unknown_child:" + userKey); } // [END_EXCLUDE] } @Override public void onChildRemoved(DataSnapshot dataSnapshot) { Log.d(TAG, "onChildRemoved:" + dataSnapshot.getKey()); // A comment has changed, use the key to determine if we are displaying this // comment and if so remove it. String userKey = dataSnapshot.getKey(); // [START_EXCLUDE] int userIndex = mUserIds.indexOf(userKey); if (userIndex> -1) { // Remove data from the list mUserIds.remove(userIndex); mUser.remove(userIndex); // Update the RecyclerView } else { Log.w(TAG, "onChildRemoved:unknown_child:" + userKey); } // [END_EXCLUDE] } @Override public void onChildMoved(DataSnapshot dataSnapshot, String previousChildName) { Log.d(TAG, "onChildMoved:" + dataSnapshot.getKey()); // A comment has changed position, use the key to determine if we are // displaying this comment and if so move it. // ... } @Override public void onCancelled(DatabaseError databaseError) { } }; mRef.addChildEventListener(childEventListener); // [END child_event_listener_recycler] // Store reference to listener so it can be removed on app stop mChildEventListener = childEventListener; btnSub.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (ptQues.getText().toString().isEmpty() || ptOpt1.getText().toString().isEmpty() || ptOpt2.getText().toString().isEmpty() || ptOpt3.getText().toString().isEmpty() || tvId.getText().toString().isEmpty()||tvGId.getText().toString().isEmpty()) { Toast.makeText(write_quest.this, "Enter all details", Toast.LENGTH_SHORT).show(); } else if (clickStatus == 0) { tvQuest.setText("Game "+ptGame.getSelectedItem().toString()+"\n"+"ID= " + tvId.getText().toString() + "\n" + ptQues.getText().toString() + "\n" + "1- " + ptOpt1.getText().toString() + "\n" + "2- " + ptOpt2.getText().toString() + "\n" + "3- " + ptOpt3.getText().toString()); tvQuest.setVisibility(View.VISIBLE); ptQues.setVisibility(View.GONE); ptOpt1.setVisibility(View.GONE); ptOpt2.setVisibility(View.GONE); ptOpt3.setVisibility(View.GONE); tvId.setVisibility(View.GONE); ptGame.setVisibility(View.GONE); clickStatus = 1; btnSub.setText("Submit"); btnEdit.setVisibility(View.VISIBLE); } else { DatabaseReference mDRef = FirebaseDatabase.getInstance().getReference(); if (ptQues.getText().toString().isEmpty() || ptOpt1.getText().toString().isEmpty() || ptOpt2.getText().toString().isEmpty() || ptOpt3.getText().toString().isEmpty() || tvId.getText().toString().isEmpty()||tvGId.getText().toString().isEmpty()) { Toast.makeText(write_quest.this, "Enter all details", Toast.LENGTH_SHORT).show(); } else { Quest quest = new Quest(ptQues.getText().toString(), ptOpt1.getText().toString(), ptOpt2.getText().toString(), ptOpt3.getText().toString(), tvId.getText().toString(), 0, 0,0, "U", "U"); for (int i = 0; i < mUserIds.size(); i++) { mDRef.child("quest_usr").child(mUserIds.get(i)).child(ptGame.getSelectedItem().toString()).child(tvGId.getText().toString()).child("normal").child(tvId.getText().toString()).setValue(quest); } AllQuest allQuest = new AllQuest(ptQues.getText().toString(), ptOpt1.getText().toString(), ptOpt2.getText().toString(), ptOpt3.getText().toString(), tvId.getText().toString(), new Quest_wall(0,0,0,150,150,150,50,50, 50, "U", 0,0)); mDRef.child("quest").child(ptGame.getSelectedItem().toString()).child(tvGId.getText().toString()).child("normal").child(tvId.getText().toString()).setValue(allQuest); Toast.makeText(write_quest.this, "Question Added Successfully", Toast.LENGTH_SHORT).show(); btnSub.setText("PREVIEW"); tvQuest.setVisibility(View.GONE); ptQues.setVisibility(View.VISIBLE); ptOpt1.setVisibility(View.VISIBLE); ptOpt2.setVisibility(View.VISIBLE); ptOpt3.setVisibility(View.VISIBLE); tvId.setVisibility(View.VISIBLE); btnEdit.setVisibility(View.GONE); ptQues.setText(""); tvId.setText(""); ptOpt1.setText(""); ptOpt2.setText(""); ptOpt3.setText(""); clickStatus = 0; } } } }); btnEdit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { btnSub.setText("PREVIEW"); tvQuest.setVisibility(View.GONE); ptQues.setVisibility(View.VISIBLE); ptOpt1.setVisibility(View.VISIBLE); ptOpt2.setVisibility(View.VISIBLE); ptOpt3.setVisibility(View.VISIBLE); tvId.setVisibility(View.GONE); ptGame.setVisibility(View.VISIBLE); clickStatus=0; } }); } @Override public void onStop() { super.onStop(); if (mChildEventListener != null) { mRef.removeEventListener(mChildEventListener); } } }
UTF-8
Java
9,851
java
write_quest.java
Java
[]
null
[]
package com.vincis.betradict; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import com.vincis.betradict.Class.AllQuest; import com.vincis.betradict.Class.Quest; import com.vincis.betradict.Class.User; import com.vincis.betradict.Class.Quest_wall; import com.google.firebase.database.ChildEventListener; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import java.util.ArrayList; import java.util.List; import static android.support.constraint.Constraints.TAG; public class write_quest extends AppCompatActivity { Spinner ptGame; EditText ptQues,ptOpt1,ptOpt2,ptOpt3,tvId,tvGId; TextView tvQuest; Button btnSub,btnEdit; int clickStatus=0; public DatabaseReference mRef; public List<String> mUserIds = new ArrayList<>(); public List<User> mUser = new ArrayList<>( ); public ChildEventListener mChildEventListener; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_write_quest); ptQues=findViewById(R.id.ptQues); ptOpt1=findViewById(R.id.ptOpt1); ptOpt2=findViewById(R.id.ptOpt2); ptOpt3=findViewById(R.id.ptOpt3); btnSub=findViewById(R.id.btnSub); btnEdit=findViewById(R.id.btnEdit); tvId=findViewById(R.id.tvId); tvGId=findViewById(R.id.tvGId); tvQuest=findViewById(R.id.tvQuest); ptGame=findViewById(R.id.ptGame); ArrayAdapter<CharSequence> adapter =ArrayAdapter.createFromResource(this,R.array.Games,R.layout.support_simple_spinner_dropdown_item); ptGame.setAdapter(adapter); tvQuest.setVisibility(View.GONE); btnEdit.setVisibility(View.GONE); mRef = FirebaseDatabase.getInstance().getReference() .child("users"); ChildEventListener childEventListener = new ChildEventListener() { @Override public void onChildAdded(DataSnapshot dataSnapshot, String previousChildName) { Log.d(TAG, "onChildAdded:" + dataSnapshot.getKey()); // A new comment has been added, add it to the displayed list User user = dataSnapshot.getValue(User.class); // [START_EXCLUDE] // Update RecyclerView mUser.add(user); mUserIds.add(user.per.uid); // [END_EXCLUDE] } @Override public void onChildChanged(DataSnapshot dataSnapshot, String previousChildName) { Log.d(TAG, "onChildChanged:" + dataSnapshot.getKey()); // A comment has changed, use the key to determine if we are displaying this // comment and if so displayed the changed comment. User user = dataSnapshot.getValue(User.class); String userKey = dataSnapshot.getKey(); // [START_EXCLUDE] int userIndex = mUserIds.indexOf(userKey); if (userIndex > -1) { // Replace with the new data mUser.set(userIndex, user); // Update the RecyclerView } else { Log.w(TAG, "onChildChanged:unknown_child:" + userKey); } // [END_EXCLUDE] } @Override public void onChildRemoved(DataSnapshot dataSnapshot) { Log.d(TAG, "onChildRemoved:" + dataSnapshot.getKey()); // A comment has changed, use the key to determine if we are displaying this // comment and if so remove it. String userKey = dataSnapshot.getKey(); // [START_EXCLUDE] int userIndex = mUserIds.indexOf(userKey); if (userIndex> -1) { // Remove data from the list mUserIds.remove(userIndex); mUser.remove(userIndex); // Update the RecyclerView } else { Log.w(TAG, "onChildRemoved:unknown_child:" + userKey); } // [END_EXCLUDE] } @Override public void onChildMoved(DataSnapshot dataSnapshot, String previousChildName) { Log.d(TAG, "onChildMoved:" + dataSnapshot.getKey()); // A comment has changed position, use the key to determine if we are // displaying this comment and if so move it. // ... } @Override public void onCancelled(DatabaseError databaseError) { } }; mRef.addChildEventListener(childEventListener); // [END child_event_listener_recycler] // Store reference to listener so it can be removed on app stop mChildEventListener = childEventListener; btnSub.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (ptQues.getText().toString().isEmpty() || ptOpt1.getText().toString().isEmpty() || ptOpt2.getText().toString().isEmpty() || ptOpt3.getText().toString().isEmpty() || tvId.getText().toString().isEmpty()||tvGId.getText().toString().isEmpty()) { Toast.makeText(write_quest.this, "Enter all details", Toast.LENGTH_SHORT).show(); } else if (clickStatus == 0) { tvQuest.setText("Game "+ptGame.getSelectedItem().toString()+"\n"+"ID= " + tvId.getText().toString() + "\n" + ptQues.getText().toString() + "\n" + "1- " + ptOpt1.getText().toString() + "\n" + "2- " + ptOpt2.getText().toString() + "\n" + "3- " + ptOpt3.getText().toString()); tvQuest.setVisibility(View.VISIBLE); ptQues.setVisibility(View.GONE); ptOpt1.setVisibility(View.GONE); ptOpt2.setVisibility(View.GONE); ptOpt3.setVisibility(View.GONE); tvId.setVisibility(View.GONE); ptGame.setVisibility(View.GONE); clickStatus = 1; btnSub.setText("Submit"); btnEdit.setVisibility(View.VISIBLE); } else { DatabaseReference mDRef = FirebaseDatabase.getInstance().getReference(); if (ptQues.getText().toString().isEmpty() || ptOpt1.getText().toString().isEmpty() || ptOpt2.getText().toString().isEmpty() || ptOpt3.getText().toString().isEmpty() || tvId.getText().toString().isEmpty()||tvGId.getText().toString().isEmpty()) { Toast.makeText(write_quest.this, "Enter all details", Toast.LENGTH_SHORT).show(); } else { Quest quest = new Quest(ptQues.getText().toString(), ptOpt1.getText().toString(), ptOpt2.getText().toString(), ptOpt3.getText().toString(), tvId.getText().toString(), 0, 0,0, "U", "U"); for (int i = 0; i < mUserIds.size(); i++) { mDRef.child("quest_usr").child(mUserIds.get(i)).child(ptGame.getSelectedItem().toString()).child(tvGId.getText().toString()).child("normal").child(tvId.getText().toString()).setValue(quest); } AllQuest allQuest = new AllQuest(ptQues.getText().toString(), ptOpt1.getText().toString(), ptOpt2.getText().toString(), ptOpt3.getText().toString(), tvId.getText().toString(), new Quest_wall(0,0,0,150,150,150,50,50, 50, "U", 0,0)); mDRef.child("quest").child(ptGame.getSelectedItem().toString()).child(tvGId.getText().toString()).child("normal").child(tvId.getText().toString()).setValue(allQuest); Toast.makeText(write_quest.this, "Question Added Successfully", Toast.LENGTH_SHORT).show(); btnSub.setText("PREVIEW"); tvQuest.setVisibility(View.GONE); ptQues.setVisibility(View.VISIBLE); ptOpt1.setVisibility(View.VISIBLE); ptOpt2.setVisibility(View.VISIBLE); ptOpt3.setVisibility(View.VISIBLE); tvId.setVisibility(View.VISIBLE); btnEdit.setVisibility(View.GONE); ptQues.setText(""); tvId.setText(""); ptOpt1.setText(""); ptOpt2.setText(""); ptOpt3.setText(""); clickStatus = 0; } } } }); btnEdit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { btnSub.setText("PREVIEW"); tvQuest.setVisibility(View.GONE); ptQues.setVisibility(View.VISIBLE); ptOpt1.setVisibility(View.VISIBLE); ptOpt2.setVisibility(View.VISIBLE); ptOpt3.setVisibility(View.VISIBLE); tvId.setVisibility(View.GONE); ptGame.setVisibility(View.VISIBLE); clickStatus=0; } }); } @Override public void onStop() { super.onStop(); if (mChildEventListener != null) { mRef.removeEventListener(mChildEventListener); } } }
9,851
0.576388
0.569181
224
42.97768
44.401722
297
false
false
0
0
0
0
0
0
0.848214
false
false
12
24c4153610aab237b9ea78820934b439336b553a
11,562,052,008,833
d1eb4ae5d9da2afb2fc9df95ad833a792db8cfe6
/IteratorUkazka/src/cz/spsejecna/kuzma/myArrayList.java
726003462cf16b23ba8a1b287e3ea0b9f046aa70
[]
no_license
i1ystery/IT
https://github.com/i1ystery/IT
0032b146f0c42da59f410b57c8b63314bef12737
cacb2e5dc7ff86980d91119e9b09f4b3f7366601
refs/heads/master
2022-10-24T01:55:56.790000
2020-06-20T21:11:50
2020-06-20T21:11:50
267,935,542
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cz.spsejecna.kuzma; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class myArrayList<T> implements Iterable<T> { ArrayList<T> myArray = new ArrayList<>(); public void add(T value){ myArray.add(value); } public Iterator<T> iterator() { return new myIterator<T>(myArray); } /* tato trida reprezentuje iterator, * ktery se pouziva v tride myArrayList pri implementovani Iterable */ public class myIterator<E> implements Iterator<E> { int position = 0; List<E> tempList; public myIterator(List<E> myList) { this.tempList = myList; } /*metoda, ktera kontroluje, zda v poli je nasledujici prvek */ public boolean hasNext() { if(tempList.size()>=position+1){ return true; } return false; } /*metoda, ktera vypisuje nasledujici prvek v poli myArray. * Da se menit aby se tam treba vypisoval ne dalsi prvek, * ale bude preskakovat 1 a vypisovat ten nasledujici */ public E next() { E value = tempList.get(position); position+=2; return value; } } }
UTF-8
Java
1,074
java
myArrayList.java
Java
[]
null
[]
package cz.spsejecna.kuzma; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class myArrayList<T> implements Iterable<T> { ArrayList<T> myArray = new ArrayList<>(); public void add(T value){ myArray.add(value); } public Iterator<T> iterator() { return new myIterator<T>(myArray); } /* tato trida reprezentuje iterator, * ktery se pouziva v tride myArrayList pri implementovani Iterable */ public class myIterator<E> implements Iterator<E> { int position = 0; List<E> tempList; public myIterator(List<E> myList) { this.tempList = myList; } /*metoda, ktera kontroluje, zda v poli je nasledujici prvek */ public boolean hasNext() { if(tempList.size()>=position+1){ return true; } return false; } /*metoda, ktera vypisuje nasledujici prvek v poli myArray. * Da se menit aby se tam treba vypisoval ne dalsi prvek, * ale bude preskakovat 1 a vypisovat ten nasledujici */ public E next() { E value = tempList.get(position); position+=2; return value; } } }
1,074
0.68622
0.682495
46
22.347826
20.376049
70
false
false
0
0
0
0
0
0
1.978261
false
false
12
49f23c507a276bc50f4b4e7eef302f20a3e3bdb7
31,945,966,763,068
d34f769065c4aa64320b9a165f072d5e8afc2f78
/src/main/java/com/marcarndt/morsemonkey/telegram/alerts/command/comandlets/chef/ChefCommands.java
73dc4c01fe2ae9642f9a28f57a99dff06675a5fc
[]
no_license
zamedic/MorseMonkey
https://github.com/zamedic/MorseMonkey
a2cf915bf12f1b112cef06fff47cea8744959b0d
4479318d855f6de8ee163de5592feb7b76686b06
refs/heads/initialize-delivery-pipeline
2021-01-18T20:55:59.054000
2017-05-05T08:56:33
2017-05-05T08:56:33
87,002,050
1
0
null
false
2018-06-13T07:33:48
2017-04-02T17:13:35
2017-12-06T15:35:34
2017-05-05T08:57:09
245
1
0
0
Java
false
null
package com.marcarndt.morsemonkey.telegram.alerts.command.comandlets.chef; import com.marcarndt.morsemonkey.services.StateService.State; import com.marcarndt.morsemonkey.telegram.alerts.MorseBot; import com.marcarndt.morsemonkey.telegram.alerts.command.ConfigureCommand; import com.marcarndt.morsemonkey.telegram.alerts.command.comandlets.Commandlet; import java.util.List; import javax.ejb.Stateless; import org.telegram.telegrambots.api.objects.Message; /** * Created by arndt on 2017/05/04. */ @Stateless public class ChefCommands implements Commandlet { public static final String server = "Server URL"; public static final String user = "User"; public static final String key = "Key Path"; public static final String org = "Organization"; @Override public boolean canHandleCommand(Message message, State state) { return state.equals(State.CONFIGURE) && message.getText().equals(ConfigureCommand.chef); } @Override public void handleCommand(Message message, State state, List<String> parameters, MorseBot morseBot) { morseBot.sendReplyKeyboardMessage(message,"Select option",server,user,key,org); } @Override public State getNewState(Message message, State command) { return State.CONFIGURE_CHEF; } @Override public List<String> getNewStateParams(Message message, State state, List<String> parameters) { return null; } }
UTF-8
Java
1,388
java
ChefCommands.java
Java
[ { "context": "legrambots.api.objects.Message;\n\n/**\n * Created by arndt on 2017/05/04.\n */\n@Stateless\npublic class ChefCo", "end": 481, "score": 0.9996272921562195, "start": 476, "tag": "USERNAME", "value": "arndt" }, { "context": "Server URL\";\n public static final String use...
null
[]
package com.marcarndt.morsemonkey.telegram.alerts.command.comandlets.chef; import com.marcarndt.morsemonkey.services.StateService.State; import com.marcarndt.morsemonkey.telegram.alerts.MorseBot; import com.marcarndt.morsemonkey.telegram.alerts.command.ConfigureCommand; import com.marcarndt.morsemonkey.telegram.alerts.command.comandlets.Commandlet; import java.util.List; import javax.ejb.Stateless; import org.telegram.telegrambots.api.objects.Message; /** * Created by arndt on 2017/05/04. */ @Stateless public class ChefCommands implements Commandlet { public static final String server = "Server URL"; public static final String user = "User"; public static final String key = "Key Path"; public static final String org = "Organization"; @Override public boolean canHandleCommand(Message message, State state) { return state.equals(State.CONFIGURE) && message.getText().equals(ConfigureCommand.chef); } @Override public void handleCommand(Message message, State state, List<String> parameters, MorseBot morseBot) { morseBot.sendReplyKeyboardMessage(message,"Select option",server,user,key,org); } @Override public State getNewState(Message message, State command) { return State.CONFIGURE_CHEF; } @Override public List<String> getNewStateParams(Message message, State state, List<String> parameters) { return null; } }
1,388
0.773775
0.768012
42
32.047619
30.667147
96
false
false
0
0
0
0
0
0
0.666667
false
false
12
8362723b419a6bf89924ef1cae8096b40169402b
33,243,046,914,885
04394e58da3c089b7e520f26f64dd8dfc99838c6
/java-workspace/java/src/com/bit/jdbc/ConnectMain.java
6612b2a191ca58976311d5efb389aafd5dd098ed
[]
no_license
Ddock2/Bit-Study2
https://github.com/Ddock2/Bit-Study2
be462e11239805472ebbf86c35ffc792eb0b237c
7dcb18b1c01a5c182f5d7e5a1bc435cf5905fdf9
refs/heads/master
2020-04-15T08:17:11.057000
2019-05-17T08:46:26
2019-05-17T08:46:26
164,416,667
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bit.jdbc; import java.sql.Connection; import java.sql.DriverManager; // JDBC 연결 테스트 public class ConnectMain { public static void main(String[] args) { Connection con = null; try { // 드라이버 로딩 Class.forName("oracle.jdbc.driver.OracleDriver"); // 사용자 정보 String url = "jdbc:oracle:thin:@127.0.0.1:1521:xe"; String user = "hr"; String password = "hr"; con = DriverManager.getConnection(url, user, password); System.out.println("연결 성공!"); }catch(Exception e) { e.printStackTrace(); }finally { try { if(con != null) { con.close(); } }catch(Exception e) { e.printStackTrace(); } } } }
UTF-8
Java
721
java
ConnectMain.java
Java
[ { "context": "\t\n\t\t\t// 사용자 정보\n\t\t\tString url = \"jdbc:oracle:thin:@127.0.0.1:1521:xe\";\n\t\t\tString user = \"hr\";\n\t\t\tString passwo", "end": 334, "score": 0.9996704459190369, "start": 325, "tag": "IP_ADDRESS", "value": "127.0.0.1" }, { "context": "racle:thin:@127.0.0.1:1...
null
[]
package com.bit.jdbc; import java.sql.Connection; import java.sql.DriverManager; // JDBC 연결 테스트 public class ConnectMain { public static void main(String[] args) { Connection con = null; try { // 드라이버 로딩 Class.forName("oracle.jdbc.driver.OracleDriver"); // 사용자 정보 String url = "jdbc:oracle:thin:@127.0.0.1:1521:xe"; String user = "hr"; String password = "hr"; con = DriverManager.getConnection(url, user, password); System.out.println("연결 성공!"); }catch(Exception e) { e.printStackTrace(); }finally { try { if(con != null) { con.close(); } }catch(Exception e) { e.printStackTrace(); } } } }
721
0.60793
0.593245
39
16.461538
15.621888
59
false
false
0
0
0
0
0
0
2.435897
false
false
12
9309f383c159549c9924b8d8cef1fb1b944bf56a
17,978,733,118,757
12729a50f1ff756c4c3efd2da81d1d44a9d571e1
/src/test/java/edu/uniritter/giovanni/solid/liskov/test/TestaCarros.java
a56dc750271865de3c1bba7db2e21d0759160fb2
[]
no_license
willsg89/aoo-uniritter-p1
https://github.com/willsg89/aoo-uniritter-p1
d6e0d914fbd3c05ef673349a014307f89fbb21b7
c47f4c33c878b4815970cb2316748c73672d0487
refs/heads/master
2016-04-02T19:36:05.744000
2015-08-22T15:02:00
2015-08-22T15:02:00
41,212,224
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.uniritter.giovanni.solid.liskov.test; import static org.junit.Assert.*; import edu.uniritter.giovani.solid.liskov.CarroNissan; import edu.uniritter.giovani.solid.liskov.CarroVolvo; import edu.uniritter.giovani.solid.liskov.ICarro; import org.junit.Test; public class TestaCarros { @Test public void test() { try{ ICarro carro; carro = new CarroNissan(); carro.ligar(); carro.rodar(); carro.mudarMarcha(); carro.mudarMarcha(); carro.parar(); carro = new CarroVolvo(); carro.ligar(); carro.rodar(); carro.mudarMarcha(); carro.parar(); }catch(RuntimeException r){ System.out.println(r.getMessage()); } } }
UTF-8
Java
681
java
TestaCarros.java
Java
[]
null
[]
package edu.uniritter.giovanni.solid.liskov.test; import static org.junit.Assert.*; import edu.uniritter.giovani.solid.liskov.CarroNissan; import edu.uniritter.giovani.solid.liskov.CarroVolvo; import edu.uniritter.giovani.solid.liskov.ICarro; import org.junit.Test; public class TestaCarros { @Test public void test() { try{ ICarro carro; carro = new CarroNissan(); carro.ligar(); carro.rodar(); carro.mudarMarcha(); carro.mudarMarcha(); carro.parar(); carro = new CarroVolvo(); carro.ligar(); carro.rodar(); carro.mudarMarcha(); carro.parar(); }catch(RuntimeException r){ System.out.println(r.getMessage()); } } }
681
0.688693
0.688693
36
17.916666
16.038799
54
false
false
0
0
0
0
0
0
2.111111
false
false
12
44e790a37e7b8b772e76ebcf42cbfd0ccee44e15
6,167,573,085,614
1cda5a3b88c7fbd6e533cb56e329561b35208225
/ud.tesis.sgpg/UDProject/database/com/developer/persistence/modulo/anteproyecto/AnteproyectoControllerDB.java
582863651dc8ae45ae20b7f9098c342bedd19444
[]
no_license
jerezjcv/ud-tesis
https://github.com/jerezjcv/ud-tesis
40826c77fc5e6aa2fbd20816b0cbc1fd93912c24
c4375d93e555b62b20eaba7dc128d5d3bd320093
refs/heads/master
2016-03-22T09:23:05.296000
2015-06-16T02:58:04
2015-06-16T02:58:04
32,276,890
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.developer.persistence.modulo.anteproyecto; import java.util.HashMap; import java.util.List; import org.apache.ibatis.session.SqlSession; import com.developer.core.utils.SimpleLogger; import com.developer.logic.modulo.anteproyecto.dto.Anteproyecto; import com.developer.logic.modulo.anteproyecto.dto.EstadoAnteproyecto; import com.developer.logic.modulo.anteproyecto.dto.FormularioAnteproyecto; import com.developer.logic.modulo.anteproyecto.dto.HistoricoAnteproyecto; import com.developer.logic.modulo.anteproyecto.dto.RevisorAnteproyecto; import com.developer.logic.modulo.autenticacion.dto.Usuario; import com.developer.logic.modulo.general.dto.Profesor; import com.developer.logic.modulo.prepropuesta.dto.Prepropuesta; import com.developer.mybatis.DBManager; import com.developer.persistence.modulo.anteproyecto.mapper.dao.AnteproyectoDao; import com.developer.persistence.modulo.prepropuesta.mapper.dao.PrepropuestaDao; public class AnteproyectoControllerDB { private static AnteproyectoControllerDB instance; public static AnteproyectoControllerDB getInstance() { if (instance == null) { instance = new AnteproyectoControllerDB(); } return instance; } /** *=================================================== * CONSULTAS ======================================== *=================================================== */ public Anteproyecto getAnteproyecto(Long antp_antp){ SqlSession session = DBManager.openSession(); try { AnteproyectoDao dao = session.getMapper(AnteproyectoDao.class); return dao.getAnteproyecto(antp_antp); } catch (Exception e) { SimpleLogger.error("Error getAnteproyecto", e); return null; } finally { session.close(); } } public List<Anteproyecto> getAnteproyectosPorEstudiante(String estd_estd, String...antp_estados){ SqlSession session = DBManager.openSession(); try { AnteproyectoDao dao = session.getMapper(AnteproyectoDao.class); HashMap<String , Object> hashMap = new HashMap<String, Object>(); hashMap.put("estd_estd", estd_estd); if(antp_estados!=null){ String estados=""; for (String string : antp_estados) { estados = estados+"'"+string+"',"; } estados = estados.substring(0, estados.lastIndexOf(',')); hashMap.put("antp_estados", estados); } return dao.getAnteproyectosPorEstudiante(hashMap); } catch (Exception e) { SimpleLogger.error("Error getAnteproyectosPorEstudiante", e); return null; } finally { session.close(); } } public List<Anteproyecto> getAnteproyectosProyectoCurricular(Long pcur_pcur, String...ante_estados ) { SqlSession session = DBManager.openSession(); try { AnteproyectoDao dao = session.getMapper(AnteproyectoDao.class); HashMap<String , Object> hashMap = new HashMap<String, Object>(); hashMap.put("pcur_pcur", pcur_pcur); if(ante_estados!=null){ String estados=""; for (String string : ante_estados) { estados = estados+"'"+string+"',"; } estados = estados.substring(0, estados.lastIndexOf(',')); hashMap.put("antp_estados", estados); } return dao.getAnteproyectosProyectoCurricular(hashMap); } catch (Exception e) { SimpleLogger.error("Error getAnteproyectosProyectoCurricular", e); return null; } finally { session.close(); } } public List<Anteproyecto> getAnteproyectosEnCursoDirigidasPorProfesor(String prof_prof) { SqlSession session = DBManager.openSession(); try { AnteproyectoDao dao = session.getMapper(AnteproyectoDao.class); return dao.getAnteproyectosEnCursoDirigidasPorProfesor(prof_prof); } catch (Exception e) { SimpleLogger.error("Error getAnteproyectosDirigidasPorProfesor", e); return null; } finally { session.close(); } } public List<Anteproyecto> getAnteproyectosEnCursoAsignadosParaRevision(String prof_prof) { SqlSession session = DBManager.openSession(); try { AnteproyectoDao dao = session.getMapper(AnteproyectoDao.class); return dao.getAnteproyectosEnCursoAsignadosParaRevision(prof_prof); } catch (Exception e) { SimpleLogger.error("Error getAnteproyectosAsignadosParaRevisionPorProfesor", e); return null; } finally { session.close(); } } public List<RevisorAnteproyecto> getRevisoresPorAnteproyecto(Anteproyecto anteproyecto){ SqlSession session = DBManager.openSession(); try { AnteproyectoDao dao = session.getMapper(AnteproyectoDao.class); return dao.getRevisoresPorAnteproyecto(anteproyecto); } catch (Exception e) { SimpleLogger.error("Error getRevisoresPorAnteproyecto", e); return null; } finally { session.close(); } } public List<RevisorAnteproyecto> getRevisoresSinProcesoDeRevision(SqlSession session, Anteproyecto anteproyecto){ try { AnteproyectoDao dao = session.getMapper(AnteproyectoDao.class); return dao.getRevisoresSinProcesoDeRevision(anteproyecto); } catch (Exception e) { SimpleLogger.error("Error getRevisoresSinProcesoDeRevision", e); return null; } } public RevisorAnteproyecto getRevisorAnteproyecto(Long rev_rev){ SqlSession session = DBManager.openSession(); try { AnteproyectoDao dao = session.getMapper(AnteproyectoDao.class); return dao.getRevisor(rev_rev); } catch (Exception e) { SimpleLogger.error("Error getRevisorAnteproyecto", e); return null; } finally { session.close(); } } public List<HistoricoAnteproyecto> getHistoricoPorAnteproyecto(Long antp_antp) { SqlSession session = DBManager.openSession(); try{ AnteproyectoDao dao = session.getMapper(AnteproyectoDao.class); return dao.getHistoricoPorAnteproyecto(antp_antp); }catch (Exception e) { SimpleLogger.error("Error getHistoricoPorAnteproyecto ", e); return null; }finally { session.close(); } } public RevisorAnteproyecto getRevisorAnteproyectoPorUsuario(String usua_usua, Long antp_antp) { SqlSession session = DBManager.openSession(); try { AnteproyectoDao dao = session.getMapper(AnteproyectoDao.class); HashMap<String , Object> hashMap = new HashMap<String, Object>(); hashMap.put("usua_usua", usua_usua); hashMap.put("antp_antp", antp_antp); return dao.getRevisorPorUsuario(hashMap); } catch (Exception e) { SimpleLogger.error("Error getRevisorAnteproyectoPorUsuario", e); return null; } finally { session.close(); } } public List<Anteproyecto> getAnteproyectoPorEstados(String...antp_estados){ SqlSession session = DBManager.openSession(); try { AnteproyectoDao dao = session.getMapper(AnteproyectoDao.class); HashMap<String , Object> hashMap = new HashMap<String, Object>(); if(antp_estados!=null){ String estados=""; for (String string : antp_estados) { estados = estados+"'"+string+"',"; } estados = estados.substring(0, estados.lastIndexOf(',')); hashMap.put("antp_estados", estados); } return dao.getAnteproyectosPorEstados(hashMap); } catch (Exception e) { SimpleLogger.error("Error getAnteproyectoPorEstados", e); return null; } finally { session.close(); } } /** *=================================================== * OPERACIONES TRANSACCIONALES ====================== *=================================================== */ public Boolean setEstadoAnteproyecto(Long antp_antp, String estado){ SqlSession session = DBManager.openSession(); Boolean respuesta = true; try { Anteproyecto anteproyecto = new Anteproyecto(); anteproyecto.setAntp_antp(antp_antp); anteproyecto.setAntp_eantp(estado); try { AnteproyectoDao anteproyectoMapper = session.getMapper(AnteproyectoDao.class); anteproyectoMapper.setEstadoAnteproyecto(anteproyecto); } catch (Exception e) { respuesta = false; } }catch (Exception e) { SimpleLogger.error("Error ", e); return null; } finally { session.close(); } return respuesta; } public Anteproyecto iniciarAnteproyectoTransaccional( SqlSession session, Long prop_prop, Long cias_cias, String tituloAnteproyecto, String descripcion, String observacion, Long moda_moda, Long pcur_pcur, FormularioAnteproyecto formularioInicioAnteproyecto, Usuario usuario, StringBuffer mensajeError){ Anteproyecto anteproyecto = new Anteproyecto(); //Se estable que el identificador unico de la anteproyecto es el mismo numero de que la preanteproyecto anteproyecto.setAntp_antp(prop_prop); anteproyecto.setAntp_prop(prop_prop); anteproyecto.setAntp_titu(tituloAnteproyecto); anteproyecto.setAntp_descri(descripcion); anteproyecto.setAntp_obser(observacion); anteproyecto.setAntp_cias(cias_cias); anteproyecto.setAntp_moda(moda_moda); anteproyecto.setAntp_pcur(pcur_pcur); anteproyecto.setAntp_frmu_ini(formularioInicioAnteproyecto.getFrmu_frmu()); anteproyecto.setAntp_eantp(Anteproyecto.RADICADO); try{ AnteproyectoDao anteproyectoDao= session.getMapper(AnteproyectoDao.class); //Se crea la preanteproyecto anteproyectoDao.iniciarAnteproyecto(anteproyecto); //Se crea el historico de la preanteproyecto HashMap<String, Object> hashMap = new HashMap<String, Object>(); hashMap.put("hantp_antp", anteproyecto.getAntp_antp()); hashMap.put("hantp_eantp", anteproyecto.getAntp_eantp()); hashMap.put("hantp_usua", usuario.getUsua_usua()); hashMap.put("hantp_obser", observacion); anteproyectoDao.crearHistoricoAnteproyecto(hashMap); return anteproyecto; }catch (Exception e) { SimpleLogger.error("Error iniciarAnteproyectoTransaccional", e); mensajeError.append("Error al crear el registro de anteproyecto"); return null; } } public Boolean registrarRevisorAnteproyectoTransaccional(SqlSession session, RevisorAnteproyecto revisorAnteproyecto, StringBuffer mensajeError){ try{ AnteproyectoDao anteproyectoDao= session.getMapper(AnteproyectoDao.class); //Se crea la preanteproyecto anteproyectoDao.registrarRevisorPorAnteproyecto(revisorAnteproyecto); return true; }catch (Exception e) { SimpleLogger.error("Error registrarRevisorAnteproyectoTransaccional", e); mensajeError.append("Error al registrar revisor por anteproyecto"); return false; } } public List<Profesor> getProfesoresAptosParaRevisorAnteproyecto(Long antp_antp){ SqlSession session = DBManager.openSession(); try { AnteproyectoDao antpMapper = session.getMapper(AnteproyectoDao.class); List<Profesor> profesores = antpMapper.getProfesoresAptosParaRevisorAnteproyecto(antp_antp); return profesores; }catch (Exception e) { SimpleLogger.error("Error ", e); return null; } finally { session.close(); } } public Boolean convertirAnteproyectoEnProyectoTransaccional(SqlSession session, Long antp_antp, Usuario usuario, String observacion, StringBuffer mensajeError ){ Boolean respuesta = true; try { Anteproyecto anteproyecto= new Anteproyecto(); anteproyecto.setAntp_antp(antp_antp); anteproyecto.setAntp_eantp(Anteproyecto.PROYECTO); try { //Se cambia de estado AnteproyectoDao anteproyectoMapper = session.getMapper(AnteproyectoDao.class); anteproyectoMapper.setEstadoAnteproyecto(anteproyecto); //Se crea el historico de la preanteproyecto HashMap<String, Object> hashMap = new HashMap<String, Object>(); hashMap.put("hantp_antp", anteproyecto.getAntp_antp()); hashMap.put("hantp_eantp", anteproyecto.getAntp_eantp()); hashMap.put("hantp_usua", usuario.getUsua_usua()); hashMap.put("hantp_obser", observacion); anteproyectoMapper.crearHistoricoAnteproyecto(hashMap); } catch (Exception e) { mensajeError.append("Error al convertir anteproyecto en proyecyo"); SimpleLogger.error("Error al convertir anteproyecto en proyecto",e ); respuesta = false; } }catch (Exception e) { SimpleLogger.error("Error ", e); mensajeError.append("Error convertirAnteproyectoEnProyectoTransaccional"); return null; } return respuesta; } public List<EstadoAnteproyecto> getEstadosAnteproyecto(){ SqlSession session = DBManager.openSession(); try { AnteproyectoDao antpMapper = session.getMapper(AnteproyectoDao.class); List<EstadoAnteproyecto> estados = antpMapper.getEstadosAnteproyecto(); return estados; }catch (Exception e) { SimpleLogger.error("Error ", e); return null; } finally { session.close(); } } public List<Profesor> getProfesoresAptosParaDirector(){ SqlSession session = DBManager.openSession(); try { AnteproyectoDao antpMapper = session.getMapper(AnteproyectoDao.class); List<Profesor> profesores = antpMapper.getProfesoresAptosParaDirector(); return profesores; }catch (Exception e) { SimpleLogger.error("Error ", e); return null; } finally { session.close(); } } }
UTF-8
Java
13,179
java
AnteproyectoControllerDB.java
Java
[]
null
[]
package com.developer.persistence.modulo.anteproyecto; import java.util.HashMap; import java.util.List; import org.apache.ibatis.session.SqlSession; import com.developer.core.utils.SimpleLogger; import com.developer.logic.modulo.anteproyecto.dto.Anteproyecto; import com.developer.logic.modulo.anteproyecto.dto.EstadoAnteproyecto; import com.developer.logic.modulo.anteproyecto.dto.FormularioAnteproyecto; import com.developer.logic.modulo.anteproyecto.dto.HistoricoAnteproyecto; import com.developer.logic.modulo.anteproyecto.dto.RevisorAnteproyecto; import com.developer.logic.modulo.autenticacion.dto.Usuario; import com.developer.logic.modulo.general.dto.Profesor; import com.developer.logic.modulo.prepropuesta.dto.Prepropuesta; import com.developer.mybatis.DBManager; import com.developer.persistence.modulo.anteproyecto.mapper.dao.AnteproyectoDao; import com.developer.persistence.modulo.prepropuesta.mapper.dao.PrepropuestaDao; public class AnteproyectoControllerDB { private static AnteproyectoControllerDB instance; public static AnteproyectoControllerDB getInstance() { if (instance == null) { instance = new AnteproyectoControllerDB(); } return instance; } /** *=================================================== * CONSULTAS ======================================== *=================================================== */ public Anteproyecto getAnteproyecto(Long antp_antp){ SqlSession session = DBManager.openSession(); try { AnteproyectoDao dao = session.getMapper(AnteproyectoDao.class); return dao.getAnteproyecto(antp_antp); } catch (Exception e) { SimpleLogger.error("Error getAnteproyecto", e); return null; } finally { session.close(); } } public List<Anteproyecto> getAnteproyectosPorEstudiante(String estd_estd, String...antp_estados){ SqlSession session = DBManager.openSession(); try { AnteproyectoDao dao = session.getMapper(AnteproyectoDao.class); HashMap<String , Object> hashMap = new HashMap<String, Object>(); hashMap.put("estd_estd", estd_estd); if(antp_estados!=null){ String estados=""; for (String string : antp_estados) { estados = estados+"'"+string+"',"; } estados = estados.substring(0, estados.lastIndexOf(',')); hashMap.put("antp_estados", estados); } return dao.getAnteproyectosPorEstudiante(hashMap); } catch (Exception e) { SimpleLogger.error("Error getAnteproyectosPorEstudiante", e); return null; } finally { session.close(); } } public List<Anteproyecto> getAnteproyectosProyectoCurricular(Long pcur_pcur, String...ante_estados ) { SqlSession session = DBManager.openSession(); try { AnteproyectoDao dao = session.getMapper(AnteproyectoDao.class); HashMap<String , Object> hashMap = new HashMap<String, Object>(); hashMap.put("pcur_pcur", pcur_pcur); if(ante_estados!=null){ String estados=""; for (String string : ante_estados) { estados = estados+"'"+string+"',"; } estados = estados.substring(0, estados.lastIndexOf(',')); hashMap.put("antp_estados", estados); } return dao.getAnteproyectosProyectoCurricular(hashMap); } catch (Exception e) { SimpleLogger.error("Error getAnteproyectosProyectoCurricular", e); return null; } finally { session.close(); } } public List<Anteproyecto> getAnteproyectosEnCursoDirigidasPorProfesor(String prof_prof) { SqlSession session = DBManager.openSession(); try { AnteproyectoDao dao = session.getMapper(AnteproyectoDao.class); return dao.getAnteproyectosEnCursoDirigidasPorProfesor(prof_prof); } catch (Exception e) { SimpleLogger.error("Error getAnteproyectosDirigidasPorProfesor", e); return null; } finally { session.close(); } } public List<Anteproyecto> getAnteproyectosEnCursoAsignadosParaRevision(String prof_prof) { SqlSession session = DBManager.openSession(); try { AnteproyectoDao dao = session.getMapper(AnteproyectoDao.class); return dao.getAnteproyectosEnCursoAsignadosParaRevision(prof_prof); } catch (Exception e) { SimpleLogger.error("Error getAnteproyectosAsignadosParaRevisionPorProfesor", e); return null; } finally { session.close(); } } public List<RevisorAnteproyecto> getRevisoresPorAnteproyecto(Anteproyecto anteproyecto){ SqlSession session = DBManager.openSession(); try { AnteproyectoDao dao = session.getMapper(AnteproyectoDao.class); return dao.getRevisoresPorAnteproyecto(anteproyecto); } catch (Exception e) { SimpleLogger.error("Error getRevisoresPorAnteproyecto", e); return null; } finally { session.close(); } } public List<RevisorAnteproyecto> getRevisoresSinProcesoDeRevision(SqlSession session, Anteproyecto anteproyecto){ try { AnteproyectoDao dao = session.getMapper(AnteproyectoDao.class); return dao.getRevisoresSinProcesoDeRevision(anteproyecto); } catch (Exception e) { SimpleLogger.error("Error getRevisoresSinProcesoDeRevision", e); return null; } } public RevisorAnteproyecto getRevisorAnteproyecto(Long rev_rev){ SqlSession session = DBManager.openSession(); try { AnteproyectoDao dao = session.getMapper(AnteproyectoDao.class); return dao.getRevisor(rev_rev); } catch (Exception e) { SimpleLogger.error("Error getRevisorAnteproyecto", e); return null; } finally { session.close(); } } public List<HistoricoAnteproyecto> getHistoricoPorAnteproyecto(Long antp_antp) { SqlSession session = DBManager.openSession(); try{ AnteproyectoDao dao = session.getMapper(AnteproyectoDao.class); return dao.getHistoricoPorAnteproyecto(antp_antp); }catch (Exception e) { SimpleLogger.error("Error getHistoricoPorAnteproyecto ", e); return null; }finally { session.close(); } } public RevisorAnteproyecto getRevisorAnteproyectoPorUsuario(String usua_usua, Long antp_antp) { SqlSession session = DBManager.openSession(); try { AnteproyectoDao dao = session.getMapper(AnteproyectoDao.class); HashMap<String , Object> hashMap = new HashMap<String, Object>(); hashMap.put("usua_usua", usua_usua); hashMap.put("antp_antp", antp_antp); return dao.getRevisorPorUsuario(hashMap); } catch (Exception e) { SimpleLogger.error("Error getRevisorAnteproyectoPorUsuario", e); return null; } finally { session.close(); } } public List<Anteproyecto> getAnteproyectoPorEstados(String...antp_estados){ SqlSession session = DBManager.openSession(); try { AnteproyectoDao dao = session.getMapper(AnteproyectoDao.class); HashMap<String , Object> hashMap = new HashMap<String, Object>(); if(antp_estados!=null){ String estados=""; for (String string : antp_estados) { estados = estados+"'"+string+"',"; } estados = estados.substring(0, estados.lastIndexOf(',')); hashMap.put("antp_estados", estados); } return dao.getAnteproyectosPorEstados(hashMap); } catch (Exception e) { SimpleLogger.error("Error getAnteproyectoPorEstados", e); return null; } finally { session.close(); } } /** *=================================================== * OPERACIONES TRANSACCIONALES ====================== *=================================================== */ public Boolean setEstadoAnteproyecto(Long antp_antp, String estado){ SqlSession session = DBManager.openSession(); Boolean respuesta = true; try { Anteproyecto anteproyecto = new Anteproyecto(); anteproyecto.setAntp_antp(antp_antp); anteproyecto.setAntp_eantp(estado); try { AnteproyectoDao anteproyectoMapper = session.getMapper(AnteproyectoDao.class); anteproyectoMapper.setEstadoAnteproyecto(anteproyecto); } catch (Exception e) { respuesta = false; } }catch (Exception e) { SimpleLogger.error("Error ", e); return null; } finally { session.close(); } return respuesta; } public Anteproyecto iniciarAnteproyectoTransaccional( SqlSession session, Long prop_prop, Long cias_cias, String tituloAnteproyecto, String descripcion, String observacion, Long moda_moda, Long pcur_pcur, FormularioAnteproyecto formularioInicioAnteproyecto, Usuario usuario, StringBuffer mensajeError){ Anteproyecto anteproyecto = new Anteproyecto(); //Se estable que el identificador unico de la anteproyecto es el mismo numero de que la preanteproyecto anteproyecto.setAntp_antp(prop_prop); anteproyecto.setAntp_prop(prop_prop); anteproyecto.setAntp_titu(tituloAnteproyecto); anteproyecto.setAntp_descri(descripcion); anteproyecto.setAntp_obser(observacion); anteproyecto.setAntp_cias(cias_cias); anteproyecto.setAntp_moda(moda_moda); anteproyecto.setAntp_pcur(pcur_pcur); anteproyecto.setAntp_frmu_ini(formularioInicioAnteproyecto.getFrmu_frmu()); anteproyecto.setAntp_eantp(Anteproyecto.RADICADO); try{ AnteproyectoDao anteproyectoDao= session.getMapper(AnteproyectoDao.class); //Se crea la preanteproyecto anteproyectoDao.iniciarAnteproyecto(anteproyecto); //Se crea el historico de la preanteproyecto HashMap<String, Object> hashMap = new HashMap<String, Object>(); hashMap.put("hantp_antp", anteproyecto.getAntp_antp()); hashMap.put("hantp_eantp", anteproyecto.getAntp_eantp()); hashMap.put("hantp_usua", usuario.getUsua_usua()); hashMap.put("hantp_obser", observacion); anteproyectoDao.crearHistoricoAnteproyecto(hashMap); return anteproyecto; }catch (Exception e) { SimpleLogger.error("Error iniciarAnteproyectoTransaccional", e); mensajeError.append("Error al crear el registro de anteproyecto"); return null; } } public Boolean registrarRevisorAnteproyectoTransaccional(SqlSession session, RevisorAnteproyecto revisorAnteproyecto, StringBuffer mensajeError){ try{ AnteproyectoDao anteproyectoDao= session.getMapper(AnteproyectoDao.class); //Se crea la preanteproyecto anteproyectoDao.registrarRevisorPorAnteproyecto(revisorAnteproyecto); return true; }catch (Exception e) { SimpleLogger.error("Error registrarRevisorAnteproyectoTransaccional", e); mensajeError.append("Error al registrar revisor por anteproyecto"); return false; } } public List<Profesor> getProfesoresAptosParaRevisorAnteproyecto(Long antp_antp){ SqlSession session = DBManager.openSession(); try { AnteproyectoDao antpMapper = session.getMapper(AnteproyectoDao.class); List<Profesor> profesores = antpMapper.getProfesoresAptosParaRevisorAnteproyecto(antp_antp); return profesores; }catch (Exception e) { SimpleLogger.error("Error ", e); return null; } finally { session.close(); } } public Boolean convertirAnteproyectoEnProyectoTransaccional(SqlSession session, Long antp_antp, Usuario usuario, String observacion, StringBuffer mensajeError ){ Boolean respuesta = true; try { Anteproyecto anteproyecto= new Anteproyecto(); anteproyecto.setAntp_antp(antp_antp); anteproyecto.setAntp_eantp(Anteproyecto.PROYECTO); try { //Se cambia de estado AnteproyectoDao anteproyectoMapper = session.getMapper(AnteproyectoDao.class); anteproyectoMapper.setEstadoAnteproyecto(anteproyecto); //Se crea el historico de la preanteproyecto HashMap<String, Object> hashMap = new HashMap<String, Object>(); hashMap.put("hantp_antp", anteproyecto.getAntp_antp()); hashMap.put("hantp_eantp", anteproyecto.getAntp_eantp()); hashMap.put("hantp_usua", usuario.getUsua_usua()); hashMap.put("hantp_obser", observacion); anteproyectoMapper.crearHistoricoAnteproyecto(hashMap); } catch (Exception e) { mensajeError.append("Error al convertir anteproyecto en proyecyo"); SimpleLogger.error("Error al convertir anteproyecto en proyecto",e ); respuesta = false; } }catch (Exception e) { SimpleLogger.error("Error ", e); mensajeError.append("Error convertirAnteproyectoEnProyectoTransaccional"); return null; } return respuesta; } public List<EstadoAnteproyecto> getEstadosAnteproyecto(){ SqlSession session = DBManager.openSession(); try { AnteproyectoDao antpMapper = session.getMapper(AnteproyectoDao.class); List<EstadoAnteproyecto> estados = antpMapper.getEstadosAnteproyecto(); return estados; }catch (Exception e) { SimpleLogger.error("Error ", e); return null; } finally { session.close(); } } public List<Profesor> getProfesoresAptosParaDirector(){ SqlSession session = DBManager.openSession(); try { AnteproyectoDao antpMapper = session.getMapper(AnteproyectoDao.class); List<Profesor> profesores = antpMapper.getProfesoresAptosParaDirector(); return profesores; }catch (Exception e) { SimpleLogger.error("Error ", e); return null; } finally { session.close(); } } }
13,179
0.703012
0.702785
499
25.410822
28.04158
163
false
false
0
0
0
0
0
0
2.851703
false
false
10
1bc716435e86713291a24b4de0ef6efd014614eb
6,167,573,084,864
495bdfa03cc2d5c14d8effd3ed2319afec82040c
/gamemaster/src/main/java/cn/wsds/gamemaster/ui/floatwindow/FloatWindowInReconnect.java
c235240b595db3abb6b1479e6274c3ab3e9bb995
[]
no_license
tuoxin/proxy_android
https://github.com/tuoxin/proxy_android
14e13bde1b17e104a3ed2e85ab58e256d1d70227
642d7f5c5d6eb7b85d0c690226752a398b52b970
refs/heads/master
2020-04-05T11:52:11.603000
2017-05-22T13:49:28
2017-05-22T13:49:28
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.wsds.gamemaster.ui.floatwindow; import android.content.Context; import android.graphics.Point; import android.view.View; import cn.wsds.gamemaster.R; import cn.wsds.gamemaster.ui.floatwindow.ViewFloatInReconnect.OnFinishListener; import com.subao.utils.MetricsUtils; /** * 断线重连悬浮窗 * @author Administrator * */ public class FloatWindowInReconnect extends FloatWindow{ private static FloatWindowInReconnect instance; private ViewFloatInReconnect viewFloat; private int positionX; private int positionY; private FloatWindowInReconnect(Context context, String beginContent) { super(context); viewFloat = new ViewFloatInReconnect(context, beginContent); viewFloat.setOnFinishListener(new OnFinishListener() { @Override public void onFinish(boolean successed) { destroyInstance(); } }); initPosition(context); addView(Type.DRAGGED, viewFloat, positionX, positionY); } /** * 创建断线重连悬浮窗实例 * * @param context * Context * @param beginContent * 开始显示的内容 * @return */ public static FloatWindowInReconnect createInstance(Context context, String beginContent){ if(instance == null){ instance = new FloatWindowInReconnect(context, beginContent); instance.setVisibility(View.VISIBLE); FloatWindowInGame.setInstanceVisibility(View.GONE); } return instance; } @Override protected void destroy() { super.destroy(); FloatWindowInGame.setInstanceVisibility(View.VISIBLE); instance = null; } public static boolean exists() { return instance != null; } /** * 获取InGame悬浮窗的高度 */ private void initPosition(Context context){ Point screenSize = MetricsUtils.getDevicesSizeByPixels(context); positionX = (screenSize.x - context.getResources().getDimensionPixelSize(R.dimen.space_size_310)) / 2; positionY = screenSize.y / 3; } @Override protected void onViewAdded(View view) { } @Override protected boolean canDrag() { return false; } /** * 销毁悬浮窗 */ public static void destroyInstance() { if (instance != null) { FloatWindowInReconnect inst = instance; instance = null; inst.destroy(); } } @Override protected void onClick(int x, int y) { super.onClick(x, y); if(instance != null && viewFloat.canCloseWindow(x, y)){ // StatisticDefault.addEvent(instance.getContext(), // StatisticDefault.Event.REPAIR_CONNECTION_EFFECT_CLOSED_BY_USER); instance.destroy(); } } /** * 改变当前数据 * @param count * @param successed */ public static void changeCurrentData(int count, boolean successed){ if(instance != null){ instance.viewFloat.changeCurrentData(count, successed); } } }
UTF-8
Java
2,734
java
FloatWindowInReconnect.java
Java
[ { "context": "bao.utils.MetricsUtils;\n\n/**\n * 断线重连悬浮窗\n * @author Administrator\n *\n */\npublic class FloatWindowInReconnect extend", "end": 320, "score": 0.6887969970703125, "start": 307, "tag": "USERNAME", "value": "Administrator" } ]
null
[]
package cn.wsds.gamemaster.ui.floatwindow; import android.content.Context; import android.graphics.Point; import android.view.View; import cn.wsds.gamemaster.R; import cn.wsds.gamemaster.ui.floatwindow.ViewFloatInReconnect.OnFinishListener; import com.subao.utils.MetricsUtils; /** * 断线重连悬浮窗 * @author Administrator * */ public class FloatWindowInReconnect extends FloatWindow{ private static FloatWindowInReconnect instance; private ViewFloatInReconnect viewFloat; private int positionX; private int positionY; private FloatWindowInReconnect(Context context, String beginContent) { super(context); viewFloat = new ViewFloatInReconnect(context, beginContent); viewFloat.setOnFinishListener(new OnFinishListener() { @Override public void onFinish(boolean successed) { destroyInstance(); } }); initPosition(context); addView(Type.DRAGGED, viewFloat, positionX, positionY); } /** * 创建断线重连悬浮窗实例 * * @param context * Context * @param beginContent * 开始显示的内容 * @return */ public static FloatWindowInReconnect createInstance(Context context, String beginContent){ if(instance == null){ instance = new FloatWindowInReconnect(context, beginContent); instance.setVisibility(View.VISIBLE); FloatWindowInGame.setInstanceVisibility(View.GONE); } return instance; } @Override protected void destroy() { super.destroy(); FloatWindowInGame.setInstanceVisibility(View.VISIBLE); instance = null; } public static boolean exists() { return instance != null; } /** * 获取InGame悬浮窗的高度 */ private void initPosition(Context context){ Point screenSize = MetricsUtils.getDevicesSizeByPixels(context); positionX = (screenSize.x - context.getResources().getDimensionPixelSize(R.dimen.space_size_310)) / 2; positionY = screenSize.y / 3; } @Override protected void onViewAdded(View view) { } @Override protected boolean canDrag() { return false; } /** * 销毁悬浮窗 */ public static void destroyInstance() { if (instance != null) { FloatWindowInReconnect inst = instance; instance = null; inst.destroy(); } } @Override protected void onClick(int x, int y) { super.onClick(x, y); if(instance != null && viewFloat.canCloseWindow(x, y)){ // StatisticDefault.addEvent(instance.getContext(), // StatisticDefault.Event.REPAIR_CONNECTION_EFFECT_CLOSED_BY_USER); instance.destroy(); } } /** * 改变当前数据 * @param count * @param successed */ public static void changeCurrentData(int count, boolean successed){ if(instance != null){ instance.viewFloat.changeCurrentData(count, successed); } } }
2,734
0.721466
0.719577
117
21.615385
22.798203
105
false
false
0
0
0
0
0
0
1.82906
false
false
10
7fa08ffba5935b6996cce629c69a058a1b60a79d
214,748,384,400
921dd3f64ea08fd8edb5e990a61743225e0448f6
/Deliverables/Dress-Store/src/model/carta/CartaDiCreditoModelDM.java
592179dfd65bf049e332d22f663a1afba76b39c9
[]
no_license
aleRizzolo/Dress-Store
https://github.com/aleRizzolo/Dress-Store
de956317017c59f5a23c314f55c17de4f2dca00c
7edf5f70b9abf9b8dd993e2bbc428fea5790171e
refs/heads/master
2020-08-04T13:45:29.839000
2020-02-02T20:01:16
2020-02-02T20:01:16
212,155,946
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package model.carta; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collection; import model.DriverManagerConnectionPool; //a public class CartaDiCreditoModelDM implements CartaDiCreditoModel<CartaDiCreditoBean>{ private static final String TABLE ="CARTA_CREDITO"; @Override public CartaDiCreditoBean doRetrieveByKey(String numero_carta) throws SQLException { Connection connection = null; PreparedStatement statement=null; CartaDiCreditoBean bean = new CartaDiCreditoBean(); String queryString ="Select * FROM " + TABLE + " WHERE numero_carta = ?"; try{ connection = (Connection) DriverManagerConnectionPool.getConnection(); statement = (PreparedStatement) connection.prepareStatement(queryString); statement.setString(1, numero_carta); ResultSet result = statement.executeQuery(); while(result.next()){ bean = getBean(result); } } finally{ if(statement!=null) statement.close(); DriverManagerConnectionPool.releaseConnection(connection); } return bean; } @Override public Collection<CartaDiCreditoBean> doRetrieveAll() throws SQLException { Connection connection = null; PreparedStatement statement=null; Collection<CartaDiCreditoBean> listaBean = new ArrayList<CartaDiCreditoBean>(); String queryString ="Select * FROM " + TABLE ; try{ connection = (Connection) DriverManagerConnectionPool.getConnection(); statement = (PreparedStatement) connection.prepareStatement(queryString); ResultSet result = statement.executeQuery(); while(result.next()){ listaBean.add(getBean(result)); } } finally{ if(statement!=null) statement.close(); DriverManagerConnectionPool.releaseConnection(connection); } return listaBean; } @Override public void doSave(CartaDiCreditoBean carta ) throws SQLException { Connection connection = null; PreparedStatement statement=null; String insertString=" INSERT INTO " + TABLE + " (numero_carta, data_scadenza, cvv," + " nome_proprietario, cognome_proprietario, utente) VALUES(?, ?, ?, ?, ?, ?)"; try{ connection = (Connection) DriverManagerConnectionPool.getConnection(); statement = (PreparedStatement) connection.prepareStatement(insertString); statement.setString(1, carta.getNumero_carta()); statement.setDate(2, carta.getData_scadenza()); statement.setString(3, carta.getCvv()); statement.setString(4, carta.getNome_proprietario()); statement.setString(5, carta.getCognome_proprietario()); statement.setInt(6, carta.getUtente()); statement.executeUpdate(); connection.commit(); } finally{ if(statement!= null) statement.close(); DriverManagerConnectionPool.releaseConnection(connection); } } @Override public void doUpdate(CartaDiCreditoBean carta) throws SQLException { Connection connection = null; PreparedStatement statement = null; String insertSQL = "UPDATE " + TABLE + " SET data_scadenza = ?, cvv = ?, " + "nome_proprietario = ?, cognome_proprietario = ? WHERE numero_carta = ?;"; try { connection = DriverManagerConnectionPool.getConnection(); statement = connection.prepareStatement(insertSQL); statement.setDate(1, carta.getData_scadenza()); statement.setString(2, carta.getCvv()); statement.setString(3, carta.getNome_proprietario()); statement.setString(4, carta.getCognome_proprietario()); statement.setString(5, carta.getNumero_carta()); statement.executeUpdate(); connection.commit(); } finally{ if(statement!= null) statement.close(); DriverManagerConnectionPool.releaseConnection(connection); } } @Override public boolean doDelete(String numero_carta) throws SQLException { Connection connection = null; PreparedStatement statement=null; int result = 0; String deleteString ="DELETE FROM " + TABLE + " WHERE numero_carta = ?"; try { connection = (Connection) DriverManagerConnectionPool.getConnection(); statement = (PreparedStatement) connection.prepareStatement(deleteString); statement.setString(1, numero_carta); result = statement.executeUpdate(); connection.commit(); } finally{ if(statement!=null) statement.close(); DriverManagerConnectionPool.releaseConnection(connection); } return result != 0; } @Override public ArrayList<CartaDiCreditoBean> doRetrieveByUtente(int utente) throws SQLException { Connection connection = null; PreparedStatement statement=null; ArrayList<CartaDiCreditoBean> bean = new ArrayList<CartaDiCreditoBean>(); String queryString ="Select * FROM " + TABLE + " WHERE utente = ?"; try{ connection = (Connection) DriverManagerConnectionPool.getConnection(); statement = (PreparedStatement) connection.prepareStatement(queryString); statement.setInt(1, utente); ResultSet result = statement.executeQuery(); while(result.next()){ bean.add( getBean(result)); } } finally{ if(statement!=null) statement.close(); DriverManagerConnectionPool.releaseConnection(connection); } return bean; } private static CartaDiCreditoBean getBean(ResultSet rs) throws SQLException{ CartaDiCreditoBean bean = new CartaDiCreditoBean(); bean.setNumero_carta(rs.getString("numero_carta")); bean.setData_scadenza(rs.getDate("data_scadenza")); bean.setCvv(rs.getString("cvv")); bean.setNome_proprietario(rs.getString("nome_proprietario")); bean.setCognome_proprietario(rs.getString("cognome_proprietario")); bean.setUtente(rs.getInt("utente")); return bean; } public static boolean checkCarta(String nCarta ) throws SQLException { // verifica se carta esiste gia boolean flag =false; Connection connection = null; PreparedStatement preparedStatement = null; String checkSQL="Select numero_carta from "+TABLE+" where numero_carta= ?;" ; try { try { connection = DriverManagerConnectionPool.getConnection(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } // crea la connessione se non esiste preparedStatement = connection.prepareStatement(checkSQL); preparedStatement.setString(1,nCarta); System.out.println("validate..." + preparedStatement.toString()); ResultSet rs = preparedStatement.executeQuery(); // la query viene eseguita flag=rs.next(); } finally { try { if(preparedStatement != null ) { preparedStatement.close(); // rilascio risorse } } finally { DriverManagerConnectionPool.releaseConnection(connection); // evita di far reinstanziare ogni volta una connection // la connection viene "conservata" nella collection Pool } } return flag; } }
UTF-8
Java
6,736
java
CartaDiCreditoModelDM.java
Java
[]
null
[]
package model.carta; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collection; import model.DriverManagerConnectionPool; //a public class CartaDiCreditoModelDM implements CartaDiCreditoModel<CartaDiCreditoBean>{ private static final String TABLE ="CARTA_CREDITO"; @Override public CartaDiCreditoBean doRetrieveByKey(String numero_carta) throws SQLException { Connection connection = null; PreparedStatement statement=null; CartaDiCreditoBean bean = new CartaDiCreditoBean(); String queryString ="Select * FROM " + TABLE + " WHERE numero_carta = ?"; try{ connection = (Connection) DriverManagerConnectionPool.getConnection(); statement = (PreparedStatement) connection.prepareStatement(queryString); statement.setString(1, numero_carta); ResultSet result = statement.executeQuery(); while(result.next()){ bean = getBean(result); } } finally{ if(statement!=null) statement.close(); DriverManagerConnectionPool.releaseConnection(connection); } return bean; } @Override public Collection<CartaDiCreditoBean> doRetrieveAll() throws SQLException { Connection connection = null; PreparedStatement statement=null; Collection<CartaDiCreditoBean> listaBean = new ArrayList<CartaDiCreditoBean>(); String queryString ="Select * FROM " + TABLE ; try{ connection = (Connection) DriverManagerConnectionPool.getConnection(); statement = (PreparedStatement) connection.prepareStatement(queryString); ResultSet result = statement.executeQuery(); while(result.next()){ listaBean.add(getBean(result)); } } finally{ if(statement!=null) statement.close(); DriverManagerConnectionPool.releaseConnection(connection); } return listaBean; } @Override public void doSave(CartaDiCreditoBean carta ) throws SQLException { Connection connection = null; PreparedStatement statement=null; String insertString=" INSERT INTO " + TABLE + " (numero_carta, data_scadenza, cvv," + " nome_proprietario, cognome_proprietario, utente) VALUES(?, ?, ?, ?, ?, ?)"; try{ connection = (Connection) DriverManagerConnectionPool.getConnection(); statement = (PreparedStatement) connection.prepareStatement(insertString); statement.setString(1, carta.getNumero_carta()); statement.setDate(2, carta.getData_scadenza()); statement.setString(3, carta.getCvv()); statement.setString(4, carta.getNome_proprietario()); statement.setString(5, carta.getCognome_proprietario()); statement.setInt(6, carta.getUtente()); statement.executeUpdate(); connection.commit(); } finally{ if(statement!= null) statement.close(); DriverManagerConnectionPool.releaseConnection(connection); } } @Override public void doUpdate(CartaDiCreditoBean carta) throws SQLException { Connection connection = null; PreparedStatement statement = null; String insertSQL = "UPDATE " + TABLE + " SET data_scadenza = ?, cvv = ?, " + "nome_proprietario = ?, cognome_proprietario = ? WHERE numero_carta = ?;"; try { connection = DriverManagerConnectionPool.getConnection(); statement = connection.prepareStatement(insertSQL); statement.setDate(1, carta.getData_scadenza()); statement.setString(2, carta.getCvv()); statement.setString(3, carta.getNome_proprietario()); statement.setString(4, carta.getCognome_proprietario()); statement.setString(5, carta.getNumero_carta()); statement.executeUpdate(); connection.commit(); } finally{ if(statement!= null) statement.close(); DriverManagerConnectionPool.releaseConnection(connection); } } @Override public boolean doDelete(String numero_carta) throws SQLException { Connection connection = null; PreparedStatement statement=null; int result = 0; String deleteString ="DELETE FROM " + TABLE + " WHERE numero_carta = ?"; try { connection = (Connection) DriverManagerConnectionPool.getConnection(); statement = (PreparedStatement) connection.prepareStatement(deleteString); statement.setString(1, numero_carta); result = statement.executeUpdate(); connection.commit(); } finally{ if(statement!=null) statement.close(); DriverManagerConnectionPool.releaseConnection(connection); } return result != 0; } @Override public ArrayList<CartaDiCreditoBean> doRetrieveByUtente(int utente) throws SQLException { Connection connection = null; PreparedStatement statement=null; ArrayList<CartaDiCreditoBean> bean = new ArrayList<CartaDiCreditoBean>(); String queryString ="Select * FROM " + TABLE + " WHERE utente = ?"; try{ connection = (Connection) DriverManagerConnectionPool.getConnection(); statement = (PreparedStatement) connection.prepareStatement(queryString); statement.setInt(1, utente); ResultSet result = statement.executeQuery(); while(result.next()){ bean.add( getBean(result)); } } finally{ if(statement!=null) statement.close(); DriverManagerConnectionPool.releaseConnection(connection); } return bean; } private static CartaDiCreditoBean getBean(ResultSet rs) throws SQLException{ CartaDiCreditoBean bean = new CartaDiCreditoBean(); bean.setNumero_carta(rs.getString("numero_carta")); bean.setData_scadenza(rs.getDate("data_scadenza")); bean.setCvv(rs.getString("cvv")); bean.setNome_proprietario(rs.getString("nome_proprietario")); bean.setCognome_proprietario(rs.getString("cognome_proprietario")); bean.setUtente(rs.getInt("utente")); return bean; } public static boolean checkCarta(String nCarta ) throws SQLException { // verifica se carta esiste gia boolean flag =false; Connection connection = null; PreparedStatement preparedStatement = null; String checkSQL="Select numero_carta from "+TABLE+" where numero_carta= ?;" ; try { try { connection = DriverManagerConnectionPool.getConnection(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } // crea la connessione se non esiste preparedStatement = connection.prepareStatement(checkSQL); preparedStatement.setString(1,nCarta); System.out.println("validate..." + preparedStatement.toString()); ResultSet rs = preparedStatement.executeQuery(); // la query viene eseguita flag=rs.next(); } finally { try { if(preparedStatement != null ) { preparedStatement.close(); // rilascio risorse } } finally { DriverManagerConnectionPool.releaseConnection(connection); // evita di far reinstanziare ogni volta una connection // la connection viene "conservata" nella collection Pool } } return flag; } }
6,736
0.733967
0.731443
211
30.928909
27.863405
118
false
false
0
0
0
0
0
0
2.706161
false
false
10
b8a12845c351c92c78b8af206b71794a1371bb1a
21,199,958,605,127
65925ea73f02113cec1c9bce5778f6db66eebf1f
/ums-webservice-library/src/main/java/org/ums/resource/RecordLogResource.java
d70789ea095e0b553f70b6512ecb99949cc4fe0c
[]
no_license
shimpux3/UMS
https://github.com/shimpux3/UMS
74076445f34627907e5906fcb1b37a62510715a6
7ed44a32214e8883ec28d2e4d062d825e33f526f
refs/heads/master
2020-03-31T07:40:54.244000
2018-10-05T14:44:51
2018-10-05T14:45:11
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.ums.resource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.ums.resource.helper.RecordLogResourceHelper; import javax.json.JsonObject; import javax.ws.rs.*; import javax.ws.rs.core.UriInfo; @Component @Path("record/log") @Produces(Resource.MIME_TYPE_JSON) @Consumes(Resource.MIME_TYPE_JSON) public class RecordLogResource extends MutableRecordLogResource { @Autowired private RecordLogResourceHelper mHelper; @GET @Path("/all") public JsonObject getAll() throws Exception { return mHelper.getAll(mUriInfo); } @GET @Path("/filter/query") public JsonObject get(final @QueryParam("modifiedDate") String pModifiedDate, final @QueryParam("modifiedBy") String pModifiedBy, final @QueryParam("mfn") String pMfn, final UriInfo pUriInfo) throws Exception { return mHelper.get(pModifiedDate, pModifiedBy, pMfn, mUriInfo); } }
UTF-8
Java
952
java
RecordLogResource.java
Java
[]
null
[]
package org.ums.resource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.ums.resource.helper.RecordLogResourceHelper; import javax.json.JsonObject; import javax.ws.rs.*; import javax.ws.rs.core.UriInfo; @Component @Path("record/log") @Produces(Resource.MIME_TYPE_JSON) @Consumes(Resource.MIME_TYPE_JSON) public class RecordLogResource extends MutableRecordLogResource { @Autowired private RecordLogResourceHelper mHelper; @GET @Path("/all") public JsonObject getAll() throws Exception { return mHelper.getAll(mUriInfo); } @GET @Path("/filter/query") public JsonObject get(final @QueryParam("modifiedDate") String pModifiedDate, final @QueryParam("modifiedBy") String pModifiedBy, final @QueryParam("mfn") String pMfn, final UriInfo pUriInfo) throws Exception { return mHelper.get(pModifiedDate, pModifiedBy, pMfn, mUriInfo); } }
952
0.767857
0.767857
34
27
27.700075
119
false
false
0
0
0
0
0
0
0.470588
false
false
10
ba6d6379e4744d58ff3927e7f0e4f993cbb9ba32
27,470,610,885,054
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_5640146288377856_0/java/Bg1/p1.java
027e7e75bb9fa06ba5cb191e970fd6cf40978009
[]
no_license
alexandraback/datacollection
https://github.com/alexandraback/datacollection
0bc67a9ace00abbc843f4912562f3a064992e0e9
076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf
refs/heads/master
2021-01-24T18:27:24.417000
2017-05-23T09:23:38
2017-05-23T09:23:38
84,313,442
2
4
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.*; import java.io.*; public class p1 { public static void main (String[]args)throws IOException { Scanner s=new Scanner (new File("A-small-attempt1.in")); //Scanner s=new Scanner (new File("in.txt")); PrintWriter out=new PrintWriter(new FileWriter("out.txt")); //Scanner s=new Scanner (new File("in.txt")); int ans=0; int cases=s.nextInt(); for (int tt=0;tt<cases;tt++) { ans=0; int r=s.nextInt(); int c=s.nextInt(); int w=s.nextInt(); ans=c/w-1; int extra=c%w; ans+=(w); if (extra!=0) ans+=1; ans*=r; out.println ("Case #"+(tt+1)+": "+ans); System.out.println ("Case: #"+(tt+1)+": "+ans); } out.close(); } }
UTF-8
Java
785
java
p1.java
Java
[]
null
[]
import java.util.*; import java.io.*; public class p1 { public static void main (String[]args)throws IOException { Scanner s=new Scanner (new File("A-small-attempt1.in")); //Scanner s=new Scanner (new File("in.txt")); PrintWriter out=new PrintWriter(new FileWriter("out.txt")); //Scanner s=new Scanner (new File("in.txt")); int ans=0; int cases=s.nextInt(); for (int tt=0;tt<cases;tt++) { ans=0; int r=s.nextInt(); int c=s.nextInt(); int w=s.nextInt(); ans=c/w-1; int extra=c%w; ans+=(w); if (extra!=0) ans+=1; ans*=r; out.println ("Case #"+(tt+1)+": "+ans); System.out.println ("Case: #"+(tt+1)+": "+ans); } out.close(); } }
785
0.515924
0.503185
32
22.59375
18.460869
63
false
false
0
0
0
0
0
0
0.6875
false
false
10
823f25012bfa8a853ed41093e527eb61e19ac5af
32,976,758,967,965
691ac36f7c21a9433a5ed375b8b4d134550f0011
/src/main/java/zkxy/model/Pdtlevel.java
342f4e6de527eec14a8cd6e5473fd6a97af930f6
[]
no_license
franklaluna/ts1
https://github.com/franklaluna/ts1
6c81c3587e4b1e39a0f29c0c11aac93b36f3d18e
eff103ea55bf92125434a91f601dfefc8edecb43
refs/heads/master
2020-05-18T14:31:28.196000
2019-05-03T15:47:19
2019-05-03T15:47:19
184,473,648
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package zkxy.model; //产品的细节 import java.util.Date; public class Pdtlevel { private int ID;// int(11) (NULL) NO PRI (NULL) select,insert,update,references private String name;// varchar(16) utf8_general_ci NO (NULL) select,insert,update,references private int pdt;// int(11) (NULL) NO (NULL) select,insert,update,references private double totle;//e double (NULL) NO (NULL) select,insert,update,references private double surplus;// private int percentage; private String p_type; private String pdt_level; private double cur_hght; public double getCur_hght() { return cur_hght; } public void setCur_hght(double cur_hght) { this.cur_hght = cur_hght; } public Date getUpdate_time() { return update_time; } public void setUpdate_time(Date update_time) { this.update_time = update_time; } public String getShort_name() { return short_name; } public void setShort_name(String short_name) { this.short_name = short_name; } public int getType() { return type; } public void setType(int type) { this.type = type; } public double getAlarm_ll() { return alarm_ll; } public void setAlarm_ll(double alarm_ll) { this.alarm_ll = alarm_ll; } public double getAlarm_l() { return alarm_l; } public void setAlarm_l(double alarm_l) { this.alarm_l = alarm_l; } public double getAlarm_h() { return alarm_h; } public void setAlarm_h(double alarm_h) { this.alarm_h = alarm_h; } public double getAlarm_hh() { return alarm_hh; } public void setAlarm_hh(double alarm_hh) { this.alarm_hh = alarm_hh; } public double getCur_wght() { return cur_wght; } public void setCur_wght(double cur_wght) { this.cur_wght = cur_wght; } private Date update_time; private String short_name; private int type; private double alarm_ll; private double alarm_l; private double alarm_h; private double alarm_hh; private double cur_wght; public String getPdt_level() { return pdt_level; } public void setPdt_level(String pdt_level) { this.pdt_level = pdt_level; } public String getP_type() { return p_type; } public void setP_type(String p_type) { this.p_type = p_type; } public int getID() { return ID; } public void setID(int iD) { ID = iD; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getPdt() { return pdt; } public void setPdt(int pdt) { this.pdt = pdt; } public double getTotle() { return totle; } public void setTotle(double totle) { this.totle = totle; } public double getSurplus() { return surplus; } public void setSurplus(double surplus) { this.surplus = surplus; } public int getPercentage() { return percentage; } public void setPercentage(int percentage) { this.percentage = percentage; } }
UTF-8
Java
3,583
java
Pdtlevel.java
Java
[]
null
[]
package zkxy.model; //产品的细节 import java.util.Date; public class Pdtlevel { private int ID;// int(11) (NULL) NO PRI (NULL) select,insert,update,references private String name;// varchar(16) utf8_general_ci NO (NULL) select,insert,update,references private int pdt;// int(11) (NULL) NO (NULL) select,insert,update,references private double totle;//e double (NULL) NO (NULL) select,insert,update,references private double surplus;// private int percentage; private String p_type; private String pdt_level; private double cur_hght; public double getCur_hght() { return cur_hght; } public void setCur_hght(double cur_hght) { this.cur_hght = cur_hght; } public Date getUpdate_time() { return update_time; } public void setUpdate_time(Date update_time) { this.update_time = update_time; } public String getShort_name() { return short_name; } public void setShort_name(String short_name) { this.short_name = short_name; } public int getType() { return type; } public void setType(int type) { this.type = type; } public double getAlarm_ll() { return alarm_ll; } public void setAlarm_ll(double alarm_ll) { this.alarm_ll = alarm_ll; } public double getAlarm_l() { return alarm_l; } public void setAlarm_l(double alarm_l) { this.alarm_l = alarm_l; } public double getAlarm_h() { return alarm_h; } public void setAlarm_h(double alarm_h) { this.alarm_h = alarm_h; } public double getAlarm_hh() { return alarm_hh; } public void setAlarm_hh(double alarm_hh) { this.alarm_hh = alarm_hh; } public double getCur_wght() { return cur_wght; } public void setCur_wght(double cur_wght) { this.cur_wght = cur_wght; } private Date update_time; private String short_name; private int type; private double alarm_ll; private double alarm_l; private double alarm_h; private double alarm_hh; private double cur_wght; public String getPdt_level() { return pdt_level; } public void setPdt_level(String pdt_level) { this.pdt_level = pdt_level; } public String getP_type() { return p_type; } public void setP_type(String p_type) { this.p_type = p_type; } public int getID() { return ID; } public void setID(int iD) { ID = iD; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getPdt() { return pdt; } public void setPdt(int pdt) { this.pdt = pdt; } public double getTotle() { return totle; } public void setTotle(double totle) { this.totle = totle; } public double getSurplus() { return surplus; } public void setSurplus(double surplus) { this.surplus = surplus; } public int getPercentage() { return percentage; } public void setPercentage(int percentage) { this.percentage = percentage; } }
3,583
0.537364
0.535404
162
20.055555
22.166945
126
false
false
0
0
0
0
0
0
0.401235
false
false
10
acb6ec8918f854b2e52358bf796feab524254fd0
7,696,581,446,615
1f15f36db665e6ff44a5b3d89b43ffa6ce5bb34b
/Anature/src/application/interfaces/IAI.java
9d5bffef1bdcb052cc77fe8c4d32fb20cf068cac
[]
no_license
HMRich/SNR-Project
https://github.com/HMRich/SNR-Project
bcc4eefa989ab59e00a29e8586963f87227c7c0f
8e93004238977a787319dbc09c374e8536bf409d
refs/heads/master
2020-12-08T09:47:47.120000
2020-06-11T09:18:40
2020-06-11T09:18:40
232,948,949
0
2
null
false
2020-06-15T06:17:03
2020-01-10T02:30:17
2020-06-11T09:19:24
2020-06-15T03:28:43
16,635
1
2
0
Java
false
false
package application.interfaces; import java.util.ArrayList; import application.trainers.ai.choice_objects.AiMoveChoice; public interface IAI { /* * PUBLIC METHODS */ public boolean willUseHealthPotion(ArrayList<IHealthPotion> healthPotionBases, IAnature currentAnature); public IHealthPotion healthPotionToUse(ArrayList<IHealthPotion> healthPotionBases, IAnature currentAnature); public boolean willSwitchAnature(ArrayList<IAnature> anatureBases, IAnature enemyAnature, IAnature currentAnature); public AiMoveChoice chooseMove(IAnature source, IAnature target); public IAnature chooseNewAnature(ArrayList<IAnature> anatureBases, IAnature currentAnature, IAnature enemyAnature); }
UTF-8
Java
698
java
IAI.java
Java
[]
null
[]
package application.interfaces; import java.util.ArrayList; import application.trainers.ai.choice_objects.AiMoveChoice; public interface IAI { /* * PUBLIC METHODS */ public boolean willUseHealthPotion(ArrayList<IHealthPotion> healthPotionBases, IAnature currentAnature); public IHealthPotion healthPotionToUse(ArrayList<IHealthPotion> healthPotionBases, IAnature currentAnature); public boolean willSwitchAnature(ArrayList<IAnature> anatureBases, IAnature enemyAnature, IAnature currentAnature); public AiMoveChoice chooseMove(IAnature source, IAnature target); public IAnature chooseNewAnature(ArrayList<IAnature> anatureBases, IAnature currentAnature, IAnature enemyAnature); }
698
0.833811
0.833811
22
30.727272
42.278496
116
false
false
0
0
0
0
0
0
1.045455
false
false
10
6e5aff2d91cce9d50c27bfd09bfd453912a59852
19,421,842,161,978
1627f39bdce9c3fe5bfa34e68c276faa4568bc35
/src/binary_search/Boj14786.java
b0aafac611561f7a79293f64a7b5590ee708c5fe
[ "Apache-2.0" ]
permissive
minuk8932/Algorithm_BaekJoon
https://github.com/minuk8932/Algorithm_BaekJoon
9ebb556f5055b89a5e5c8d885b77738f1e660e4d
a4a46b5e22e0ed0bb1b23bf1e63b78d542aa5557
refs/heads/master
2022-10-23T20:08:19.968000
2022-10-02T06:55:53
2022-10-02T06:55:53
84,549,122
3
3
null
null
null
null
null
null
null
null
null
null
null
null
null
package binary_search; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; /** * * @author exponential-e * 백준 14786번: Ax+Bsin(x)=C * * @see https://www.acmicpc.net/problem/14786/ * */ public class Boj14786 { private static final int INF = 1_000_000_000; public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int A = Integer.parseInt(st.nextToken()); int B = Integer.parseInt(st.nextToken()); int C = Integer.parseInt(st.nextToken()); System.out.println(triangularFunction(A, B, C)); } private static double triangularFunction(double a, double b, double c){ double left = (c - b) / a; double right = (c + b) / a; double result = 0; for(; left <= right; left++){ int start = 0, end = INF; while(start <= end){ int mid = (start + end) / 2; double x = (mid / (double) INF) + left; // make x with decimal point double temp = makeValue(a, b, x); if(temp > c) { end = mid - 1; } else { start = mid + 1; result = x; } } } return result; } private static double makeValue(double a, double b, double x){ return a * x + b * Math.sin(x); } }
UTF-8
Java
1,583
java
Boj14786.java
Java
[ { "context": "port java.util.StringTokenizer;\n\n/**\n *\n * @author exponential-e\n * 백준 14786번: Ax+Bsin(x)=C\n *\n * @see https://www", "end": 155, "score": 0.9941916465759277, "start": 142, "tag": "USERNAME", "value": "exponential-e" } ]
null
[]
package binary_search; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; /** * * @author exponential-e * 백준 14786번: Ax+Bsin(x)=C * * @see https://www.acmicpc.net/problem/14786/ * */ public class Boj14786 { private static final int INF = 1_000_000_000; public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int A = Integer.parseInt(st.nextToken()); int B = Integer.parseInt(st.nextToken()); int C = Integer.parseInt(st.nextToken()); System.out.println(triangularFunction(A, B, C)); } private static double triangularFunction(double a, double b, double c){ double left = (c - b) / a; double right = (c + b) / a; double result = 0; for(; left <= right; left++){ int start = 0, end = INF; while(start <= end){ int mid = (start + end) / 2; double x = (mid / (double) INF) + left; // make x with decimal point double temp = makeValue(a, b, x); if(temp > c) { end = mid - 1; } else { start = mid + 1; result = x; } } } return result; } private static double makeValue(double a, double b, double x){ return a * x + b * Math.sin(x); } }
1,583
0.53012
0.511097
58
26.189655
23.492813
92
false
false
0
0
0
0
0
0
0.586207
false
false
10
d638aa17cb4010dac8cee9b1e1669e5a82ca8577
15,504,831,985,128
d167873b09dfac341d27ecd8b7936833c4ca8e33
/src/BMI.java
20ed3ac40fc5d3a9b82d81c3ce4c20dac2ab1064
[]
no_license
christianhayes2019/BMI
https://github.com/christianhayes2019/BMI
1cad75d5299f61c40814dbdf1ca69b538e776c54
839dde012e965abb7cb10c2616470c1d1ad5846d
refs/heads/master
2020-03-28T00:14:01.604000
2018-09-06T18:16:58
2018-09-06T18:16:58
147,387,402
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; public class BMI { public static void main(String[] args){ /* Bmi= kg/m*m inch = m* (1 inch/0.254 m) */ Scanner keyboard; int inches; double meters; double height; int pounds; double kilograms; double weight; double bmi; keyboard = new Scanner(System.in); System.out.println("What is your height in inches?"); inches = keyboard.nextInt(); meters = .0254; height= (int) inches *meters; System.out.println("What is your weight in pounds?"); pounds = keyboard.nextInt(); kilograms = (double) 0.453592; weight = ((double) pounds*kilograms); System.out.println(weight+ "/" + height); bmi = weight/height; System.out.println("Your bmi is " + bmi +"."); } }
UTF-8
Java
896
java
BMI.java
Java
[]
null
[]
import java.util.Scanner; public class BMI { public static void main(String[] args){ /* Bmi= kg/m*m inch = m* (1 inch/0.254 m) */ Scanner keyboard; int inches; double meters; double height; int pounds; double kilograms; double weight; double bmi; keyboard = new Scanner(System.in); System.out.println("What is your height in inches?"); inches = keyboard.nextInt(); meters = .0254; height= (int) inches *meters; System.out.println("What is your weight in pounds?"); pounds = keyboard.nextInt(); kilograms = (double) 0.453592; weight = ((double) pounds*kilograms); System.out.println(weight+ "/" + height); bmi = weight/height; System.out.println("Your bmi is " + bmi +"."); } }
896
0.534598
0.516741
60
13.933333
18.173119
61
false
false
0
0
0
0
0
0
0.35
false
false
10
cf1993d7a1f1db124861f804f3c3f8de96ac3afc
20,787,641,749,583
b886add25d7576680f63f97b704fa3cc5880b8b4
/lowestCommonAncestorBinaryTree/src/lowestCommonAncestorBinaryTree/main.java
b6dc0e4332f8a8704f70202a891a05cd1a69060c
[]
no_license
yijuchung/leetcode
https://github.com/yijuchung/leetcode
c889266931c9adaa350779952ff7a7c4dc2d18f9
1108423797379f14e89ff556bf7baa8d0e0fe1a0
refs/heads/master
2016-04-02T03:48:29.557000
2014-09-06T01:34:28
2014-09-06T01:34:28
10,723,882
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package lowestCommonAncestorBinaryTree; public class main { public static int count(node r, node x, node y){ if(r == null) return 0; int match = count(r.left,x,y)+count(r.right,x,y); if(r == x || r == y) return 1+match; return match; } public static node lca(node h, node x, node y){ // top down if(h == null || x == null || y == null) return null; if(h == x || h == y) return h; int match = count(h.left,x,y); if(match == 1){ return h; }else if(match == 2){ return lca(h.left,x,y); }else return lca(h.right,x,y); } // public static node lca(node h, node x, node y){ // // bottom up // if(h == null) // return null; // if(h == x || h == y) // return h; // // node l = lca(h.left,x,y); // node r = lca(h.right,x,y); // // if(l != null && r != null){ // return h; // } // return (l == null)?r:l; // } public static void main(String[] args) { node head = new node(3); head.left = new node(5); head.left.left = new node(6); head.left.right = new node(2); head.left.right.left = new node(7); head.left.right.right = new node(4); head.right = new node(1); head.right.left = new node(0); head.right.right = new node(8); System.out.print(lca(head,head.left,head.right.right).val); } }
UTF-8
Java
1,278
java
main.java
Java
[]
null
[]
package lowestCommonAncestorBinaryTree; public class main { public static int count(node r, node x, node y){ if(r == null) return 0; int match = count(r.left,x,y)+count(r.right,x,y); if(r == x || r == y) return 1+match; return match; } public static node lca(node h, node x, node y){ // top down if(h == null || x == null || y == null) return null; if(h == x || h == y) return h; int match = count(h.left,x,y); if(match == 1){ return h; }else if(match == 2){ return lca(h.left,x,y); }else return lca(h.right,x,y); } // public static node lca(node h, node x, node y){ // // bottom up // if(h == null) // return null; // if(h == x || h == y) // return h; // // node l = lca(h.left,x,y); // node r = lca(h.right,x,y); // // if(l != null && r != null){ // return h; // } // return (l == null)?r:l; // } public static void main(String[] args) { node head = new node(3); head.left = new node(5); head.left.left = new node(6); head.left.right = new node(2); head.left.right.left = new node(7); head.left.right.right = new node(4); head.right = new node(1); head.right.left = new node(0); head.right.right = new node(8); System.out.print(lca(head,head.left,head.right.right).val); } }
1,278
0.565728
0.555556
60
20.299999
15.614416
61
false
false
0
0
0
0
0
0
2.733333
false
false
10
30be4e1d668f83088a1dfe63e2e3e4bdc646b15c
15,616,501,101,412
2a5559111c9c56ae24adc3b2d13e07e9da4e734c
/src/LeetCode/BackTracking/GenerateParentheses.java
5ea2aae0b4fbf64da62ea5fed12df00ad57c43b3
[]
no_license
wayne0324/LeetCode
https://github.com/wayne0324/LeetCode
2122f9e0c96acf8b0cf24646f26c291c0f690887
c9a3aa39c5fb92a62d087d36ba821b51a3a32ea1
refs/heads/master
2020-03-29T13:01:24.663000
2019-01-30T04:42:02
2019-01-30T04:42:02
149,932,973
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package LeetCode.BackTracking; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class GenerateParentheses { public static void main(String[] args) { GenerateParentheses generateParentheses = new GenerateParentheses(); List<String> list = generateParentheses.generateParenthesis(2); System.out.println(Arrays.toString(list.toArray()));/**简单的打印ArrayList的方法!*/ } public List<String> generateParenthesis(int n) { List<String> list = new ArrayList<>(); //这里不能写 new List<String>(),一定要是LinkedList或者是ArrayList doadd(n,n,list,""); return list; } public static void doadd(int left, int right, List<String> list, String path){ if (left == 0 && right == 0){ list.add(path); return; } if (left != 0) doadd(left-1,right,list,path+"("); if (right != 0 && right > left) doadd(left,right-1,list,path+")"); } }
UTF-8
Java
1,031
java
GenerateParentheses.java
Java
[]
null
[]
package LeetCode.BackTracking; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class GenerateParentheses { public static void main(String[] args) { GenerateParentheses generateParentheses = new GenerateParentheses(); List<String> list = generateParentheses.generateParenthesis(2); System.out.println(Arrays.toString(list.toArray()));/**简单的打印ArrayList的方法!*/ } public List<String> generateParenthesis(int n) { List<String> list = new ArrayList<>(); //这里不能写 new List<String>(),一定要是LinkedList或者是ArrayList doadd(n,n,list,""); return list; } public static void doadd(int left, int right, List<String> list, String path){ if (left == 0 && right == 0){ list.add(path); return; } if (left != 0) doadd(left-1,right,list,path+"("); if (right != 0 && right > left) doadd(left,right-1,list,path+")"); } }
1,031
0.615773
0.608696
35
27.257143
27.823261
101
false
false
0
0
0
0
0
0
0.771429
false
false
10
173301dfdff6e050e9001464f27e6dc08af457cb
33,535,104,662,407
2a081548051d341c87937efc0ef89e242262bc58
/src/View/SellerVacation/SellerVacationController.java
ec97f66b073ee33487ffa31d4fcf01398f4b0f82
[]
no_license
advafa/EveryVacation4u
https://github.com/advafa/EveryVacation4u
59b54c3acbc8227945efeb38c8db411a6583db32
9179b2bf9f4c6717984a8d2a4b83b3be844e2fbc
refs/heads/master
2020-04-14T11:54:14.300000
2019-01-15T08:57:18
2019-01-15T08:57:18
163,825,852
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package View.SellerVacation; import View.TableViewClass; import App.Vacation; import Main.ViewModel; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.*; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.input.MouseButton; import javafx.scene.input.MouseEvent; import java.net.URL; import java.util.List; import java.util.Optional; import java.util.ResourceBundle; import javafx.scene.control.Button; public class SellerVacationController implements Initializable { //seller_status true=approve, false=decline @FXML public TableView<TableViewClass> SaleRequstTable; public TableColumn<TableViewClass, String> colFrom; public TableColumn<TableViewClass, String> colTo; public TableColumn<TableViewClass, String> colCheckin; public TableColumn<TableViewClass, String> colCheckout; public TableColumn<TableViewClass, String> colVacatinStatus; public Button done_btn; public Button edit_btn; public Button del_btn; public Button details; public Button can_btn; //MenuItems @FXML public MenuItem SignUp_menu; public MenuItem View_profile_menu; public MenuItem EditProfile_menu; public MenuItem Delete_profile_menu; public MenuItem addVac_menu; public MenuItem seller_vacations_menu; public MenuItem seller_req_menu; public MenuItem search_menu; public MenuItem searcher_req_menu; public MenuItem inbox_traderequests_menu; public MenuItem outbox_traderequests_menu; public MenuItem SignIn_menu; public MenuItem SignOut_menu; public MenuItem exit_menu; private ObservableList<TableViewClass> SaleRequst; private TableViewClass clickedRow; private ViewModel viewModel; @Override public void initialize(URL location, ResourceBundle resources) { //********* Menu Functions **************/// SignUp_menu.setOnAction(e -> {viewModel.goToSignUp();}); View_profile_menu.setOnAction(e -> {viewModel.goToProfileView();}); EditProfile_menu.setOnAction(e -> {viewModel.goToEditProfile();}); Delete_profile_menu.setOnAction(e -> {viewModel.goTODeleteProfile();});; addVac_menu.setOnAction(e -> {viewModel.goToAddVacation();}); seller_vacations_menu.setOnAction(e -> {viewModel.goToSellerVacationsView("View");}); seller_req_menu.setOnAction(e -> {viewModel.goToSellerRequest();}); search_menu.setOnAction(e -> {viewModel.goToSearchView();}); searcher_req_menu.setOnAction(e -> {viewModel.goToSearcherVacationsView();}); inbox_traderequests_menu.setOnAction(e -> {viewModel.goToInbox_traderequests();}); outbox_traderequests_menu.setOnAction(e -> {viewModel.goToOutbox_traderequests();}); SignIn_menu.setOnAction(e -> {viewModel.goToSignIn();}); SignOut_menu.setOnAction(e -> {viewModel.SignOut();}); exit_menu.setOnAction(e -> {System.exit(0);}); colFrom.setCellValueFactory(new PropertyValueFactory<> ("from")); colTo.setCellValueFactory(new PropertyValueFactory<> ("to")); colCheckin.setCellValueFactory(new PropertyValueFactory<>("checkin")); colCheckout.setCellValueFactory(new PropertyValueFactory<>("checkout")); colVacatinStatus.setCellValueFactory(new PropertyValueFactory<>("vac_status")); colFrom.setStyle("-fx-alignment: BASELINE_CENTER"); colTo.setStyle("-fx-alignment: BASELINE_CENTER"); colCheckin.setStyle("-fx-alignment: BASELINE_CENTER"); colCheckout.setStyle("-fx-alignment: BASELINE_CENTER"); colVacatinStatus.setStyle("-fx-alignment: BASELINE_CENTER"); SaleRequst = FXCollections.observableArrayList(); SaleRequstTable.setRowFactory(tv -> { TableRow<TableViewClass> row = new TableRow<>(); row.setOnMouseClicked(event -> { if (!row.isEmpty() && event.getButton() == MouseButton.PRIMARY) { this.clickedRow = row.getItem(); } }); return row; }); } public void setViewModel(ViewModel viewModel) { this.viewModel = viewModel; } public void goToDetails(MouseEvent mouseEvent) { if(this.clickedRow==null) viewModel.popAlertinfo("Please pick a Request row from the Table!"); else viewModel.goToSellerVacationDetails(this.clickedRow.getVacation_id()); } public void goToDone (MouseEvent mouseEvent) { if(this.clickedRow==null) viewModel.popAlertinfo("Please pick a Request row from the Table!"); else{ Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setContentText("In this send Requst you agree to trade in"); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.OK) { this.viewModel.addTradeReq(this.clickedRow.getVacation_id(),true); }}} public void loadAllSellerVacations() { this.clickedRow=null; this.done_btn.setVisible(false); this.details.setVisible(true); this.edit_btn.setVisible(true); this.del_btn.setVisible(true); can_btn.setVisible(false); SaleRequstTable.setItems(FXCollections.observableArrayList()); SaleRequst = FXCollections.observableArrayList(); List<Vacation> SellerVacationsList = viewModel.getVacationsByseller_email(); int id; String checkin; String checkout; String from; String to; String stat; TableViewClass addrow; for(Vacation vacation : SellerVacationsList){ id=vacation.getVacation_id(); from=vacation.getFrom(); to=vacation.getto(); checkin=vacation.toStringCheckin(); checkout=vacation.toStringCheckout(); stat=vacation.getVacation_status()?"Available":"NOT Available"; addrow=new TableViewClass(id,checkin,checkout, from,to,stat); SaleRequst.add(addrow); } SaleRequstTable.setItems(SaleRequst); } public void loadAvailableSellerVacations() { this.clickedRow=null; this.done_btn.setVisible(true); this.details.setVisible(true); this.edit_btn.setVisible(false); this.del_btn.setVisible(false); can_btn.setVisible(true); SaleRequstTable.setItems(FXCollections.observableArrayList()); SaleRequst = FXCollections.observableArrayList(); List<Vacation> SellerVacationsList = viewModel.getAvailableVacationsByseller_email(); int id; String checkin; String checkout; String from; String to; String stat; TableViewClass addrow; for(Vacation vacation : SellerVacationsList){ id=vacation.getVacation_id(); from=vacation.getFrom(); to=vacation.getto(); checkin=vacation.toStringCheckin(); checkout=vacation.toStringCheckout(); stat=vacation.getVacation_status()?"Available":"NOT Available"; addrow=new TableViewClass(id,checkin,checkout, from,to,stat); SaleRequst.add(addrow); } SaleRequstTable.setItems(SaleRequst); } public void goToEditVacation (MouseEvent mouseEvent) { if (this.clickedRow == null) viewModel.popAlertinfo("Please pick a Request row from the Table!"); else { if(!this.clickedRow.getVac_status().equals("Available")) this.viewModel.popAlertinfo("This Vacation is NOT Avalible !!!"); else this.viewModel.goToEditVacation(this.clickedRow.getVacation_id()); } } public void goToDeleteVacation (MouseEvent mouseEvent) { if(this.clickedRow==null) viewModel.popAlertinfo("Please pick a Request row from the Table!"); else{ Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setContentText("Are you sure you want to delete this Vacation?"); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.OK) { this.viewModel.DeleteVacation(this.clickedRow.getVacation_id()); this.viewModel.popAlertinfo("Your Vacation successfully deleted !"); this.loadAllSellerVacations(); }}} public void goToCancel (MouseEvent mouseEvent){ viewModel.goToSearchView(); } }
UTF-8
Java
9,017
java
SellerVacationController.java
Java
[]
null
[]
package View.SellerVacation; import View.TableViewClass; import App.Vacation; import Main.ViewModel; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.*; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.input.MouseButton; import javafx.scene.input.MouseEvent; import java.net.URL; import java.util.List; import java.util.Optional; import java.util.ResourceBundle; import javafx.scene.control.Button; public class SellerVacationController implements Initializable { //seller_status true=approve, false=decline @FXML public TableView<TableViewClass> SaleRequstTable; public TableColumn<TableViewClass, String> colFrom; public TableColumn<TableViewClass, String> colTo; public TableColumn<TableViewClass, String> colCheckin; public TableColumn<TableViewClass, String> colCheckout; public TableColumn<TableViewClass, String> colVacatinStatus; public Button done_btn; public Button edit_btn; public Button del_btn; public Button details; public Button can_btn; //MenuItems @FXML public MenuItem SignUp_menu; public MenuItem View_profile_menu; public MenuItem EditProfile_menu; public MenuItem Delete_profile_menu; public MenuItem addVac_menu; public MenuItem seller_vacations_menu; public MenuItem seller_req_menu; public MenuItem search_menu; public MenuItem searcher_req_menu; public MenuItem inbox_traderequests_menu; public MenuItem outbox_traderequests_menu; public MenuItem SignIn_menu; public MenuItem SignOut_menu; public MenuItem exit_menu; private ObservableList<TableViewClass> SaleRequst; private TableViewClass clickedRow; private ViewModel viewModel; @Override public void initialize(URL location, ResourceBundle resources) { //********* Menu Functions **************/// SignUp_menu.setOnAction(e -> {viewModel.goToSignUp();}); View_profile_menu.setOnAction(e -> {viewModel.goToProfileView();}); EditProfile_menu.setOnAction(e -> {viewModel.goToEditProfile();}); Delete_profile_menu.setOnAction(e -> {viewModel.goTODeleteProfile();});; addVac_menu.setOnAction(e -> {viewModel.goToAddVacation();}); seller_vacations_menu.setOnAction(e -> {viewModel.goToSellerVacationsView("View");}); seller_req_menu.setOnAction(e -> {viewModel.goToSellerRequest();}); search_menu.setOnAction(e -> {viewModel.goToSearchView();}); searcher_req_menu.setOnAction(e -> {viewModel.goToSearcherVacationsView();}); inbox_traderequests_menu.setOnAction(e -> {viewModel.goToInbox_traderequests();}); outbox_traderequests_menu.setOnAction(e -> {viewModel.goToOutbox_traderequests();}); SignIn_menu.setOnAction(e -> {viewModel.goToSignIn();}); SignOut_menu.setOnAction(e -> {viewModel.SignOut();}); exit_menu.setOnAction(e -> {System.exit(0);}); colFrom.setCellValueFactory(new PropertyValueFactory<> ("from")); colTo.setCellValueFactory(new PropertyValueFactory<> ("to")); colCheckin.setCellValueFactory(new PropertyValueFactory<>("checkin")); colCheckout.setCellValueFactory(new PropertyValueFactory<>("checkout")); colVacatinStatus.setCellValueFactory(new PropertyValueFactory<>("vac_status")); colFrom.setStyle("-fx-alignment: BASELINE_CENTER"); colTo.setStyle("-fx-alignment: BASELINE_CENTER"); colCheckin.setStyle("-fx-alignment: BASELINE_CENTER"); colCheckout.setStyle("-fx-alignment: BASELINE_CENTER"); colVacatinStatus.setStyle("-fx-alignment: BASELINE_CENTER"); SaleRequst = FXCollections.observableArrayList(); SaleRequstTable.setRowFactory(tv -> { TableRow<TableViewClass> row = new TableRow<>(); row.setOnMouseClicked(event -> { if (!row.isEmpty() && event.getButton() == MouseButton.PRIMARY) { this.clickedRow = row.getItem(); } }); return row; }); } public void setViewModel(ViewModel viewModel) { this.viewModel = viewModel; } public void goToDetails(MouseEvent mouseEvent) { if(this.clickedRow==null) viewModel.popAlertinfo("Please pick a Request row from the Table!"); else viewModel.goToSellerVacationDetails(this.clickedRow.getVacation_id()); } public void goToDone (MouseEvent mouseEvent) { if(this.clickedRow==null) viewModel.popAlertinfo("Please pick a Request row from the Table!"); else{ Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setContentText("In this send Requst you agree to trade in"); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.OK) { this.viewModel.addTradeReq(this.clickedRow.getVacation_id(),true); }}} public void loadAllSellerVacations() { this.clickedRow=null; this.done_btn.setVisible(false); this.details.setVisible(true); this.edit_btn.setVisible(true); this.del_btn.setVisible(true); can_btn.setVisible(false); SaleRequstTable.setItems(FXCollections.observableArrayList()); SaleRequst = FXCollections.observableArrayList(); List<Vacation> SellerVacationsList = viewModel.getVacationsByseller_email(); int id; String checkin; String checkout; String from; String to; String stat; TableViewClass addrow; for(Vacation vacation : SellerVacationsList){ id=vacation.getVacation_id(); from=vacation.getFrom(); to=vacation.getto(); checkin=vacation.toStringCheckin(); checkout=vacation.toStringCheckout(); stat=vacation.getVacation_status()?"Available":"NOT Available"; addrow=new TableViewClass(id,checkin,checkout, from,to,stat); SaleRequst.add(addrow); } SaleRequstTable.setItems(SaleRequst); } public void loadAvailableSellerVacations() { this.clickedRow=null; this.done_btn.setVisible(true); this.details.setVisible(true); this.edit_btn.setVisible(false); this.del_btn.setVisible(false); can_btn.setVisible(true); SaleRequstTable.setItems(FXCollections.observableArrayList()); SaleRequst = FXCollections.observableArrayList(); List<Vacation> SellerVacationsList = viewModel.getAvailableVacationsByseller_email(); int id; String checkin; String checkout; String from; String to; String stat; TableViewClass addrow; for(Vacation vacation : SellerVacationsList){ id=vacation.getVacation_id(); from=vacation.getFrom(); to=vacation.getto(); checkin=vacation.toStringCheckin(); checkout=vacation.toStringCheckout(); stat=vacation.getVacation_status()?"Available":"NOT Available"; addrow=new TableViewClass(id,checkin,checkout, from,to,stat); SaleRequst.add(addrow); } SaleRequstTable.setItems(SaleRequst); } public void goToEditVacation (MouseEvent mouseEvent) { if (this.clickedRow == null) viewModel.popAlertinfo("Please pick a Request row from the Table!"); else { if(!this.clickedRow.getVac_status().equals("Available")) this.viewModel.popAlertinfo("This Vacation is NOT Avalible !!!"); else this.viewModel.goToEditVacation(this.clickedRow.getVacation_id()); } } public void goToDeleteVacation (MouseEvent mouseEvent) { if(this.clickedRow==null) viewModel.popAlertinfo("Please pick a Request row from the Table!"); else{ Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setContentText("Are you sure you want to delete this Vacation?"); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.OK) { this.viewModel.DeleteVacation(this.clickedRow.getVacation_id()); this.viewModel.popAlertinfo("Your Vacation successfully deleted !"); this.loadAllSellerVacations(); }}} public void goToCancel (MouseEvent mouseEvent){ viewModel.goToSearchView(); } }
9,017
0.635355
0.635245
237
37.046413
27.814825
97
false
false
0
0
0
0
0
0
0.746835
false
false
10
65e922f94c553ebc3199601cf069e52d3b63d505
3,702,261,819,582
fcbc72af1eec0248ccd37da0e5a3a1807cfd39aa
/ISSUETRACKINGSYSTEM/src/dsynhub/its/controller/task/TaskInsertServlet.java
dbf38cd560e1dd2d18395870861dba51051c1364
[]
no_license
aalapdesai112/IssueTrackingSystem
https://github.com/aalapdesai112/IssueTrackingSystem
79f8616e597a54e7486963cd4d3e2e5149fdff5e
ce0e84d045d0d73401dd275f401cd4b0c2f26a2b
refs/heads/master
2016-08-12T08:31:33.931000
2016-04-09T07:35:00
2016-04-09T07:35:00
55,831,739
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dsynhub.its.controller.task; import java.io.IOException; import java.io.PrintWriter; import java.util.regex.Pattern; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import dsynhub.its.bean.TaskBean; import dsynhub.its.dao.TaskDao; public class TaskInsertServlet extends HttpServlet{ private static final long serialVersionUID = 5529305582961502104L; @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } @Override protected void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { { TaskDao dao = new TaskDao(); TaskBean bean = new TaskBean(); PrintWriter out = response.getWriter(); String taskName = request.getParameter("taskName"); String taskDiscription = request.getParameter("taskDescription"); String estimatedStartDate = request.getParameter("estimated_start_date"); String actualStartDate = request.getParameter("actual_start_date"); String estimatedEndDate = request.getParameter("estimated_end_date"); String actualEndDate = request.getParameter("actual_end_date"); int prorityId = Integer.parseInt(request.getParameter("priorityid")); int statusId = Integer.parseInt(request.getParameter("statusid")); int moduleId = Integer.parseInt(request.getParameter("moduleid")); boolean isError = false; Pattern pattern1 = Pattern.compile(".*[A-z].*"); if (taskName.isEmpty() || taskName.trim().length() == 0) { isError = true; request.setAttribute("taskName","<font color=red>Enter the ModuleName</font>"); } else if (taskName.trim().length() > 50) { isError = true; request.setAttribute("taskName","<font color=red>size exided from 50 in ModuleName</font>"); } else if (pattern1.matcher(taskName).matches() == false) { isError = true; request.setAttribute("taskName","<font color=red>only character enter in ModuleName</font>"); } else { bean.setTaskName(taskName); } if (actualStartDate.isEmpty()|| actualStartDate.trim().length() == 0) { isError = true; request.setAttribute("actualStartDate","<font color=red>Enter the actualStartDate</font>"); } else if (actualStartDate.trim().length() > 50) { isError = true; request.setAttribute("actualStartDate","<font color=red>size exided from 50 in ProjectName</font>"); } else { bean.setTaskActualStartDate(actualStartDate); } if (actualEndDate.isEmpty()|| actualEndDate.trim().length() == 0) { isError = true; request.setAttribute("actualEndDate","<font color=red>Enter the actualEndDate</font>"); } else if (actualEndDate.trim().length() > 50) { isError = true; request.setAttribute("actualEndDate","<font color=red>size exided from 50 in actualEndDate</font>"); } else { bean.setTaskDescription(taskDiscription); bean.setTaskEstimateStartDate(estimatedStartDate); bean.setTaskActualStartDate(actualStartDate); bean.setTaskEstimateEndDate(estimatedEndDate); bean.setTaskActualEndDate(actualEndDate); bean.setPmtPriorityId(prorityId); bean.setPmtStatusId(statusId); bean.setModuleId(moduleId); } if (isError == true) { RequestDispatcher rd = request.getRequestDispatcher("ModuleInsert.jsp"); rd.forward(request, response); } else { boolean flag1 = false; flag1 = dao.duplicateTask(taskName); System.out.println(flag1); if (flag1 == false) { boolean flag = dao.DataInsertTask(bean); if (flag) { response.sendRedirect("TaskViewServlet"); out.println("inserted..."); } } else { request.setAttribute("duplicate","<font color=red>Task Name exist </font>"); RequestDispatcher rd=request.getRequestDispatcher("TaskViewServlet"); rd.forward(request, response); out.println("inserted..."); } } } } }
UTF-8
Java
4,141
java
TaskInsertServlet.java
Java
[]
null
[]
package dsynhub.its.controller.task; import java.io.IOException; import java.io.PrintWriter; import java.util.regex.Pattern; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import dsynhub.its.bean.TaskBean; import dsynhub.its.dao.TaskDao; public class TaskInsertServlet extends HttpServlet{ private static final long serialVersionUID = 5529305582961502104L; @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } @Override protected void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { { TaskDao dao = new TaskDao(); TaskBean bean = new TaskBean(); PrintWriter out = response.getWriter(); String taskName = request.getParameter("taskName"); String taskDiscription = request.getParameter("taskDescription"); String estimatedStartDate = request.getParameter("estimated_start_date"); String actualStartDate = request.getParameter("actual_start_date"); String estimatedEndDate = request.getParameter("estimated_end_date"); String actualEndDate = request.getParameter("actual_end_date"); int prorityId = Integer.parseInt(request.getParameter("priorityid")); int statusId = Integer.parseInt(request.getParameter("statusid")); int moduleId = Integer.parseInt(request.getParameter("moduleid")); boolean isError = false; Pattern pattern1 = Pattern.compile(".*[A-z].*"); if (taskName.isEmpty() || taskName.trim().length() == 0) { isError = true; request.setAttribute("taskName","<font color=red>Enter the ModuleName</font>"); } else if (taskName.trim().length() > 50) { isError = true; request.setAttribute("taskName","<font color=red>size exided from 50 in ModuleName</font>"); } else if (pattern1.matcher(taskName).matches() == false) { isError = true; request.setAttribute("taskName","<font color=red>only character enter in ModuleName</font>"); } else { bean.setTaskName(taskName); } if (actualStartDate.isEmpty()|| actualStartDate.trim().length() == 0) { isError = true; request.setAttribute("actualStartDate","<font color=red>Enter the actualStartDate</font>"); } else if (actualStartDate.trim().length() > 50) { isError = true; request.setAttribute("actualStartDate","<font color=red>size exided from 50 in ProjectName</font>"); } else { bean.setTaskActualStartDate(actualStartDate); } if (actualEndDate.isEmpty()|| actualEndDate.trim().length() == 0) { isError = true; request.setAttribute("actualEndDate","<font color=red>Enter the actualEndDate</font>"); } else if (actualEndDate.trim().length() > 50) { isError = true; request.setAttribute("actualEndDate","<font color=red>size exided from 50 in actualEndDate</font>"); } else { bean.setTaskDescription(taskDiscription); bean.setTaskEstimateStartDate(estimatedStartDate); bean.setTaskActualStartDate(actualStartDate); bean.setTaskEstimateEndDate(estimatedEndDate); bean.setTaskActualEndDate(actualEndDate); bean.setPmtPriorityId(prorityId); bean.setPmtStatusId(statusId); bean.setModuleId(moduleId); } if (isError == true) { RequestDispatcher rd = request.getRequestDispatcher("ModuleInsert.jsp"); rd.forward(request, response); } else { boolean flag1 = false; flag1 = dao.duplicateTask(taskName); System.out.println(flag1); if (flag1 == false) { boolean flag = dao.DataInsertTask(bean); if (flag) { response.sendRedirect("TaskViewServlet"); out.println("inserted..."); } } else { request.setAttribute("duplicate","<font color=red>Task Name exist </font>"); RequestDispatcher rd=request.getRequestDispatcher("TaskViewServlet"); rd.forward(request, response); out.println("inserted..."); } } } } }
4,141
0.708042
0.698382
124
32.403225
28.750013
118
false
false
0
0
0
0
0
0
3.612903
false
false
10
96ca7f6a990f16ba5b7d830e426281708314b508
5,308,579,618,187
3a4b212a67ea7ba435b500db1a4d0d39855a9b3a
/houserent/src/com/softxm/hs/dao/WaterMoneyDao.java
4e7910ab60c332e160cd59f0c2132a1cee5d1f79
[]
no_license
lidonghao1116/house
https://github.com/lidonghao1116/house
10a14f5e22d0985853c50bf9c6e6665d02d619b9
a318e47ce5275a32ff8804cd33dbf6495d98077a
refs/heads/master
2021-01-17T22:35:58.152000
2014-05-20T02:30:44
2014-05-20T02:30:44
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.softxm.hs.dao; import java.util.List; import com.softxm.hs.model.PageModel; import com.softxm.hs.model.Twatermoney; public interface WaterMoneyDao { PageModel getWatermoneyList(int currentPage, int pageSize, Twatermoney twatermoney); void newWater(Twatermoney twatermoney); void isrevice(Long wmid); void delWaterMoney(Long wmid); Twatermoney getWaterMoneyById(Long wmid); void updateWater(Twatermoney twatermoney); PageModel getPersonWater(int currentPage, int pageSize, Twatermoney twatermoney); List<Twatermoney> getAllWaterByUserId(Long uiid); List<Twatermoney> getAllWater(); List<Twatermoney> getDate(Long uiid); }
UTF-8
Java
663
java
WaterMoneyDao.java
Java
[]
null
[]
package com.softxm.hs.dao; import java.util.List; import com.softxm.hs.model.PageModel; import com.softxm.hs.model.Twatermoney; public interface WaterMoneyDao { PageModel getWatermoneyList(int currentPage, int pageSize, Twatermoney twatermoney); void newWater(Twatermoney twatermoney); void isrevice(Long wmid); void delWaterMoney(Long wmid); Twatermoney getWaterMoneyById(Long wmid); void updateWater(Twatermoney twatermoney); PageModel getPersonWater(int currentPage, int pageSize, Twatermoney twatermoney); List<Twatermoney> getAllWaterByUserId(Long uiid); List<Twatermoney> getAllWater(); List<Twatermoney> getDate(Long uiid); }
663
0.790347
0.790347
32
19.71875
19.922089
59
false
false
0
0
0
0
0
0
1.0625
false
false
10
83bfec03ad46ebd7387e74bcb555cbba484f5d19
27,238,682,600,886
0db0f45dbc6b59cd85c1a7d14c35fdf4f0fb6225
/vertx-gaia/vertx-co/src/main/java/com/fasterxml/jackson/databind/InstantSerializer.java
73372ed050202689a8a4d6e5b8d36f6ead6dc28a
[ "Apache-2.0" ]
permissive
StrangeDreamer/vertx-zero
https://github.com/StrangeDreamer/vertx-zero
48950eebc2ebaa27363e8001de1b0e3d4c02263e
00aeed8c3d5123f8115f3a99d4d1b3bf295e26a4
refs/heads/master
2020-04-08T06:57:13.165000
2018-11-20T04:19:41
2018-11-20T04:19:41
159,120,199
1
0
Apache-2.0
true
2018-11-26T06:16:47
2018-11-26T06:16:43
2018-11-20T04:19:43
2018-11-25T08:23:08
19,038
0
0
0
null
false
null
package com.fasterxml.jackson.databind; import com.fasterxml.jackson.core.JsonGenerator; import java.io.IOException; import java.time.Instant; import static java.time.format.DateTimeFormatter.ISO_INSTANT; public class InstantSerializer extends JsonSerializer<Instant> { @Override public void serialize(final Instant value, final JsonGenerator jgen, final SerializerProvider provider) throws IOException { jgen.writeString(ISO_INSTANT.format(value)); } }
UTF-8
Java
478
java
InstantSerializer.java
Java
[]
null
[]
package com.fasterxml.jackson.databind; import com.fasterxml.jackson.core.JsonGenerator; import java.io.IOException; import java.time.Instant; import static java.time.format.DateTimeFormatter.ISO_INSTANT; public class InstantSerializer extends JsonSerializer<Instant> { @Override public void serialize(final Instant value, final JsonGenerator jgen, final SerializerProvider provider) throws IOException { jgen.writeString(ISO_INSTANT.format(value)); } }
478
0.792887
0.792887
15
30.866667
34.629211
128
false
false
0
0
0
0
0
0
0.533333
false
false
10
4c2c24b5556d2fda2b55322bc51ee99b82894d26
27,590,869,963,753
0b2702041d2fa6ee0451a700e3ea538a8bafe742
/app/web/src/mil/disa/ads/web/security/AdsAuthenticationProvider.java
94704b3e8055c733e8e7fc6de138c0b8a5212ae4
[]
no_license
gcroghan/ads
https://github.com/gcroghan/ads
4be9a24b69a31b12edb1caa9330c26f6f2fe53f0
a0f3e36be35dfc360dc2b232a737d082cfd1c626
refs/heads/master
2017-12-01T22:30:48.752000
2011-11-10T20:28:08
2011-11-10T20:28:08
63,978,256
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package mil.disa.ads.web.security; import org.acegisecurity.AuthenticationException; import org.acegisecurity.GrantedAuthority; import org.acegisecurity.providers.UsernamePasswordAuthenticationToken; import org.acegisecurity.providers.dao.DaoAuthenticationProvider; import org.acegisecurity.userdetails.UserDetails; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Implementation of an Authentication Provider. Currently, this is just being used to log information about the user. * * @author Brian Uri! * @version EADS 1.0 */ public class AdsAuthenticationProvider extends DaoAuthenticationProvider { protected final transient Log logger = LogFactory.getLog(getClass()); /** * @see org.acegisecurity.providers.dao.DaoAuthenticationProvider#additionalAuthenticationChecks(org.acegisecurity.userdetails.UserDetails, * org.acegisecurity.providers.UsernamePasswordAuthenticationToken) */ protected void additionalAuthenticationChecks(UserDetails userDetails, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException { LoginUserDetails loginDetails = (LoginUserDetails) userDetails; logger.debug("User " + loginDetails.getUser().getDkoId() + " logged into system."); String roles = ""; for (int i = 0; i < loginDetails.getAuthorities().length; i++) { GrantedAuthority authority = loginDetails.getAuthorities()[i]; roles += authority.getAuthority(); if (i < loginDetails.getAuthorities().length - 1) roles += ", "; } logger.debug("User " + loginDetails.getUser().getDkoId() + " has roles: " + roles); } }
UTF-8
Java
1,660
java
AdsAuthenticationProvider.java
Java
[ { "context": "o log information about the user.\r\n * \r\n * @author Brian Uri!\r\n * @version EADS 1.0\r\n */\r\npublic class AdsAuth", "end": 563, "score": 0.9998607039451599, "start": 554, "tag": "NAME", "value": "Brian Uri" } ]
null
[]
package mil.disa.ads.web.security; import org.acegisecurity.AuthenticationException; import org.acegisecurity.GrantedAuthority; import org.acegisecurity.providers.UsernamePasswordAuthenticationToken; import org.acegisecurity.providers.dao.DaoAuthenticationProvider; import org.acegisecurity.userdetails.UserDetails; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Implementation of an Authentication Provider. Currently, this is just being used to log information about the user. * * @author <NAME>! * @version EADS 1.0 */ public class AdsAuthenticationProvider extends DaoAuthenticationProvider { protected final transient Log logger = LogFactory.getLog(getClass()); /** * @see org.acegisecurity.providers.dao.DaoAuthenticationProvider#additionalAuthenticationChecks(org.acegisecurity.userdetails.UserDetails, * org.acegisecurity.providers.UsernamePasswordAuthenticationToken) */ protected void additionalAuthenticationChecks(UserDetails userDetails, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException { LoginUserDetails loginDetails = (LoginUserDetails) userDetails; logger.debug("User " + loginDetails.getUser().getDkoId() + " logged into system."); String roles = ""; for (int i = 0; i < loginDetails.getAuthorities().length; i++) { GrantedAuthority authority = loginDetails.getAuthorities()[i]; roles += authority.getAuthority(); if (i < loginDetails.getAuthorities().length - 1) roles += ", "; } logger.debug("User " + loginDetails.getUser().getDkoId() + " has roles: " + roles); } }
1,657
0.762048
0.759639
37
42.864864
40.079762
156
false
false
0
0
0
0
0
0
1.486486
false
false
10
40134637993ff3057ca99b6db177a9ff1d029c89
13,168,369,773,171
77e2db8319e06e09e3e42ed73a48c21c9858d2ef
/src/java/us/temerity/pipeline/message/env/MiscGetToolsetEnvironmentReq.java
7a47950e1f84670e791ba3e3c855e0112e83f69b
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
JimCallahan/Pipeline
https://github.com/JimCallahan/Pipeline
8e47b6124d322bb063e54d3a99b3ab273e8f825e
948ea80b84e13de69f049210b63e1d58f7a8f9de
refs/heads/master
2021-01-10T18:37:22.859000
2015-10-26T21:05:21
2015-10-26T21:05:21
21,285,228
10
2
null
null
null
null
null
null
null
null
null
null
null
null
null
// $Id: MiscGetToolsetEnvironmentReq.java,v 1.4 2005/06/10 16:14:22 jim Exp $ package us.temerity.pipeline.message.env; import us.temerity.pipeline.*; import us.temerity.pipeline.core.*; import java.io.*; import java.util.*; /*------------------------------------------------------------------------------------------*/ /* M I S C G E T T O O L S E T E N V I R O N M E N T R E Q */ /*------------------------------------------------------------------------------------------*/ /** * A request to get the cooked OS specific toolset environment. * * @see MasterMgr */ public class MiscGetToolsetEnvironmentReq implements Serializable { /*----------------------------------------------------------------------------------------*/ /* C O N S T R U C T O R S */ /*----------------------------------------------------------------------------------------*/ /** * Constructs a new request. * * @param author * The user owning the generated environment. * * @param view * The name of the user's working area view. * * @param name * The toolset name. * * @param os * The operating system type. */ public MiscGetToolsetEnvironmentReq ( String author, String view, String name, OsType os ) { pAuthor = author; pView = view; if(name == null) throw new IllegalArgumentException ("The toolset name cannot be (null)!"); pName = name; if(os == null) throw new IllegalArgumentException ("The operating system cannot be (null)!"); pOsType = os; } /*----------------------------------------------------------------------------------------*/ /* A C C E S S */ /*----------------------------------------------------------------------------------------*/ /** * Get the name of user which owens the working area. */ public String getAuthor() { return pAuthor; } /** * Get the name of the working area view. */ public String getView() { return pView; } /** * Gets the name of the toolset; */ public String getName() { return pName; } /** * Gets the operating system type. */ public OsType getOsType() { return pOsType; } /*----------------------------------------------------------------------------------------*/ /* S T A T I C I N T E R N A L S */ /*----------------------------------------------------------------------------------------*/ private static final long serialVersionUID = -3461016757882146279L; /*----------------------------------------------------------------------------------------*/ /* I N T E R N A L S */ /*----------------------------------------------------------------------------------------*/ /** * The name of user which owens the working version. */ private String pAuthor; /** * The name of the working area view. */ private String pView; /** * The name of the toolset. */ private String pName; /** * The operating system type. */ private OsType pOsType; }
UTF-8
Java
3,391
java
MiscGetToolsetEnvironmentReq.java
Java
[]
null
[]
// $Id: MiscGetToolsetEnvironmentReq.java,v 1.4 2005/06/10 16:14:22 jim Exp $ package us.temerity.pipeline.message.env; import us.temerity.pipeline.*; import us.temerity.pipeline.core.*; import java.io.*; import java.util.*; /*------------------------------------------------------------------------------------------*/ /* M I S C G E T T O O L S E T E N V I R O N M E N T R E Q */ /*------------------------------------------------------------------------------------------*/ /** * A request to get the cooked OS specific toolset environment. * * @see MasterMgr */ public class MiscGetToolsetEnvironmentReq implements Serializable { /*----------------------------------------------------------------------------------------*/ /* C O N S T R U C T O R S */ /*----------------------------------------------------------------------------------------*/ /** * Constructs a new request. * * @param author * The user owning the generated environment. * * @param view * The name of the user's working area view. * * @param name * The toolset name. * * @param os * The operating system type. */ public MiscGetToolsetEnvironmentReq ( String author, String view, String name, OsType os ) { pAuthor = author; pView = view; if(name == null) throw new IllegalArgumentException ("The toolset name cannot be (null)!"); pName = name; if(os == null) throw new IllegalArgumentException ("The operating system cannot be (null)!"); pOsType = os; } /*----------------------------------------------------------------------------------------*/ /* A C C E S S */ /*----------------------------------------------------------------------------------------*/ /** * Get the name of user which owens the working area. */ public String getAuthor() { return pAuthor; } /** * Get the name of the working area view. */ public String getView() { return pView; } /** * Gets the name of the toolset; */ public String getName() { return pName; } /** * Gets the operating system type. */ public OsType getOsType() { return pOsType; } /*----------------------------------------------------------------------------------------*/ /* S T A T I C I N T E R N A L S */ /*----------------------------------------------------------------------------------------*/ private static final long serialVersionUID = -3461016757882146279L; /*----------------------------------------------------------------------------------------*/ /* I N T E R N A L S */ /*----------------------------------------------------------------------------------------*/ /** * The name of user which owens the working version. */ private String pAuthor; /** * The name of the working area view. */ private String pView; /** * The name of the toolset. */ private String pName; /** * The operating system type. */ private OsType pOsType; }
3,391
0.373046
0.362725
142
22.859156
28.924036
94
true
false
0
0
0
0
0
0
0.190141
false
false
10
9138facffa059cfc2e3aeb1f6af9e0ef92d1b7bc
171,798,755,174
a31c11b05355eff8197366f159f0d794ed9a6363
/src/java/conexion/Conexion.java
de225072aedf12f5b510fe14ef98b08493bd6cbf
[]
no_license
trau-sierra/testing
https://github.com/trau-sierra/testing
437f9e19774aaa184e747082e9e270b5502ff479
c9790a5ca20d5be122ddc3e33670f1fba27fb27a
refs/heads/master
2022-12-02T21:25:55.429000
2020-08-13T01:27:10
2020-08-13T01:27:10
287,148,081
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package conexion; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import javax.swing.JOptionPane; /** * * @author Usuario */ public class Conexion { private static String URL="jdbc:mysql://localhost:3306/java?zeroDateTimeBehavior=CONVERT_TO_NULL"; private static String Driver="com.mysql.cj.jdbc.Driver"; private static String user="root"; private static String pass="trau214"; private static PreparedStatement ps = null; private static ResultSet rs = null; private static String sql = ""; private Connection conex; private static Connection cn = null; public void conectar() throws ClassNotFoundException, SQLException{ Class.forName(Driver); conex=DriverManager.getConnection(URL, user,pass); } public void desconectar()throws SQLException { conex.close(); } public static Connection getConexion() throws SQLException { DriverManager.registerDriver(new com.mysql.jdbc.Driver()); cn = DriverManager.getConnection(URL, user, pass); return cn; } public ResultSet getDatos(String com){ try { this.getConexion(); rs = ps.executeQuery(com); } catch (Exception e) { JOptionPane.showMessageDialog(null,"Error: "+e); } return rs; } }
UTF-8
Java
1,452
java
Conexion.java
Java
[ { "context": "mport javax.swing.JOptionPane;\n\n\n/**\n *\n * @author Usuario\n */\npublic class Conexion {\n private static St", "end": 228, "score": 0.676735520362854, "start": 221, "tag": "NAME", "value": "Usuario" }, { "context": "ring user=\"root\";\n private static String...
null
[]
package conexion; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import javax.swing.JOptionPane; /** * * @author Usuario */ public class Conexion { private static String URL="jdbc:mysql://localhost:3306/java?zeroDateTimeBehavior=CONVERT_TO_NULL"; private static String Driver="com.mysql.cj.jdbc.Driver"; private static String user="root"; private static String pass="<PASSWORD>"; private static PreparedStatement ps = null; private static ResultSet rs = null; private static String sql = ""; private Connection conex; private static Connection cn = null; public void conectar() throws ClassNotFoundException, SQLException{ Class.forName(Driver); conex=DriverManager.getConnection(URL, user,pass); } public void desconectar()throws SQLException { conex.close(); } public static Connection getConexion() throws SQLException { DriverManager.registerDriver(new com.mysql.jdbc.Driver()); cn = DriverManager.getConnection(URL, user, pass); return cn; } public ResultSet getDatos(String com){ try { this.getConexion(); rs = ps.executeQuery(com); } catch (Exception e) { JOptionPane.showMessageDialog(null,"Error: "+e); } return rs; } }
1,455
0.663223
0.658402
52
26.923077
22.972263
102
false
false
0
0
0
0
0
0
0.615385
false
false
10
564526aa9a79fac91ebeae24bc4321183fa6323d
10,694,468,634,510
6fa5dea59e6e063716d4b7f4bb48562a0a300ec5
/Model/Users/1/Main.java
0320b2919b3129c34a296c34d146d36c23989ea0
[]
no_license
J3ff3z/Java-IDE--in-phpwebsite
https://github.com/J3ff3z/Java-IDE--in-phpwebsite
1cd029ef74c6f5f5e89269e35c3cc0aceba5e955
b2250b337fbd691fb9a01c14409c9575d4d50241
refs/heads/master
2017-12-06T18:47:18.224000
2017-01-24T23:15:58
2017-01-24T23:15:58
79,739,588
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Main { public static void main(String[ ] args) { System.out.println("Bonjour !"); int array[] = new int[5]; System.out.println(array[6]); } }
UTF-8
Java
191
java
Main.java
Java
[]
null
[]
public class Main { public static void main(String[ ] args) { System.out.println("Bonjour !"); int array[] = new int[5]; System.out.println(array[6]); } }
191
0.549738
0.539267
9
19
15.8885
42
false
false
0
0
0
0
0
0
0.333333
false
false
10
f8fc1c34b333e910b1fe3657246a65000cafdd58
27,616,639,775,959
32e82f2f43c26fa11f5a0996f8c8d4a796de39c3
/src/Comportement/Operation.java
5a34e73819323759f49104668140e5254c16fb79
[]
no_license
jordan62300/VideoGame_Java
https://github.com/jordan62300/VideoGame_Java
ee3e677f4c0e10d6a8968a06fac03e73f4c704fb
fe3f384622491685e6a159f1d7c904240a0cdd1e
refs/heads/master
2020-09-01T15:43:04.638000
2019-11-01T14:01:33
2019-11-01T14:01:33
218,996,095
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Comportement; public class Operation implements Soin { @Override public void soin() { System.out.println("Je fais une operation "); } }
UTF-8
Java
153
java
Operation.java
Java
[]
null
[]
package Comportement; public class Operation implements Soin { @Override public void soin() { System.out.println("Je fais une operation "); } }
153
0.712418
0.712418
11
12.909091
16.41205
47
false
false
0
0
0
0
0
0
0.636364
false
false
10
00a635a3b563a0d7e4cf02ef6d57fb828836ee03
7,885,559,986,436
a299d42305b16934cd41c6d1a957d9ac3719cd46
/day5.java
724ade03ed3bd7c30ea04274dc2d470140fbdf2d
[]
no_license
guptabhoomika/LeetCode
https://github.com/guptabhoomika/LeetCode
cc3a3af3bcf932a0bd35ae3571c83f3ae5d5cfe6
968a7860414c91eef4df8d535ffcd5b3f3b6ecc4
refs/heads/master
2022-07-16T17:55:33.318000
2020-05-20T13:08:51
2020-05-20T13:08:51
260,678,251
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
class Solution { //asciichars static final int MAX_CHAR = 256; public int firstUniqChar(String s) { //array to stire count int count[] = new int[MAX_CHAR]; //counts occurence of each char in the string for (int i = 0; i < s.length(); i++) { count[s.charAt(i)]++; } int index=-1; //checks which char count is 1 and returns its index for(int i =0;i<s.length();i++) { if(count[s.charAt(i)]==1) { index = i; break; } } return index; } }
UTF-8
Java
762
java
day5.java
Java
[]
null
[]
class Solution { //asciichars static final int MAX_CHAR = 256; public int firstUniqChar(String s) { //array to stire count int count[] = new int[MAX_CHAR]; //counts occurence of each char in the string for (int i = 0; i < s.length(); i++) { count[s.charAt(i)]++; } int index=-1; //checks which char count is 1 and returns its index for(int i =0;i<s.length();i++) { if(count[s.charAt(i)]==1) { index = i; break; } } return index; } }
762
0.374016
0.363517
41
17.585365
16.865284
64
false
false
0
0
0
0
0
0
0.268293
false
false
10
25c21a68e365c178a0f53f4fcd7151db29552b84
12,833,362,313,269
cb1294db0c9baa8975b7248b97697a4055861609
/src/main/java/za/co/ajk/messenger/controller/InjectDemoController.java
afaa31d98e659e074de9c34ddea2c3ccba6453f6
[]
no_license
kappaj2/jaxrs-testing
https://github.com/kappaj2/jaxrs-testing
855b7b53e7cdcfce7e6e1be90dcbbb0d875bccec
02fbd93d962959972d610c003f981fac56af5fdc
refs/heads/master
2020-09-05T04:32:23.009000
2019-11-07T08:47:01
2019-11-07T08:47:01
219,983,615
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package za.co.ajk.messenger.controller; import javax.ws.rs.Consumes; import javax.ws.rs.CookieParam; import javax.ws.rs.GET; import javax.ws.rs.HeaderParam; import javax.ws.rs.MatrixParam; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.UriInfo; @Path("/injectdemo") @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_PLAIN) public class InjectDemoController { //http://localhost:8080/messenger_war/webapi/injectdemo/annotations;param=value // @GET // @Path("annotations") // public String getParamsUsingAnnotations(@MatrixParam("matrixParam") String matrixParam) { // return "matrixParam : " + matrixParam ; // } // @GET // @Path("annotations") // public String getParamsUsingAnnotations(@MatrixParam("matrixParam") String matrixParam, // @HeaderParam("headerParam") String headerParam) { // return "matrixParam : " + matrixParam + " and headerParam : " + headerParam; // } // Also use BeanParam and add these annotations to that class and then use Jersey to inhect that bean. @GET @Path("annotations") public String getParamsUsingAnnotations(@MatrixParam("matrixParam") String matrixParam, @HeaderParam("headerParam") String headerParam, @CookieParam("name")String cookie) { return "matrixParam : " + matrixParam + " and headerParam : " + headerParam +" cookie : "+cookie; } @GET @Path("context") public String getParamsUsingContext(@Context UriInfo uriInfo, @Context HttpHeaders httpHeaders){ String absPAth = uriInfo.getAbsolutePath().toString(); System.out.println("Abs path : "+absPAth); MultivaluedMap<String, String> requestHeaders = httpHeaders.getRequestHeaders(); return "test "; } }
UTF-8
Java
2,037
java
InjectDemoController.java
Java
[]
null
[]
package za.co.ajk.messenger.controller; import javax.ws.rs.Consumes; import javax.ws.rs.CookieParam; import javax.ws.rs.GET; import javax.ws.rs.HeaderParam; import javax.ws.rs.MatrixParam; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.UriInfo; @Path("/injectdemo") @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_PLAIN) public class InjectDemoController { //http://localhost:8080/messenger_war/webapi/injectdemo/annotations;param=value // @GET // @Path("annotations") // public String getParamsUsingAnnotations(@MatrixParam("matrixParam") String matrixParam) { // return "matrixParam : " + matrixParam ; // } // @GET // @Path("annotations") // public String getParamsUsingAnnotations(@MatrixParam("matrixParam") String matrixParam, // @HeaderParam("headerParam") String headerParam) { // return "matrixParam : " + matrixParam + " and headerParam : " + headerParam; // } // Also use BeanParam and add these annotations to that class and then use Jersey to inhect that bean. @GET @Path("annotations") public String getParamsUsingAnnotations(@MatrixParam("matrixParam") String matrixParam, @HeaderParam("headerParam") String headerParam, @CookieParam("name")String cookie) { return "matrixParam : " + matrixParam + " and headerParam : " + headerParam +" cookie : "+cookie; } @GET @Path("context") public String getParamsUsingContext(@Context UriInfo uriInfo, @Context HttpHeaders httpHeaders){ String absPAth = uriInfo.getAbsolutePath().toString(); System.out.println("Abs path : "+absPAth); MultivaluedMap<String, String> requestHeaders = httpHeaders.getRequestHeaders(); return "test "; } }
2,037
0.66863
0.666667
57
34.736843
33.53685
107
false
false
0
0
0
0
0
0
0.45614
false
false
10
bbf3440ee1d46efc373ec6e26ca570cd9363b7d1
24,507,083,418,416
8763d0cc2046d7227d88bab03f293b32c131e31b
/src/main/java/crawler/service/mail/NovelReportMail.java
d0f6ef3c638cd413d20650767eedfb11de00b277
[ "Apache-2.0" ]
permissive
hide6644/crawler
https://github.com/hide6644/crawler
9190038e531f551f451d6ed6b0afcb46a9b6b02c
42169d3d46e53f946c00d8ff80ca4ac313a1753e
refs/heads/master
2023-08-03T06:49:41.602000
2023-07-30T08:36:38
2023-07-30T08:36:38
19,454,054
1
1
Apache-2.0
false
2023-04-17T17:36:04
2014-05-05T11:50:46
2022-03-21T11:23:45
2023-04-17T17:36:04
904
0
1
9
Java
false
false
package crawler.service.mail; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.HashMap; import java.util.List; import java.util.Map; import jakarta.mail.MessagingException; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import crawler.Constants; import crawler.entity.Novel; import freemarker.template.Configuration; import freemarker.template.TemplateException; import freemarker.template.TemplateExceptionHandler; import no.api.freemarker.java8.Java8ObjectWrapper; /** * Novel Reportメール処理クラス. */ @Service("novelReportMail") public class NovelReportMail { /** 日付のフォーマット */ public static final String DATE_FORMAT = "yyyy-MM-dd"; /** ログ出力クラス */ private final Logger log = LogManager.getLogger(this); /** メールを処理するクラス */ @Autowired(required = false) private MailEngine mailEngine; /** * 未読小説の一覧のファイルを送信する. * * @param unreadNovels * 未読小説の一覧 */ public void sendUnreadReport(final List<Novel> unreadNovels) { Map<String, Object> dataModel = new HashMap<>(); dataModel.put("unreadNovels", unreadNovels); String yesterday = LocalDateTime.now().minusDays(1).format(DateTimeFormatter.ofPattern(DATE_FORMAT)); var path = getPath("unread_novels_" + yesterday + ".html"); String bodyText = yesterday + " updated."; sendReport("unread_report.ftl", dataModel, bodyText, path); } /** * 小説の最終更新日時一覧のファイルを送信する. * * @param novels * 小説の一覧 */ public void sendModifiedDateReport(final List<Novel> novels) { Map<String, Object> dataModel = new HashMap<>(); dataModel.put("novels", novels); String today = LocalDateTime.now().format(DateTimeFormatter.ofPattern(DATE_FORMAT)); var path = getPath("modified_date_of_novels_" + today + ".html"); var bodyText = "modified date of novels."; sendReport("modified_date_report.ftl", dataModel, bodyText, path); } /** * Pathオブジェクトを取得する. * * @param filePath * ファイルパス * @return Pathオブジェクト */ private Path getPath(String filePath) { var path = Path.of(Constants.APP_FOLDER_NAME + Constants.FILE_SEP + "report" + Constants.FILE_SEP + filePath); try { Files.createDirectories(path.getParent()); } catch (IOException e) { // file exists and is not a directory // parent may not exist or other reason } return path; } /** * ファイルを作成し送信する. * * @param templateName * テンプレート名 * @param dataModel * テンプレートの変数(名前と値のペア) * @param bodyText * メール本文 * @param path * Pathオブジェクト */ private void sendReport(String templateName, Map<String, Object> dataModel, String bodyText, Path path) { try (var bw = Files.newBufferedWriter(path, StandardCharsets.UTF_8);) { // テンプレートとマージ getConfiguration().getTemplate(templateName).process(dataModel, bw); log.info("[send] report:{}", bodyText); mailEngine.sendMail(bodyText, path.toFile()); } catch (IOException | TemplateException | MessagingException e) { log.error("[not send] report:", e); } } /** * Freemarkerの構成を取得する. * * @return Freemarkerの構成 */ private Configuration getConfiguration() { var cfg = new Configuration(Configuration.VERSION_2_3_29); cfg.setClassForTemplateLoading(getClass(), "/META-INF/freemarker/"); cfg.setDefaultEncoding("UTF-8"); cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); cfg.setLogTemplateExceptions(false); cfg.setObjectWrapper(new Java8ObjectWrapper(Configuration.VERSION_2_3_30)); return cfg; } }
UTF-8
Java
4,652
java
NovelReportMail.java
Java
[]
null
[]
package crawler.service.mail; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.HashMap; import java.util.List; import java.util.Map; import jakarta.mail.MessagingException; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import crawler.Constants; import crawler.entity.Novel; import freemarker.template.Configuration; import freemarker.template.TemplateException; import freemarker.template.TemplateExceptionHandler; import no.api.freemarker.java8.Java8ObjectWrapper; /** * Novel Reportメール処理クラス. */ @Service("novelReportMail") public class NovelReportMail { /** 日付のフォーマット */ public static final String DATE_FORMAT = "yyyy-MM-dd"; /** ログ出力クラス */ private final Logger log = LogManager.getLogger(this); /** メールを処理するクラス */ @Autowired(required = false) private MailEngine mailEngine; /** * 未読小説の一覧のファイルを送信する. * * @param unreadNovels * 未読小説の一覧 */ public void sendUnreadReport(final List<Novel> unreadNovels) { Map<String, Object> dataModel = new HashMap<>(); dataModel.put("unreadNovels", unreadNovels); String yesterday = LocalDateTime.now().minusDays(1).format(DateTimeFormatter.ofPattern(DATE_FORMAT)); var path = getPath("unread_novels_" + yesterday + ".html"); String bodyText = yesterday + " updated."; sendReport("unread_report.ftl", dataModel, bodyText, path); } /** * 小説の最終更新日時一覧のファイルを送信する. * * @param novels * 小説の一覧 */ public void sendModifiedDateReport(final List<Novel> novels) { Map<String, Object> dataModel = new HashMap<>(); dataModel.put("novels", novels); String today = LocalDateTime.now().format(DateTimeFormatter.ofPattern(DATE_FORMAT)); var path = getPath("modified_date_of_novels_" + today + ".html"); var bodyText = "modified date of novels."; sendReport("modified_date_report.ftl", dataModel, bodyText, path); } /** * Pathオブジェクトを取得する. * * @param filePath * ファイルパス * @return Pathオブジェクト */ private Path getPath(String filePath) { var path = Path.of(Constants.APP_FOLDER_NAME + Constants.FILE_SEP + "report" + Constants.FILE_SEP + filePath); try { Files.createDirectories(path.getParent()); } catch (IOException e) { // file exists and is not a directory // parent may not exist or other reason } return path; } /** * ファイルを作成し送信する. * * @param templateName * テンプレート名 * @param dataModel * テンプレートの変数(名前と値のペア) * @param bodyText * メール本文 * @param path * Pathオブジェクト */ private void sendReport(String templateName, Map<String, Object> dataModel, String bodyText, Path path) { try (var bw = Files.newBufferedWriter(path, StandardCharsets.UTF_8);) { // テンプレートとマージ getConfiguration().getTemplate(templateName).process(dataModel, bw); log.info("[send] report:{}", bodyText); mailEngine.sendMail(bodyText, path.toFile()); } catch (IOException | TemplateException | MessagingException e) { log.error("[not send] report:", e); } } /** * Freemarkerの構成を取得する. * * @return Freemarkerの構成 */ private Configuration getConfiguration() { var cfg = new Configuration(Configuration.VERSION_2_3_29); cfg.setClassForTemplateLoading(getClass(), "/META-INF/freemarker/"); cfg.setDefaultEncoding("UTF-8"); cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); cfg.setLogTemplateExceptions(false); cfg.setObjectWrapper(new Java8ObjectWrapper(Configuration.VERSION_2_3_30)); return cfg; } }
4,652
0.627268
0.623546
135
29.837036
26.44861
118
false
false
0
0
0
0
0
0
0.540741
false
false
10
0e85faac1be23f3a2998d1dec04bdb5ca4975cf7
18,915,035,986,138
7459755dc465907d1210fdcece2e1f48f5d64f83
/src/main/java/com/employee/rest/utils/ValidationProcessor.java
4c3787c39fc7284392fe39a7821d88a970a2dab1
[ "Apache-2.0" ]
permissive
anaz-shajahan/employee-service
https://github.com/anaz-shajahan/employee-service
f8be8e0b0d31cfadd337e312e024f67f9eb2383e
b538b019c2c8702c2b109a3cbdffedbede148134
refs/heads/master
2020-05-30T22:52:01.043000
2019-06-04T06:06:10
2019-06-04T06:06:10
190,002,618
0
0
Apache-2.0
false
2019-06-04T06:06:11
2019-06-03T12:39:23
2019-06-03T17:47:35
2019-06-04T06:06:11
42
0
0
0
Java
false
false
package com.employee.rest.utils; import org.springframework.validation.BindingResult; import org.springframework.validation.ObjectError; import java.util.ArrayList; import java.util.List; /** * The Validation Processor. */ public class ValidationProcessor { /** * The process Binding Result. * * @param bindingResult bindingResult * @return list of String */ public static List<String> processBindingResult(final BindingResult bindingResult) { List<String> errorMessage = new ArrayList<>(); if (bindingResult.hasErrors()) { for (ObjectError error : bindingResult.getAllErrors()) { errorMessage.add(error.getDefaultMessage()); } } return errorMessage; } }
UTF-8
Java
770
java
ValidationProcessor.java
Java
[]
null
[]
package com.employee.rest.utils; import org.springframework.validation.BindingResult; import org.springframework.validation.ObjectError; import java.util.ArrayList; import java.util.List; /** * The Validation Processor. */ public class ValidationProcessor { /** * The process Binding Result. * * @param bindingResult bindingResult * @return list of String */ public static List<String> processBindingResult(final BindingResult bindingResult) { List<String> errorMessage = new ArrayList<>(); if (bindingResult.hasErrors()) { for (ObjectError error : bindingResult.getAllErrors()) { errorMessage.add(error.getDefaultMessage()); } } return errorMessage; } }
770
0.667532
0.667532
29
25.551723
23.357176
88
false
false
0
0
0
0
0
0
0.275862
false
false
10
159a95a697f8e22fa59142b2762206286b79b1fd
3,178,275,799,457
a8de4bf8b1b6f3fe7214d8cf0de2036eab49a91f
/land-management-assist/.history/src/main/java/com/xz/landmangementassist/domain/dto/base/BaseDTO_20210131214806.java
9edd2fe869c8c5fd0b4b63501e051229b962ff9d
[]
no_license
xuzhu2017/land-management-assist
https://github.com/xuzhu2017/land-management-assist
cb384430373fd2b09d67b9a3857927989f1c5a42
c0d4a3625d3ca4e92451be42b3548c9dde577b11
refs/heads/master
2023-04-15T19:54:16.148000
2021-05-07T07:04:11
2021-05-07T07:04:11
333,630,288
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.xz.landmanagementassist.domain.dto; import lombok.Data; import java.util.Date; /** * baseDTO * * @author xuzhu * @date 2021-1-29 09:12:33 */ @Data public class BaseDTO { /** * 主键Id */ private Integer id; /** * 更新时间 */ private Date updateTime; /** * 创建时间 */ private Date createTime; }
UTF-8
Java
381
java
BaseDTO_20210131214806.java
Java
[ { "context": "ort java.util.Date;\n\n/**\n * baseDTO\n * \n * @author xuzhu\n * @date 2021-1-29 09:12:33\n */\n@Data\npublic clas", "end": 129, "score": 0.9993826150894165, "start": 124, "tag": "USERNAME", "value": "xuzhu" } ]
null
[]
package com.xz.landmanagementassist.domain.dto; import lombok.Data; import java.util.Date; /** * baseDTO * * @author xuzhu * @date 2021-1-29 09:12:33 */ @Data public class BaseDTO { /** * 主键Id */ private Integer id; /** * 更新时间 */ private Date updateTime; /** * 创建时间 */ private Date createTime; }
381
0.559557
0.523546
29
11.448276
11.186772
47
false
false
0
0
0
0
0
0
0.206897
false
false
10
8177fa30c29acde89534a70a8b753b653a741eb9
31,748,398,262,835
0f876dfa085f81889ea502005e1cf0efaf00b595
/illaclient/src/main/java/illarion/client/util/pathfinding/AStarPathNode.java
2bc85cb205ef968d3ed94929c908ef3c75985a24
[]
no_license
bsmr-Illarion/Illarion-Java
https://github.com/bsmr-Illarion/Illarion-Java
d21e1761a662036c8a96a2058f02fbb31a557360
f8c5a5ffc5147368cfcee84e8e6d3a6bc829cefd
refs/heads/master
2021-01-17T23:54:23.822000
2015-03-05T20:12:04
2015-03-05T20:12:04
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * This file is part of the Illarion project. * * Copyright © 2014 - Illarion e.V. * * Illarion is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Illarion is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ package illarion.client.util.pathfinding; import illarion.client.world.MapTile; import illarion.common.types.Direction; import javax.annotation.Nonnull; import javax.annotation.Nullable; /** * This is the path node implementation used for the A* algorithm that contains all required node information to get the * algorithm to work. * * @author Martin Karing &lt;nitram@illarion.org&gt; */ class AStarPathNode extends AbstractPathNode implements Comparable<AStarPathNode> { /** * The square root of two. */ private static final double SQRT2 = 1.4142135623730951; /** * The cost to reach this field. */ private final int cost; /** * This flag stores if the field is blocked or not. */ private final boolean blocked; /** * The predicted cost to reach the target location from this field */ private final int heuristic; /** * The node that prepends this node. */ @Nullable private final AStarPathNode parentNode; /** * Create a node on the path. * * @param parentNode the parent of this node or {@code null} in case this node is the first step on the path. * @param tile the tile this node is assigned to * @param method the movement method to reach this node * @param approachDirection the this tile is approached from * @param heuristic the predicted cost to reach the target from this location * @param walkingTile the tile that is stepped over in case running is used as movement */ AStarPathNode( @Nullable AStarPathNode parentNode, @Nonnull MapTile tile, @Nonnull PathMovementMethod method, @Nonnull Direction approachDirection, int heuristic, @Nullable MapTile walkingTile) { super(tile.getLocation(), method); blocked = tile.isBlocked(); this.heuristic = heuristic; this.parentNode = parentNode; if (heuristic > 0) { int tileCost = tile.getMovementCost(); if ((method == PathMovementMethod.Run) && (walkingTile != null)) { tileCost += walkingTile.getMovementCost(); tileCost = (int) (0.6 * tileCost); } if (approachDirection.isDiagonal()) { tileCost = (int) (SQRT2 * tileCost); } cost = parentNode == null ? tileCost : parentNode.cost + tileCost; } else { cost = 0; } } /** * Get the predicted cost to reach the target. * * @return the predicted cost to reach the target */ private int getPredictedCost() { return heuristic + cost; } @Override public int compareTo(@Nonnull AStarPathNode o) { int result = Integer.compare(getPredictedCost(), o.getPredictedCost()); return (result == 0) ? 1 : result; } @Override @Nonnull public String toString() { return getLocation() + " Predicted cost: " + getPredictedCost(); } public int getCost() { return cost; } public boolean isBlocked() { return blocked; } @Nullable public AStarPathNode getParentNode() { return parentNode; } }
UTF-8
Java
3,822
java
AStarPathNode.java
Java
[ { "context": "ion to get the\n * algorithm to work.\n *\n * @author Martin Karing &lt;nitram@illarion.org&gt;\n */\nclass AStarPathNo", "end": 959, "score": 0.9998471140861511, "start": 946, "tag": "NAME", "value": "Martin Karing" }, { "context": "lgorithm to work.\n *\n * @author Ma...
null
[]
/* * This file is part of the Illarion project. * * Copyright © 2014 - Illarion e.V. * * Illarion is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Illarion is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ package illarion.client.util.pathfinding; import illarion.client.world.MapTile; import illarion.common.types.Direction; import javax.annotation.Nonnull; import javax.annotation.Nullable; /** * This is the path node implementation used for the A* algorithm that contains all required node information to get the * algorithm to work. * * @author <NAME> &lt;<EMAIL>&gt; */ class AStarPathNode extends AbstractPathNode implements Comparable<AStarPathNode> { /** * The square root of two. */ private static final double SQRT2 = 1.4142135623730951; /** * The cost to reach this field. */ private final int cost; /** * This flag stores if the field is blocked or not. */ private final boolean blocked; /** * The predicted cost to reach the target location from this field */ private final int heuristic; /** * The node that prepends this node. */ @Nullable private final AStarPathNode parentNode; /** * Create a node on the path. * * @param parentNode the parent of this node or {@code null} in case this node is the first step on the path. * @param tile the tile this node is assigned to * @param method the movement method to reach this node * @param approachDirection the this tile is approached from * @param heuristic the predicted cost to reach the target from this location * @param walkingTile the tile that is stepped over in case running is used as movement */ AStarPathNode( @Nullable AStarPathNode parentNode, @Nonnull MapTile tile, @Nonnull PathMovementMethod method, @Nonnull Direction approachDirection, int heuristic, @Nullable MapTile walkingTile) { super(tile.getLocation(), method); blocked = tile.isBlocked(); this.heuristic = heuristic; this.parentNode = parentNode; if (heuristic > 0) { int tileCost = tile.getMovementCost(); if ((method == PathMovementMethod.Run) && (walkingTile != null)) { tileCost += walkingTile.getMovementCost(); tileCost = (int) (0.6 * tileCost); } if (approachDirection.isDiagonal()) { tileCost = (int) (SQRT2 * tileCost); } cost = parentNode == null ? tileCost : parentNode.cost + tileCost; } else { cost = 0; } } /** * Get the predicted cost to reach the target. * * @return the predicted cost to reach the target */ private int getPredictedCost() { return heuristic + cost; } @Override public int compareTo(@Nonnull AStarPathNode o) { int result = Integer.compare(getPredictedCost(), o.getPredictedCost()); return (result == 0) ? 1 : result; } @Override @Nonnull public String toString() { return getLocation() + " Predicted cost: " + getPredictedCost(); } public int getCost() { return cost; } public boolean isBlocked() { return blocked; } @Nullable public AStarPathNode getParentNode() { return parentNode; } }
3,803
0.640408
0.632557
124
29.814516
27.506413
120
false
false
0
0
0
0
0
0
0.322581
false
false
10
3b393b28a505c249f950cf781e1c53a26d8ec20d
29,695,403,892,563
e6bcc67e0a0b777a02b81f769710b373a1d7ea8c
/src/po/Doc.java
7619b613aaa6f092cf8731dbbfa89113fe255037
[]
no_license
MasterZhao/SensitiveWordFilter
https://github.com/MasterZhao/SensitiveWordFilter
e456d8a24594eaf2b4f9fcda38e422968986a1b1
0fad3839a673f36cc1b11f5cac82ccfced208821
refs/heads/master
2021-05-07T07:05:11.012000
2017-11-02T01:56:15
2017-11-02T01:56:15
109,205,269
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package po; public class Doc { private Integer id; private String title; private String docPath; private String content; private Integer docSymbol; private String description; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDocPath() { return docPath; } public void setDocPath(String docPath) { this.docPath = docPath; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public Integer getDocSymbol() { return docSymbol; } public void setDocSymbol(Integer docSymbol) { this.docSymbol = docSymbol; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } //无参构造方法 public Doc() { } @Override public String toString() { return "Doc [id=" + id + ", title=" + title + ", docPath=" + docPath + ", content=" + content + ", docSymbol=" + docSymbol + ", description=" + description + "]"; } public Doc(Integer id,String title, String docPath, Integer docSymbol, String description) { //Doc中有content变量,但是不在构造方法中使用,因为数据库中没有设置这个字段 super(); this.id=id; this.title = title; this.docPath = docPath; this.docSymbol = docSymbol; this.description = description; } }
GB18030
Java
1,594
java
Doc.java
Java
[]
null
[]
package po; public class Doc { private Integer id; private String title; private String docPath; private String content; private Integer docSymbol; private String description; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDocPath() { return docPath; } public void setDocPath(String docPath) { this.docPath = docPath; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public Integer getDocSymbol() { return docSymbol; } public void setDocSymbol(Integer docSymbol) { this.docSymbol = docSymbol; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } //无参构造方法 public Doc() { } @Override public String toString() { return "Doc [id=" + id + ", title=" + title + ", docPath=" + docPath + ", content=" + content + ", docSymbol=" + docSymbol + ", description=" + description + "]"; } public Doc(Integer id,String title, String docPath, Integer docSymbol, String description) { //Doc中有content变量,但是不在构造方法中使用,因为数据库中没有设置这个字段 super(); this.id=id; this.title = title; this.docPath = docPath; this.docSymbol = docSymbol; this.description = description; } }
1,594
0.657237
0.657237
69
20
16.352104
70
false
false
0
0
0
0
0
0
1.84058
false
false
10
21fe804e3a65ecd5d171ddbca4d716ea9de45faf
5,351,529,251,291
d069d374f16be6113e4af90d4e6dccd6595720cc
/src/main/java/br/com/aprendendo/seleniumwebdriveregrid/config/EstabelecerDriver.java
cb5ad0c784aaf0f83bc24e2b6080c1b74f410caa
[]
no_license
brendo10x/Aprendendo-Selenium-WebDriver-Grid-e-TestNG
https://github.com/brendo10x/Aprendendo-Selenium-WebDriver-Grid-e-TestNG
4743cb90a2558b8e1f4a3c3166ccd0328defe78a
85e63d3f768dfd7be12846f757e51b45dbb5bc9d
refs/heads/master
2016-08-11T19:51:27.356000
2015-10-02T19:20:48
2015-10-02T19:20:48
43,402,736
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.aprendendo.seleniumwebdriveregrid.config; import org.openqa.selenium.Platform; import org.openqa.selenium.WebDriver; import org.openqa.selenium.remote.DesiredCapabilities; /*Fonte: https://www.safaribooksonline.com/library/view/mastering-selenium-webdriver/9781784394356/ch01s06.html*/ public interface EstabelecerDriver { WebDriver obterObjetoWebDriver(DesiredCapabilities desiredCapabilities); WebDriver obterObjetoWebDriverRemoto( DesiredCapabilities desiredCapabilities, Platform plataforma, String enderecoRemoto); DesiredCapabilities obterCapacidadesDesejadas(); }
UTF-8
Java
600
java
EstabelecerDriver.java
Java
[]
null
[]
package br.com.aprendendo.seleniumwebdriveregrid.config; import org.openqa.selenium.Platform; import org.openqa.selenium.WebDriver; import org.openqa.selenium.remote.DesiredCapabilities; /*Fonte: https://www.safaribooksonline.com/library/view/mastering-selenium-webdriver/9781784394356/ch01s06.html*/ public interface EstabelecerDriver { WebDriver obterObjetoWebDriver(DesiredCapabilities desiredCapabilities); WebDriver obterObjetoWebDriverRemoto( DesiredCapabilities desiredCapabilities, Platform plataforma, String enderecoRemoto); DesiredCapabilities obterCapacidadesDesejadas(); }
600
0.848333
0.82
17
34.294117
31.375834
113
false
false
0
0
0
0
0
0
1.058824
false
false
10
b043e9aeb4423311c5055fa88b8e025617c11915
10,591,389,392,751
6f672fb72caedccb841ee23f53e32aceeaf1895e
/youtube-source/src/com/google/android/apps/ytremote/fork/net/async/q.java
98e46dc478397d931b8f50d697d1fddd43084ca3
[]
no_license
cha63506/CompSecurity
https://github.com/cha63506/CompSecurity
5c69743f660b9899146ed3cf21eceabe3d5f4280
eee7e74f4088b9c02dd711c061fc04fb1e4e2654
refs/heads/master
2018-03-23T04:15:18.480000
2015-12-19T01:29:58
2015-12-19T01:29:58
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.google.android.apps.ytremote.fork.net.async; // Referenced classes of package com.google.android.apps.ytremote.fork.net.async: // s final class q implements s { q() { } public final long a() { return System.currentTimeMillis(); } }
UTF-8
Java
471
java
q.java
Java
[ { "context": "// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.\n// Jad home page: http://www.geocities.com/kpdus", "end": 61, "score": 0.9996625781059265, "start": 45, "tag": "NAME", "value": "Pavel Kouznetsov" } ]
null
[]
// Decompiled by Jad v1.5.8e. Copyright 2001 <NAME>. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.google.android.apps.ytremote.fork.net.async; // Referenced classes of package com.google.android.apps.ytremote.fork.net.async: // s final class q implements s { q() { } public final long a() { return System.currentTimeMillis(); } }
461
0.666667
0.651805
23
19.47826
24.634493
81
false
false
0
0
0
0
0
0
0.086957
false
false
10
e328858c497495544a96829c69774be5a19c6a30
3,161,095,991,376
c663b981af3566743a774fae261548255947bfdc
/snomed-osgi/uk.nhs.cfh.dsp.snomed.objectmodel/src/main/java/uk/nhs/cfh/dsp/snomed/objectmodel/impl/AbstractTerminologyRelationship.java
59b57da5281e6336acea4069ff0b59bc650e7039
[]
no_license
termlex/snofyre
https://github.com/termlex/snofyre
c653295ecb1b2a28a44d111ff7603a3cc639e7eb
2622c524377ed7cc77a9aae9f1ec522b00da2b7c
refs/heads/master
2022-05-22T18:37:18.579000
2022-03-25T15:23:41
2022-03-25T15:23:41
34,781,765
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Crown Copyright (C) 2008 - 2011 * * 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. */ /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package uk.nhs.cfh.dsp.snomed.objectmodel.impl; import org.hibernate.annotations.Index; import uk.nhs.cfh.dsp.snomed.objectmodel.TerminologyRelationship; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.MappedSuperclass; // TODO: Auto-generated Javadoc /** * An abstract implementation of a {@link TerminologyRelationship}. * * <br>Version : @#VersionNumber#@ * <br>Written by @author Jay Kola * <br>Created on 2:35:36 PM * */ @MappedSuperclass @Entity(name = "AbstractRelationship") public abstract class AbstractTerminologyRelationship implements TerminologyRelationship { /** The relationship id. */ private String relationshipID = ""; /** The source concept id. */ private String sourceConceptID = ""; /** The target concept id. */ private String targetConceptID = ""; /** * Instantiates a new abstract terminology relationship. */ public AbstractTerminologyRelationship() { } /** * Instantiates a new abstract terminology relationship. * * @param relationshipId the relationship id * @param sourceConceptId the source concept id * @param targetConceptId the target concept id */ public AbstractTerminologyRelationship(String relationshipId, String sourceConceptId, String targetConceptId) { this.relationshipID = relationshipId; this.sourceConceptID = sourceConceptId; this.targetConceptID = targetConceptId; } /* (non-Javadoc) * @see uk.nhs.cfh.dsp.snomed.objectmodel.TerminologyRelationship#getRelationshipID() */ @Id @Column(name = "relationship_id", nullable = false, columnDefinition = "VARCHAR(18)") @Index(name = "IDX_REL_ID") public String getRelationshipID() { return relationshipID; } /* (non-Javadoc) * @see uk.nhs.cfh.dsp.snomed.objectmodel.TerminologyRelationship#getSourceConceptID() */ @Column(name = "source_id", nullable = false) @Index(name = "IDX_SOURCE_ID") public String getSourceConceptID() { return sourceConceptID; } /* (non-Javadoc) * @see uk.nhs.cfh.dsp.snomed.objectmodel.TerminologyRelationship#getTargetConceptID() */ @Column(name = "target_id", nullable = false, columnDefinition = "VARCHAR(18)") @Index(name = "IDX_TARGET_ID") public String getTargetConceptID() { return targetConceptID; } /* (non-Javadoc) * @see uk.nhs.cfh.dsp.snomed.objectmodel.TerminologyRelationship#setRelationshipID(java.lang.String) */ public void setRelationshipID(String relationshipID) { this.relationshipID = relationshipID; } /* (non-Javadoc) * @see uk.nhs.cfh.dsp.snomed.objectmodel.TerminologyRelationship#setSourceConceptID(java.lang.String) */ public void setSourceConceptID(String sourceConceptID) { this.sourceConceptID = sourceConceptID; } /* (non-Javadoc) * @see uk.nhs.cfh.dsp.snomed.objectmodel.TerminologyRelationship#setTargetConceptID(java.lang.String) */ public void setTargetConceptID(String targetConceptID) { this.targetConceptID = targetConceptID; } }
UTF-8
Java
3,926
java
AbstractTerminologyRelationship.java
Java
[ { "context": "sion : @#VersionNumber#@\n * <br>Written by @author Jay Kola\n * <br>Created on 2:35:36 PM\n * \n */\n\n@MappedSupe", "end": 1177, "score": 0.9998000860214233, "start": 1169, "tag": "NAME", "value": "Jay Kola" } ]
null
[]
/** * Crown Copyright (C) 2008 - 2011 * * 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. */ /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package uk.nhs.cfh.dsp.snomed.objectmodel.impl; import org.hibernate.annotations.Index; import uk.nhs.cfh.dsp.snomed.objectmodel.TerminologyRelationship; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.MappedSuperclass; // TODO: Auto-generated Javadoc /** * An abstract implementation of a {@link TerminologyRelationship}. * * <br>Version : @#VersionNumber#@ * <br>Written by @author <NAME> * <br>Created on 2:35:36 PM * */ @MappedSuperclass @Entity(name = "AbstractRelationship") public abstract class AbstractTerminologyRelationship implements TerminologyRelationship { /** The relationship id. */ private String relationshipID = ""; /** The source concept id. */ private String sourceConceptID = ""; /** The target concept id. */ private String targetConceptID = ""; /** * Instantiates a new abstract terminology relationship. */ public AbstractTerminologyRelationship() { } /** * Instantiates a new abstract terminology relationship. * * @param relationshipId the relationship id * @param sourceConceptId the source concept id * @param targetConceptId the target concept id */ public AbstractTerminologyRelationship(String relationshipId, String sourceConceptId, String targetConceptId) { this.relationshipID = relationshipId; this.sourceConceptID = sourceConceptId; this.targetConceptID = targetConceptId; } /* (non-Javadoc) * @see uk.nhs.cfh.dsp.snomed.objectmodel.TerminologyRelationship#getRelationshipID() */ @Id @Column(name = "relationship_id", nullable = false, columnDefinition = "VARCHAR(18)") @Index(name = "IDX_REL_ID") public String getRelationshipID() { return relationshipID; } /* (non-Javadoc) * @see uk.nhs.cfh.dsp.snomed.objectmodel.TerminologyRelationship#getSourceConceptID() */ @Column(name = "source_id", nullable = false) @Index(name = "IDX_SOURCE_ID") public String getSourceConceptID() { return sourceConceptID; } /* (non-Javadoc) * @see uk.nhs.cfh.dsp.snomed.objectmodel.TerminologyRelationship#getTargetConceptID() */ @Column(name = "target_id", nullable = false, columnDefinition = "VARCHAR(18)") @Index(name = "IDX_TARGET_ID") public String getTargetConceptID() { return targetConceptID; } /* (non-Javadoc) * @see uk.nhs.cfh.dsp.snomed.objectmodel.TerminologyRelationship#setRelationshipID(java.lang.String) */ public void setRelationshipID(String relationshipID) { this.relationshipID = relationshipID; } /* (non-Javadoc) * @see uk.nhs.cfh.dsp.snomed.objectmodel.TerminologyRelationship#setSourceConceptID(java.lang.String) */ public void setSourceConceptID(String sourceConceptID) { this.sourceConceptID = sourceConceptID; } /* (non-Javadoc) * @see uk.nhs.cfh.dsp.snomed.objectmodel.TerminologyRelationship#setTargetConceptID(java.lang.String) */ public void setTargetConceptID(String targetConceptID) { this.targetConceptID = targetConceptID; } }
3,924
0.698166
0.692817
121
31.446281
28.396236
106
false
false
0
0
0
0
0
0
0.272727
false
false
10
d2dabe01bfae41adfc121b16a19ec12790f9827c
20,976,620,281,653
4f073be0e25c7f1cb02ad1febe94519f266ef78d
/src/com/dimikcomputing/helloworld/SimpleServletWithParams.java
ded088d26eff26fbd6066d6ac352b14d946b8506
[]
no_license
rokon12/simple-servlet
https://github.com/rokon12/simple-servlet
4bf368e13eefe6f55ac70e37b871d7c891074e84
82c2a360c4a5f003b4b443da66bc7a9d0a8ae8b7
refs/heads/master
2021-01-19T09:49:55.277000
2015-01-30T23:26:31
2015-01-30T23:26:31
30,095,512
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dimikcomputing.helloworld; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/hi") public class SimpleServletWithParams extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { System.out.println("We are doGet method of SimpleServletWithParams"); PrintWriter out = resp.getWriter(); String userName = req.getParameter("userName"); String age = req.getParameter("age"); out.print("Hi! " + userName + "!" + " Your age is: " + age); } }
UTF-8
Java
789
java
SimpleServletWithParams.java
Java
[ { "context": "tWriter();\n\n\t\tString userName = req.getParameter(\"userName\");\n\t\tString age = req.getParameter(\"age\");\n\n\t\tout", "end": 675, "score": 0.9980150461196899, "start": 667, "tag": "USERNAME", "value": "userName" } ]
null
[]
package com.dimikcomputing.helloworld; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/hi") public class SimpleServletWithParams extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { System.out.println("We are doGet method of SimpleServletWithParams"); PrintWriter out = resp.getWriter(); String userName = req.getParameter("userName"); String age = req.getParameter("age"); out.print("Hi! " + userName + "!" + " Your age is: " + age); } }
789
0.774398
0.774398
28
27.178572
23.745756
71
false
false
0
0
0
0
0
0
1.107143
false
false
10
2f27a6d129d85fd1f610661bf20499e2c9092ff9
16,879,221,493,765
b2f5ba62e18cffad586315e1ed2fd78a43d5dc3b
/app/src/main/java/cn/krisez/sign/persenter/class_presenter/ClassListener.java
83d148bdd125a3e2994a03efe7d86dd88f5706e5
[]
no_license
krisez/Sign
https://github.com/krisez/Sign
06f7b558f38c236cfd5d3326931a2c6d3affe6bb
61c787367977316eabf39a7d6043c91fa6034e7e
refs/heads/master
2019-07-09T18:33:41.435000
2018-04-04T04:41:23
2018-04-04T04:41:23
90,521,076
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.krisez.sign.persenter.class_presenter; import java.util.List; import cn.krisez.sign.bean.Seat.Seats; /** * Created by Krisez on 2018-01-25. */ public interface ClassListener { void success(List<Seats> seats); void failed(); }
UTF-8
Java
251
java
ClassListener.java
Java
[ { "context": "cn.krisez.sign.bean.Seat.Seats;\n\n/**\n * Created by Krisez on 2018-01-25.\n */\n\npublic interface ClassListene", "end": 139, "score": 0.9997164607048035, "start": 133, "tag": "USERNAME", "value": "Krisez" } ]
null
[]
package cn.krisez.sign.persenter.class_presenter; import java.util.List; import cn.krisez.sign.bean.Seat.Seats; /** * Created by Krisez on 2018-01-25. */ public interface ClassListener { void success(List<Seats> seats); void failed(); }
251
0.713147
0.681275
14
16.928572
17.330667
49
false
false
0
0
0
0
0
0
0.357143
false
false
10
9edb1903c073b7010a7a70a5cdd4018d60fccfe6
19,490,561,607,720
127c7abb2416e8bd83fb016adfdbb9920a3c8136
/app/src/main/java/com/getomnify/hackernews/helpers/GlideAPI.java
b45a914572fbc7499335975ffa56915a696bd65d
[]
no_license
sharukhmohammed/HackerNews
https://github.com/sharukhmohammed/HackerNews
df613a5dc33564bdf50cc0b004ff5834b76e2d9e
ce121ec5bc576290a90061bb835c35ade3488979
refs/heads/master
2020-03-19T03:36:18.623000
2018-06-01T17:10:57
2018-06-01T17:10:57
135,743,338
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.getomnify.hackernews.helpers; /** * Created by Sharukh Mohammed on 29/05/18 at 14:03. */ import com.bumptech.glide.annotation.GlideModule; import com.bumptech.glide.module.AppGlideModule; @GlideModule public class GlideAPI extends AppGlideModule { }
UTF-8
Java
268
java
GlideAPI.java
Java
[ { "context": "m.getomnify.hackernews.helpers;\n\n/**\n * Created by Sharukh Mohammed on 29/05/18 at 14:03.\n */\n\n\nimport com.bumptech.g", "end": 77, "score": 0.9998816251754761, "start": 61, "tag": "NAME", "value": "Sharukh Mohammed" } ]
null
[]
package com.getomnify.hackernews.helpers; /** * Created by <NAME> on 29/05/18 at 14:03. */ import com.bumptech.glide.annotation.GlideModule; import com.bumptech.glide.module.AppGlideModule; @GlideModule public class GlideAPI extends AppGlideModule { }
258
0.783582
0.746269
13
19.615385
22.130865
52
false
false
0
0
0
0
0
0
0.230769
false
false
10
6ea7fed72a1662fba695587b06a483921f0fb612
30,640,296,692,989
369270a14e669687b5b506b35895ef385dad11ab
/jdk.internal.vm.compiler/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/nodes/aot/InitializeKlassNode.java
2f67914b891ab65e12f79673ef566b3f5622b3e3
[]
no_license
zcc888/Java9Source
https://github.com/zcc888/Java9Source
39254262bd6751203c2002d9fc020da533f78731
7776908d8053678b0b987101a50d68995c65b431
refs/heads/master
2021-09-10T05:49:56.469000
2018-03-20T06:26:03
2018-03-20T06:26:03
125,970,208
3
3
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * */ package org.graalvm.compiler.hotspot.nodes.aot; import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_3; import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_20; import org.graalvm.compiler.graph.NodeClass; import org.graalvm.compiler.nodeinfo.NodeInfo; import org.graalvm.compiler.nodes.DeoptimizingFixedWithNextNode; import org.graalvm.compiler.nodes.ValueNode; import org.graalvm.compiler.nodes.spi.Lowerable; import org.graalvm.compiler.nodes.spi.LoweringTool; @NodeInfo(cycles = CYCLES_3, size = SIZE_20) public class InitializeKlassNode extends DeoptimizingFixedWithNextNode implements Lowerable { public static final NodeClass<InitializeKlassNode> TYPE = NodeClass.create(InitializeKlassNode.class); @Input ValueNode value; public InitializeKlassNode(ValueNode value) { super(TYPE, value.stamp()); this.value = value; } @Override public void lower(LoweringTool tool) { tool.getLowerer().lower(this, tool); } public ValueNode value() { return value; } @Override public boolean canDeoptimize() { return true; } }
UTF-8
Java
1,331
java
InitializeKlassNode.java
Java
[]
null
[]
/* * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * */ package org.graalvm.compiler.hotspot.nodes.aot; import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_3; import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_20; import org.graalvm.compiler.graph.NodeClass; import org.graalvm.compiler.nodeinfo.NodeInfo; import org.graalvm.compiler.nodes.DeoptimizingFixedWithNextNode; import org.graalvm.compiler.nodes.ValueNode; import org.graalvm.compiler.nodes.spi.Lowerable; import org.graalvm.compiler.nodes.spi.LoweringTool; @NodeInfo(cycles = CYCLES_3, size = SIZE_20) public class InitializeKlassNode extends DeoptimizingFixedWithNextNode implements Lowerable { public static final NodeClass<InitializeKlassNode> TYPE = NodeClass.create(InitializeKlassNode.class); @Input ValueNode value; public InitializeKlassNode(ValueNode value) { super(TYPE, value.stamp()); this.value = value; } @Override public void lower(LoweringTool tool) { tool.getLowerer().lower(this, tool); } public ValueNode value() { return value; } @Override public boolean canDeoptimize() { return true; } }
1,331
0.715252
0.707739
59
21.559322
26.588688
106
false
false
0
0
0
0
0
0
0.338983
false
false
10
70b1a4f07518e0db5df90336d8d4ce10afb803a2
16,733,192,593,237
9848855b517a01ce96ae50ac34e88119e017ed9a
/org.bigtrack.cassandra/src/main/java/Domain/MapperConfiguration.java
7cbee300b4dd72808d3161adbb734412377a47da
[]
no_license
AlexM-Itu/BigTrack
https://github.com/AlexM-Itu/BigTrack
f88f5dd5cc1ea0f468c99c1e6fe1b38656ba1135
a60623ed1eee7dcaef2e1d465407bf407a5695e1
refs/heads/master
2020-04-06T07:06:18.121000
2016-08-31T04:08:51
2016-08-31T04:08:51
59,967,583
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Domain; import com.datastax.driver.core.Cluster; import com.datastax.driver.core.CodecRegistry; import com.datastax.driver.extras.codecs.enums.EnumNameCodec; import com.datastax.driver.mapping.Mapper; import com.datastax.driver.mapping.MappingManager; /** * Created by Alex on 6/11/16. */ public class MapperConfiguration { public static void Configure (){ CodecRegistry.DEFAULT_INSTANCE.register(new EnumNameCodec<Operations>(Operations.class)); } }
UTF-8
Java
479
java
MapperConfiguration.java
Java
[ { "context": ".driver.mapping.MappingManager;\n\n/**\n * Created by Alex on 6/11/16.\n */\npublic class MapperConfiguration ", "end": 284, "score": 0.99221271276474, "start": 280, "tag": "NAME", "value": "Alex" } ]
null
[]
package Domain; import com.datastax.driver.core.Cluster; import com.datastax.driver.core.CodecRegistry; import com.datastax.driver.extras.codecs.enums.EnumNameCodec; import com.datastax.driver.mapping.Mapper; import com.datastax.driver.mapping.MappingManager; /** * Created by Alex on 6/11/16. */ public class MapperConfiguration { public static void Configure (){ CodecRegistry.DEFAULT_INSTANCE.register(new EnumNameCodec<Operations>(Operations.class)); } }
479
0.776618
0.76618
16
28.9375
26.614067
97
false
false
0
0
0
0
0
0
0.4375
false
false
10
b1238aaba239d328a34bdf21e2749a3a8f446761
23,124,103,929,911
988b199a0d32f30212a548d2181124a5a7d878f1
/project1/src/controller/companylist.java
5a2e836199c65eb88cfcdcb9a22103881329322a
[]
no_license
tk244/Servlet
https://github.com/tk244/Servlet
27c98f812453de618260798b88d7e83e4cc49d73
31c43bc5b50de1928d862db0101bd04d0562d84d
refs/heads/master
2020-04-06T04:06:19.218000
2017-02-24T11:14:37
2017-02-24T11:14:37
83,033,489
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package controller; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; import org.apache.log4j.xml.DOMConfigurator; import constants.constant; import dao.companyDAO; /** * Servlet implementation class companyedit * 企業一覧 削除/検索 */ @WebServlet("/companylist") public class companylist extends HttpServlet { private static final long serialVersionUID = 1L; private static final Logger logger = Logger.getLogger(companylist.class); /** * @see HttpServlet#HttpServlet() */ public companylist() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.getWriter().append("Served at: ").append(request.getContextPath()); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String MyAction = request.getParameter("MySubmit"); ServletContext context = getServletContext(); DOMConfigurator.configure(context.getRealPath(constant.log4j)); logger.debug("doPost Start"); try { if (MyAction.equals("Delete")){ // 削除 String deletechks[] = request.getParameterValues("deletechks"); companyDAO companydao = new companyDAO(); companydao.companyDelete(deletechks); RequestDispatcher dispatch = request.getRequestDispatcher("/top"); dispatch.forward(request, response); }else{ // 検索 String company_name = request.getParameter("company_name"); String area_id = request.getParameter("area"); String characteristics[] = request.getParameterValues("characteristics"); try { request.setAttribute("company_name", company_name); request.setAttribute("area", area_id); request.setAttribute("characteristics", characteristics); // トップ画面 RequestDispatcher dispatchar = request.getRequestDispatcher("/top"); dispatchar.forward(request, response); }catch (Exception e){ logger.error(e.getMessage()); } } }catch (Exception e){ logger.error(e.getMessage()); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, constant.serverError); } logger.debug("doPost End"); } }
SHIFT_JIS
Java
2,928
java
companylist.java
Java
[]
null
[]
package controller; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; import org.apache.log4j.xml.DOMConfigurator; import constants.constant; import dao.companyDAO; /** * Servlet implementation class companyedit * 企業一覧 削除/検索 */ @WebServlet("/companylist") public class companylist extends HttpServlet { private static final long serialVersionUID = 1L; private static final Logger logger = Logger.getLogger(companylist.class); /** * @see HttpServlet#HttpServlet() */ public companylist() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.getWriter().append("Served at: ").append(request.getContextPath()); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String MyAction = request.getParameter("MySubmit"); ServletContext context = getServletContext(); DOMConfigurator.configure(context.getRealPath(constant.log4j)); logger.debug("doPost Start"); try { if (MyAction.equals("Delete")){ // 削除 String deletechks[] = request.getParameterValues("deletechks"); companyDAO companydao = new companyDAO(); companydao.companyDelete(deletechks); RequestDispatcher dispatch = request.getRequestDispatcher("/top"); dispatch.forward(request, response); }else{ // 検索 String company_name = request.getParameter("company_name"); String area_id = request.getParameter("area"); String characteristics[] = request.getParameterValues("characteristics"); try { request.setAttribute("company_name", company_name); request.setAttribute("area", area_id); request.setAttribute("characteristics", characteristics); // トップ画面 RequestDispatcher dispatchar = request.getRequestDispatcher("/top"); dispatchar.forward(request, response); }catch (Exception e){ logger.error(e.getMessage()); } } }catch (Exception e){ logger.error(e.getMessage()); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, constant.serverError); } logger.debug("doPost End"); } }
2,928
0.704907
0.703525
96
28.145834
27.655235
119
false
false
0
0
0
0
0
0
2.291667
false
false
10
d44b6bd3905767cb64c13147a7148d31360c789a
2,534,030,722,292
e55d5bea8c6e97ec54132288341e85aa5c81c011
/CURDOperation(SpringJDBC,AspectJ)/src/com/ranjit/bo/App.java
d6000d619224694bb3f3eb6233009d3461a103be
[]
no_license
ranjitchavan/SpringInAction
https://github.com/ranjitchavan/SpringInAction
b8502061075ef2b18f25988abb86d079d23e2b2b
75c55b0d8cf8a54e10044e22bff2f686cfb7883e
refs/heads/master
2020-03-27T01:45:48.484000
2019-01-10T13:45:23
2019-01-10T13:45:23
145,740,698
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ranjit.bo; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.ranjit.repo.StudentRegisterationDAO; public class App { public static void main(String[] args) { try(ClassPathXmlApplicationContext context=new ClassPathXmlApplicationContext("app.xml")){ StudentRegisterationDAO dao=context.getBean("studentDAO",StudentRegisterationDAO.class); System.out.println(dao.registerStudent(new StudentBO("Ranjit","Pass"))); } } }
UTF-8
Java
481
java
App.java
Java
[ { "context": "em.out.println(dao.registerStudent(new StudentBO(\"Ranjit\",\"Pass\")));\n\t\t}\n\t}\n}\n", "end": 459, "score": 0.9995854496955872, "start": 453, "tag": "NAME", "value": "Ranjit" }, { "context": "intln(dao.registerStudent(new StudentBO(\"Ranjit\",\"Pass\")));\n\t\t}\n\...
null
[]
package com.ranjit.bo; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.ranjit.repo.StudentRegisterationDAO; public class App { public static void main(String[] args) { try(ClassPathXmlApplicationContext context=new ClassPathXmlApplicationContext("app.xml")){ StudentRegisterationDAO dao=context.getBean("studentDAO",StudentRegisterationDAO.class); System.out.println(dao.registerStudent(new StudentBO("Ranjit","Pass"))); } } }
481
0.800416
0.800416
13
36
35.130527
92
false
false
0
0
0
0
0
0
1.615385
false
false
10
6133aef45d7a3728881d6b52dcfb2d2b275e8797
2,534,030,720,168
c72c40292594e67ee4de9f88a9490d022ab90892
/javaoo/src/ChuanWan/CrossActor.java
0efaf218deeb2c4792099217f18c95263d0038fe
[]
no_license
Suixin-practice/java
https://github.com/Suixin-practice/java
5e9a5e5aed39e196e17ac32e852f8ce8ccafa716
36cc87362ee88e40a7f33931d0ca7bf4ad50abe1
refs/heads/master
2022-09-28T06:08:40.427000
2020-06-01T14:27:20
2020-06-01T14:27:20
268,542,659
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ChuanWan; public class CrossActor extends Actor{ public CrossActor() { super(); } public CrossActor(String name) { super(name); } @Override public void perfroms() { System.out.println(getName()+"现在开始说相声"); } }
GB18030
Java
248
java
CrossActor.java
Java
[]
null
[]
package ChuanWan; public class CrossActor extends Actor{ public CrossActor() { super(); } public CrossActor(String name) { super(name); } @Override public void perfroms() { System.out.println(getName()+"现在开始说相声"); } }
248
0.683761
0.683761
16
13.625
13.994977
42
false
false
0
0
0
0
0
0
1.0625
false
false
10
118ec974da5124a3961b4c04de325012bebdc546
8,529,805,089,537
ac805ea1812d88b2adbf0f3b9ee056b7b68f2add
/Team/EAD_HAFIDH/Project/CeleratesJavaFundamental/src/com/celerates/polymorphism/Informasi.java
debaa72d6463783367daf4477cd0e1a77c64e102
[]
no_license
andbyprmn/celerates-java-fundamental
https://github.com/andbyprmn/celerates-java-fundamental
29eaafeca90d2bbf2d416543c4d01427e8af7827
3bd638f0376e3e9436946829164dd208c24faf61
refs/heads/master
2020-05-24T06:48:18.186000
2019-05-27T01:37:56
2019-05-27T01:37:56
187,144,912
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.celerates.polymorphism; /** * * @author Hafidh Adhi */ public class Informasi extends Movie{ public void info(Movie m){ m.setJudul("Avengers End Game"); m.setTahun(2019); System.out.println(m.getJudul()); System.out.println(m.getTahun()); System.out.println(""); } }
UTF-8
Java
526
java
Informasi.java
Java
[ { "context": "age com.celerates.polymorphism;\n\n/**\n *\n * @author Hafidh Adhi\n */\npublic class Informasi extends Movie{\n \n ", "end": 251, "score": 0.9998636245727539, "start": 240, "tag": "NAME", "value": "Hafidh Adhi" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.celerates.polymorphism; /** * * @author <NAME> */ public class Informasi extends Movie{ public void info(Movie m){ m.setJudul("Avengers End Game"); m.setTahun(2019); System.out.println(m.getJudul()); System.out.println(m.getTahun()); System.out.println(""); } }
521
0.644487
0.636882
22
22.90909
21.409235
79
false
false
0
0
0
0
0
0
0.409091
false
false
10
3c7f85ee20a3cbd5472d21eb096705c0c0ea6c67
8,529,805,090,290
f6ff6bfc4dd38f2dd4ab9943afa793a9de17366f
/src/main/java/org/lekic/ttt/Game.java
09540292e7da02e02b6160978fa34ad86d6dced2
[]
no_license
dejlek/ttt
https://github.com/dejlek/ttt
35112f46d332ca14135e87b0118565ff5491cbae
2f86e5a383059bc7a92a21f5b850f6be5848b581
refs/heads/master
2021-01-10T11:54:01.028000
2016-03-29T19:46:36
2016-03-29T19:46:36
54,996,978
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.lekic.ttt; import java.util.ArrayList; import java.util.Scanner; /** * The "Game" class contains the game logic and the data. * * @author dejan */ public class Game { private final String[] players; /// Player names("computer" and "human") private final ArrayList<String> history; /// Move history private int nextPlayerID; /// The ID of the player who should play next move. private final char[][] board; /// The board /** * The default constructor. * @param argFirst Name of the player to play first ("computer" or "human"). */ public Game(String argFirst) { players = new String[2]; if ("human".equals(argFirst)) { players[0] = "human"; players[1] = "computer"; } else { players[0] = "computer"; players[1] = "human"; } nextPlayerID = 1; /// Initialised to 1 so when we flip it, it becomes 0. history = new ArrayList<>(); board = new char[][] {{' ', ' ', ' '}, {' ', ' ', ' '}, {' ', ' ', ' '}}; } // Game constructor /** * Use this method to get the ID of the player that should play next. * * @return 0 (first) or 1 (second) player. */ public int next() { nextPlayerID = 1 - nextPlayerID; return nextPlayerID; } /** * Either does a computer move (calls the computerMove method), or asks user to input a new move by calling the * humanMove() method. */ public void makeMove() { int pid = next(); // get ID of the player who should make move String move = ""; if ("computer".equals(players[pid])) { computerMove(); } else { humanMove(); } } public int getX(String argMove) { return 0 + argMove.charAt(0) - 'A'; } public int getY(String argMove) { return Integer.parseInt("" + argMove.charAt(1)) - 1; } public boolean isValid(String argMove) { int x = getX(argMove); int y = getY(argMove); return (x < 3 && x >=0 && y < 3 && y >= 0); } /** * Makes a move. * @param argMove */ public void move(String argMove) { char what = nextPlayerID == 0 ? 'X' : 'O'; int x = getX(argMove); int y = getY(argMove); board[x][y] = what; history.add(argMove); } public void computerMove() { // if computer first, we start with "A1" move. if (history.isEmpty()) { move("A1"); } } public void humanMove() { Scanner keyboard = new Scanner(System.in); boolean done = false; String move = ""; while (!done) { System.out.println("Your move: "); move = keyboard.next(); Game.checkQuit(move); // check whether we should exit prematurely if (isValid(move)) { done = true; move(move); } } // while } public static void checkQuit(String argInput) { if ("quit".equals(argInput)) { System.out.println("Exiting the tic-tac-toe game. Good bye!"); System.exit(0); } } } // Game class
UTF-8
Java
3,282
java
Game.java
Java
[ { "context": "ntains the game logic and the data.\n * \n * @author dejan\n */\npublic class Game {\n private final String[", "end": 161, "score": 0.9918301701545715, "start": 156, "tag": "USERNAME", "value": "dejan" } ]
null
[]
package org.lekic.ttt; import java.util.ArrayList; import java.util.Scanner; /** * The "Game" class contains the game logic and the data. * * @author dejan */ public class Game { private final String[] players; /// Player names("computer" and "human") private final ArrayList<String> history; /// Move history private int nextPlayerID; /// The ID of the player who should play next move. private final char[][] board; /// The board /** * The default constructor. * @param argFirst Name of the player to play first ("computer" or "human"). */ public Game(String argFirst) { players = new String[2]; if ("human".equals(argFirst)) { players[0] = "human"; players[1] = "computer"; } else { players[0] = "computer"; players[1] = "human"; } nextPlayerID = 1; /// Initialised to 1 so when we flip it, it becomes 0. history = new ArrayList<>(); board = new char[][] {{' ', ' ', ' '}, {' ', ' ', ' '}, {' ', ' ', ' '}}; } // Game constructor /** * Use this method to get the ID of the player that should play next. * * @return 0 (first) or 1 (second) player. */ public int next() { nextPlayerID = 1 - nextPlayerID; return nextPlayerID; } /** * Either does a computer move (calls the computerMove method), or asks user to input a new move by calling the * humanMove() method. */ public void makeMove() { int pid = next(); // get ID of the player who should make move String move = ""; if ("computer".equals(players[pid])) { computerMove(); } else { humanMove(); } } public int getX(String argMove) { return 0 + argMove.charAt(0) - 'A'; } public int getY(String argMove) { return Integer.parseInt("" + argMove.charAt(1)) - 1; } public boolean isValid(String argMove) { int x = getX(argMove); int y = getY(argMove); return (x < 3 && x >=0 && y < 3 && y >= 0); } /** * Makes a move. * @param argMove */ public void move(String argMove) { char what = nextPlayerID == 0 ? 'X' : 'O'; int x = getX(argMove); int y = getY(argMove); board[x][y] = what; history.add(argMove); } public void computerMove() { // if computer first, we start with "A1" move. if (history.isEmpty()) { move("A1"); } } public void humanMove() { Scanner keyboard = new Scanner(System.in); boolean done = false; String move = ""; while (!done) { System.out.println("Your move: "); move = keyboard.next(); Game.checkQuit(move); // check whether we should exit prematurely if (isValid(move)) { done = true; move(move); } } // while } public static void checkQuit(String argInput) { if ("quit".equals(argInput)) { System.out.println("Exiting the tic-tac-toe game. Good bye!"); System.exit(0); } } } // Game class
3,282
0.517977
0.510969
116
27.293104
22.822409
115
false
false
0
0
0
0
0
0
0.456897
false
false
10
6c3fb3fa836fb29be2a6f31a3164a8bf6f54389c
3,444,563,803,889
5cc99d5e88b195f714026adb9720cb21c76fc896
/src/Bean/CartItem.java
418e4d70d3ad96244e3a3ca67768658a0a8aeed8
[]
no_license
muscleboy/miniTmall
https://github.com/muscleboy/miniTmall
5d0e83411be86e9b646c6765c92ed68059ba06a2
8657b79872cacc187517e466ad2eee7fd5e35451
refs/heads/master
2020-05-17T00:28:15.264000
2019-07-08T03:30:51
2019-07-08T03:30:51
183,396,354
2
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package Bean; /** * Create with IDEA. * * @Package: Bean * @Description: * @Date: 2019/6/1 10:57 * @Author: Wyj */ public class CartItem { private Product product; private int num; private int price; public Product getProduct() { return product; } public void setProduct(Product product) { this.product = product; } public int getNum() { return num; } public void setNum(int num) { this.num = num; } public int getPrice() { return price; } public void setPrice(int price) { this.price = price; } @Override public String toString() { return product + ", " + num + ", " + price; } }
UTF-8
Java
725
java
CartItem.java
Java
[ { "context": "@Description:\n * @Date: 2019/6/1 10:57\n * @Author: Wyj\n */\npublic class CartItem {\n\n private Product ", "end": 118, "score": 0.9978725910186768, "start": 115, "tag": "USERNAME", "value": "Wyj" } ]
null
[]
package Bean; /** * Create with IDEA. * * @Package: Bean * @Description: * @Date: 2019/6/1 10:57 * @Author: Wyj */ public class CartItem { private Product product; private int num; private int price; public Product getProduct() { return product; } public void setProduct(Product product) { this.product = product; } public int getNum() { return num; } public void setNum(int num) { this.num = num; } public int getPrice() { return price; } public void setPrice(int price) { this.price = price; } @Override public String toString() { return product + ", " + num + ", " + price; } }
725
0.550345
0.536552
45
15.111111
13.482865
51
false
false
0
0
0
0
0
0
0.288889
false
false
10
38e5cf7a1884f8b6e1e942a5efc704aa37a1b54c
27,169,963,124,499
7bdd4cccffe0683176e79a6b65c59678ee94c4f2
/src/main/java/com/bidanet/springmvc/demo/jkbuilder/annotation/type/JkSourceType.java
66e2851b689398a10d38f42b10fa40141fff2bbc
[]
no_license
xuejike/spring_xuejike_tpl
https://github.com/xuejike/spring_xuejike_tpl
4e6b06e39ae2817a722309f938bc54ea8c6a083c
2e8114eb071bf47fc6ed9bf922633ade2e4f7b06
refs/heads/master
2021-07-02T14:20:29.579000
2019-03-08T03:42:42
2019-03-08T03:42:42
111,900,621
4
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bidanet.springmvc.demo.jkbuilder.annotation.type; import com.bidanet.springmvc.demo.jkbuilder.data.JkNameValueData; public enum JkSourceType implements JkNameValueData { /** * 字符串数组 */ stringArray, /** * 枚举 */ enumType, /** * Url地址 */ url, /** * Spring BeanClass数据 */ beanClass ; @Override public String getName(){ switch (this){ case stringArray: return "字符串数组"; case url: return "URL地址"; case enumType: return "枚举类型"; case beanClass: return "接口数据"; } return ""; } @Override public String getValue(){ return toString(); } }
UTF-8
Java
838
java
JkSourceType.java
Java
[]
null
[]
package com.bidanet.springmvc.demo.jkbuilder.annotation.type; import com.bidanet.springmvc.demo.jkbuilder.data.JkNameValueData; public enum JkSourceType implements JkNameValueData { /** * 字符串数组 */ stringArray, /** * 枚举 */ enumType, /** * Url地址 */ url, /** * Spring BeanClass数据 */ beanClass ; @Override public String getName(){ switch (this){ case stringArray: return "字符串数组"; case url: return "URL地址"; case enumType: return "枚举类型"; case beanClass: return "接口数据"; } return ""; } @Override public String getValue(){ return toString(); } }
838
0.497455
0.497455
44
16.863636
15.299422
65
false
false
0
0
0
0
0
0
0.272727
false
false
10
f3a11d815a0635b1d031073f7022e5b4f027e4bc
28,509,992,931,066
e758fecdea501a5d88394a9e1c5f54cf20ae5421
/src/main/java/rwilk/browseenglish/release/repository/LessonReleaseRepository.java
199dee89fe5f02e651637297143b818508ac956a
[]
no_license
RWilk94/BrowseEnglishGUI
https://github.com/RWilk94/BrowseEnglishGUI
00e9d2476d041829677de3f09a6d4fdd687964bc
3e1962d410f7c0725d1157e75b8aa77c33f5d8c8
refs/heads/master
2023-01-05T04:02:25.712000
2020-11-03T15:24:36
2020-11-03T15:24:36
309,725,042
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package rwilk.browseenglish.release.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import rwilk.browseenglish.release.entity.LessonRelease; @Repository public interface LessonReleaseRepository extends JpaRepository<LessonRelease, Long> { }
UTF-8
Java
319
java
LessonReleaseRepository.java
Java
[]
null
[]
package rwilk.browseenglish.release.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import rwilk.browseenglish.release.entity.LessonRelease; @Repository public interface LessonReleaseRepository extends JpaRepository<LessonRelease, Long> { }
319
0.862069
0.862069
9
34.444443
30.067003
85
false
false
0
0
0
0
0
0
0.555556
false
false
10
5987abef011fafc969942fa864cd52645842e10e
31,121,333,087,456
1de21a723b176555f788ad2b73245590c45816a0
/Disk.java
ede960267e36048de548527096aead83b22815ba
[]
no_license
michaelebelle/TowerOfHanoi
https://github.com/michaelebelle/TowerOfHanoi
d39c7e1cc48ae1da82542a4ae2bade5cc08f5fce
c0991229d33221fedc6b35842283ace00dd001b7
refs/heads/master
2022-12-06T03:39:24.481000
2020-08-10T15:32:42
2020-08-10T15:32:42
285,964,488
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public final class Disk { // Declare instance variables here. See toString() method below for names. private int diskSize; private char diskChar; private char poleChar; private String diskString; public Disk(int aDiskSize, char aDiskChar, char aPoleChar) { diskSize = aDiskSize; diskChar = aDiskChar; poleChar = aPoleChar; diskString = ""; for (int i = 1; i <= diskSize; i++) { diskString += diskChar; } diskString += poleChar; for (int i = 1; i <= diskSize; i++) { diskString += diskChar; } } public Disk(int aDiskSize) { diskSize = aDiskSize; diskChar = '*'; poleChar = '|'; diskString = ""; if (diskSize <= 0 ) { diskSize = 1; } for (int i = 1; i <= diskSize; i++) { diskString += diskChar; } diskString += poleChar; for (int i = 1; i <= diskSize; i++) { diskString += diskChar; } } public int getSize() { return diskSize; } public String toString() { return diskString; } }
UTF-8
Java
1,003
java
Disk.java
Java
[]
null
[]
public final class Disk { // Declare instance variables here. See toString() method below for names. private int diskSize; private char diskChar; private char poleChar; private String diskString; public Disk(int aDiskSize, char aDiskChar, char aPoleChar) { diskSize = aDiskSize; diskChar = aDiskChar; poleChar = aPoleChar; diskString = ""; for (int i = 1; i <= diskSize; i++) { diskString += diskChar; } diskString += poleChar; for (int i = 1; i <= diskSize; i++) { diskString += diskChar; } } public Disk(int aDiskSize) { diskSize = aDiskSize; diskChar = '*'; poleChar = '|'; diskString = ""; if (diskSize <= 0 ) { diskSize = 1; } for (int i = 1; i <= diskSize; i++) { diskString += diskChar; } diskString += poleChar; for (int i = 1; i <= diskSize; i++) { diskString += diskChar; } } public int getSize() { return diskSize; } public String toString() { return diskString; } }
1,003
0.595214
0.589232
72
12.944445
15.031346
76
false
false
0
0
0
0
0
0
1.902778
false
false
10
b4b281766a6ba62dad67e45b99dccfa0280de74e
31,121,333,089,141
f066c1887f681b3357bdaf2f3f38569889212c93
/airline-parent/airline-qunar/src/main/java/com/apin/qunar/order/dao/mapper/NationalChangeOrderMapper.java
1b54deb873818e299aad9f769871e4df3b5f3754
[]
no_license
wang-shun/apin-qunar
https://github.com/wang-shun/apin-qunar
ac25c3833cf700070ce59dbdc93a5b9fdba8f320
2ea9f960e2e43f6bebd01a3628b079a1fee5d6ab
refs/heads/master
2020-03-29T16:22:04.234000
2018-09-07T17:28:04
2018-09-07T17:28:04
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.apin.qunar.order.dao.mapper; import com.apin.qunar.order.dao.model.NationalChangeOrder; import com.apin.qunar.order.dao.model.NationalChangeOrderExample; import java.util.List; import org.apache.ibatis.annotations.Param; public interface NationalChangeOrderMapper { int countByExample(NationalChangeOrderExample example); int deleteByExample(NationalChangeOrderExample example); int deleteByPrimaryKey(Long id); int insert(NationalChangeOrder record); int insertSelective(NationalChangeOrder record); List<NationalChangeOrder> selectByExample(NationalChangeOrderExample example); NationalChangeOrder selectByPrimaryKey(Long id); int updateByExampleSelective(@Param("record") NationalChangeOrder record, @Param("example") NationalChangeOrderExample example); int updateByExample(@Param("record") NationalChangeOrder record, @Param("example") NationalChangeOrderExample example); int updateByPrimaryKeySelective(NationalChangeOrder record); int updateByPrimaryKey(NationalChangeOrder record); }
UTF-8
Java
1,060
java
NationalChangeOrderMapper.java
Java
[]
null
[]
package com.apin.qunar.order.dao.mapper; import com.apin.qunar.order.dao.model.NationalChangeOrder; import com.apin.qunar.order.dao.model.NationalChangeOrderExample; import java.util.List; import org.apache.ibatis.annotations.Param; public interface NationalChangeOrderMapper { int countByExample(NationalChangeOrderExample example); int deleteByExample(NationalChangeOrderExample example); int deleteByPrimaryKey(Long id); int insert(NationalChangeOrder record); int insertSelective(NationalChangeOrder record); List<NationalChangeOrder> selectByExample(NationalChangeOrderExample example); NationalChangeOrder selectByPrimaryKey(Long id); int updateByExampleSelective(@Param("record") NationalChangeOrder record, @Param("example") NationalChangeOrderExample example); int updateByExample(@Param("record") NationalChangeOrder record, @Param("example") NationalChangeOrderExample example); int updateByPrimaryKeySelective(NationalChangeOrder record); int updateByPrimaryKey(NationalChangeOrder record); }
1,060
0.813208
0.813208
30
34.366665
36.54174
132
false
false
0
0
0
0
0
0
0.6
false
false
10
650186e26daad422951b6d623ba681a674c06c0e
7,507,602,855,550
f28bc38a06593add66d505b5f6b5af574e0cdd79
/src/org/hashtable/sdk/util/NavigableSet.java
9556a766acf86dd9510d2624be2a96225f41b4fc
[ "Apache-2.0" ]
permissive
seulkikims/study
https://github.com/seulkikims/study
1e45fb18e44113f28c2a7c19889851eaf0e196df
d54ce452e746012573f1c2396ee175538ecdcaaf
refs/heads/master
2016-09-09T18:26:58.801000
2014-03-30T23:02:59
2014-03-30T23:02:59
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.hashtable.sdk.util; public interface NavigableSet<E> extends SortedSet<E> { E lower(E e); E floor(E e); E ceiling(E e); E higher(E e); E pollFirst(); E pollLast(); NavigableSet<E> descendingSet(); Iterator<E> descendingIterator(); NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive); NavigableSet<E> headSet(E toElement, boolean inclusive); NavigableSet<E> tailSet(E fromElement, boolean inclusive); }
UTF-8
Java
482
java
NavigableSet.java
Java
[]
null
[]
package org.hashtable.sdk.util; public interface NavigableSet<E> extends SortedSet<E> { E lower(E e); E floor(E e); E ceiling(E e); E higher(E e); E pollFirst(); E pollLast(); NavigableSet<E> descendingSet(); Iterator<E> descendingIterator(); NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive); NavigableSet<E> headSet(E toElement, boolean inclusive); NavigableSet<E> tailSet(E fromElement, boolean inclusive); }
482
0.728216
0.728216
17
27.352942
26.006653
97
false
false
0
0
0
0
0
0
1
false
false
10
bb77b72b570206bfaefc9ada60dd31457cbb60a9
21,500,606,284,365
27e89f584a463e49f0b84a87dae686766ab69120
/src/main/java/iterator/v4/Main.java
291a4e9b1ba294dacd4674c100109968fa95816f
[]
no_license
jsw2580/DesignPattern
https://github.com/jsw2580/DesignPattern
80e032da96ed2d1d795aec4cfaae5c122083e225
81d642c573acf03ff8235bf4933de7a33bb4ede8
refs/heads/master
2023-05-31T19:50:31.112000
2021-07-01T15:19:09
2021-07-01T15:19:09
378,555,244
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package iterator.v4; public class Main { public static void main(String[] args) { Collection_ list = new LinkedList(); for(int i = 0; i < 15; i ++) { list.add(new String("s" +i)); } System.out.println(list.size()); Iterator_ iterator = list.iterator(); while(iterator.hasNext()) { Object o = iterator.next(); System.out.println(o); } } }
UTF-8
Java
440
java
Main.java
Java
[]
null
[]
package iterator.v4; public class Main { public static void main(String[] args) { Collection_ list = new LinkedList(); for(int i = 0; i < 15; i ++) { list.add(new String("s" +i)); } System.out.println(list.size()); Iterator_ iterator = list.iterator(); while(iterator.hasNext()) { Object o = iterator.next(); System.out.println(o); } } }
440
0.515909
0.506818
17
24.882353
17.060041
45
false
false
0
0
0
0
0
0
0.529412
false
false
10
93316ceb47f3ea771c8b21ff7d6cd94f4db77f7a
20,375,324,917,396
2c066f0df1531187354d87bdd1fdd2af63b630e8
/java/2010-11-15/Pumpe.java
3cea1e163727ce5096b8b29cf6594bccafbef72c
[]
no_license
mzemanek/junk
https://github.com/mzemanek/junk
43f8e8789f923bfc0c5ce98b03fc51e1ab682399
ef1b37ee7c0440cb0ced3c4eb6cc8bae0421251a
refs/heads/master
2020-05-20T11:30:47.217000
2011-06-16T21:51:05
2011-06-16T21:51:05
820,220
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
// 2010-11-15 // package Produkt;
UTF-8
Java
35
java
Pumpe.java
Java
[]
null
[]
// 2010-11-15 // package Produkt;
35
0.628571
0.4
2
16
3
19
false
false
0
0
0
0
0
0
0.5
false
false
10
5b1af78118401b87b759c89263d893fb6bd21f3e
16,733,192,654,183
95c62a879b6d57ecb7a860a2d943b8db65c419d7
/src/main/java/pl/me/shop/security/JwtAuthenticationFilter.java
206849b9c8aa90b301eafa83f4fc23aa8a20ae07
[]
no_license
Kuba312/online-shop
https://github.com/Kuba312/online-shop
a48620fee2b2329d9caf470f93981647eca85e32
efeb9699f534617fd748ac798320f350fe796c45
refs/heads/master
2023-05-26T00:21:38.628000
2021-06-12T14:39:22
2021-06-12T14:39:22
296,649,751
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pl.me.shop.security; import ch.qos.logback.classic.Level; import io.jsonwebtoken.*; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.logging.Logger; import java.util.stream.Collectors; public class JwtAuthenticationFilter extends UsernamePasswordAuthenticationFilter { public JwtAuthenticationFilter(AuthenticationManager authenticationManager) { setAuthenticationManager(authenticationManager); setUsernameParameter("login"); } @Override protected void successfulAuthentication(HttpServletRequest request, HttpServletResponse response, FilterChain chain, Authentication authResult) throws IOException, ServletException { String authorities = authResult.getAuthorities().stream() .map(GrantedAuthority::getAuthority) .collect(Collectors.joining(",")); Map<String, Object> claims = new HashMap<>(); claims.put("authorities", authorities); String token = Jwts.builder().setClaims(claims) .setSubject(((UserDetails) authResult.getPrincipal()).getUsername()) .setExpiration(new Date(System.currentTimeMillis() + 1000 * 60 * 30)) .signWith(SignatureAlgorithm.HS512, "kuba123") .compact(); response.setHeader("Authorization","Bearer " + token); } }
UTF-8
Java
2,000
java
JwtAuthenticationFilter.java
Java
[]
null
[]
package pl.me.shop.security; import ch.qos.logback.classic.Level; import io.jsonwebtoken.*; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.logging.Logger; import java.util.stream.Collectors; public class JwtAuthenticationFilter extends UsernamePasswordAuthenticationFilter { public JwtAuthenticationFilter(AuthenticationManager authenticationManager) { setAuthenticationManager(authenticationManager); setUsernameParameter("login"); } @Override protected void successfulAuthentication(HttpServletRequest request, HttpServletResponse response, FilterChain chain, Authentication authResult) throws IOException, ServletException { String authorities = authResult.getAuthorities().stream() .map(GrantedAuthority::getAuthority) .collect(Collectors.joining(",")); Map<String, Object> claims = new HashMap<>(); claims.put("authorities", authorities); String token = Jwts.builder().setClaims(claims) .setSubject(((UserDetails) authResult.getPrincipal()).getUsername()) .setExpiration(new Date(System.currentTimeMillis() + 1000 * 60 * 30)) .signWith(SignatureAlgorithm.HS512, "kuba123") .compact(); response.setHeader("Authorization","Bearer " + token); } }
2,000
0.7225
0.7155
47
41.553192
29.757036
109
false
false
0
0
0
0
0
0
0.723404
false
false
10
929f5ff9e3d390d271ac4333f594ee0921179eb1
790,274,009,009
12b2d559453be9599842bda45a30539568c164f7
/src/main/java/susalud/backend/rest/test/RestControllerTest.java
09a0beea7c5f65ff60a08d20083636d5d712a116
[]
no_license
Tayuelo/susalud-adj
https://github.com/Tayuelo/susalud-adj
d8887f441af8eab2a541096805bf19b1a924e98f
7644b655bbb8854ec817045b5c75014a425752de
refs/heads/master
2020-05-04T14:28:09.894000
2019-06-12T02:55:34
2019-06-12T02:55:34
179,198,155
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package susalud.backend.rest.test; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import susalud.backend.dominio.test.dto.TestDto; import susalud.backend.dominio.test.servicio.TestServicio; @CrossOrigin @RestController @RequestMapping("/api/test") public class RestControllerTest { @Autowired private TestServicio testServicio; @GetMapping(path = "/hello") public String test() { return "Cualquier cosa"; } @PostMapping public void ingresarTest(@Valid @RequestBody TestDto dto) { testServicio.ingresarTest(dto); } @DeleteMapping("/{idTest}") public void borrarTest(@PathVariable(value="idTest") int idTest) { testServicio.borrarTest(idTest); } }
UTF-8
Java
1,213
java
RestControllerTest.java
Java
[]
null
[]
package susalud.backend.rest.test; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import susalud.backend.dominio.test.dto.TestDto; import susalud.backend.dominio.test.servicio.TestServicio; @CrossOrigin @RestController @RequestMapping("/api/test") public class RestControllerTest { @Autowired private TestServicio testServicio; @GetMapping(path = "/hello") public String test() { return "Cualquier cosa"; } @PostMapping public void ingresarTest(@Valid @RequestBody TestDto dto) { testServicio.ingresarTest(dto); } @DeleteMapping("/{idTest}") public void borrarTest(@PathVariable(value="idTest") int idTest) { testServicio.borrarTest(idTest); } }
1,213
0.807914
0.807914
41
28.560976
24.132813
67
false
false
0
0
0
0
0
0
0.951219
false
false
10
b46a2320823c49cd2e7a608e4bcd82c852c1288e
13,580,686,625,687
38d6cc82c4fcddbfc6721e1299f27d63aa6229ad
/LoginWs/src/com/exemple/activities/InternetDesativada.java
7436a99bd8e83e8bc5c82c949bfa204242f45b11
[]
no_license
lillydi/SIGS-Mobile
https://github.com/lillydi/SIGS-Mobile
ac279b9d14972b29e4acf26ac4d4ca2c4b7a8171
64f92a0133c8e099bdcf737239a5e24f4e3570bd
refs/heads/master
2021-01-23T06:54:58.657000
2013-11-06T23:55:13
2013-11-06T23:55:13
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.exemple.activities; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import com.example.loginws.R; public class InternetDesativada extends Activity { public Activity activityAtual = this; public Activity parent = activityAtual.getParent(); @Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.internet_desativada); Button bt = (Button) findViewById(R.id.button1); bt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent it = new Intent(activityAtual, InicialActivity.class); startActivity(it); } }); } }
UTF-8
Java
826
java
InternetDesativada.java
Java
[]
null
[]
package com.exemple.activities; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import com.example.loginws.R; public class InternetDesativada extends Activity { public Activity activityAtual = this; public Activity parent = activityAtual.getParent(); @Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.internet_desativada); Button bt = (Button) findViewById(R.id.button1); bt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent it = new Intent(activityAtual, InicialActivity.class); startActivity(it); } }); } }
826
0.707022
0.705811
35
21.6
19.358572
65
false
false
0
0
0
0
0
0
1.857143
false
false
10
b3a6898af1528a0261a85b5722806145c0375a72
19,782,619,365,902
4c0a11741a916a5ec55242fd6be27b594ba83515
/src/Interprete/Convertidor.java
0654dbaa4414d22bbbdaf81f543e50ccac522e37
[]
no_license
CarlosGutierrezArdila/juego-io
https://github.com/CarlosGutierrezArdila/juego-io
477ecab035f023c14e6fec98979cbe3a06bac408
6b4a4696af075fbec2c232f0493ea75ee1ec738f
refs/heads/master
2021-05-15T14:24:21.340000
2017-10-15T01:55:19
2017-10-15T01:55:19
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package interprete; import org.json.JSONArray; import org.json.JSONObject; import cuestionario.Categoria; import cuestionario.Opcion; import cuestionario.Pregunta; public class Convertidor { public Categoria convertir(String path) { Lector la = new Lector(); JSONObject json = new JSONObject(la.leer(path)); JSONArray array = json.getJSONArray("preguntas"); Categoria categoria = new Categoria(); for(int iter = 0; iter < array.length(); iter ++) { Pregunta pregunta = new Pregunta(); pregunta.asunto = array.getJSONObject(iter).getString("asunto"); pregunta.texto = array.getJSONObject(iter).getString("texto"); pregunta.repeticiones = array.getJSONObject(iter).getInt("repeticiones"); JSONArray arrayOp = array.getJSONObject(iter).getJSONArray("opciones"); for(int jr=0; jr < arrayOp.length(); jr++) { Opcion opcion = new Opcion(); opcion.texto = arrayOp.getJSONObject(jr).getString("texto"); opcion.reputacion = arrayOp.getJSONObject(jr).getInt("reputacion"); opcion.cargo = arrayOp.getJSONObject(jr).getInt("cargo"); pregunta.opciones.add(opcion); } categoria.preguntas.add(pregunta); } return categoria; } }
UTF-8
Java
1,178
java
Convertidor.java
Java
[]
null
[]
package interprete; import org.json.JSONArray; import org.json.JSONObject; import cuestionario.Categoria; import cuestionario.Opcion; import cuestionario.Pregunta; public class Convertidor { public Categoria convertir(String path) { Lector la = new Lector(); JSONObject json = new JSONObject(la.leer(path)); JSONArray array = json.getJSONArray("preguntas"); Categoria categoria = new Categoria(); for(int iter = 0; iter < array.length(); iter ++) { Pregunta pregunta = new Pregunta(); pregunta.asunto = array.getJSONObject(iter).getString("asunto"); pregunta.texto = array.getJSONObject(iter).getString("texto"); pregunta.repeticiones = array.getJSONObject(iter).getInt("repeticiones"); JSONArray arrayOp = array.getJSONObject(iter).getJSONArray("opciones"); for(int jr=0; jr < arrayOp.length(); jr++) { Opcion opcion = new Opcion(); opcion.texto = arrayOp.getJSONObject(jr).getString("texto"); opcion.reputacion = arrayOp.getJSONObject(jr).getInt("reputacion"); opcion.cargo = arrayOp.getJSONObject(jr).getInt("cargo"); pregunta.opciones.add(opcion); } categoria.preguntas.add(pregunta); } return categoria; } }
1,178
0.724958
0.72326
34
33.64706
23.580753
76
false
false
0
0
0
0
0
0
2.558824
false
false
10
1194b79479d11120f9fb73b06ddebb62f295acfd
32,830,730,023,326
21d32eef977520be493ea7c72256cf21edbba670
/src/ua/kharkov/rian/Launcher.java
4b6b334565999e9c3c2df363223c7cf28e3d9c18
[]
no_license
ASD888/ApplicationForRydbergSpectroscopy
https://github.com/ASD888/ApplicationForRydbergSpectroscopy
de7284619571ba4d405301896083beada7e7ce25
2845510fe26ac88a092dc25832b4d3e6412006d5
refs/heads/master
2015-09-26T02:46:07.805000
2015-09-04T23:37:46
2015-09-04T23:37:46
41,941,989
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ua.kharkov.rian; import ua.kharkov.rian.gui.GraphicalUserInterface; /** * * @author Artur Meshcheriakov */ public class Launcher { public static void main(String[] args) { GraphicalUserInterface userInterface = new GraphicalUserInterface(); userInterface.createGUI(); } }
UTF-8
Java
298
java
Launcher.java
Java
[ { "context": "an.gui.GraphicalUserInterface;\n\n/**\n * \n * @author Artur Meshcheriakov\n */\npublic class Launcher {\n public static voi", "end": 116, "score": 0.9998840093612671, "start": 97, "tag": "NAME", "value": "Artur Meshcheriakov" } ]
null
[]
package ua.kharkov.rian; import ua.kharkov.rian.gui.GraphicalUserInterface; /** * * @author <NAME> */ public class Launcher { public static void main(String[] args) { GraphicalUserInterface userInterface = new GraphicalUserInterface(); userInterface.createGUI(); } }
285
0.734899
0.734899
16
17.625
20.937033
69
false
false
0
0
0
0
0
0
0.375
false
false
10
2d82e8fbe18cceacda4c379f87e13dc7010f3833
6,322,191,869,606
38ad18478c452e655b5b38ce7542107f89d1ad8c
/ics-common/src/main/java/com/ics/cloud/common/model/Sys_permission.java
91aa198cede532b3128bfaf5e4fce880fd476fcf
[]
no_license
wenxpro/ics-cloud
https://github.com/wenxpro/ics-cloud
eb60d595b2ff933ea3c5c678a2b669c3f2dbc4b6
57ead1a7fbb352a543c63aa2572b89f0e3a344ea
refs/heads/master
2022-07-01T03:36:13.321000
2020-01-08T01:53:11
2020-01-08T01:53:11
229,238,718
0
0
null
false
2022-06-17T02:50:34
2019-12-20T09:59:24
2020-01-20T09:47:52
2022-06-17T02:50:33
540
0
0
1
Java
false
false
package com.ics.cloud.common.model; import java.util.Date; public class Sys_permission { private String id; private String name; private String description; private Date create_date; private String create_userid; private Date del_date; private String del_uerid; private Integer status; public String getId() { return id; } public void setId(String id) { this.id = id == null ? null : id.trim(); } public String getName() { return name; } public void setName(String name) { this.name = name == null ? null : name.trim(); } public String getDescription() { return description; } public void setDescription(String description) { this.description = description == null ? null : description.trim(); } public Date getCreate_date() { return create_date; } public void setCreate_date(Date create_date) { this.create_date = create_date; } public String getCreate_userid() { return create_userid; } public void setCreate_userid(String create_userid) { this.create_userid = create_userid == null ? null : create_userid.trim(); } public Date getDel_date() { return del_date; } public void setDel_date(Date del_date) { this.del_date = del_date; } public String getDel_uerid() { return del_uerid; } public void setDel_uerid(String del_uerid) { this.del_uerid = del_uerid == null ? null : del_uerid.trim(); } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } }
UTF-8
Java
1,718
java
Sys_permission.java
Java
[]
null
[]
package com.ics.cloud.common.model; import java.util.Date; public class Sys_permission { private String id; private String name; private String description; private Date create_date; private String create_userid; private Date del_date; private String del_uerid; private Integer status; public String getId() { return id; } public void setId(String id) { this.id = id == null ? null : id.trim(); } public String getName() { return name; } public void setName(String name) { this.name = name == null ? null : name.trim(); } public String getDescription() { return description; } public void setDescription(String description) { this.description = description == null ? null : description.trim(); } public Date getCreate_date() { return create_date; } public void setCreate_date(Date create_date) { this.create_date = create_date; } public String getCreate_userid() { return create_userid; } public void setCreate_userid(String create_userid) { this.create_userid = create_userid == null ? null : create_userid.trim(); } public Date getDel_date() { return del_date; } public void setDel_date(Date del_date) { this.del_date = del_date; } public String getDel_uerid() { return del_uerid; } public void setDel_uerid(String del_uerid) { this.del_uerid = del_uerid == null ? null : del_uerid.trim(); } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } }
1,718
0.602445
0.602445
85
19.22353
19.911201
81
false
false
0
0
0
0
0
0
0.305882
false
false
10
b5891127ee04976cb703ae37ebbb36f94da100e2
6,322,191,872,115
d6e0f08d405afc739170426e03bd1052c729db48
/lfims-service-api/LFIMS-base/src/main/java/com/dreamtech360/lfims/model/base/LFIMSNodeStructure.java
a44fc44823ba158f02f2758b69a9162c9488441f
[]
no_license
dreamtech360/lfims
https://github.com/dreamtech360/lfims
a69af83f3b3b45adebb977a0b48f90b070c1e10f
784c2ed6851b19c594e503e7140a546c9172ede2
refs/heads/master
2016-09-05T14:55:04.052000
2012-06-14T23:48:02
2012-06-14T23:48:02
2,277,580
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dreamtech360.lfims.model.base; import com.dreamtech360.lfims.model.service.exception.LFIMSServiceException; import com.dreamtech360.lfims.util.LFIMSUtils; public abstract class LFIMSNodeStructure<T> { public abstract LFIMSNode<T> getNodeType(); public abstract LFIMSNodeStructure<T> getTopNodeStructure(); //If the Node is part of a Composite structure and is not a collection then this method returns the key to store the reference value //else his method should return null public String getCompositKeyIdentifier() throws LFIMSServiceException{ if( !isNodeTypeCollection() && LFIMSUtils.isCompositNode(getClass())){ throw new LFIMSServiceException("The property to store the reference key for a composit node is not set please set the value before proceeding"); } return null; } //If this value is false then the implementing class must override the method getCompositKeyIdentifier and return the attribute name to store the composit key //reference if the node is of type composit public abstract boolean isNodeTypeCollection(); }
UTF-8
Java
1,109
java
LFIMSNodeStructure.java
Java
[]
null
[]
package com.dreamtech360.lfims.model.base; import com.dreamtech360.lfims.model.service.exception.LFIMSServiceException; import com.dreamtech360.lfims.util.LFIMSUtils; public abstract class LFIMSNodeStructure<T> { public abstract LFIMSNode<T> getNodeType(); public abstract LFIMSNodeStructure<T> getTopNodeStructure(); //If the Node is part of a Composite structure and is not a collection then this method returns the key to store the reference value //else his method should return null public String getCompositKeyIdentifier() throws LFIMSServiceException{ if( !isNodeTypeCollection() && LFIMSUtils.isCompositNode(getClass())){ throw new LFIMSServiceException("The property to store the reference key for a composit node is not set please set the value before proceeding"); } return null; } //If this value is false then the implementing class must override the method getCompositKeyIdentifier and return the attribute name to store the composit key //reference if the node is of type composit public abstract boolean isNodeTypeCollection(); }
1,109
0.77367
0.765555
26
40.653847
46.123531
159
false
false
0
0
0
0
0
0
1.384615
false
false
10
2215847ccb12da8d31fd0d3c6139636d0b866f03
5,944,234,766,818
3a76a32f7274e66fe1a0f345abc5bc7e2407e60f
/src/main/java/com/wills/bill/springbootbill/config/MySpringMvcConfigurer.java
6bc89c155ba4dbaeb33f96926968a62d302ec0df
[]
no_license
get2bad/bill-project
https://github.com/get2bad/bill-project
1b77d86b64fd74a2507e7f7a4c159fae6dfea5b9
9e67dfe88a87e71bbbf7db444fc398f4106c2b6e
refs/heads/master
2022-01-07T17:08:36.547000
2019-07-06T04:08:55
2019-07-06T04:08:55
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wills.bill.springbootbill.config; import com.wills.bill.springbootbill.intercepter.LoginHandlerIntercepter; import com.wills.bill.springbootbill.locale.MyLocaleResolver; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.LocaleResolver; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration public class MySpringMvcConfigurer { /** * 两种方式实现视图控制 * 1、实现WebMvcConfigurer接口,实现接口内的方法即可 * 2、直接写上返回值,返回值内部实现接口的方法 * @return */ @Bean //向容器中添加实例 public WebMvcConfigurer webMvcConfigurer() { WebMvcConfigurer webMvcConfigurer = new WebMvcConfigurer() { @Override public void addInterceptors(InterceptorRegistry registry) { //SpringBoot2+中要排除静态资源路径, 因访问时不会加/static,所以配置如下 registry.addInterceptor(new LoginHandlerIntercepter()).addPathPatterns("/**") .excludePathPatterns("/", "/index.html", "/login","/logout","/css/**", "/img/**","/js/**"); } @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/").setViewName("main/login"); registry.addViewController("/index.html").setViewName("main/login"); } }; return webMvcConfigurer; } //替换mvc中自动配置类中的区域解析器 @Bean public LocaleResolver localeResolver() { return new MyLocaleResolver(); } }
UTF-8
Java
2,060
java
MySpringMvcConfigurer.java
Java
[]
null
[]
package com.wills.bill.springbootbill.config; import com.wills.bill.springbootbill.intercepter.LoginHandlerIntercepter; import com.wills.bill.springbootbill.locale.MyLocaleResolver; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.LocaleResolver; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration public class MySpringMvcConfigurer { /** * 两种方式实现视图控制 * 1、实现WebMvcConfigurer接口,实现接口内的方法即可 * 2、直接写上返回值,返回值内部实现接口的方法 * @return */ @Bean //向容器中添加实例 public WebMvcConfigurer webMvcConfigurer() { WebMvcConfigurer webMvcConfigurer = new WebMvcConfigurer() { @Override public void addInterceptors(InterceptorRegistry registry) { //SpringBoot2+中要排除静态资源路径, 因访问时不会加/static,所以配置如下 registry.addInterceptor(new LoginHandlerIntercepter()).addPathPatterns("/**") .excludePathPatterns("/", "/index.html", "/login","/logout","/css/**", "/img/**","/js/**"); } @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/").setViewName("main/login"); registry.addViewController("/index.html").setViewName("main/login"); } }; return webMvcConfigurer; } //替换mvc中自动配置类中的区域解析器 @Bean public LocaleResolver localeResolver() { return new MyLocaleResolver(); } }
2,060
0.708333
0.706731
47
38.829788
30.674212
115
false
false
0
0
0
0
0
0
0.510638
false
false
10
1ae6c2beede43726501da2b03dbe418c2567e96b
4,337,916,988,282
8aa7564133d43ac56acf5b04a86a3fdc6dc39725
/sssm/src/main/java/com/xhhy/util/MySqlProvider.java
955a1f0412f014d46db91a099d33543b95e06f73
[]
no_license
wanglianjiehero/repositoryONE
https://github.com/wanglianjiehero/repositoryONE
02fedd8e29f2a03a04e6beeef8326eae70cd29d3
70274c5a1ba58b4d07486f07e9c058ca5ff31708
refs/heads/master
2021-07-17T19:11:30.413000
2017-10-26T05:17:17
2017-10-26T05:17:17
103,947,114
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.xhhy.util; import java.util.List; import java.util.Map; import com.xhhy.domain.Emp; import com.xhhy.domain.User; import static org.apache.ibatis.jdbc.SqlBuilder.*; public class MySqlProvider { public String listUser(User user) { BEGIN(); SELECT("uid,uname,uage"); FROM("user"); if(user != null){ if(user.getUid() != null){ WHERE("uid = #{uid}"); } if(user.getUage() != null&&!user.getUage().equals("")){ WHERE("uage = #{uage}"); } if(user.getUname() != null && !user.getUname().equals("")){ WHERE("uname like #{uname}\"%\""); } ORDER_BY(user.getPaixu()); } String sql = SQL(); System.out.println(sql); return sql; } public String getAllemp(Emp emp) { BEGIN(); SELECT("emp_id empid,emp_name empname,dept_id deptid"); FROM("emp"); if(emp != null){ if(emp.getEmpid() != null){ WHERE("emp_id = #{empid}"); } if(emp.getEmpname() != null&&!emp.getEmpname().equals("")){ WHERE("emp_name like \"%\"#{empname}\"%\""); } if(emp.getDeptid() != null ){ WHERE("dept_id = #{deptid}"); } } String sql = SQL(); System.out.println(sql); return sql; } }
UTF-8
Java
1,163
java
MySqlProvider.java
Java
[]
null
[]
package com.xhhy.util; import java.util.List; import java.util.Map; import com.xhhy.domain.Emp; import com.xhhy.domain.User; import static org.apache.ibatis.jdbc.SqlBuilder.*; public class MySqlProvider { public String listUser(User user) { BEGIN(); SELECT("uid,uname,uage"); FROM("user"); if(user != null){ if(user.getUid() != null){ WHERE("uid = #{uid}"); } if(user.getUage() != null&&!user.getUage().equals("")){ WHERE("uage = #{uage}"); } if(user.getUname() != null && !user.getUname().equals("")){ WHERE("uname like #{uname}\"%\""); } ORDER_BY(user.getPaixu()); } String sql = SQL(); System.out.println(sql); return sql; } public String getAllemp(Emp emp) { BEGIN(); SELECT("emp_id empid,emp_name empname,dept_id deptid"); FROM("emp"); if(emp != null){ if(emp.getEmpid() != null){ WHERE("emp_id = #{empid}"); } if(emp.getEmpname() != null&&!emp.getEmpname().equals("")){ WHERE("emp_name like \"%\"#{empname}\"%\""); } if(emp.getDeptid() != null ){ WHERE("dept_id = #{deptid}"); } } String sql = SQL(); System.out.println(sql); return sql; } }
1,163
0.582975
0.582975
56
19.767857
17.297802
62
false
false
0
0
0
0
0
0
2.410714
false
false
10
98d230c52dabdbb0d798a1eaf58bd42404cc6f29
1,520,418,493,026
b4afbd1e1594976bc37564347b0b56dea0e8017e
/src/com/poorfellow/agameofthings/MainGameScreenPagerAdapter.java
f4313b81466a16c9a1759e7a3ec31fcf69d165d2
[]
no_license
zerocool947/AnAppOfThings
https://github.com/zerocool947/AnAppOfThings
e89713abb97e6b2b371e2cf26e414b65d2c59b26
7505b794a30a5863c0a7fdc31ef4dcce27b78fcd
refs/heads/master
2020-12-24T13:17:33.319000
2014-04-20T13:39:30
2014-04-20T13:39:30
17,311,359
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.poorfellow.agameofthings; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.util.Log; /** * Created by David on 3/1/14. */ public class MainGameScreenPagerAdapter extends FragmentPagerAdapter { public static final String ARG_SECTION_NUMBER = "section_number"; public MainGameScreenPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { Log.d("The position is", Integer.toString(position)); switch (position) { case 0: Log.d("POSITION", "0"); Fragment submitThingFragment = new SubmitThingFragment(); return submitThingFragment; case 1: Log.d("POSITION", "1"); Fragment listThingsFragment = new ListThingsFragment(); return listThingsFragment; case 2: Log.d("POSITION", "1"); Fragment listNamesFragment = new ListNamesFragment(); return listNamesFragment; } return null; } @Override public int getCount() { return 3; } }
UTF-8
Java
1,253
java
MainGameScreenPagerAdapter.java
Java
[ { "context": "apter;\nimport android.util.Log;\n\n/**\n * Created by David on 3/1/14.\n */\npublic class MainGameScreenPagerAd", "end": 227, "score": 0.99504554271698, "start": 222, "tag": "NAME", "value": "David" } ]
null
[]
package com.poorfellow.agameofthings; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.util.Log; /** * Created by David on 3/1/14. */ public class MainGameScreenPagerAdapter extends FragmentPagerAdapter { public static final String ARG_SECTION_NUMBER = "section_number"; public MainGameScreenPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { Log.d("The position is", Integer.toString(position)); switch (position) { case 0: Log.d("POSITION", "0"); Fragment submitThingFragment = new SubmitThingFragment(); return submitThingFragment; case 1: Log.d("POSITION", "1"); Fragment listThingsFragment = new ListThingsFragment(); return listThingsFragment; case 2: Log.d("POSITION", "1"); Fragment listNamesFragment = new ListNamesFragment(); return listNamesFragment; } return null; } @Override public int getCount() { return 3; } }
1,253
0.611333
0.60016
45
26.844444
23.296118
73
false
false
0
0
0
0
0
0
0.511111
false
false
10
ac73530189b1eb77ae9fed377e8393c6d4e558bd
1,382,979,473,388
41e527e661602427a6b7073c83bab6292dc829c9
/java/src/ie/tudublin/Life.java
815302671e5955dab48f35f319a169c61bbc2905
[ "MIT" ]
permissive
jinantonic/OOP-2020-2021
https://github.com/jinantonic/OOP-2020-2021
06eb6ce97035ea7d5f825d01c5e04c5ccba3b3cd
919f0ead85cc09531914a4b35f03acde4571c351
refs/heads/master
2023-04-26T01:16:03.448000
2021-04-19T23:32:43
2021-04-19T23:32:43
332,896,934
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ie.tudublin; import processing.core.PApplet; public class Life extends PApplet { int mode = 0; public void keyPressed() { if (keyCode >= '0' && keyCode <= '9') mode = keyCode - '0'; } public void setup() { colorMode(RGB); size(500, 500); } public void draw() { background(0); } }
UTF-8
Java
402
java
Life.java
Java
[]
null
[]
package ie.tudublin; import processing.core.PApplet; public class Life extends PApplet { int mode = 0; public void keyPressed() { if (keyCode >= '0' && keyCode <= '9') mode = keyCode - '0'; } public void setup() { colorMode(RGB); size(500, 500); } public void draw() { background(0); } }
402
0.480099
0.452736
25
14.08
13.248155
45
false
false
0
0
0
0
0
0
0.32
false
false
10
78063901030e810145c15d4504a746251e9fd7d3
22,634,477,656,981
6cae46815448d2ab66bc6cb401d1e20e318fd627
/src/test/java/tests/PublishProject.java
38fa73be49a490d548f7212111cce7fd40024ce8
[]
no_license
Orfik/N2PS-AutoTests
https://github.com/Orfik/N2PS-AutoTests
33fe44f2dec1c445a2e8318d4aa5c5eceba25dd4
49a3f1d3defa42cbe2672ad96cb3235a64eb10b4
refs/heads/master
2021-01-23T05:24:21.489000
2017-05-10T13:54:00
2017-05-10T13:54:00
86,302,015
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package tests; import dataproviders.DataProviderClass; import org.openqa.selenium.By; import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.ui.ExpectedConditions; import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Listeners; import org.testng.annotations.Test; import pages.DetailProjectPage; import pages.ProjectBoardPage; import pages.ProjectPublishPage; import ru.yandex.qatools.allure.annotations.Description; import ru.yandex.qatools.allure.annotations.Features; import ru.yandex.qatools.allure.annotations.Stories; import ru.yandex.qatools.allure.annotations.TestCaseId; import java.io.IOException; @Listeners(value = AllureTestListener.class) public class PublishProject extends BaseTest { private DetailProjectPage detailProjectPage; private ProjectBoardPage projectBoardPage; private ProjectPublishPage projectPublishPage; @BeforeMethod public void setUp() throws Exception { PageFactory.initElements(driver, this); projectBoardPage = new ProjectBoardPage(driver); projectPublishPage = new ProjectPublishPage(driver); detailProjectPage = new DetailProjectPage(driver); } @TestCaseId("17") @Features("Upload Cover Image") @Stories("Upload Cover Image") @Test(priority=1, description = "Upload Cover image", dataProvider = "validUserData", dataProviderClass = DataProviderClass.class) public void uploadProjectCoverImage (String login, String password, String expectedUserName) throws IOException, InterruptedException { auth(login, password); projectBoardPage.createNewProject(); detailProjectPage.createFirstArticle(); detailProjectPage.openProjectPublish(); projectPublishPage.uploadProjectCoverImage(System.getProperty("user.dir") + "/src/test/resources/test.jpg", System.getProperty("user.dir") + "\\src\\test\\resources\\test3.jpg"); ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='projectPublishCoverPhoto']/div[1]/div[1]/div/div/img")); } @TestCaseId("18") @Features("Upload Logo Image") @Stories("Upload Logo Image") @Test(priority=2, description = "Upload Logo Image", dataProvider = "validUserData", dataProviderClass = DataProviderClass.class) public void uploadLogoImage (String login, String password,String expectedUserName) throws IOException, InterruptedException{ projectPublishPage.uploadProjectLogo(System.getProperty("user.dir")+"/src/test/resources/test.jpg"); ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='projectPublishLogo']/div[1]/div[1]/div/div/img")); } @TestCaseId("19") @Features("Upload Cover Video") @Stories("Upload Cover Video") @Test(priority=3, description = "upload cover video", dataProvider = "validUserData", dataProviderClass = DataProviderClass.class) public void uploadProjectCoverVideo (String login, String password,String expectedUserName) throws IOException, InterruptedException { projectPublishPage.selectVideoCover(); projectPublishPage.uploadProjectCoverVideo(System.getProperty("user.dir") + "/src/test/resources/Video1.mp4"); } @TestCaseId("20") @Features("Change Project Title") @Stories("Change Project Title") @Test(priority =4,description = "Change Project Title", dataProvider = "validUserData", dataProviderClass = DataProviderClass.class) public void changeProjectTitle(String login, String password,String expectedUserName) throws IOException, InterruptedException { auth("qa@storied.co", "zxc123"); projectBoardPage.openProject(); detailProjectPage.openProjectPublish(); projectPublishPage.changeProjectTitle(); ExpectedConditions.textToBePresentInElementValue(By.xpath("/html/body/section/section/section/div[2]/span"), "Test1"); } }
UTF-8
Java
3,902
java
PublishProject.java
Java
[ { "context": "IOException, InterruptedException {\n auth(\"qa@storied.co\", \"zxc123\");\n projectBoardPage.openProject", "end": 3614, "score": 0.9999249577522278, "start": 3601, "tag": "EMAIL", "value": "qa@storied.co" }, { "context": "rruptedException {\n auth(...
null
[]
package tests; import dataproviders.DataProviderClass; import org.openqa.selenium.By; import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.ui.ExpectedConditions; import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Listeners; import org.testng.annotations.Test; import pages.DetailProjectPage; import pages.ProjectBoardPage; import pages.ProjectPublishPage; import ru.yandex.qatools.allure.annotations.Description; import ru.yandex.qatools.allure.annotations.Features; import ru.yandex.qatools.allure.annotations.Stories; import ru.yandex.qatools.allure.annotations.TestCaseId; import java.io.IOException; @Listeners(value = AllureTestListener.class) public class PublishProject extends BaseTest { private DetailProjectPage detailProjectPage; private ProjectBoardPage projectBoardPage; private ProjectPublishPage projectPublishPage; @BeforeMethod public void setUp() throws Exception { PageFactory.initElements(driver, this); projectBoardPage = new ProjectBoardPage(driver); projectPublishPage = new ProjectPublishPage(driver); detailProjectPage = new DetailProjectPage(driver); } @TestCaseId("17") @Features("Upload Cover Image") @Stories("Upload Cover Image") @Test(priority=1, description = "Upload Cover image", dataProvider = "validUserData", dataProviderClass = DataProviderClass.class) public void uploadProjectCoverImage (String login, String password, String expectedUserName) throws IOException, InterruptedException { auth(login, password); projectBoardPage.createNewProject(); detailProjectPage.createFirstArticle(); detailProjectPage.openProjectPublish(); projectPublishPage.uploadProjectCoverImage(System.getProperty("user.dir") + "/src/test/resources/test.jpg", System.getProperty("user.dir") + "\\src\\test\\resources\\test3.jpg"); ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='projectPublishCoverPhoto']/div[1]/div[1]/div/div/img")); } @TestCaseId("18") @Features("Upload Logo Image") @Stories("Upload Logo Image") @Test(priority=2, description = "Upload Logo Image", dataProvider = "validUserData", dataProviderClass = DataProviderClass.class) public void uploadLogoImage (String login, String password,String expectedUserName) throws IOException, InterruptedException{ projectPublishPage.uploadProjectLogo(System.getProperty("user.dir")+"/src/test/resources/test.jpg"); ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='projectPublishLogo']/div[1]/div[1]/div/div/img")); } @TestCaseId("19") @Features("Upload Cover Video") @Stories("Upload Cover Video") @Test(priority=3, description = "upload cover video", dataProvider = "validUserData", dataProviderClass = DataProviderClass.class) public void uploadProjectCoverVideo (String login, String password,String expectedUserName) throws IOException, InterruptedException { projectPublishPage.selectVideoCover(); projectPublishPage.uploadProjectCoverVideo(System.getProperty("user.dir") + "/src/test/resources/Video1.mp4"); } @TestCaseId("20") @Features("Change Project Title") @Stories("Change Project Title") @Test(priority =4,description = "Change Project Title", dataProvider = "validUserData", dataProviderClass = DataProviderClass.class) public void changeProjectTitle(String login, String password,String expectedUserName) throws IOException, InterruptedException { auth("<EMAIL>", "<PASSWORD>"); projectBoardPage.openProject(); detailProjectPage.openProjectPublish(); projectPublishPage.changeProjectTitle(); ExpectedConditions.textToBePresentInElementValue(By.xpath("/html/body/section/section/section/div[2]/span"), "Test1"); } }
3,900
0.757304
0.751153
80
47.762501
43.653534
186
false
false
0
0
0
0
0
0
0.85
false
false
10
7aeb4df928250d1151f1ee467c5888774eeb2017
33,251,636,859,171
991623a859bf97f3c7a135facb59d245a465d33a
/src/javalab6/ReadXMLUrl.java
5a9d5a4aef8d67302f7996ab506a7a08a35ad53c
[]
no_license
Nasibulin/NIIT
https://github.com/Nasibulin/NIIT
6d06db98c607f6b48cb1905819759110fe31839e
923e6e49d51c4892291e5c777d934f5f3c56962b
refs/heads/master
2020-03-28T20:48:06.459000
2018-12-21T09:32:02
2018-12-21T09:32:02
149,103,082
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package javalab6; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import java.net.URL; import java.text.NumberFormat; import java.util.Locale; public class ReadXMLUrl { public static void main(String args[]) { Locale ru = Locale.getDefault(); try { String url = "https://www.cbr.ru/scripts/XML_daily.asp"; DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(new URL(url).openStream()); //optional, but recommended //read this - http://stackoverflow.com/questions/13786607/normalization-in-dom-parsing-with-java-how-does-it-work doc.getDocumentElement().normalize(); System.out.println( "Root element :" + doc.getDocumentElement().getNodeName() + " " + doc.getDocumentElement().getAttribute( "Date")); NodeList nList = doc.getElementsByTagName("Valute"); System.out.println("----------------------------"); for (int temp = 0; temp < nList.getLength(); temp++) { Node nNode = nList.item(temp); System.out.println("\nCurrent Element :" + nNode.getNodeName()); if (nNode.getNodeType() == Node.ELEMENT_NODE) { Element eElement = (Element) nNode; System.out.println("Valute ID : " + eElement.getAttribute("ID")); System.out.println( "NumCode : " + eElement.getElementsByTagName("NumCode").item(0).getTextContent()); System.out.println( "CharCode : " + eElement.getElementsByTagName("CharCode").item(0).getTextContent()); System.out.println( "Nominal : " + eElement.getElementsByTagName("Nominal").item(0).getTextContent()); System.out.println("Name : " + eElement.getElementsByTagName("Name").item(0).getTextContent()); System.out.println("Value : " + NumberFormat.getInstance(Locale.FRANCE).parse( eElement.getElementsByTagName("Value").item(0).getTextContent()).doubleValue()); } } } catch (Exception e) { e.printStackTrace(); } } }
UTF-8
Java
2,570
java
ReadXMLUrl.java
Java
[]
null
[]
package javalab6; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import java.net.URL; import java.text.NumberFormat; import java.util.Locale; public class ReadXMLUrl { public static void main(String args[]) { Locale ru = Locale.getDefault(); try { String url = "https://www.cbr.ru/scripts/XML_daily.asp"; DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(new URL(url).openStream()); //optional, but recommended //read this - http://stackoverflow.com/questions/13786607/normalization-in-dom-parsing-with-java-how-does-it-work doc.getDocumentElement().normalize(); System.out.println( "Root element :" + doc.getDocumentElement().getNodeName() + " " + doc.getDocumentElement().getAttribute( "Date")); NodeList nList = doc.getElementsByTagName("Valute"); System.out.println("----------------------------"); for (int temp = 0; temp < nList.getLength(); temp++) { Node nNode = nList.item(temp); System.out.println("\nCurrent Element :" + nNode.getNodeName()); if (nNode.getNodeType() == Node.ELEMENT_NODE) { Element eElement = (Element) nNode; System.out.println("Valute ID : " + eElement.getAttribute("ID")); System.out.println( "NumCode : " + eElement.getElementsByTagName("NumCode").item(0).getTextContent()); System.out.println( "CharCode : " + eElement.getElementsByTagName("CharCode").item(0).getTextContent()); System.out.println( "Nominal : " + eElement.getElementsByTagName("Nominal").item(0).getTextContent()); System.out.println("Name : " + eElement.getElementsByTagName("Name").item(0).getTextContent()); System.out.println("Value : " + NumberFormat.getInstance(Locale.FRANCE).parse( eElement.getElementsByTagName("Value").item(0).getTextContent()).doubleValue()); } } } catch (Exception e) { e.printStackTrace(); } } }
2,570
0.576654
0.569261
65
38.53846
36.985268
125
false
false
0
0
0
0
0
0
0.492308
false
false
10
0285f767286d96240e4a0b43ab8fe6d5974c84be
28,578,712,433,783
8b9190a8c5855d5753eb8ba7003e1db875f5d28f
/sources/com/google/common/util/concurrent/CycleDetectingLockFactory.java
03dc4c901ab3be8b7949a649ed58b3812af27d2b
[]
no_license
stevehav/iowa-caucus-app
https://github.com/stevehav/iowa-caucus-app
6aeb7de7487bd800f69cb0b51cc901f79bd4666b
e3c7eb39de0be6bbfa8b6b063aaa85dcbcee9044
refs/heads/master
2020-12-29T10:25:28.354000
2020-02-05T23:15:52
2020-02-05T23:15:52
238,565,283
21
3
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.google.common.util.concurrent; import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; import com.google.common.collect.MapMaker; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.j2objc.annotations.Weak; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.EnumMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.logging.Level; import java.util.logging.Logger; import org.checkerframework.checker.nullness.compatqual.NullableDecl; @GwtIncompatible @CanIgnoreReturnValue @Beta public class CycleDetectingLockFactory { private static final ThreadLocal<ArrayList<LockGraphNode>> acquiredLocks = new ThreadLocal<ArrayList<LockGraphNode>>() { /* access modifiers changed from: protected */ public ArrayList<LockGraphNode> initialValue() { return Lists.newArrayListWithCapacity(3); } }; private static final ConcurrentMap<Class<? extends Enum>, Map<? extends Enum, LockGraphNode>> lockGraphNodesPerType = new MapMaker().weakKeys().makeMap(); /* access modifiers changed from: private */ public static final Logger logger = Logger.getLogger(CycleDetectingLockFactory.class.getName()); final Policy policy; private interface CycleDetectingLock { LockGraphNode getLockGraphNode(); boolean isAcquiredByCurrentThread(); } @Beta public enum Policies implements Policy { THROW { public void handlePotentialDeadlock(PotentialDeadlockException potentialDeadlockException) { throw potentialDeadlockException; } }, WARN { public void handlePotentialDeadlock(PotentialDeadlockException potentialDeadlockException) { CycleDetectingLockFactory.logger.log(Level.SEVERE, "Detected potential deadlock", potentialDeadlockException); } }, DISABLED { public void handlePotentialDeadlock(PotentialDeadlockException potentialDeadlockException) { } } } @Beta public interface Policy { void handlePotentialDeadlock(PotentialDeadlockException potentialDeadlockException); } public static CycleDetectingLockFactory newInstance(Policy policy2) { return new CycleDetectingLockFactory(policy2); } public ReentrantLock newReentrantLock(String str) { return newReentrantLock(str, false); } public ReentrantLock newReentrantLock(String str, boolean z) { return this.policy == Policies.DISABLED ? new ReentrantLock(z) : new CycleDetectingReentrantLock(new LockGraphNode(str), z); } public ReentrantReadWriteLock newReentrantReadWriteLock(String str) { return newReentrantReadWriteLock(str, false); } public ReentrantReadWriteLock newReentrantReadWriteLock(String str, boolean z) { return this.policy == Policies.DISABLED ? new ReentrantReadWriteLock(z) : new CycleDetectingReentrantReadWriteLock(new LockGraphNode(str), z); } public static <E extends Enum<E>> WithExplicitOrdering<E> newInstanceWithExplicitOrdering(Class<E> cls, Policy policy2) { Preconditions.checkNotNull(cls); Preconditions.checkNotNull(policy2); return new WithExplicitOrdering<>(policy2, getOrCreateNodes(cls)); } /* JADX WARNING: type inference failed for: r2v0, types: [java.lang.Class<? extends java.lang.Enum>, java.lang.Object, java.lang.Class] */ /* JADX WARNING: Unknown variable types count: 1 */ /* Code decompiled incorrectly, please refer to instructions dump. */ private static java.util.Map<? extends java.lang.Enum, com.google.common.util.concurrent.CycleDetectingLockFactory.LockGraphNode> getOrCreateNodes(java.lang.Class<? extends java.lang.Enum> r2) { /* java.util.concurrent.ConcurrentMap<java.lang.Class<? extends java.lang.Enum>, java.util.Map<? extends java.lang.Enum, com.google.common.util.concurrent.CycleDetectingLockFactory$LockGraphNode>> r0 = lockGraphNodesPerType java.lang.Object r0 = r0.get(r2) java.util.Map r0 = (java.util.Map) r0 if (r0 == 0) goto L_0x000b return r0 L_0x000b: java.util.Map r0 = createNodes(r2) java.util.concurrent.ConcurrentMap<java.lang.Class<? extends java.lang.Enum>, java.util.Map<? extends java.lang.Enum, com.google.common.util.concurrent.CycleDetectingLockFactory$LockGraphNode>> r1 = lockGraphNodesPerType java.lang.Object r2 = r1.putIfAbsent(r2, r0) java.util.Map r2 = (java.util.Map) r2 java.lang.Object r2 = com.google.common.base.MoreObjects.firstNonNull(r2, r0) java.util.Map r2 = (java.util.Map) r2 return r2 */ throw new UnsupportedOperationException("Method not decompiled: com.google.common.util.concurrent.CycleDetectingLockFactory.getOrCreateNodes(java.lang.Class):java.util.Map"); } @VisibleForTesting static <E extends Enum<E>> Map<E, LockGraphNode> createNodes(Class<E> cls) { EnumMap<K, V> newEnumMap = Maps.newEnumMap(cls); Enum[] enumArr = (Enum[]) cls.getEnumConstants(); int length = enumArr.length; ArrayList newArrayListWithCapacity = Lists.newArrayListWithCapacity(length); int i = 0; for (Enum enumR : enumArr) { LockGraphNode lockGraphNode = new LockGraphNode(getLockName(enumR)); newArrayListWithCapacity.add(lockGraphNode); newEnumMap.put(enumR, lockGraphNode); } for (int i2 = 1; i2 < length; i2++) { ((LockGraphNode) newArrayListWithCapacity.get(i2)).checkAcquiredLocks(Policies.THROW, newArrayListWithCapacity.subList(0, i2)); } while (i < length - 1) { i++; ((LockGraphNode) newArrayListWithCapacity.get(i)).checkAcquiredLocks(Policies.DISABLED, newArrayListWithCapacity.subList(i, length)); } return Collections.unmodifiableMap(newEnumMap); } private static String getLockName(Enum<?> enumR) { return enumR.getDeclaringClass().getSimpleName() + "." + enumR.name(); } @Beta public static final class WithExplicitOrdering<E extends Enum<E>> extends CycleDetectingLockFactory { private final Map<E, LockGraphNode> lockGraphNodes; @VisibleForTesting WithExplicitOrdering(Policy policy, Map<E, LockGraphNode> map) { super(policy); this.lockGraphNodes = map; } public ReentrantLock newReentrantLock(E e) { return newReentrantLock(e, false); } public ReentrantLock newReentrantLock(E e, boolean z) { if (this.policy == Policies.DISABLED) { return new ReentrantLock(z); } return new CycleDetectingReentrantLock(this.lockGraphNodes.get(e), z); } public ReentrantReadWriteLock newReentrantReadWriteLock(E e) { return newReentrantReadWriteLock(e, false); } public ReentrantReadWriteLock newReentrantReadWriteLock(E e, boolean z) { if (this.policy == Policies.DISABLED) { return new ReentrantReadWriteLock(z); } return new CycleDetectingReentrantReadWriteLock(this.lockGraphNodes.get(e), z); } } private CycleDetectingLockFactory(Policy policy2) { this.policy = (Policy) Preconditions.checkNotNull(policy2); } private static class ExampleStackTrace extends IllegalStateException { static final StackTraceElement[] EMPTY_STACK_TRACE = new StackTraceElement[0]; static final ImmutableSet<String> EXCLUDED_CLASS_NAMES = ImmutableSet.of(CycleDetectingLockFactory.class.getName(), ExampleStackTrace.class.getName(), LockGraphNode.class.getName()); ExampleStackTrace(LockGraphNode lockGraphNode, LockGraphNode lockGraphNode2) { super(lockGraphNode.getLockName() + " -> " + lockGraphNode2.getLockName()); StackTraceElement[] stackTrace = getStackTrace(); int length = stackTrace.length; int i = 0; while (i < length) { if (WithExplicitOrdering.class.getName().equals(stackTrace[i].getClassName())) { setStackTrace(EMPTY_STACK_TRACE); return; } else if (!EXCLUDED_CLASS_NAMES.contains(stackTrace[i].getClassName())) { setStackTrace((StackTraceElement[]) Arrays.copyOfRange(stackTrace, i, length)); return; } else { i++; } } } } @Beta public static final class PotentialDeadlockException extends ExampleStackTrace { private final ExampleStackTrace conflictingStackTrace; private PotentialDeadlockException(LockGraphNode lockGraphNode, LockGraphNode lockGraphNode2, ExampleStackTrace exampleStackTrace) { super(lockGraphNode, lockGraphNode2); this.conflictingStackTrace = exampleStackTrace; initCause(exampleStackTrace); } public ExampleStackTrace getConflictingStackTrace() { return this.conflictingStackTrace; } public String getMessage() { StringBuilder sb = new StringBuilder(super.getMessage()); for (Throwable th = this.conflictingStackTrace; th != null; th = th.getCause()) { sb.append(", "); sb.append(th.getMessage()); } return sb.toString(); } } private static class LockGraphNode { final Map<LockGraphNode, ExampleStackTrace> allowedPriorLocks = new MapMaker().weakKeys().makeMap(); final Map<LockGraphNode, PotentialDeadlockException> disallowedPriorLocks = new MapMaker().weakKeys().makeMap(); final String lockName; LockGraphNode(String str) { this.lockName = (String) Preconditions.checkNotNull(str); } /* access modifiers changed from: package-private */ public String getLockName() { return this.lockName; } /* access modifiers changed from: package-private */ public void checkAcquiredLocks(Policy policy, List<LockGraphNode> list) { int size = list.size(); for (int i = 0; i < size; i++) { checkAcquiredLock(policy, list.get(i)); } } /* access modifiers changed from: package-private */ public void checkAcquiredLock(Policy policy, LockGraphNode lockGraphNode) { Preconditions.checkState(this != lockGraphNode, "Attempted to acquire multiple locks with the same rank %s", (Object) lockGraphNode.getLockName()); if (!this.allowedPriorLocks.containsKey(lockGraphNode)) { PotentialDeadlockException potentialDeadlockException = this.disallowedPriorLocks.get(lockGraphNode); if (potentialDeadlockException != null) { policy.handlePotentialDeadlock(new PotentialDeadlockException(lockGraphNode, this, potentialDeadlockException.getConflictingStackTrace())); return; } ExampleStackTrace findPathTo = lockGraphNode.findPathTo(this, Sets.newIdentityHashSet()); if (findPathTo == null) { this.allowedPriorLocks.put(lockGraphNode, new ExampleStackTrace(lockGraphNode, this)); return; } PotentialDeadlockException potentialDeadlockException2 = new PotentialDeadlockException(lockGraphNode, this, findPathTo); this.disallowedPriorLocks.put(lockGraphNode, potentialDeadlockException2); policy.handlePotentialDeadlock(potentialDeadlockException2); } } @NullableDecl private ExampleStackTrace findPathTo(LockGraphNode lockGraphNode, Set<LockGraphNode> set) { if (!set.add(this)) { return null; } ExampleStackTrace exampleStackTrace = this.allowedPriorLocks.get(lockGraphNode); if (exampleStackTrace != null) { return exampleStackTrace; } for (Map.Entry next : this.allowedPriorLocks.entrySet()) { LockGraphNode lockGraphNode2 = (LockGraphNode) next.getKey(); ExampleStackTrace findPathTo = lockGraphNode2.findPathTo(lockGraphNode, set); if (findPathTo != null) { ExampleStackTrace exampleStackTrace2 = new ExampleStackTrace(lockGraphNode2, this); exampleStackTrace2.setStackTrace(((ExampleStackTrace) next.getValue()).getStackTrace()); exampleStackTrace2.initCause(findPathTo); return exampleStackTrace2; } } return null; } } /* access modifiers changed from: private */ public void aboutToAcquire(CycleDetectingLock cycleDetectingLock) { if (!cycleDetectingLock.isAcquiredByCurrentThread()) { ArrayList arrayList = acquiredLocks.get(); LockGraphNode lockGraphNode = cycleDetectingLock.getLockGraphNode(); lockGraphNode.checkAcquiredLocks(this.policy, arrayList); arrayList.add(lockGraphNode); } } /* access modifiers changed from: private */ public static void lockStateChanged(CycleDetectingLock cycleDetectingLock) { if (!cycleDetectingLock.isAcquiredByCurrentThread()) { ArrayList arrayList = acquiredLocks.get(); LockGraphNode lockGraphNode = cycleDetectingLock.getLockGraphNode(); for (int size = arrayList.size() - 1; size >= 0; size--) { if (arrayList.get(size) == lockGraphNode) { arrayList.remove(size); return; } } } } final class CycleDetectingReentrantLock extends ReentrantLock implements CycleDetectingLock { private final LockGraphNode lockGraphNode; private CycleDetectingReentrantLock(LockGraphNode lockGraphNode2, boolean z) { super(z); this.lockGraphNode = (LockGraphNode) Preconditions.checkNotNull(lockGraphNode2); } public LockGraphNode getLockGraphNode() { return this.lockGraphNode; } public boolean isAcquiredByCurrentThread() { return isHeldByCurrentThread(); } public void lock() { CycleDetectingLockFactory.this.aboutToAcquire(this); try { super.lock(); } finally { CycleDetectingLockFactory.lockStateChanged(this); } } public void lockInterruptibly() throws InterruptedException { CycleDetectingLockFactory.this.aboutToAcquire(this); try { super.lockInterruptibly(); } finally { CycleDetectingLockFactory.lockStateChanged(this); } } public boolean tryLock() { CycleDetectingLockFactory.this.aboutToAcquire(this); try { return super.tryLock(); } finally { CycleDetectingLockFactory.lockStateChanged(this); } } public boolean tryLock(long j, TimeUnit timeUnit) throws InterruptedException { CycleDetectingLockFactory.this.aboutToAcquire(this); try { return super.tryLock(j, timeUnit); } finally { CycleDetectingLockFactory.lockStateChanged(this); } } public void unlock() { try { super.unlock(); } finally { CycleDetectingLockFactory.lockStateChanged(this); } } } final class CycleDetectingReentrantReadWriteLock extends ReentrantReadWriteLock implements CycleDetectingLock { private final LockGraphNode lockGraphNode; private final CycleDetectingReentrantReadLock readLock; private final CycleDetectingReentrantWriteLock writeLock; private CycleDetectingReentrantReadWriteLock(LockGraphNode lockGraphNode2, boolean z) { super(z); this.readLock = new CycleDetectingReentrantReadLock(this); this.writeLock = new CycleDetectingReentrantWriteLock(this); this.lockGraphNode = (LockGraphNode) Preconditions.checkNotNull(lockGraphNode2); } public ReentrantReadWriteLock.ReadLock readLock() { return this.readLock; } public ReentrantReadWriteLock.WriteLock writeLock() { return this.writeLock; } public LockGraphNode getLockGraphNode() { return this.lockGraphNode; } public boolean isAcquiredByCurrentThread() { return isWriteLockedByCurrentThread() || getReadHoldCount() > 0; } } private class CycleDetectingReentrantReadLock extends ReentrantReadWriteLock.ReadLock { @Weak final CycleDetectingReentrantReadWriteLock readWriteLock; CycleDetectingReentrantReadLock(CycleDetectingReentrantReadWriteLock cycleDetectingReentrantReadWriteLock) { super(cycleDetectingReentrantReadWriteLock); this.readWriteLock = cycleDetectingReentrantReadWriteLock; } public void lock() { CycleDetectingLockFactory.this.aboutToAcquire(this.readWriteLock); try { super.lock(); } finally { CycleDetectingLockFactory.lockStateChanged(this.readWriteLock); } } public void lockInterruptibly() throws InterruptedException { CycleDetectingLockFactory.this.aboutToAcquire(this.readWriteLock); try { super.lockInterruptibly(); } finally { CycleDetectingLockFactory.lockStateChanged(this.readWriteLock); } } public boolean tryLock() { CycleDetectingLockFactory.this.aboutToAcquire(this.readWriteLock); try { return super.tryLock(); } finally { CycleDetectingLockFactory.lockStateChanged(this.readWriteLock); } } public boolean tryLock(long j, TimeUnit timeUnit) throws InterruptedException { CycleDetectingLockFactory.this.aboutToAcquire(this.readWriteLock); try { return super.tryLock(j, timeUnit); } finally { CycleDetectingLockFactory.lockStateChanged(this.readWriteLock); } } public void unlock() { try { super.unlock(); } finally { CycleDetectingLockFactory.lockStateChanged(this.readWriteLock); } } } private class CycleDetectingReentrantWriteLock extends ReentrantReadWriteLock.WriteLock { @Weak final CycleDetectingReentrantReadWriteLock readWriteLock; CycleDetectingReentrantWriteLock(CycleDetectingReentrantReadWriteLock cycleDetectingReentrantReadWriteLock) { super(cycleDetectingReentrantReadWriteLock); this.readWriteLock = cycleDetectingReentrantReadWriteLock; } public void lock() { CycleDetectingLockFactory.this.aboutToAcquire(this.readWriteLock); try { super.lock(); } finally { CycleDetectingLockFactory.lockStateChanged(this.readWriteLock); } } public void lockInterruptibly() throws InterruptedException { CycleDetectingLockFactory.this.aboutToAcquire(this.readWriteLock); try { super.lockInterruptibly(); } finally { CycleDetectingLockFactory.lockStateChanged(this.readWriteLock); } } public boolean tryLock() { CycleDetectingLockFactory.this.aboutToAcquire(this.readWriteLock); try { return super.tryLock(); } finally { CycleDetectingLockFactory.lockStateChanged(this.readWriteLock); } } public boolean tryLock(long j, TimeUnit timeUnit) throws InterruptedException { CycleDetectingLockFactory.this.aboutToAcquire(this.readWriteLock); try { return super.tryLock(j, timeUnit); } finally { CycleDetectingLockFactory.lockStateChanged(this.readWriteLock); } } public void unlock() { try { super.unlock(); } finally { CycleDetectingLockFactory.lockStateChanged(this.readWriteLock); } } } }
UTF-8
Java
21,444
java
CycleDetectingLockFactory.java
Java
[]
null
[]
package com.google.common.util.concurrent; import com.google.common.annotations.Beta; import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; import com.google.common.collect.MapMaker; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.google.errorprone.annotations.CanIgnoreReturnValue; import com.google.j2objc.annotations.Weak; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.EnumMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.logging.Level; import java.util.logging.Logger; import org.checkerframework.checker.nullness.compatqual.NullableDecl; @GwtIncompatible @CanIgnoreReturnValue @Beta public class CycleDetectingLockFactory { private static final ThreadLocal<ArrayList<LockGraphNode>> acquiredLocks = new ThreadLocal<ArrayList<LockGraphNode>>() { /* access modifiers changed from: protected */ public ArrayList<LockGraphNode> initialValue() { return Lists.newArrayListWithCapacity(3); } }; private static final ConcurrentMap<Class<? extends Enum>, Map<? extends Enum, LockGraphNode>> lockGraphNodesPerType = new MapMaker().weakKeys().makeMap(); /* access modifiers changed from: private */ public static final Logger logger = Logger.getLogger(CycleDetectingLockFactory.class.getName()); final Policy policy; private interface CycleDetectingLock { LockGraphNode getLockGraphNode(); boolean isAcquiredByCurrentThread(); } @Beta public enum Policies implements Policy { THROW { public void handlePotentialDeadlock(PotentialDeadlockException potentialDeadlockException) { throw potentialDeadlockException; } }, WARN { public void handlePotentialDeadlock(PotentialDeadlockException potentialDeadlockException) { CycleDetectingLockFactory.logger.log(Level.SEVERE, "Detected potential deadlock", potentialDeadlockException); } }, DISABLED { public void handlePotentialDeadlock(PotentialDeadlockException potentialDeadlockException) { } } } @Beta public interface Policy { void handlePotentialDeadlock(PotentialDeadlockException potentialDeadlockException); } public static CycleDetectingLockFactory newInstance(Policy policy2) { return new CycleDetectingLockFactory(policy2); } public ReentrantLock newReentrantLock(String str) { return newReentrantLock(str, false); } public ReentrantLock newReentrantLock(String str, boolean z) { return this.policy == Policies.DISABLED ? new ReentrantLock(z) : new CycleDetectingReentrantLock(new LockGraphNode(str), z); } public ReentrantReadWriteLock newReentrantReadWriteLock(String str) { return newReentrantReadWriteLock(str, false); } public ReentrantReadWriteLock newReentrantReadWriteLock(String str, boolean z) { return this.policy == Policies.DISABLED ? new ReentrantReadWriteLock(z) : new CycleDetectingReentrantReadWriteLock(new LockGraphNode(str), z); } public static <E extends Enum<E>> WithExplicitOrdering<E> newInstanceWithExplicitOrdering(Class<E> cls, Policy policy2) { Preconditions.checkNotNull(cls); Preconditions.checkNotNull(policy2); return new WithExplicitOrdering<>(policy2, getOrCreateNodes(cls)); } /* JADX WARNING: type inference failed for: r2v0, types: [java.lang.Class<? extends java.lang.Enum>, java.lang.Object, java.lang.Class] */ /* JADX WARNING: Unknown variable types count: 1 */ /* Code decompiled incorrectly, please refer to instructions dump. */ private static java.util.Map<? extends java.lang.Enum, com.google.common.util.concurrent.CycleDetectingLockFactory.LockGraphNode> getOrCreateNodes(java.lang.Class<? extends java.lang.Enum> r2) { /* java.util.concurrent.ConcurrentMap<java.lang.Class<? extends java.lang.Enum>, java.util.Map<? extends java.lang.Enum, com.google.common.util.concurrent.CycleDetectingLockFactory$LockGraphNode>> r0 = lockGraphNodesPerType java.lang.Object r0 = r0.get(r2) java.util.Map r0 = (java.util.Map) r0 if (r0 == 0) goto L_0x000b return r0 L_0x000b: java.util.Map r0 = createNodes(r2) java.util.concurrent.ConcurrentMap<java.lang.Class<? extends java.lang.Enum>, java.util.Map<? extends java.lang.Enum, com.google.common.util.concurrent.CycleDetectingLockFactory$LockGraphNode>> r1 = lockGraphNodesPerType java.lang.Object r2 = r1.putIfAbsent(r2, r0) java.util.Map r2 = (java.util.Map) r2 java.lang.Object r2 = com.google.common.base.MoreObjects.firstNonNull(r2, r0) java.util.Map r2 = (java.util.Map) r2 return r2 */ throw new UnsupportedOperationException("Method not decompiled: com.google.common.util.concurrent.CycleDetectingLockFactory.getOrCreateNodes(java.lang.Class):java.util.Map"); } @VisibleForTesting static <E extends Enum<E>> Map<E, LockGraphNode> createNodes(Class<E> cls) { EnumMap<K, V> newEnumMap = Maps.newEnumMap(cls); Enum[] enumArr = (Enum[]) cls.getEnumConstants(); int length = enumArr.length; ArrayList newArrayListWithCapacity = Lists.newArrayListWithCapacity(length); int i = 0; for (Enum enumR : enumArr) { LockGraphNode lockGraphNode = new LockGraphNode(getLockName(enumR)); newArrayListWithCapacity.add(lockGraphNode); newEnumMap.put(enumR, lockGraphNode); } for (int i2 = 1; i2 < length; i2++) { ((LockGraphNode) newArrayListWithCapacity.get(i2)).checkAcquiredLocks(Policies.THROW, newArrayListWithCapacity.subList(0, i2)); } while (i < length - 1) { i++; ((LockGraphNode) newArrayListWithCapacity.get(i)).checkAcquiredLocks(Policies.DISABLED, newArrayListWithCapacity.subList(i, length)); } return Collections.unmodifiableMap(newEnumMap); } private static String getLockName(Enum<?> enumR) { return enumR.getDeclaringClass().getSimpleName() + "." + enumR.name(); } @Beta public static final class WithExplicitOrdering<E extends Enum<E>> extends CycleDetectingLockFactory { private final Map<E, LockGraphNode> lockGraphNodes; @VisibleForTesting WithExplicitOrdering(Policy policy, Map<E, LockGraphNode> map) { super(policy); this.lockGraphNodes = map; } public ReentrantLock newReentrantLock(E e) { return newReentrantLock(e, false); } public ReentrantLock newReentrantLock(E e, boolean z) { if (this.policy == Policies.DISABLED) { return new ReentrantLock(z); } return new CycleDetectingReentrantLock(this.lockGraphNodes.get(e), z); } public ReentrantReadWriteLock newReentrantReadWriteLock(E e) { return newReentrantReadWriteLock(e, false); } public ReentrantReadWriteLock newReentrantReadWriteLock(E e, boolean z) { if (this.policy == Policies.DISABLED) { return new ReentrantReadWriteLock(z); } return new CycleDetectingReentrantReadWriteLock(this.lockGraphNodes.get(e), z); } } private CycleDetectingLockFactory(Policy policy2) { this.policy = (Policy) Preconditions.checkNotNull(policy2); } private static class ExampleStackTrace extends IllegalStateException { static final StackTraceElement[] EMPTY_STACK_TRACE = new StackTraceElement[0]; static final ImmutableSet<String> EXCLUDED_CLASS_NAMES = ImmutableSet.of(CycleDetectingLockFactory.class.getName(), ExampleStackTrace.class.getName(), LockGraphNode.class.getName()); ExampleStackTrace(LockGraphNode lockGraphNode, LockGraphNode lockGraphNode2) { super(lockGraphNode.getLockName() + " -> " + lockGraphNode2.getLockName()); StackTraceElement[] stackTrace = getStackTrace(); int length = stackTrace.length; int i = 0; while (i < length) { if (WithExplicitOrdering.class.getName().equals(stackTrace[i].getClassName())) { setStackTrace(EMPTY_STACK_TRACE); return; } else if (!EXCLUDED_CLASS_NAMES.contains(stackTrace[i].getClassName())) { setStackTrace((StackTraceElement[]) Arrays.copyOfRange(stackTrace, i, length)); return; } else { i++; } } } } @Beta public static final class PotentialDeadlockException extends ExampleStackTrace { private final ExampleStackTrace conflictingStackTrace; private PotentialDeadlockException(LockGraphNode lockGraphNode, LockGraphNode lockGraphNode2, ExampleStackTrace exampleStackTrace) { super(lockGraphNode, lockGraphNode2); this.conflictingStackTrace = exampleStackTrace; initCause(exampleStackTrace); } public ExampleStackTrace getConflictingStackTrace() { return this.conflictingStackTrace; } public String getMessage() { StringBuilder sb = new StringBuilder(super.getMessage()); for (Throwable th = this.conflictingStackTrace; th != null; th = th.getCause()) { sb.append(", "); sb.append(th.getMessage()); } return sb.toString(); } } private static class LockGraphNode { final Map<LockGraphNode, ExampleStackTrace> allowedPriorLocks = new MapMaker().weakKeys().makeMap(); final Map<LockGraphNode, PotentialDeadlockException> disallowedPriorLocks = new MapMaker().weakKeys().makeMap(); final String lockName; LockGraphNode(String str) { this.lockName = (String) Preconditions.checkNotNull(str); } /* access modifiers changed from: package-private */ public String getLockName() { return this.lockName; } /* access modifiers changed from: package-private */ public void checkAcquiredLocks(Policy policy, List<LockGraphNode> list) { int size = list.size(); for (int i = 0; i < size; i++) { checkAcquiredLock(policy, list.get(i)); } } /* access modifiers changed from: package-private */ public void checkAcquiredLock(Policy policy, LockGraphNode lockGraphNode) { Preconditions.checkState(this != lockGraphNode, "Attempted to acquire multiple locks with the same rank %s", (Object) lockGraphNode.getLockName()); if (!this.allowedPriorLocks.containsKey(lockGraphNode)) { PotentialDeadlockException potentialDeadlockException = this.disallowedPriorLocks.get(lockGraphNode); if (potentialDeadlockException != null) { policy.handlePotentialDeadlock(new PotentialDeadlockException(lockGraphNode, this, potentialDeadlockException.getConflictingStackTrace())); return; } ExampleStackTrace findPathTo = lockGraphNode.findPathTo(this, Sets.newIdentityHashSet()); if (findPathTo == null) { this.allowedPriorLocks.put(lockGraphNode, new ExampleStackTrace(lockGraphNode, this)); return; } PotentialDeadlockException potentialDeadlockException2 = new PotentialDeadlockException(lockGraphNode, this, findPathTo); this.disallowedPriorLocks.put(lockGraphNode, potentialDeadlockException2); policy.handlePotentialDeadlock(potentialDeadlockException2); } } @NullableDecl private ExampleStackTrace findPathTo(LockGraphNode lockGraphNode, Set<LockGraphNode> set) { if (!set.add(this)) { return null; } ExampleStackTrace exampleStackTrace = this.allowedPriorLocks.get(lockGraphNode); if (exampleStackTrace != null) { return exampleStackTrace; } for (Map.Entry next : this.allowedPriorLocks.entrySet()) { LockGraphNode lockGraphNode2 = (LockGraphNode) next.getKey(); ExampleStackTrace findPathTo = lockGraphNode2.findPathTo(lockGraphNode, set); if (findPathTo != null) { ExampleStackTrace exampleStackTrace2 = new ExampleStackTrace(lockGraphNode2, this); exampleStackTrace2.setStackTrace(((ExampleStackTrace) next.getValue()).getStackTrace()); exampleStackTrace2.initCause(findPathTo); return exampleStackTrace2; } } return null; } } /* access modifiers changed from: private */ public void aboutToAcquire(CycleDetectingLock cycleDetectingLock) { if (!cycleDetectingLock.isAcquiredByCurrentThread()) { ArrayList arrayList = acquiredLocks.get(); LockGraphNode lockGraphNode = cycleDetectingLock.getLockGraphNode(); lockGraphNode.checkAcquiredLocks(this.policy, arrayList); arrayList.add(lockGraphNode); } } /* access modifiers changed from: private */ public static void lockStateChanged(CycleDetectingLock cycleDetectingLock) { if (!cycleDetectingLock.isAcquiredByCurrentThread()) { ArrayList arrayList = acquiredLocks.get(); LockGraphNode lockGraphNode = cycleDetectingLock.getLockGraphNode(); for (int size = arrayList.size() - 1; size >= 0; size--) { if (arrayList.get(size) == lockGraphNode) { arrayList.remove(size); return; } } } } final class CycleDetectingReentrantLock extends ReentrantLock implements CycleDetectingLock { private final LockGraphNode lockGraphNode; private CycleDetectingReentrantLock(LockGraphNode lockGraphNode2, boolean z) { super(z); this.lockGraphNode = (LockGraphNode) Preconditions.checkNotNull(lockGraphNode2); } public LockGraphNode getLockGraphNode() { return this.lockGraphNode; } public boolean isAcquiredByCurrentThread() { return isHeldByCurrentThread(); } public void lock() { CycleDetectingLockFactory.this.aboutToAcquire(this); try { super.lock(); } finally { CycleDetectingLockFactory.lockStateChanged(this); } } public void lockInterruptibly() throws InterruptedException { CycleDetectingLockFactory.this.aboutToAcquire(this); try { super.lockInterruptibly(); } finally { CycleDetectingLockFactory.lockStateChanged(this); } } public boolean tryLock() { CycleDetectingLockFactory.this.aboutToAcquire(this); try { return super.tryLock(); } finally { CycleDetectingLockFactory.lockStateChanged(this); } } public boolean tryLock(long j, TimeUnit timeUnit) throws InterruptedException { CycleDetectingLockFactory.this.aboutToAcquire(this); try { return super.tryLock(j, timeUnit); } finally { CycleDetectingLockFactory.lockStateChanged(this); } } public void unlock() { try { super.unlock(); } finally { CycleDetectingLockFactory.lockStateChanged(this); } } } final class CycleDetectingReentrantReadWriteLock extends ReentrantReadWriteLock implements CycleDetectingLock { private final LockGraphNode lockGraphNode; private final CycleDetectingReentrantReadLock readLock; private final CycleDetectingReentrantWriteLock writeLock; private CycleDetectingReentrantReadWriteLock(LockGraphNode lockGraphNode2, boolean z) { super(z); this.readLock = new CycleDetectingReentrantReadLock(this); this.writeLock = new CycleDetectingReentrantWriteLock(this); this.lockGraphNode = (LockGraphNode) Preconditions.checkNotNull(lockGraphNode2); } public ReentrantReadWriteLock.ReadLock readLock() { return this.readLock; } public ReentrantReadWriteLock.WriteLock writeLock() { return this.writeLock; } public LockGraphNode getLockGraphNode() { return this.lockGraphNode; } public boolean isAcquiredByCurrentThread() { return isWriteLockedByCurrentThread() || getReadHoldCount() > 0; } } private class CycleDetectingReentrantReadLock extends ReentrantReadWriteLock.ReadLock { @Weak final CycleDetectingReentrantReadWriteLock readWriteLock; CycleDetectingReentrantReadLock(CycleDetectingReentrantReadWriteLock cycleDetectingReentrantReadWriteLock) { super(cycleDetectingReentrantReadWriteLock); this.readWriteLock = cycleDetectingReentrantReadWriteLock; } public void lock() { CycleDetectingLockFactory.this.aboutToAcquire(this.readWriteLock); try { super.lock(); } finally { CycleDetectingLockFactory.lockStateChanged(this.readWriteLock); } } public void lockInterruptibly() throws InterruptedException { CycleDetectingLockFactory.this.aboutToAcquire(this.readWriteLock); try { super.lockInterruptibly(); } finally { CycleDetectingLockFactory.lockStateChanged(this.readWriteLock); } } public boolean tryLock() { CycleDetectingLockFactory.this.aboutToAcquire(this.readWriteLock); try { return super.tryLock(); } finally { CycleDetectingLockFactory.lockStateChanged(this.readWriteLock); } } public boolean tryLock(long j, TimeUnit timeUnit) throws InterruptedException { CycleDetectingLockFactory.this.aboutToAcquire(this.readWriteLock); try { return super.tryLock(j, timeUnit); } finally { CycleDetectingLockFactory.lockStateChanged(this.readWriteLock); } } public void unlock() { try { super.unlock(); } finally { CycleDetectingLockFactory.lockStateChanged(this.readWriteLock); } } } private class CycleDetectingReentrantWriteLock extends ReentrantReadWriteLock.WriteLock { @Weak final CycleDetectingReentrantReadWriteLock readWriteLock; CycleDetectingReentrantWriteLock(CycleDetectingReentrantReadWriteLock cycleDetectingReentrantReadWriteLock) { super(cycleDetectingReentrantReadWriteLock); this.readWriteLock = cycleDetectingReentrantReadWriteLock; } public void lock() { CycleDetectingLockFactory.this.aboutToAcquire(this.readWriteLock); try { super.lock(); } finally { CycleDetectingLockFactory.lockStateChanged(this.readWriteLock); } } public void lockInterruptibly() throws InterruptedException { CycleDetectingLockFactory.this.aboutToAcquire(this.readWriteLock); try { super.lockInterruptibly(); } finally { CycleDetectingLockFactory.lockStateChanged(this.readWriteLock); } } public boolean tryLock() { CycleDetectingLockFactory.this.aboutToAcquire(this.readWriteLock); try { return super.tryLock(); } finally { CycleDetectingLockFactory.lockStateChanged(this.readWriteLock); } } public boolean tryLock(long j, TimeUnit timeUnit) throws InterruptedException { CycleDetectingLockFactory.this.aboutToAcquire(this.readWriteLock); try { return super.tryLock(j, timeUnit); } finally { CycleDetectingLockFactory.lockStateChanged(this.readWriteLock); } } public void unlock() { try { super.unlock(); } finally { CycleDetectingLockFactory.lockStateChanged(this.readWriteLock); } } } }
21,444
0.647267
0.64363
517
40.477757
38.019108
232
false
false
0
0
0
0
0
0
0.529981
false
false
10