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
71cf7f74ae2a7e01be4ab1e8bf8d193e3e75b876
31,722,628,458,556
bace066eb62278ca6a4879c3e20183b58bec99d6
/src/org/waspec/exercise3.java
7b9be48d33bef8c1c415d024ba63d360195730b1
[]
no_license
pumaatlarge/exericesOnHappyJavaClass
https://github.com/pumaatlarge/exericesOnHappyJavaClass
888ce1b8f22f7de28d3d3828be4dd6b2091e73da
b5aa969141bf26800a508fed0e65c6eb6e0b0028
refs/heads/master
2021-01-16T19:18:23.778000
2015-02-25T06:55:28
2015-02-25T06:55:28
31,301,253
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.waspec; /** * Created by AlienLi on 2015-02-24. */ public class exercise3 { }
UTF-8
Java
93
java
exercise3.java
Java
[ { "context": "package org.waspec;\n\n/**\n * Created by AlienLi on 2015-02-24.\n */\npublic class exercise3 {\n}\n", "end": 46, "score": 0.9975411891937256, "start": 39, "tag": "NAME", "value": "AlienLi" } ]
null
[]
package org.waspec; /** * Created by AlienLi on 2015-02-24. */ public class exercise3 { }
93
0.666667
0.569892
7
12.285714
13.06811
36
false
false
0
0
0
0
0
0
0.142857
false
false
0
85e552b2f672fcb564c1a81e122d11ae96378509
27,565,100,111,585
664ac00310dca0cc9be5135c7dd25f04879e47f1
/src/main/java/me/newt/multiplier/util/UtilBook.java
d13a69a2f72905883964adfd6d4192daa610c745
[]
no_license
JustDJplease/ExperienceBooster
https://github.com/JustDJplease/ExperienceBooster
de41f3f96ce1f7b7215bad16b8c35f2079e6105d
eda30be3558c474d140f81b884029452b0bb858b
refs/heads/master
2021-04-09T10:27:13.782000
2020-08-25T12:11:25
2020-08-25T12:11:25
125,271,127
2
1
null
false
2020-08-16T11:05:37
2018-03-14T20:42:04
2020-08-16T10:53:46
2020-08-16T10:53:44
53
0
2
2
Java
false
false
package me.newt.multiplier.util; import me.newt.multiplier.Multiplier; import me.newt.multiplier.MultiplierPlugin; import me.newt.multiplier.messages.MessagesAPI; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.ComponentBuilder; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.BookMeta; import java.util.ArrayList; import java.util.List; import java.util.UUID; public class UtilBook { private final MessagesAPI msg; /** * Constructor. * @param multiplierPlugin Instance of the main class. */ public UtilBook(MultiplierPlugin multiplierPlugin) { this.msg = multiplierPlugin.getMessagesAPI(); } /** * Get a book {@link ItemStack} to show to a player. * @param multipliers The list of multipliers from this player. * @param sessionID Player session ID. * @return Book item. */ public ItemStack getBook(List<Multiplier> multipliers, UUID sessionID) { ItemStack book = new ItemStack(Material.WRITTEN_BOOK, 1); BookMeta bookMeta = (BookMeta) book.getItemMeta(); assert bookMeta != null : "Could not fetch book metadata. Something is seriously broken."; // Patch for *Invalid Book Tag* issue since 1.15: bookMeta.setTitle("NULL"); bookMeta.setAuthor("NULL"); for (BaseComponent[] page : getPages(multipliers, sessionID.toString())) { bookMeta.spigot().addPage(page); } book.setItemMeta(bookMeta); return book; } /** * Generate pages from a list of multipliers. * @param multipliers List of multipliers. * @param sessionID Player session ID. * @return Generated pages. */ private List<BaseComponent[]> getPages(List<Multiplier> multipliers, String sessionID) { List<BaseComponent[]> pages = new ArrayList<>(); ComponentBuilder builder = new ComponentBuilder(); builder.appendLegacy(msg.get("book_title") + "\n"); builder.appendLegacy(msg.get("book_description") + "\n\n"); builder.bold(false); builder.appendLegacy(msg.get("book_header") + "\n"); int size = multipliers.size(); if (size == 0) { builder.appendLegacy(msg.get("book_no_multipliers")); builder.bold(false); pages.add(builder.create()); return pages; } if (size <= 3) { builder.append(multipliers.get(0).getMultiplierAsComponent(msg, sessionID)); if (size > 1) builder.append(multipliers.get(1).getMultiplierAsComponent(msg, sessionID)); if (size > 2) builder.append(multipliers.get(2).getMultiplierAsComponent(msg, sessionID)); pages.add(builder.create()); return pages; } else { String nextPage = msg.get("book_next_page"); builder.append(multipliers.get(0).getMultiplierAsComponent(msg, sessionID)); builder.append(multipliers.get(1).getMultiplierAsComponent(msg, sessionID)); builder.append(multipliers.get(2).getMultiplierAsComponent(msg, sessionID)); builder.appendLegacy("\n" + nextPage); pages.add(builder.create()); builder = new ComponentBuilder(); int onPage = 0; for (int shown = 3; shown <= size; shown++) { if (onPage == 5) { builder.appendLegacy("\n" + nextPage); pages.add(builder.create()); builder = new ComponentBuilder(); onPage = 0; } builder.append(multipliers.get(shown).getMultiplierAsComponent(msg, sessionID)); onPage++; } pages.add(builder.create()); return pages; } } }
UTF-8
Java
3,847
java
UtilBook.java
Java
[]
null
[]
package me.newt.multiplier.util; import me.newt.multiplier.Multiplier; import me.newt.multiplier.MultiplierPlugin; import me.newt.multiplier.messages.MessagesAPI; import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.ComponentBuilder; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.BookMeta; import java.util.ArrayList; import java.util.List; import java.util.UUID; public class UtilBook { private final MessagesAPI msg; /** * Constructor. * @param multiplierPlugin Instance of the main class. */ public UtilBook(MultiplierPlugin multiplierPlugin) { this.msg = multiplierPlugin.getMessagesAPI(); } /** * Get a book {@link ItemStack} to show to a player. * @param multipliers The list of multipliers from this player. * @param sessionID Player session ID. * @return Book item. */ public ItemStack getBook(List<Multiplier> multipliers, UUID sessionID) { ItemStack book = new ItemStack(Material.WRITTEN_BOOK, 1); BookMeta bookMeta = (BookMeta) book.getItemMeta(); assert bookMeta != null : "Could not fetch book metadata. Something is seriously broken."; // Patch for *Invalid Book Tag* issue since 1.15: bookMeta.setTitle("NULL"); bookMeta.setAuthor("NULL"); for (BaseComponent[] page : getPages(multipliers, sessionID.toString())) { bookMeta.spigot().addPage(page); } book.setItemMeta(bookMeta); return book; } /** * Generate pages from a list of multipliers. * @param multipliers List of multipliers. * @param sessionID Player session ID. * @return Generated pages. */ private List<BaseComponent[]> getPages(List<Multiplier> multipliers, String sessionID) { List<BaseComponent[]> pages = new ArrayList<>(); ComponentBuilder builder = new ComponentBuilder(); builder.appendLegacy(msg.get("book_title") + "\n"); builder.appendLegacy(msg.get("book_description") + "\n\n"); builder.bold(false); builder.appendLegacy(msg.get("book_header") + "\n"); int size = multipliers.size(); if (size == 0) { builder.appendLegacy(msg.get("book_no_multipliers")); builder.bold(false); pages.add(builder.create()); return pages; } if (size <= 3) { builder.append(multipliers.get(0).getMultiplierAsComponent(msg, sessionID)); if (size > 1) builder.append(multipliers.get(1).getMultiplierAsComponent(msg, sessionID)); if (size > 2) builder.append(multipliers.get(2).getMultiplierAsComponent(msg, sessionID)); pages.add(builder.create()); return pages; } else { String nextPage = msg.get("book_next_page"); builder.append(multipliers.get(0).getMultiplierAsComponent(msg, sessionID)); builder.append(multipliers.get(1).getMultiplierAsComponent(msg, sessionID)); builder.append(multipliers.get(2).getMultiplierAsComponent(msg, sessionID)); builder.appendLegacy("\n" + nextPage); pages.add(builder.create()); builder = new ComponentBuilder(); int onPage = 0; for (int shown = 3; shown <= size; shown++) { if (onPage == 5) { builder.appendLegacy("\n" + nextPage); pages.add(builder.create()); builder = new ComponentBuilder(); onPage = 0; } builder.append(multipliers.get(shown).getMultiplierAsComponent(msg, sessionID)); onPage++; } pages.add(builder.create()); return pages; } } }
3,847
0.617624
0.612425
101
37.089108
27.091373
102
false
false
0
0
0
0
0
0
0.663366
false
false
0
c6382ac791bcaf80f9d54e13aa167a949dc2c7c9
25,829,933,344,107
74cc798bdc0d5ae4cba31aa29ee17a7ca40545ca
/spring/SpringBasic/src/test/java/ccc/spring/knights/autowired/KnightTest.java
29cc903388b20dddc3913fd2adee910bbde22a8b
[]
no_license
chen2526264/A_GitRepository
https://github.com/chen2526264/A_GitRepository
2cfd5bc9c6fc4def55a0acbdc9d6a5d733b460bb
f61cc202a75b10f323d21e354abe0ce039c27b29
refs/heads/master
2018-12-21T07:21:45.274000
2018-12-17T00:59:23
2018-12-17T00:59:23
50,508,416
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ccc.spring.knights.autowired; import org.junit.Test; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.beans.factory.xml.XmlBeanFactory; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; /** * @author chenjiong * @date 2018/4/21 21:50 */ public class KnightTest { /** * 该方法执行会失败,可能原因是BeanFactory不能自动装配 */ // @Test public void testXmlBeanFactory() { Resource res = new ClassPathResource("knights/autowired/knights_autowired.xml"); XmlBeanFactory factory = new XmlBeanFactory(res); Knight knight = factory.getBean("knight", Knight.class); knight.embarkOnQuest(); } /** * 该方法执行会失败,可能原因是BeanFactory不能自动装配 */ // @Test public void testDefaultListableBeanFactory() { Resource res = new ClassPathResource("knights/autowired/knights_autowired.xml"); DefaultListableBeanFactory factory = new DefaultListableBeanFactory(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(factory); reader.loadBeanDefinitions(res); Knight knight = factory.getBean("knight", Knight.class); knight.embarkOnQuest(); } @Test public void testClassPathXmlApplicationContext() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("knights/autowired/knights_autowired.xml"); Knight knight = (Knight) context.getBean("knight"); // Knight knight = context.getBean("knight", Knight.class); knight.embarkOnQuest(); } }
UTF-8
Java
1,833
java
KnightTest.java
Java
[ { "context": ".springframework.core.io.Resource;\n\n/**\n * @author chenjiong\n * @date 2018/4/21 21:50\n */\npublic class KnightT", "end": 470, "score": 0.9995948672294617, "start": 461, "tag": "USERNAME", "value": "chenjiong" } ]
null
[]
package ccc.spring.knights.autowired; import org.junit.Test; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.beans.factory.xml.XmlBeanFactory; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; /** * @author chenjiong * @date 2018/4/21 21:50 */ public class KnightTest { /** * 该方法执行会失败,可能原因是BeanFactory不能自动装配 */ // @Test public void testXmlBeanFactory() { Resource res = new ClassPathResource("knights/autowired/knights_autowired.xml"); XmlBeanFactory factory = new XmlBeanFactory(res); Knight knight = factory.getBean("knight", Knight.class); knight.embarkOnQuest(); } /** * 该方法执行会失败,可能原因是BeanFactory不能自动装配 */ // @Test public void testDefaultListableBeanFactory() { Resource res = new ClassPathResource("knights/autowired/knights_autowired.xml"); DefaultListableBeanFactory factory = new DefaultListableBeanFactory(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(factory); reader.loadBeanDefinitions(res); Knight knight = factory.getBean("knight", Knight.class); knight.embarkOnQuest(); } @Test public void testClassPathXmlApplicationContext() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("knights/autowired/knights_autowired.xml"); Knight knight = (Knight) context.getBean("knight"); // Knight knight = context.getBean("knight", Knight.class); knight.embarkOnQuest(); } }
1,833
0.727895
0.72162
48
35.520832
30.67164
127
false
false
0
0
0
0
0
0
0.520833
false
false
0
161f0210d906bfd467a2cf4b24ab670df3b9a4fd
21,182,778,746,174
96d81d61aa12418bf787e6a7b4a9704fe0b9a192
/src/PADPila.java
1893018d2fc039b8659c889ea3de9b9be6805955
[]
no_license
carlosescor2199/EjercicioPilas
https://github.com/carlosescor2199/EjercicioPilas
37411a44df42a7413479a5b457f5a9bff515f599
cde1ed314c1a2d67547439bb9015c95d5eb2f1e3
refs/heads/master
2023-01-10T01:15:38.243000
2020-11-06T00:59:46
2020-11-06T00:59:46
310,455,177
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class PADPila { Object pila1[]; int cima=-1; public PADPila(int size) { pila1 = new Object[size]; } public int apilar(Object o){ if(cima>=pila1.length-1){ System.out.println("la pila está llena"); } else { cima+=1; pila1[cima] = o; } return cima; } public Object desapilar(){ Object object = null; if(cima==-1){ System.out.println("La pila esta vacia"); }else{ object = pila1[cima]; pila1[cima]=null; cima-=1; } return object; } public void ver(){ for(int i = pila1.length-1; i>=0; i--){ System.out.println("Datos de la pila: "+pila1[i]); } } public int obtenerTamano() { return pila1.length; } }
UTF-8
Java
858
java
PADPila.java
Java
[]
null
[]
public class PADPila { Object pila1[]; int cima=-1; public PADPila(int size) { pila1 = new Object[size]; } public int apilar(Object o){ if(cima>=pila1.length-1){ System.out.println("la pila está llena"); } else { cima+=1; pila1[cima] = o; } return cima; } public Object desapilar(){ Object object = null; if(cima==-1){ System.out.println("La pila esta vacia"); }else{ object = pila1[cima]; pila1[cima]=null; cima-=1; } return object; } public void ver(){ for(int i = pila1.length-1; i>=0; i--){ System.out.println("Datos de la pila: "+pila1[i]); } } public int obtenerTamano() { return pila1.length; } }
858
0.476079
0.45741
41
19.926828
15.839731
62
false
false
0
0
0
0
0
0
0.414634
false
false
0
949d8cb69b46831805e8cd02f5e6bad09da46961
22,703,197,190,944
ca030864a3a1c24be6b9d1802c2353da4ca0d441
/classes7.dex_source_from_JADX/com/facebook/debug/debugoverlay/DebugOverlayTagPrefKeys.java
3af870cd68f7ef5dd21207a96349580f12e31b35
[]
no_license
pxson001/facebook-app
https://github.com/pxson001/facebook-app
87aa51e29195eeaae69adeb30219547f83a5b7b1
640630f078980f9818049625ebc42569c67c69f7
refs/heads/master
2020-04-07T20:36:45.758000
2018-03-07T09:04:57
2018-03-07T09:04:57
124,208,458
4
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.facebook.debug.debugoverlay; import com.facebook.prefs.shared.PrefKey; import com.facebook.prefs.shared.SharedPrefKeys; /* compiled from: sync_check_server_response_received */ public class DebugOverlayTagPrefKeys { private static final PrefKey f2585a = ((PrefKey) SharedPrefKeys.a.a("debugoverlay/")); public static PrefKey m2975a(DebugOverlayTag debugOverlayTag) { return (PrefKey) f2585a.a(debugOverlayTag.f2582a); } }
UTF-8
Java
457
java
DebugOverlayTagPrefKeys.java
Java
[]
null
[]
package com.facebook.debug.debugoverlay; import com.facebook.prefs.shared.PrefKey; import com.facebook.prefs.shared.SharedPrefKeys; /* compiled from: sync_check_server_response_received */ public class DebugOverlayTagPrefKeys { private static final PrefKey f2585a = ((PrefKey) SharedPrefKeys.a.a("debugoverlay/")); public static PrefKey m2975a(DebugOverlayTag debugOverlayTag) { return (PrefKey) f2585a.a(debugOverlayTag.f2582a); } }
457
0.768053
0.733042
13
34.153847
29.061861
90
false
false
0
0
0
0
0
0
0.384615
false
false
0
c46104c5e06363843f7aa33ca8880837c998a76d
19,189,913,916,556
53adc17bed6a61b832323dd11ad201dea61a0364
/webApplication/src/main/java/com/frame/web/service/AWSauthServiceImpl.java
bc8944e52275c0c7619600846a8a1509f31b70b3
[]
no_license
akon3585/SpringBootCloudFramework
https://github.com/akon3585/SpringBootCloudFramework
39165dbe1a69370277355b88acfef9a73b3ab941
661474a97e63c9d23b902d64c871a4772e5d2077
refs/heads/master
2022-04-09T21:01:40.158000
2020-02-17T17:48:21
2020-02-17T17:48:21
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * @author: Chen * @date: Jan 10, 2020 */ package com.frame.web.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.amazonaws.auth.AWSCredentialsProvider; import com.amazonaws.auth.ClasspathPropertiesFileCredentialsProvider; import com.frame.config.AwsConfiguration; /** * @author Chen * @date Jan 10, 2020 * @description AWSauthServiceImpl.java */ @Service public class AWSauthServiceImpl implements AWSauthService{ @Autowired private AwsConfiguration config; public AWSCredentialsProvider getCredentialProvider() { if (config.isLocal()) { return new ClasspathPropertiesFileCredentialsProvider(config.getCredentialFile()); } else { // It will be controlled by IAM role in aws。 return null; } } }
UTF-8
Java
839
java
AWSauthServiceImpl.java
Java
[ { "context": "/**\n * @author: Chen\n * @date: Jan 10, 2020\n */\npackage com.frame.we", "end": 20, "score": 0.9995179176330566, "start": 16, "tag": "NAME", "value": "Chen" }, { "context": "com.frame.config.AwsConfiguration;\n\n/**\n * @author Chen\n * @date Jan 10, 2020\n * @description AWSauthSe", "end": 375, "score": 0.9930217862129211, "start": 371, "tag": "NAME", "value": "Chen" } ]
null
[]
/** * @author: Chen * @date: Jan 10, 2020 */ package com.frame.web.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.amazonaws.auth.AWSCredentialsProvider; import com.amazonaws.auth.ClasspathPropertiesFileCredentialsProvider; import com.frame.config.AwsConfiguration; /** * @author Chen * @date Jan 10, 2020 * @description AWSauthServiceImpl.java */ @Service public class AWSauthServiceImpl implements AWSauthService{ @Autowired private AwsConfiguration config; public AWSCredentialsProvider getCredentialProvider() { if (config.isLocal()) { return new ClasspathPropertiesFileCredentialsProvider(config.getCredentialFile()); } else { // It will be controlled by IAM role in aws。 return null; } } }
839
0.747909
0.733572
35
22.914286
23.650274
85
false
false
0
0
0
0
0
0
0.8
false
false
0
6c2b294cb8ae64f33961a3cf87c7d48c4fa387fd
22,127,671,529,885
7cb5770a84f3981485f7fb97bac882d468e07638
/src/threads/task1/task1/Car.java
1124e24fe9b247dac1798e4eb497f44483739728
[]
no_license
valkhrystodorova/CB_Pro_Threads
https://github.com/valkhrystodorova/CB_Pro_Threads
850c501e16c77edae229d06957b6e516895a1b6a
150b1b292186f9d75e3b12c0baa7d888daa307ac
refs/heads/master
2023-03-07T15:56:40.469000
2021-03-01T15:35:47
2021-03-01T15:35:47
341,895,939
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package threads.task1.task1; public class Car { private String mark; public Car(String mark) { this.mark = mark; } public String getMark() { return mark; } public void goCar() { System.out.println(mark + " go."); } public void stopCar() { System.out.println(mark + " stop."); } }
UTF-8
Java
354
java
Car.java
Java
[]
null
[]
package threads.task1.task1; public class Car { private String mark; public Car(String mark) { this.mark = mark; } public String getMark() { return mark; } public void goCar() { System.out.println(mark + " go."); } public void stopCar() { System.out.println(mark + " stop."); } }
354
0.545198
0.539548
21
15.809524
14.304908
44
false
false
0
0
0
0
0
0
0.285714
false
false
0
480d8ff14abc69646f27faa095e440a10902444c
21,955,872,824,919
7177430d6f4d1deee8441ffbe8fe49168552649f
/Ch07_Arrays_and_ArrayLists/Ex07_21_TurtleGraphics.java
d54cf84750e792382bf8d91b81a8e49496b8e5bb
[]
no_license
daviduntalan/JHTP9e
https://github.com/daviduntalan/JHTP9e
0015b7ae88aa092cca4db869d5a0acfe5231815f
b47911905be02293226e9a77948f0f019cdac138
refs/heads/master
2023-01-29T10:51:23.240000
2020-12-08T09:21:16
2020-12-08T09:21:16
276,873,233
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Ch07_Arrays_and_ArrayLists; import java.util.Arrays; /** * Turtle Graphics. The Logo language made the concept of turtle graphics famous. Imagine * a mechanical turtle that walks around the room under the control of a Java application. The turtle * holds a pen in one of two positions, up or down. While the pen is down, the turtle traces out shapes * as it moves, and while the pen is up, the turtle moves about freely without writing anything. In this * problem, you’ll simulate the operation of the turtle and create a computerized sketchpad. * * Use a 20-by-20 array floor that’s initialized to zeros. Read commands from an array that contains * them. Keep track of the current position of the turtle at all times and whether the pen is currently * up or down. Assume that the turtle always starts at position (0, 0) of the floor with its pen * up. The set of turtle commands your application must process are shown in Fig. 7.29. * * Command Meaning * 1 Pen up * 2 Pen down * 3 Turn right * 4 Turn left * 5, 10 Move forward 10 spaces (replace 10 for a different number of spaces) * 6 Display the 20-by-20 array * 7 Turn up * 8 Turn down * 9 End of data (sentinel) * * Suppose that the turtle is somewhere near the center of the floor. The following “program” * would draw and display a 12-by-12 square, leaving the pen in the up position: * * PEN_UP, * DOWN, * MOVE, 5, * RIGHT, * MOVE, 4, * PEN_DOWN, * RIGHT, * MOVE, 12, * DOWN, * MOVE, 12, * LEFT, * MOVE, 12, * UP, * MOVE, 12, * PEN_UP, * DISPLAY, * END * * As the turtle moves with the pen down, set the appropriate elements of array floor to 1s.When the * 6 command (display the array) is given, wherever there’s a 1 in the array, display an asterisk or any * character you choose. Wherever there’s a 0, display a blank. * Write an application to implement the turtle graphics capabilities discussed here.Write several * turtle graphics programs to draw interesting shapes. Add other commands to increase the power of * your turtle graphics language. */ public class Ex07_21_TurtleGraphics { static class Turtle { public static int footprint; public static int turns; } static int[][] floor = new int[20][20]; final static int SPACE = 0; final static int STAR = 1; final static int PEN_UP = SPACE; final static int PEN_DOWN = STAR; final static int RIGHT = 3; final static int LEFT = 4; final static int MOVE = 5; /* ex: 5,10 - move forward 10 spaces */ final static int DISPLAY = 6; /* display the 20x20 array */ final static int UP = 7; final static int DOWN = 8; final static int END = 9; /* end of data (sentinel) */ public static void main(String[] args) { for (int y = 0; y < floor.length; ++y) { Arrays.fill(floor[y], SPACE); /* initialize to zeros */ } System.out.println("Starting at coordinate position (row: 0 col: 0):"); int[] commands = new int[] { PEN_UP, DOWN, MOVE, 5, RIGHT, MOVE, 4, PEN_DOWN, // pen down RIGHT, // direction: turn right MOVE, 12, // move 12 spaces DOWN, // direction: turn down MOVE, 12, // move 12 spaces LEFT, // direction: turn left MOVE, 12, // move 12 spaces UP, // direction: turn up MOVE, 12, // move 12 spaces PEN_UP, // pen up DISPLAY, // display floor END // end command reading }; int row = 0; int col = 0; /* Read commands from an array that contains them. */ for (int index = 0; index < commands.length; ++index) { switch ( commands[index] ) { case PEN_UP: Turtle.footprint = SPACE; break; case PEN_DOWN: Turtle.footprint = STAR; break; case UP : Turtle.turns = UP; break; case DOWN : Turtle.turns = DOWN; break; case LEFT : Turtle.turns = LEFT; break; case RIGHT: Turtle.turns = RIGHT; break; case MOVE: int numberOfMoves = commands[ ++index ]; for (int moves = 0; moves < numberOfMoves; ++moves) { switch (Turtle.turns) { case UP : --row; break; case DOWN : ++row; break; case LEFT : --col; break; case RIGHT: ++col; break; } /* validate moves before executing commands */ if (row < 0) { ++row; System.err.println("negative row is out of bound"); break; } if (col < 0) { ++col; System.err.println("negative col is out of bound"); break; } if (row == floor.length) { --row; System.err.println("overshoot row is out of bound"); break; } if (col == floor[0].length) { --col; System.err.println("overshoot col is out of bound"); break; } floor[row][col] = Turtle.footprint; } break; case DISPLAY: displayTurtleFootprints(); break; case END: index = commands.length; break; } // end of switch } // end of for loop } private static void displayTurtleFootprints() { for (int y = 0; y < floor.length; ++y) { for (int x = 0; x < floor[y].length; ++x) System.out.printf("[%c]", floor[y][x] == STAR ? '*' : ' '); System.out.println(); } } } // end of class Ex07_21_TurtleGraphics
UTF-8
Java
6,067
java
Ex07_21_TurtleGraphics.java
Java
[]
null
[]
package Ch07_Arrays_and_ArrayLists; import java.util.Arrays; /** * Turtle Graphics. The Logo language made the concept of turtle graphics famous. Imagine * a mechanical turtle that walks around the room under the control of a Java application. The turtle * holds a pen in one of two positions, up or down. While the pen is down, the turtle traces out shapes * as it moves, and while the pen is up, the turtle moves about freely without writing anything. In this * problem, you’ll simulate the operation of the turtle and create a computerized sketchpad. * * Use a 20-by-20 array floor that’s initialized to zeros. Read commands from an array that contains * them. Keep track of the current position of the turtle at all times and whether the pen is currently * up or down. Assume that the turtle always starts at position (0, 0) of the floor with its pen * up. The set of turtle commands your application must process are shown in Fig. 7.29. * * Command Meaning * 1 Pen up * 2 Pen down * 3 Turn right * 4 Turn left * 5, 10 Move forward 10 spaces (replace 10 for a different number of spaces) * 6 Display the 20-by-20 array * 7 Turn up * 8 Turn down * 9 End of data (sentinel) * * Suppose that the turtle is somewhere near the center of the floor. The following “program” * would draw and display a 12-by-12 square, leaving the pen in the up position: * * PEN_UP, * DOWN, * MOVE, 5, * RIGHT, * MOVE, 4, * PEN_DOWN, * RIGHT, * MOVE, 12, * DOWN, * MOVE, 12, * LEFT, * MOVE, 12, * UP, * MOVE, 12, * PEN_UP, * DISPLAY, * END * * As the turtle moves with the pen down, set the appropriate elements of array floor to 1s.When the * 6 command (display the array) is given, wherever there’s a 1 in the array, display an asterisk or any * character you choose. Wherever there’s a 0, display a blank. * Write an application to implement the turtle graphics capabilities discussed here.Write several * turtle graphics programs to draw interesting shapes. Add other commands to increase the power of * your turtle graphics language. */ public class Ex07_21_TurtleGraphics { static class Turtle { public static int footprint; public static int turns; } static int[][] floor = new int[20][20]; final static int SPACE = 0; final static int STAR = 1; final static int PEN_UP = SPACE; final static int PEN_DOWN = STAR; final static int RIGHT = 3; final static int LEFT = 4; final static int MOVE = 5; /* ex: 5,10 - move forward 10 spaces */ final static int DISPLAY = 6; /* display the 20x20 array */ final static int UP = 7; final static int DOWN = 8; final static int END = 9; /* end of data (sentinel) */ public static void main(String[] args) { for (int y = 0; y < floor.length; ++y) { Arrays.fill(floor[y], SPACE); /* initialize to zeros */ } System.out.println("Starting at coordinate position (row: 0 col: 0):"); int[] commands = new int[] { PEN_UP, DOWN, MOVE, 5, RIGHT, MOVE, 4, PEN_DOWN, // pen down RIGHT, // direction: turn right MOVE, 12, // move 12 spaces DOWN, // direction: turn down MOVE, 12, // move 12 spaces LEFT, // direction: turn left MOVE, 12, // move 12 spaces UP, // direction: turn up MOVE, 12, // move 12 spaces PEN_UP, // pen up DISPLAY, // display floor END // end command reading }; int row = 0; int col = 0; /* Read commands from an array that contains them. */ for (int index = 0; index < commands.length; ++index) { switch ( commands[index] ) { case PEN_UP: Turtle.footprint = SPACE; break; case PEN_DOWN: Turtle.footprint = STAR; break; case UP : Turtle.turns = UP; break; case DOWN : Turtle.turns = DOWN; break; case LEFT : Turtle.turns = LEFT; break; case RIGHT: Turtle.turns = RIGHT; break; case MOVE: int numberOfMoves = commands[ ++index ]; for (int moves = 0; moves < numberOfMoves; ++moves) { switch (Turtle.turns) { case UP : --row; break; case DOWN : ++row; break; case LEFT : --col; break; case RIGHT: ++col; break; } /* validate moves before executing commands */ if (row < 0) { ++row; System.err.println("negative row is out of bound"); break; } if (col < 0) { ++col; System.err.println("negative col is out of bound"); break; } if (row == floor.length) { --row; System.err.println("overshoot row is out of bound"); break; } if (col == floor[0].length) { --col; System.err.println("overshoot col is out of bound"); break; } floor[row][col] = Turtle.footprint; } break; case DISPLAY: displayTurtleFootprints(); break; case END: index = commands.length; break; } // end of switch } // end of for loop } private static void displayTurtleFootprints() { for (int y = 0; y < floor.length; ++y) { for (int x = 0; x < floor[y].length; ++x) System.out.printf("[%c]", floor[y][x] == STAR ? '*' : ' '); System.out.println(); } } } // end of class Ex07_21_TurtleGraphics
6,067
0.543353
0.525516
154
37.31818
31.950998
122
false
false
0
0
0
0
0
0
0.850649
false
false
0
41bff58c59b4774c3f1260422f5c97bbd7518d09
24,017,457,149,764
13ac75e91402706e2e45777ce963635f823d629f
/src/common/xap/lui/core/reduce/IJsCompressionService.java
65e365adec9337d11d05128e49a741ace9f37974
[]
no_license
gufanyi/wdp
https://github.com/gufanyi/wdp
86085600062e6d42adcacaf46968854c8632ead1
9f69f798b799ab258ed57febad10495a65574c9a
refs/heads/master
2021-01-10T10:59:49.283000
2015-12-17T15:33:23
2015-12-17T15:33:23
47,962,667
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package xap.lui.core.reduce; /** * Js代码压缩服务类 * @author gd 2010-4-23 * @version NC6.0 */ public interface IJsCompressionService { public String compressJs(String[] jsFiles); public String compressCss(String[] cssFiles); public String noCompressJs(String[] jsFiles); public String noCompressCss(String[] cssFiles); }
UTF-8
Java
339
java
IJsCompressionService.java
Java
[ { "context": "xap.lui.core.reduce;\n\n\n/**\n * Js代码压缩服务类\n * @author gd 2010-4-23\n * @version NC6.0\n */\npublic interface ", "end": 61, "score": 0.702680230140686, "start": 59, "tag": "USERNAME", "value": "gd" } ]
null
[]
package xap.lui.core.reduce; /** * Js代码压缩服务类 * @author gd 2010-4-23 * @version NC6.0 */ public interface IJsCompressionService { public String compressJs(String[] jsFiles); public String compressCss(String[] cssFiles); public String noCompressJs(String[] jsFiles); public String noCompressCss(String[] cssFiles); }
339
0.744615
0.716923
14
22.214285
18.762342
48
false
false
0
0
0
0
0
0
0.642857
false
false
0
9e85312d394fda8586f7f3172f4f1349a3083d36
10,737,418,290,076
22e8d75b9d5a7bf076fa91eb5dbb4c0b58b42286
/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ConstructorInterceptorInvocationContext.java
eedd7b8096afee8833ae4880d50fd5be674f074c
[ "Apache-2.0" ]
permissive
apache/openwebbeans
https://github.com/apache/openwebbeans
56888af1999edf5d22dc47ed5a87bfd8559ebe5e
01245cf8ef0baaa9cd31342b0cdb075d314b6ef9
refs/heads/main
2023-08-31T23:32:19.832000
2023-02-25T12:58:57
2023-02-25T12:58:57
1,302,095
50
72
Apache-2.0
false
2023-06-27T07:29:08
2011-01-28T08:00:11
2023-04-16T00:31:37
2023-06-27T05:44:39
24,500
55
57
4
Java
false
false
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.webbeans.intercept; import org.apache.webbeans.util.ExceptionUtil; import jakarta.enterprise.inject.spi.InterceptionType; import jakarta.enterprise.inject.spi.Interceptor; import jakarta.inject.Provider; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.List; import java.util.Map; public class ConstructorInterceptorInvocationContext<T> extends InterceptorInvocationContext<T> { protected Object newInstance; public ConstructorInterceptorInvocationContext(Provider<T> provider, List<Interceptor<?>> aroundConstructInterceptors, Map<Interceptor<?>, ?> interceptorInstances, Constructor<T> cons, Object[] parameters) { super(provider, InterceptionType.AROUND_CONSTRUCT, aroundConstructInterceptors, interceptorInstances, cons, parameters); } public Object getNewInstance() { return newInstance; } @Override public Object directProceed() throws Exception { if (newInstance != null) // already called { return newInstance; } try { newInstance = getConstructor().newInstance(parameters); return null; } catch (InvocationTargetException ite) { // unpack the reflection Exception throw ExceptionUtil.throwAsRuntimeException(ite.getCause()); } } }
UTF-8
Java
2,370
java
ConstructorInterceptorInvocationContext.java
Java
[]
null
[]
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.webbeans.intercept; import org.apache.webbeans.util.ExceptionUtil; import jakarta.enterprise.inject.spi.InterceptionType; import jakarta.enterprise.inject.spi.Interceptor; import jakarta.inject.Provider; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.List; import java.util.Map; public class ConstructorInterceptorInvocationContext<T> extends InterceptorInvocationContext<T> { protected Object newInstance; public ConstructorInterceptorInvocationContext(Provider<T> provider, List<Interceptor<?>> aroundConstructInterceptors, Map<Interceptor<?>, ?> interceptorInstances, Constructor<T> cons, Object[] parameters) { super(provider, InterceptionType.AROUND_CONSTRUCT, aroundConstructInterceptors, interceptorInstances, cons, parameters); } public Object getNewInstance() { return newInstance; } @Override public Object directProceed() throws Exception { if (newInstance != null) // already called { return newInstance; } try { newInstance = getConstructor().newInstance(parameters); return null; } catch (InvocationTargetException ite) { // unpack the reflection Exception throw ExceptionUtil.throwAsRuntimeException(ite.getCause()); } } }
2,370
0.678903
0.677215
66
34.909092
30.428619
128
false
false
0
0
0
0
0
0
0.469697
false
false
0
de457ee0f8388c05488bed0ff6d29fe5b1e3c047
5,325,759,502,843
da7d3a2479e7a9b3598b697984344357a346809c
/Java_Learning_Project/src/learning/oops/Samsung.java
784451617963a259828a4347821c158d37402c96
[]
no_license
oindrila88/DemoJavaLearningRepo
https://github.com/oindrila88/DemoJavaLearningRepo
43112ed3509badf14ebf38ff324e9d33e379b71c
ea514739597fbd83013a060fb475bd0fc17f6466
refs/heads/master
2022-11-08T05:34:56.931000
2020-06-24T03:16:19
2020-06-24T03:16:19
262,614,729
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package learning.oops; import learning.oops.abstraction.interfaceIntroduction.Phone; public class Samsung implements Phone, AndroidUpdatePermission { @Override public void showConfig() { System.out.println("In showConfig of Samsung"); } @Override public void makeCall() { System.out.println("In makeCall of Samsung"); } @Override public void disconnectCall() { System.out.println("In disconnectCall of Samsung"); } /* public void installBixby() { System.out.println("In installBixby of Samsung"); } */ public void androidUpdate() { System.out.println("Special Updatefor Samsung in Samsung Class"); } }
UTF-8
Java
643
java
Samsung.java
Java
[]
null
[]
package learning.oops; import learning.oops.abstraction.interfaceIntroduction.Phone; public class Samsung implements Phone, AndroidUpdatePermission { @Override public void showConfig() { System.out.println("In showConfig of Samsung"); } @Override public void makeCall() { System.out.println("In makeCall of Samsung"); } @Override public void disconnectCall() { System.out.println("In disconnectCall of Samsung"); } /* public void installBixby() { System.out.println("In installBixby of Samsung"); } */ public void androidUpdate() { System.out.println("Special Updatefor Samsung in Samsung Class"); } }
643
0.724728
0.724728
38
15.921053
21.024273
67
false
false
0
0
0
0
0
0
1.078947
false
false
0
ced4932980d37bf05f1ff15ccfcfba41b1fbd3a6
5,257,040,009,703
af6fdd1732d402046b035c936bdfe9b0596ccbac
/jcloudcv-1.6/src/org/idevlab/rjc/ds/RedisConnection.java
15730defacabca5af14eb691277f3d8447001848
[]
no_license
Cloud-CV/mat-cloudcv
https://github.com/Cloud-CV/mat-cloudcv
803743e9fa6011ba90d8fca0da6f223140a994da
1583c982efdba1bb891b3b18932853911467b159
refs/heads/master
2020-04-11T04:24:04.889000
2017-09-27T13:54:43
2017-09-27T13:54:43
11,624,449
6
5
null
false
2017-09-27T13:54:44
2013-07-24T02:29:52
2017-09-25T18:59:45
2017-09-27T13:54:44
12,421
20
20
2
Java
null
null
/* * Copyright 2010-2011. Evgeny Dolgov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.idevlab.rjc.ds; import org.idevlab.rjc.protocol.RedisCommand; import java.io.IOException; import java.net.UnknownHostException; import java.util.List; /** * @author Evgeny Dolgov */ public interface RedisConnection { int getTimeout(); void rollbackTimeout(); String getHost(); int getPort(); void connect() throws UnknownHostException, IOException; void close(); boolean isConnected(); void setTimeoutInfinite(); String getStatusCodeReply(); String getBulkReply(); byte[] getBinaryBulkReply(); Long getIntegerReply(); List<String> getMultiBulkReply(); /** * Reply may contains Long and String objects * * @return Long and String objects */ List<Object> getObjectMultiBulkReply(); /** * Reply may contains Long and byte[] objects * * @return Long and byte[] objects */ List<Object> getBinaryObjectMultiBulkReply(); List<Object> getAll(); List<Object> getBinaryAll(); Object getOne(); Object getBinaryOne(); void sendCommand(final RedisCommand cmd, final String... args); void sendCommand(final RedisCommand cmd, final byte[]... args); void sendCommand(final RedisCommand cmd); }
UTF-8
Java
1,852
java
RedisConnection.java
Java
[ { "context": "/*\n * Copyright 2010-2011. Evgeny Dolgov\n *\n * Licensed under the Apache License, Version ", "end": 40, "score": 0.9998853802680969, "start": 27, "tag": "NAME", "value": "Evgeny Dolgov" }, { "context": "tException;\nimport java.util.List;\n\n/**\n * @author Evgeny Dolgov\n */\npublic interface RedisConnection {\n int get", "end": 794, "score": 0.9622172713279724, "start": 781, "tag": "NAME", "value": "Evgeny Dolgov" } ]
null
[]
/* * Copyright 2010-2011. <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.idevlab.rjc.ds; import org.idevlab.rjc.protocol.RedisCommand; import java.io.IOException; import java.net.UnknownHostException; import java.util.List; /** * @author <NAME> */ public interface RedisConnection { int getTimeout(); void rollbackTimeout(); String getHost(); int getPort(); void connect() throws UnknownHostException, IOException; void close(); boolean isConnected(); void setTimeoutInfinite(); String getStatusCodeReply(); String getBulkReply(); byte[] getBinaryBulkReply(); Long getIntegerReply(); List<String> getMultiBulkReply(); /** * Reply may contains Long and String objects * * @return Long and String objects */ List<Object> getObjectMultiBulkReply(); /** * Reply may contains Long and byte[] objects * * @return Long and byte[] objects */ List<Object> getBinaryObjectMultiBulkReply(); List<Object> getAll(); List<Object> getBinaryAll(); Object getOne(); Object getBinaryOne(); void sendCommand(final RedisCommand cmd, final String... args); void sendCommand(final RedisCommand cmd, final byte[]... args); void sendCommand(final RedisCommand cmd); }
1,838
0.692765
0.686285
82
21.585365
22.700571
75
false
false
0
0
0
0
0
0
0.426829
false
false
0
a515fb3f68bfd4a833a27891a0f81ea2895bb458
17,068,200,062,319
521e42a0b0e89f54e05d61b312b843421995df66
/src/test/java/com/example/testcases/HomePageTest.java
587108cf2c5cd75f5ccd10743b43e1c34bb81d09
[]
no_license
anasilbelbep/ProjectAutomation
https://github.com/anasilbelbep/ProjectAutomation
0e6faa678ca551241f1d7803e66b00e2f09cf2dd
eaa844702982aceee7ec01be5776b97e08ca9fd5
refs/heads/master
2022-12-17T12:59:11.716000
2020-09-17T22:39:24
2020-09-17T22:39:24
296,452,397
0
0
null
false
2020-09-17T23:06:53
2020-09-17T22:07:14
2020-09-17T22:39:40
2020-09-17T23:03:46
0
0
0
1
Java
false
false
package com.example.testcases; import javafx.scene.layout.Priority; import org.apache.tools.ant.taskdefs.Sleep; import org.testng.Assert; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.*; public class HomePageTest extends TestBase { public HomePageTest() { super(); } @BeforeTest @Parameters("browser") public void setUp(String browser) { initialization(browser); } }
UTF-8
Java
504
java
HomePageTest.java
Java
[]
null
[]
package com.example.testcases; import javafx.scene.layout.Priority; import org.apache.tools.ant.taskdefs.Sleep; import org.testng.Assert; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.*; public class HomePageTest extends TestBase { public HomePageTest() { super(); } @BeforeTest @Parameters("browser") public void setUp(String browser) { initialization(browser); } }
504
0.698413
0.698413
30
15.8
16.712072
44
false
false
0
0
0
0
0
0
0.3
false
false
0
ebee0b88e7cac0ded43edb0eb79575dc911c686e
21,242,908,274,456
145409b3e14f730c55b8d657a2b0a224d7a83eae
/app/src/main/java/org/trecet/nowhere/sensorino/activities/NewDeviceActivity.java
23a8fff1597f751d675f402eed261352a2abd81c
[]
no_license
sergioprades/Sensorino
https://github.com/sergioprades/Sensorino
77c6767c5ed1096a3b9ac9cb3348dedd2b275ac7
e7dff0d71ec6a4049c04957958dfcd4e48a8a187
refs/heads/master
2020-04-11T03:02:37.662000
2015-03-11T14:06:33
2015-03-11T14:06:33
32,212,083
0
0
null
true
2015-03-14T13:02:19
2015-03-14T13:02:19
2015-03-11T14:06:48
2015-03-11T14:06:48
552
0
0
0
null
null
null
package org.trecet.nowhere.sensorino.activities; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.Toast; import org.trecet.nowhere.sensorino.R; import org.trecet.nowhere.sensorino.model.Device; import org.trecet.nowhere.sensorino.model.Devices; import org.trecet.nowhere.sensorino.model.RemoteDeviceType; import java.util.ArrayList; import java.util.List; public class NewDeviceActivity extends Activity { private EditText txt_local_name; private EditText txt_remote_name; private EditText txt_remote_address; private EditText txt_frequency; private Button but_create; private Spinner spinner_remote_type; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sensorino_device_new); // We grab all the stuff txt_local_name = (EditText)findViewById(R.id.txt_new_device_local_name); txt_remote_name = (EditText)findViewById(R.id.txt_new_device_remote_name); txt_frequency = (EditText)findViewById(R.id.txt_new_device_frequency); txt_remote_address = (EditText)findViewById(R.id.txt_new_device_remote_address); but_create = (Button)findViewById(R.id.but_new_device_create); // Spinner // Add items to the Spinner spinner_remote_type = (Spinner) findViewById(R.id.spinner_new_device_remote_type); List<String> list = new ArrayList<String>(); for (RemoteDeviceType item: RemoteDeviceType.values()) { list.add(item.toString()); } ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner_remote_type.setAdapter(dataAdapter); // Set Listener to Spinner class CustomOnItemSelectedListener implements AdapterView.OnItemSelectedListener { public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { Toast.makeText(parent.getContext(), "On Item Select : \n" + parent.getItemAtPosition(pos).toString(), Toast.LENGTH_LONG).show(); } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } } spinner_remote_type.setOnItemSelectedListener(new CustomOnItemSelectedListener()); // Button but_create.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String local_name = txt_local_name.getText().toString(); String remote_name = txt_remote_name.getText().toString(); String remote_address = txt_remote_address.getText().toString(); int frequency = Integer.parseInt(txt_frequency.getText().toString()); RemoteDeviceType remote_type = RemoteDeviceType.valueOf( spinner_remote_type.getSelectedItem().toString()); // TODO we would need to check if one of the names already exists. Device device = new Device (); device.setRemote_name(remote_name); device.setLocal_name(local_name); // TODO we need to check the address is a valid BT address device.setRemote_address(remote_address); device.setFrequency(frequency); device.setRemote_type(remote_type); Devices devices = Devices.getInstance(NewDeviceActivity.this); if (devices.add(device) == 0) { finish(); Toast.makeText(NewDeviceActivity.this, getString(R.string.toast_new_device_created), Toast.LENGTH_SHORT).show(); } else { Toast.makeText(NewDeviceActivity.this, getString(R.string.toast_new_device_error), Toast.LENGTH_SHORT).show(); } } }); } // Usar GSON }
UTF-8
Java
4,387
java
NewDeviceActivity.java
Java
[]
null
[]
package org.trecet.nowhere.sensorino.activities; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.Toast; import org.trecet.nowhere.sensorino.R; import org.trecet.nowhere.sensorino.model.Device; import org.trecet.nowhere.sensorino.model.Devices; import org.trecet.nowhere.sensorino.model.RemoteDeviceType; import java.util.ArrayList; import java.util.List; public class NewDeviceActivity extends Activity { private EditText txt_local_name; private EditText txt_remote_name; private EditText txt_remote_address; private EditText txt_frequency; private Button but_create; private Spinner spinner_remote_type; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sensorino_device_new); // We grab all the stuff txt_local_name = (EditText)findViewById(R.id.txt_new_device_local_name); txt_remote_name = (EditText)findViewById(R.id.txt_new_device_remote_name); txt_frequency = (EditText)findViewById(R.id.txt_new_device_frequency); txt_remote_address = (EditText)findViewById(R.id.txt_new_device_remote_address); but_create = (Button)findViewById(R.id.but_new_device_create); // Spinner // Add items to the Spinner spinner_remote_type = (Spinner) findViewById(R.id.spinner_new_device_remote_type); List<String> list = new ArrayList<String>(); for (RemoteDeviceType item: RemoteDeviceType.values()) { list.add(item.toString()); } ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner_remote_type.setAdapter(dataAdapter); // Set Listener to Spinner class CustomOnItemSelectedListener implements AdapterView.OnItemSelectedListener { public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { Toast.makeText(parent.getContext(), "On Item Select : \n" + parent.getItemAtPosition(pos).toString(), Toast.LENGTH_LONG).show(); } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } } spinner_remote_type.setOnItemSelectedListener(new CustomOnItemSelectedListener()); // Button but_create.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String local_name = txt_local_name.getText().toString(); String remote_name = txt_remote_name.getText().toString(); String remote_address = txt_remote_address.getText().toString(); int frequency = Integer.parseInt(txt_frequency.getText().toString()); RemoteDeviceType remote_type = RemoteDeviceType.valueOf( spinner_remote_type.getSelectedItem().toString()); // TODO we would need to check if one of the names already exists. Device device = new Device (); device.setRemote_name(remote_name); device.setLocal_name(local_name); // TODO we need to check the address is a valid BT address device.setRemote_address(remote_address); device.setFrequency(frequency); device.setRemote_type(remote_type); Devices devices = Devices.getInstance(NewDeviceActivity.this); if (devices.add(device) == 0) { finish(); Toast.makeText(NewDeviceActivity.this, getString(R.string.toast_new_device_created), Toast.LENGTH_SHORT).show(); } else { Toast.makeText(NewDeviceActivity.this, getString(R.string.toast_new_device_error), Toast.LENGTH_SHORT).show(); } } }); } // Usar GSON }
4,387
0.639617
0.639161
112
38.169643
31.202074
132
false
false
0
0
0
0
0
0
0.571429
false
false
0
687a3636816bc537382df0c8267af27254fb23e5
26,336,739,485,293
89cceaeb28e8a4714533ef8eb76751f61bc1f065
/app/src/main/java/com/example/anthony/tictactoe/Singleton.java
40344fe4e9dbd25e4cc050fea910d7bebfa48d5d
[]
no_license
apolito53/tictactoe
https://github.com/apolito53/tictactoe
c1e24c5151c50139249779204fafbb4ecbe8a439
5d70f202a2b6c0b1954446a6b4222c598136412d
refs/heads/master
2020-04-05T17:18:18.385000
2018-11-12T03:34:00
2018-11-12T03:34:00
157,053,975
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.anthony.tictactoe; public class Singleton { private static Singleton single_instance = null; private int flag = 0; private String otherPlayerNumber; public void setFlag(int n) { flag = n; } public int getFlag() { return flag; } public void setOtherPlayerNumber(String in) { otherPlayerNumber = in; } public String getOtherPlayerNumber() { return otherPlayerNumber; } // private constructor restricted to this class itself private Singleton() {} // static method to create instance of Singleton class public static Singleton getInstance() { if (single_instance == null) single_instance = new Singleton(); return single_instance; } }
UTF-8
Java
786
java
Singleton.java
Java
[ { "context": "package com.example.anthony.tictactoe;\n\npublic class Singleton {\n\n privat", "end": 26, "score": 0.8301623463630676, "start": 20, "tag": "USERNAME", "value": "anthon" } ]
null
[]
package com.example.anthony.tictactoe; public class Singleton { private static Singleton single_instance = null; private int flag = 0; private String otherPlayerNumber; public void setFlag(int n) { flag = n; } public int getFlag() { return flag; } public void setOtherPlayerNumber(String in) { otherPlayerNumber = in; } public String getOtherPlayerNumber() { return otherPlayerNumber; } // private constructor restricted to this class itself private Singleton() {} // static method to create instance of Singleton class public static Singleton getInstance() { if (single_instance == null) single_instance = new Singleton(); return single_instance; } }
786
0.642494
0.641221
36
20.833334
19.328304
58
false
false
0
0
0
0
0
0
0.277778
false
false
0
1dd7a285814f4351824c4710fc4fc8076be3ce29
11,630,771,460,919
d22b97f5c50c6948a8bbcdb14e4c436f749ae9cd
/BusesAreUs_Complete/src/ca/ubc/cs/cpsc210/translink/parsers/ZipFileMemoryIterator.java
86a3ffa8f01d35963496f41a3f2c7f91fe45717b
[]
no_license
jding92/zzz
https://github.com/jding92/zzz
ac210338b9e4fc014ded21715d2a8040ce7c08e6
a6c3384cb888a1e3a7c38ca854b02dbf6a89656b
refs/heads/master
2021-08-17T14:57:38.312000
2017-11-21T10:25:42
2017-11-21T10:25:42
111,533,564
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ca.ubc.cs.cpsc210.translink.parsers; /** * Created by norm on 2016-09-02. */ import java.io.*; import java.util.Iterator; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; public class ZipFileMemoryIterator implements Iterator<MemoryFile> { private byte[] buffer = new byte[8192]; private InputStream is; private ZipInputStream zis; private ZipEntry ze; public ZipFileMemoryIterator(byte[] input) { is = new ByteArrayInputStream(input); zis = new ZipInputStream(new BufferedInputStream(is)); } @Override public boolean hasNext() { try { return (ze = zis.getNextEntry()) != null; } catch (IOException e) { e.printStackTrace(); } return false; } @Override public MemoryFile next() { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); int count; String filename = ze.getName(); while ((count = zis.read(buffer)) != -1) { baos.write(buffer, 0, count); } String ans = baos.toString("UTF-8"); zis.closeEntry(); return new MemoryFile(filename, ans); } catch (Exception e) { throw new RuntimeException(e); } } @Override public void remove() { throw new RuntimeException("not implemented"); } public void close() { try { zis.close(); is.close(); } catch (IOException e) {// nope } } }
UTF-8
Java
1,574
java
ZipFileMemoryIterator.java
Java
[ { "context": "bc.cs.cpsc210.translink.parsers; /**\n * Created by norm on 2016-09-02.\n */\n\nimport java.io.*;\nimport java", "end": 67, "score": 0.8648837208747864, "start": 63, "tag": "USERNAME", "value": "norm" } ]
null
[]
package ca.ubc.cs.cpsc210.translink.parsers; /** * Created by norm on 2016-09-02. */ import java.io.*; import java.util.Iterator; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; public class ZipFileMemoryIterator implements Iterator<MemoryFile> { private byte[] buffer = new byte[8192]; private InputStream is; private ZipInputStream zis; private ZipEntry ze; public ZipFileMemoryIterator(byte[] input) { is = new ByteArrayInputStream(input); zis = new ZipInputStream(new BufferedInputStream(is)); } @Override public boolean hasNext() { try { return (ze = zis.getNextEntry()) != null; } catch (IOException e) { e.printStackTrace(); } return false; } @Override public MemoryFile next() { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); int count; String filename = ze.getName(); while ((count = zis.read(buffer)) != -1) { baos.write(buffer, 0, count); } String ans = baos.toString("UTF-8"); zis.closeEntry(); return new MemoryFile(filename, ans); } catch (Exception e) { throw new RuntimeException(e); } } @Override public void remove() { throw new RuntimeException("not implemented"); } public void close() { try { zis.close(); is.close(); } catch (IOException e) {// nope } } }
1,574
0.566074
0.554638
66
22.848484
19.447865
69
false
false
0
0
0
0
0
0
0.424242
false
false
0
ff2c76a295c000b74bd500d5c7795e18449ca91c
31,301,721,677,192
d8528b7a86c23a29769aeb3c86536c1408dddb85
/src/main/java/com/cms/controller/front/member/PasswordController.java
9c7250a52a087c2fb5072903a144e5d7937d125a
[ "Apache-2.0" ]
permissive
chengmaotao/xiyouShop
https://github.com/chengmaotao/xiyouShop
22fb56f89db193b096518c83299a65616e9c4e53
ffac2dad4d95c6f43747aae0f31e0d71d2148714
refs/heads/master
2022-12-10T16:16:03.999000
2019-08-05T06:23:06
2019-08-05T06:23:06
197,115,628
0
0
Apache-2.0
false
2022-12-06T00:32:24
2019-07-16T03:43:51
2019-08-05T06:23:22
2022-12-06T00:32:23
9,933
0
0
9
CSS
false
false
package com.cms.controller.front.member; import org.apache.commons.codec.digest.DigestUtils; import com.cms.Feedback; import com.cms.controller.front.BaseController; import com.cms.entity.Member; import com.cms.routes.RouteMapping; @RouteMapping(url = "/member/password") public class PasswordController extends BaseController{ /** * 编辑 */ public void edit(){ render("/templates/"+getTheme()+"/"+getDevice()+"/memberPasswordEdit.html"); } /** * 修改 */ public void update(){ String currentPassword = getPara("currentPassword"); String password = getPara("password"); Member currentMember = getCurrentMember(); if(!currentMember.getPassword().equals(DigestUtils.md5Hex(currentPassword))){ renderJson(Feedback.error("密码错误!")); return; } currentMember.setPassword(DigestUtils.md5Hex(password)); currentMember.update(); renderJson(Feedback.success("")); } }
UTF-8
Java
1,017
java
PasswordController.java
Java
[ { "context": "turn;\n }\n currentMember.setPassword(DigestUtils.md5Hex(password));\n currentMember.update();\n ", "end": 906, "score": 0.8052844405174255, "start": 888, "tag": "PASSWORD", "value": "DigestUtils.md5Hex" } ]
null
[]
package com.cms.controller.front.member; import org.apache.commons.codec.digest.DigestUtils; import com.cms.Feedback; import com.cms.controller.front.BaseController; import com.cms.entity.Member; import com.cms.routes.RouteMapping; @RouteMapping(url = "/member/password") public class PasswordController extends BaseController{ /** * 编辑 */ public void edit(){ render("/templates/"+getTheme()+"/"+getDevice()+"/memberPasswordEdit.html"); } /** * 修改 */ public void update(){ String currentPassword = getPara("currentPassword"); String password = getPara("password"); Member currentMember = getCurrentMember(); if(!currentMember.getPassword().equals(DigestUtils.md5Hex(currentPassword))){ renderJson(Feedback.error("密码错误!")); return; } currentMember.setPassword(<PASSWORD>(password)); currentMember.update(); renderJson(Feedback.success("")); } }
1,009
0.656344
0.654346
35
27.6
24.199409
85
false
false
0
0
0
0
0
0
0.428571
false
false
0
71abfd33fc442d5a6964c2b564a3c9173e04b0e4
30,829,275,289,997
f743551e0c6a56adbf3912e1ff1a3a5ff41b16ec
/AulaUmBancoDeDados/Biblioteca.java
acc0995907181d237e11ba4859839612a9a456d1
[]
no_license
chuckberry5/Java
https://github.com/chuckberry5/Java
5a6a4d25ce09ccc191c4178288b3fa24c637da18
c57a2256da48088332dec88828ce0ab01301cc55
refs/heads/master
2021-01-02T22:47:14.047000
2017-08-05T00:53:16
2017-08-05T00:53:16
99,389,514
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package AulaUmBancoDeDados; import java.util.Scanner; import java.io.IOException; import java.util.ArrayList; class Biblioteca { private LivroService livroService; public Biblioteca() { livroService = new LivroService("livro_db.txt"); } public void criaMenu() throws IOException{ Scanner entrada = new Scanner(System.in); String opcao, cont = "s"; while (cont.equalsIgnoreCase("s")) { System.out.println("\t\t Sistema de Cadastro de Livros\n\n"); System.out.println("1 ===> Adicionar Livro "); System.out.println("2 ===> Listar Livros "); System.out.println("3 ===> Remover Livros "); System.out.println("4 ===> Buscar Livro "); System.out.println("5 ===> Atualizar Livro "); System.out.print("\n\n"); System.out.print("Escolha: "); opcao = entrada.nextLine(); if( opcao.equals("1") ) { adicionarLivro(); } else if( opcao.equals("2") ) { listarLivros(); } else if( opcao.equals("3") ) { removerLivro(); } else if( opcao.equals("4") ) { buscarLivro(); } else if( opcao.equals("5") ) { atualizarLivro(); } System.out.print("Quer continuar? (S/[N]) "); cont = entrada.nextLine(); } } private void imprimirTituloTabela() { System.out.println(" ------------------------------------------------------------- "); System.out.println("| ID\tTítulo\tAutor\tAssunto\t|"); System.out.println(" ------------------------------------------------------------- "); } private void imprimirRodapeTabela() { System.out.println("| |"); System.out.println(" ------------------------------------------------------------- "); } private void imprimirLivro(Livro l) { System.out.println("| " + l.getId() + "\t" + l.getTitulo() + "\t" + l.getAutor() + "\t" + l.getAssunto() + "\t|"); } private void imprimirTabela(Livro l) { imprimirTituloTabela(); imprimirLivro(l); imprimirRodapeTabela(); } private void imprimirTabela(ArrayList<Livro> livros) { imprimirTituloTabela(); for (Livro l : livros) { imprimirLivro(l); } imprimirRodapeTabela(); } private void adicionarLivro() { Livro livro; Long ID; String titulo, autor, assunto; Scanner entrada = new Scanner(System.in); System.out.print("Entre o ID do livro: "); ID = Long.parseLong(entrada.nextLine()); System.out.print("Entre o título do livro: "); titulo = entrada.nextLine(); System.out.print("Entre o autor do livro: "); autor = entrada.nextLine(); System.out.print("Entre o assunto do livro: "); assunto = entrada.nextLine(); livro = new Livro(ID, titulo, autor, assunto); try { livroService.adicionarLivro(livro); } catch (Exception e) { System.out.println("Erro: " + e); } } private void listarLivros() { ArrayList<Livro> livros = new ArrayList<>(); try { livros = livroService.listarLivros(); } catch (Exception e) { System.out.println("Erro: " + e); } imprimirTabela(livros); } private void removerLivro() { Scanner entrada = new Scanner(System.in); Long ID; System.out.println("\t\t Apagar Registro de Livro\n"); System.out.print("Entre o ID do Livro: "); ID = Long.parseLong(entrada.nextLine()); try { livroService.removerLivroPorId(ID); } catch (Exception e) { System.out.println("Erro: " + e); } System.out.println("\nLivro removido!\n"); } private void buscarLivro() { Long ID; Scanner entrada = new Scanner(System.in); System.out.println("\t\t Buscar Regisro de Livro\n"); System.out.print("Entre o ID do Livro: "); ID = Long.parseLong(entrada.nextLine()); try { Livro l = livroService.buscarLivroPorId(ID); imprimirTabela(l); } catch (Exception e) { System.out.println("Erro: " + e); } } private void atualizarLivro() { Scanner entrada = new Scanner(System.in); Long ID; Livro l = null; String novoTitulo, novoAutor, novoAssunto; System.out.println("\t\t Atualizar Registro de Livro\n"); System.out.print("Entre o ID do Livro: "); ID = Long.parseLong(entrada.nextLine()); try { l = livroService.buscarLivroPorId(ID); } catch (Exception e) { System.out.println("Erro: " + e); } imprimirTabela(l); System.out.print("Entre o novo Título: "); l.setTitulo(entrada.nextLine()); System.out.print("Entre o novo Autor: "); l.setAutor(entrada.nextLine()); System.out.print("Entre o novo Assunto: "); l.setAssunto(entrada.nextLine()); try { l = livroService.atualizarLivro(l); } catch (Exception e) { System.out.println("Erro: " + e); } System.out.println("\nLivro atualizado!\n"); imprimirTabela(l); } }
ISO-8859-2
Java
5,110
java
Biblioteca.java
Java
[]
null
[]
package AulaUmBancoDeDados; import java.util.Scanner; import java.io.IOException; import java.util.ArrayList; class Biblioteca { private LivroService livroService; public Biblioteca() { livroService = new LivroService("livro_db.txt"); } public void criaMenu() throws IOException{ Scanner entrada = new Scanner(System.in); String opcao, cont = "s"; while (cont.equalsIgnoreCase("s")) { System.out.println("\t\t Sistema de Cadastro de Livros\n\n"); System.out.println("1 ===> Adicionar Livro "); System.out.println("2 ===> Listar Livros "); System.out.println("3 ===> Remover Livros "); System.out.println("4 ===> Buscar Livro "); System.out.println("5 ===> Atualizar Livro "); System.out.print("\n\n"); System.out.print("Escolha: "); opcao = entrada.nextLine(); if( opcao.equals("1") ) { adicionarLivro(); } else if( opcao.equals("2") ) { listarLivros(); } else if( opcao.equals("3") ) { removerLivro(); } else if( opcao.equals("4") ) { buscarLivro(); } else if( opcao.equals("5") ) { atualizarLivro(); } System.out.print("Quer continuar? (S/[N]) "); cont = entrada.nextLine(); } } private void imprimirTituloTabela() { System.out.println(" ------------------------------------------------------------- "); System.out.println("| ID\tTítulo\tAutor\tAssunto\t|"); System.out.println(" ------------------------------------------------------------- "); } private void imprimirRodapeTabela() { System.out.println("| |"); System.out.println(" ------------------------------------------------------------- "); } private void imprimirLivro(Livro l) { System.out.println("| " + l.getId() + "\t" + l.getTitulo() + "\t" + l.getAutor() + "\t" + l.getAssunto() + "\t|"); } private void imprimirTabela(Livro l) { imprimirTituloTabela(); imprimirLivro(l); imprimirRodapeTabela(); } private void imprimirTabela(ArrayList<Livro> livros) { imprimirTituloTabela(); for (Livro l : livros) { imprimirLivro(l); } imprimirRodapeTabela(); } private void adicionarLivro() { Livro livro; Long ID; String titulo, autor, assunto; Scanner entrada = new Scanner(System.in); System.out.print("Entre o ID do livro: "); ID = Long.parseLong(entrada.nextLine()); System.out.print("Entre o título do livro: "); titulo = entrada.nextLine(); System.out.print("Entre o autor do livro: "); autor = entrada.nextLine(); System.out.print("Entre o assunto do livro: "); assunto = entrada.nextLine(); livro = new Livro(ID, titulo, autor, assunto); try { livroService.adicionarLivro(livro); } catch (Exception e) { System.out.println("Erro: " + e); } } private void listarLivros() { ArrayList<Livro> livros = new ArrayList<>(); try { livros = livroService.listarLivros(); } catch (Exception e) { System.out.println("Erro: " + e); } imprimirTabela(livros); } private void removerLivro() { Scanner entrada = new Scanner(System.in); Long ID; System.out.println("\t\t Apagar Registro de Livro\n"); System.out.print("Entre o ID do Livro: "); ID = Long.parseLong(entrada.nextLine()); try { livroService.removerLivroPorId(ID); } catch (Exception e) { System.out.println("Erro: " + e); } System.out.println("\nLivro removido!\n"); } private void buscarLivro() { Long ID; Scanner entrada = new Scanner(System.in); System.out.println("\t\t Buscar Regisro de Livro\n"); System.out.print("Entre o ID do Livro: "); ID = Long.parseLong(entrada.nextLine()); try { Livro l = livroService.buscarLivroPorId(ID); imprimirTabela(l); } catch (Exception e) { System.out.println("Erro: " + e); } } private void atualizarLivro() { Scanner entrada = new Scanner(System.in); Long ID; Livro l = null; String novoTitulo, novoAutor, novoAssunto; System.out.println("\t\t Atualizar Registro de Livro\n"); System.out.print("Entre o ID do Livro: "); ID = Long.parseLong(entrada.nextLine()); try { l = livroService.buscarLivroPorId(ID); } catch (Exception e) { System.out.println("Erro: " + e); } imprimirTabela(l); System.out.print("Entre o novo Título: "); l.setTitulo(entrada.nextLine()); System.out.print("Entre o novo Autor: "); l.setAutor(entrada.nextLine()); System.out.print("Entre o novo Assunto: "); l.setAssunto(entrada.nextLine()); try { l = livroService.atualizarLivro(l); } catch (Exception e) { System.out.println("Erro: " + e); } System.out.println("\nLivro atualizado!\n"); imprimirTabela(l); } }
5,110
0.557862
0.555904
190
25.878948
20.619129
91
false
false
0
0
0
0
0
0
1.452632
false
false
0
4c2800effb88f85babd5bccb9bd9d66dd7e51fcb
31,198,642,456,338
1ec9dafc45918dc902c47562705bfd93444b4b14
/src/main/java/com/dev/market/persistence/mapper/ProductMapper.java
7e26b07e3bc91bc601d734ef17987b8c5ad86280
[]
no_license
oscarmaxgithub/MarketSpring
https://github.com/oscarmaxgithub/MarketSpring
7f9fd95f4108d7b84e30c9036e17b2fb29f4c3c1
9d564155a4efc4621c00b57c7e3c38fca7914d97
refs/heads/master
2023-02-19T01:46:55.177000
2021-01-20T16:22:33
2021-01-20T16:22:33
328,261,500
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.dev.market.persistence.mapper; import com.dev.market.domain.Category; import com.dev.market.domain.Product; import com.dev.market.persistence.entity.Categoria; import com.dev.market.persistence.entity.Producto; import org.mapstruct.InheritInverseConfiguration; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.Mappings; import java.util.List; @Mapper(componentModel = "spring",uses = {CategoryMapper.class}) public interface ProductMapper { @Mappings({ @Mapping(source = "idProducto", target = "productId"), @Mapping(source = "nombre", target = "name"), @Mapping(source = "idCategoria", target = "categoryId"), @Mapping(source = "precioVenta", target = "price"), @Mapping(source = "cantidadStock", target = "stock"), @Mapping(source = "estado", target = "active"), @Mapping(source = "categoria", target = "category"), }) Product toProduct(Producto producto); List<Product> toProducts(List<Producto> productos); /** * InheritInverseConfiguration hace que el mapeo anterior se inverso al devolver un mapeo * jalar parametro de PRODUCTO a PRODUCT * cuando haya una categororia como objeto, agregar el USES para que spring sepa que debe mapear con esa clase * @param product * @return */ @InheritInverseConfiguration @Mapping(target = "codigoBarras",ignore = true)//ignora el listado de productos propio de la clase Producto Producto toProducto(Product product); }
UTF-8
Java
1,555
java
ProductMapper.java
Java
[]
null
[]
package com.dev.market.persistence.mapper; import com.dev.market.domain.Category; import com.dev.market.domain.Product; import com.dev.market.persistence.entity.Categoria; import com.dev.market.persistence.entity.Producto; import org.mapstruct.InheritInverseConfiguration; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.Mappings; import java.util.List; @Mapper(componentModel = "spring",uses = {CategoryMapper.class}) public interface ProductMapper { @Mappings({ @Mapping(source = "idProducto", target = "productId"), @Mapping(source = "nombre", target = "name"), @Mapping(source = "idCategoria", target = "categoryId"), @Mapping(source = "precioVenta", target = "price"), @Mapping(source = "cantidadStock", target = "stock"), @Mapping(source = "estado", target = "active"), @Mapping(source = "categoria", target = "category"), }) Product toProduct(Producto producto); List<Product> toProducts(List<Producto> productos); /** * InheritInverseConfiguration hace que el mapeo anterior se inverso al devolver un mapeo * jalar parametro de PRODUCTO a PRODUCT * cuando haya una categororia como objeto, agregar el USES para que spring sepa que debe mapear con esa clase * @param product * @return */ @InheritInverseConfiguration @Mapping(target = "codigoBarras",ignore = true)//ignora el listado de productos propio de la clase Producto Producto toProducto(Product product); }
1,555
0.697749
0.697749
38
39.921051
29.084616
114
false
false
0
0
0
0
0
0
0.789474
false
false
0
e89a77fd5cee1cddd534c99a5490a85eb315ef9a
6,665,789,300,146
187d9db877a55bb498a61dfe3083031f41a05cbf
/src/main/java/com/itmayiedu/controller/JspController.java
cb13fe611e53e3d1359c1d5bf78c9b1c6e4ec99f
[]
no_license
18838928050/SpringBoot2
https://github.com/18838928050/SpringBoot2
b49bb43843a16716c3f8cdb34f16dde5dce901b0
b533cd54fab951e96fca86d8f1813bdd9867194e
refs/heads/master
2020-06-20T03:41:00.263000
2019-07-15T14:09:20
2019-07-15T14:09:20
196,979,474
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * @copy right Stateally Interactive Company All rights reserved * * @Title: JspController.java * * @Date: 2019年7月15日 下午4:52:24 * * @Package springboot_jsp */ package com.itmayiedu.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; /** * @author 付慧芳 * * 日期:2019年7月15日 下午4:52:24 * * 描述: * @version V1.0 * */ @Controller public class JspController { @RequestMapping("/jspIndex") public String jspIndex(){ return "jspIndex"; } }
UTF-8
Java
614
java
JspController.java
Java
[ { "context": "ind.annotation.RequestMapping;\r\n\r\n/**\r\n * @author 付慧芳\r\n * \r\n * 日期:2019年7月15日 下午4:52:24\r\n *\r\n * 描述:\r\n * ", "end": 359, "score": 0.9998118281364441, "start": 356, "tag": "NAME", "value": "付慧芳" } ]
null
[]
/** * @copy right Stateally Interactive Company All rights reserved * * @Title: JspController.java * * @Date: 2019年7月15日 下午4:52:24 * * @Package springboot_jsp */ package com.itmayiedu.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; /** * @author 付慧芳 * * 日期:2019年7月15日 下午4:52:24 * * 描述: * @version V1.0 * */ @Controller public class JspController { @RequestMapping("/jspIndex") public String jspIndex(){ return "jspIndex"; } }
614
0.649306
0.604167
36
14
17.508728
64
false
false
0
0
0
0
0
0
0.361111
false
false
0
e09b07a81a5894cd647ddd6d4db66f385f329808
6,665,789,300,005
7f0ed10c87ed4fca928ca5649bec64ce463b6719
/http-server-jetty/src/main/java/io/micronaut/servlet/jetty/JettyFactory.java
19a80b7c0b181a779f011ca346fa1844a9c2c049
[ "Apache-2.0" ]
permissive
prgAmit/micronaut-servlet
https://github.com/prgAmit/micronaut-servlet
692d5414d3356beedb7afc406a9d764acbc16da0
7dcc65f97995447df2c91ae75590884fd932e02f
refs/heads/master
2023-09-03T11:18:12.380000
2021-10-27T20:08:40
2021-10-27T20:08:40
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2017-2020 original authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.micronaut.servlet.jetty; import io.micronaut.context.ApplicationContext; import io.micronaut.context.annotation.Factory; import io.micronaut.context.annotation.Primary; import io.micronaut.context.env.Environment; import io.micronaut.context.exceptions.ConfigurationException; import io.micronaut.core.io.ResourceResolver; import io.micronaut.core.io.socket.SocketUtils; import io.micronaut.core.util.CollectionUtils; import io.micronaut.core.util.StringUtils; import io.micronaut.http.ssl.ClientAuthentication; import io.micronaut.http.ssl.SslConfiguration; import io.micronaut.servlet.engine.DefaultMicronautServlet; import io.micronaut.servlet.engine.MicronautServletConfiguration; import io.micronaut.servlet.engine.server.ServletServerFactory; import io.micronaut.servlet.engine.server.ServletStaticResourceConfiguration; import org.eclipse.jetty.http.HttpVersion; import org.eclipse.jetty.server.*; import org.eclipse.jetty.servlet.*; import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.util.resource.ResourceCollection; import org.eclipse.jetty.util.ssl.SslContextFactory; import jakarta.inject.Singleton; import java.io.IOException; import java.util.List; import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; /** * Factory for the Jetty server. * * @author graemerocher * @since 1.0 */ @Factory public class JettyFactory extends ServletServerFactory { public static final String RESOURCE_BASE = "resourceBase"; private final JettyConfiguration jettyConfiguration; /** * Default constructor. * * @param resourceResolver The resource resolver * @param serverConfiguration The server config * @param sslConfiguration The SSL config * @param applicationContext The app context * @param staticResourceConfigurations The static resource configs */ public JettyFactory( ResourceResolver resourceResolver, JettyConfiguration serverConfiguration, SslConfiguration sslConfiguration, ApplicationContext applicationContext, List<ServletStaticResourceConfiguration> staticResourceConfigurations) { super( resourceResolver, serverConfiguration, sslConfiguration, applicationContext, staticResourceConfigurations ); this.jettyConfiguration = serverConfiguration; } /** * Builds the Jetty server bean. * * @param applicationContext This application context * @param configuration The servlet configuration * @param jettySslConfiguration The Jetty SSL config * @return The Jetty server bean */ @Singleton @Primary protected Server jettyServer(ApplicationContext applicationContext, MicronautServletConfiguration configuration, JettyConfiguration.JettySslConfiguration jettySslConfiguration) { final String host = getConfiguredHost(); final Integer port = getConfiguredPort(); Server server = new Server(); String contextPath = getContextPath(); List<ServletStaticResourceConfiguration> src = getStaticResourceConfigurations(); ResourceCollection resourceCollection; if (CollectionUtils.isNotEmpty(src)) { List<String> mappings = src.stream().map(ServletStaticResourceConfiguration::getMapping) .map(path -> { if (path.endsWith("/**")) { return path.substring(0, path.length() - 3); } return path; }) .collect(Collectors.toList()); resourceCollection = new ResourceCollection(src.stream() .flatMap((Function<ServletStaticResourceConfiguration, Stream<Resource>>) config -> { List<String> paths = config.getPaths(); return paths.stream().map(path -> { if (path.startsWith(ServletStaticResourceConfiguration.CLASSPATH_PREFIX)) { String cp = path.substring(ServletStaticResourceConfiguration.CLASSPATH_PREFIX.length()); return Resource.newClassPathResource(cp); } else { try { return Resource.newResource(path); } catch (IOException e) { throw new ConfigurationException("Static resource path doesn't exist: " + path, e); } } }); }).toArray(Resource[]::new)) { @Override public Resource addPath(String path) throws IOException { for (String mapping : mappings) { if (path.startsWith(mapping)) { path = path.substring(mapping.length()); } } return super.addPath(path); } }; } else { resourceCollection = null; } final ServletContextHandler contextHandler = new ServletContextHandler( server, contextPath, false, false ) { @Override public Resource newResource(String urlOrPath) throws IOException { if (resourceCollection != null && RESOURCE_BASE.endsWith(urlOrPath)) { return resourceCollection; } return super.newResource(urlOrPath); } }; final ServletHolder servletHolder = new ServletHolder(new DefaultMicronautServlet(applicationContext)); contextHandler.addServlet( servletHolder, configuration.getMapping() ); servletHolder.setAsyncSupported(true); configuration.getMultipartConfigElement().ifPresent(multipartConfiguration -> servletHolder.getRegistration().setMultipartConfig(multipartConfiguration) ); if (CollectionUtils.isNotEmpty(src)) { List<String> mappings = src.stream() .map(config -> { String mapping = config.getMapping(); if (mapping.endsWith("**")) { return mapping.substring(0, mapping.length() - 1); } else if (!mapping.endsWith("/*")) { return mapping + "/*"; } return mapping; }) .collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(mappings)) { ServletHolder defaultServletHolder = new ServletHolder( configuration.getName(), new DefaultServlet() ); defaultServletHolder.setInitParameters(jettyConfiguration.getInitParameters()); contextHandler.addServlet( defaultServletHolder, mappings.iterator().next() ); contextHandler.setBaseResource(resourceCollection); ServletHandler servletHandler = defaultServletHolder.getServletHandler(); if (mappings.size() > 1) { ServletMapping m = new ServletMapping(); m.setServletName(configuration.getName()); m.setPathSpecs(mappings.subList(1, mappings.size()).toArray(StringUtils.EMPTY_STRING_ARRAY)); servletHandler.addServletMapping(m); } // going to be replaced defaultServletHolder.setInitParameter(RESOURCE_BASE, RESOURCE_BASE); // some defaults defaultServletHolder.setInitParameter("dirAllowed", StringUtils.FALSE); } } server.setHandler(contextHandler); final SslConfiguration sslConfiguration = getSslConfiguration(); if (sslConfiguration.isEnabled()) { final HttpConfiguration httpConfig = jettyConfiguration.getHttpConfiguration(); int securePort = sslConfiguration.getPort(); if (securePort == SslConfiguration.DEFAULT_PORT && getEnvironment().getActiveNames().contains(Environment.TEST)) { securePort = SocketUtils.findAvailableTcpPort(); } httpConfig.setSecurePort(securePort); SslContextFactory.Server sslContextFactory = new SslContextFactory.Server(); ClientAuthentication clientAuth = sslConfiguration.getClientAuthentication().orElse(ClientAuthentication.NEED); switch (clientAuth) { case WANT: sslContextFactory.setWantClientAuth(true); break; case NEED: default: sslContextFactory.setNeedClientAuth(true); } sslConfiguration.getProtocol().ifPresent(sslContextFactory::setProtocol); sslConfiguration.getProtocols().ifPresent(sslContextFactory::setIncludeProtocols); sslConfiguration.getCiphers().ifPresent(sslConfiguration::setCiphers); final SslConfiguration.KeyStoreConfiguration keyStoreConfig = sslConfiguration.getKeyStore(); keyStoreConfig.getPassword().ifPresent(sslContextFactory::setKeyStorePassword); keyStoreConfig.getPath().ifPresent(path -> { if (path.startsWith(ServletStaticResourceConfiguration.CLASSPATH_PREFIX)) { String cp = path.substring(ServletStaticResourceConfiguration.CLASSPATH_PREFIX.length()); sslContextFactory.setKeyStorePath(Resource.newClassPathResource(cp).getURI().toString()); } else { sslContextFactory.setKeyStorePath(path); } }); keyStoreConfig.getProvider().ifPresent(sslContextFactory::setKeyStoreProvider); keyStoreConfig.getType().ifPresent(sslContextFactory::setKeyStoreType); SslConfiguration.TrustStoreConfiguration trustStore = sslConfiguration.getTrustStore(); trustStore.getPassword().ifPresent(sslContextFactory::setTrustStorePassword); trustStore.getType().ifPresent(sslContextFactory::setTrustStoreType); trustStore.getPath().ifPresent(path -> { if (path.startsWith(ServletStaticResourceConfiguration.CLASSPATH_PREFIX)) { String cp = path.substring(ServletStaticResourceConfiguration.CLASSPATH_PREFIX.length()); sslContextFactory.setTrustStorePath(Resource.newClassPathResource(cp).getURI().toString()); } else { sslContextFactory.setTrustStorePath(path); } }); trustStore.getProvider().ifPresent(sslContextFactory::setTrustStoreProvider); HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig); httpsConfig.addCustomizer(jettySslConfiguration); ServerConnector https = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()), new HttpConnectionFactory(httpsConfig)); https.setPort(securePort); server.addConnector(https); } final ServerConnector http = new ServerConnector( server, new HttpConnectionFactory(jettyConfiguration.getHttpConfiguration()) ); http.setPort(port); http.setHost(host); server.addConnector( http ); return server; } }
UTF-8
Java
12,594
java
JettyFactory.java
Java
[ { "context": "/**\n * Factory for the Jetty server.\n *\n * @author graemerocher\n * @since 1.0\n */\n@Factory\npublic class JettyFact", "end": 1969, "score": 0.9988903999328613, "start": 1957, "tag": "USERNAME", "value": "graemerocher" } ]
null
[]
/* * Copyright 2017-2020 original authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.micronaut.servlet.jetty; import io.micronaut.context.ApplicationContext; import io.micronaut.context.annotation.Factory; import io.micronaut.context.annotation.Primary; import io.micronaut.context.env.Environment; import io.micronaut.context.exceptions.ConfigurationException; import io.micronaut.core.io.ResourceResolver; import io.micronaut.core.io.socket.SocketUtils; import io.micronaut.core.util.CollectionUtils; import io.micronaut.core.util.StringUtils; import io.micronaut.http.ssl.ClientAuthentication; import io.micronaut.http.ssl.SslConfiguration; import io.micronaut.servlet.engine.DefaultMicronautServlet; import io.micronaut.servlet.engine.MicronautServletConfiguration; import io.micronaut.servlet.engine.server.ServletServerFactory; import io.micronaut.servlet.engine.server.ServletStaticResourceConfiguration; import org.eclipse.jetty.http.HttpVersion; import org.eclipse.jetty.server.*; import org.eclipse.jetty.servlet.*; import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.util.resource.ResourceCollection; import org.eclipse.jetty.util.ssl.SslContextFactory; import jakarta.inject.Singleton; import java.io.IOException; import java.util.List; import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; /** * Factory for the Jetty server. * * @author graemerocher * @since 1.0 */ @Factory public class JettyFactory extends ServletServerFactory { public static final String RESOURCE_BASE = "resourceBase"; private final JettyConfiguration jettyConfiguration; /** * Default constructor. * * @param resourceResolver The resource resolver * @param serverConfiguration The server config * @param sslConfiguration The SSL config * @param applicationContext The app context * @param staticResourceConfigurations The static resource configs */ public JettyFactory( ResourceResolver resourceResolver, JettyConfiguration serverConfiguration, SslConfiguration sslConfiguration, ApplicationContext applicationContext, List<ServletStaticResourceConfiguration> staticResourceConfigurations) { super( resourceResolver, serverConfiguration, sslConfiguration, applicationContext, staticResourceConfigurations ); this.jettyConfiguration = serverConfiguration; } /** * Builds the Jetty server bean. * * @param applicationContext This application context * @param configuration The servlet configuration * @param jettySslConfiguration The Jetty SSL config * @return The Jetty server bean */ @Singleton @Primary protected Server jettyServer(ApplicationContext applicationContext, MicronautServletConfiguration configuration, JettyConfiguration.JettySslConfiguration jettySslConfiguration) { final String host = getConfiguredHost(); final Integer port = getConfiguredPort(); Server server = new Server(); String contextPath = getContextPath(); List<ServletStaticResourceConfiguration> src = getStaticResourceConfigurations(); ResourceCollection resourceCollection; if (CollectionUtils.isNotEmpty(src)) { List<String> mappings = src.stream().map(ServletStaticResourceConfiguration::getMapping) .map(path -> { if (path.endsWith("/**")) { return path.substring(0, path.length() - 3); } return path; }) .collect(Collectors.toList()); resourceCollection = new ResourceCollection(src.stream() .flatMap((Function<ServletStaticResourceConfiguration, Stream<Resource>>) config -> { List<String> paths = config.getPaths(); return paths.stream().map(path -> { if (path.startsWith(ServletStaticResourceConfiguration.CLASSPATH_PREFIX)) { String cp = path.substring(ServletStaticResourceConfiguration.CLASSPATH_PREFIX.length()); return Resource.newClassPathResource(cp); } else { try { return Resource.newResource(path); } catch (IOException e) { throw new ConfigurationException("Static resource path doesn't exist: " + path, e); } } }); }).toArray(Resource[]::new)) { @Override public Resource addPath(String path) throws IOException { for (String mapping : mappings) { if (path.startsWith(mapping)) { path = path.substring(mapping.length()); } } return super.addPath(path); } }; } else { resourceCollection = null; } final ServletContextHandler contextHandler = new ServletContextHandler( server, contextPath, false, false ) { @Override public Resource newResource(String urlOrPath) throws IOException { if (resourceCollection != null && RESOURCE_BASE.endsWith(urlOrPath)) { return resourceCollection; } return super.newResource(urlOrPath); } }; final ServletHolder servletHolder = new ServletHolder(new DefaultMicronautServlet(applicationContext)); contextHandler.addServlet( servletHolder, configuration.getMapping() ); servletHolder.setAsyncSupported(true); configuration.getMultipartConfigElement().ifPresent(multipartConfiguration -> servletHolder.getRegistration().setMultipartConfig(multipartConfiguration) ); if (CollectionUtils.isNotEmpty(src)) { List<String> mappings = src.stream() .map(config -> { String mapping = config.getMapping(); if (mapping.endsWith("**")) { return mapping.substring(0, mapping.length() - 1); } else if (!mapping.endsWith("/*")) { return mapping + "/*"; } return mapping; }) .collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(mappings)) { ServletHolder defaultServletHolder = new ServletHolder( configuration.getName(), new DefaultServlet() ); defaultServletHolder.setInitParameters(jettyConfiguration.getInitParameters()); contextHandler.addServlet( defaultServletHolder, mappings.iterator().next() ); contextHandler.setBaseResource(resourceCollection); ServletHandler servletHandler = defaultServletHolder.getServletHandler(); if (mappings.size() > 1) { ServletMapping m = new ServletMapping(); m.setServletName(configuration.getName()); m.setPathSpecs(mappings.subList(1, mappings.size()).toArray(StringUtils.EMPTY_STRING_ARRAY)); servletHandler.addServletMapping(m); } // going to be replaced defaultServletHolder.setInitParameter(RESOURCE_BASE, RESOURCE_BASE); // some defaults defaultServletHolder.setInitParameter("dirAllowed", StringUtils.FALSE); } } server.setHandler(contextHandler); final SslConfiguration sslConfiguration = getSslConfiguration(); if (sslConfiguration.isEnabled()) { final HttpConfiguration httpConfig = jettyConfiguration.getHttpConfiguration(); int securePort = sslConfiguration.getPort(); if (securePort == SslConfiguration.DEFAULT_PORT && getEnvironment().getActiveNames().contains(Environment.TEST)) { securePort = SocketUtils.findAvailableTcpPort(); } httpConfig.setSecurePort(securePort); SslContextFactory.Server sslContextFactory = new SslContextFactory.Server(); ClientAuthentication clientAuth = sslConfiguration.getClientAuthentication().orElse(ClientAuthentication.NEED); switch (clientAuth) { case WANT: sslContextFactory.setWantClientAuth(true); break; case NEED: default: sslContextFactory.setNeedClientAuth(true); } sslConfiguration.getProtocol().ifPresent(sslContextFactory::setProtocol); sslConfiguration.getProtocols().ifPresent(sslContextFactory::setIncludeProtocols); sslConfiguration.getCiphers().ifPresent(sslConfiguration::setCiphers); final SslConfiguration.KeyStoreConfiguration keyStoreConfig = sslConfiguration.getKeyStore(); keyStoreConfig.getPassword().ifPresent(sslContextFactory::setKeyStorePassword); keyStoreConfig.getPath().ifPresent(path -> { if (path.startsWith(ServletStaticResourceConfiguration.CLASSPATH_PREFIX)) { String cp = path.substring(ServletStaticResourceConfiguration.CLASSPATH_PREFIX.length()); sslContextFactory.setKeyStorePath(Resource.newClassPathResource(cp).getURI().toString()); } else { sslContextFactory.setKeyStorePath(path); } }); keyStoreConfig.getProvider().ifPresent(sslContextFactory::setKeyStoreProvider); keyStoreConfig.getType().ifPresent(sslContextFactory::setKeyStoreType); SslConfiguration.TrustStoreConfiguration trustStore = sslConfiguration.getTrustStore(); trustStore.getPassword().ifPresent(sslContextFactory::setTrustStorePassword); trustStore.getType().ifPresent(sslContextFactory::setTrustStoreType); trustStore.getPath().ifPresent(path -> { if (path.startsWith(ServletStaticResourceConfiguration.CLASSPATH_PREFIX)) { String cp = path.substring(ServletStaticResourceConfiguration.CLASSPATH_PREFIX.length()); sslContextFactory.setTrustStorePath(Resource.newClassPathResource(cp).getURI().toString()); } else { sslContextFactory.setTrustStorePath(path); } }); trustStore.getProvider().ifPresent(sslContextFactory::setTrustStoreProvider); HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig); httpsConfig.addCustomizer(jettySslConfiguration); ServerConnector https = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()), new HttpConnectionFactory(httpsConfig)); https.setPort(securePort); server.addConnector(https); } final ServerConnector http = new ServerConnector( server, new HttpConnectionFactory(jettyConfiguration.getHttpConfiguration()) ); http.setPort(port); http.setHost(host); server.addConnector( http ); return server; } }
12,594
0.616643
0.614896
283
43.501766
31.579546
182
false
false
0
0
0
0
0
0
0.515901
false
false
0
e9d0c7a4b327f5bf5409c0ff6da7181cd881929e
32,427,003,142,676
e483aacd047babe45e20f54944d7800443c8bb2d
/mysite/src/assign/servlets/GetAllEMailListbyGroupServlet.java
f75184b9f15506a6cc7eb61d99b849585c4e4a9d
[]
no_license
garghimani/Servlets
https://github.com/garghimani/Servlets
250200e4696a55976a9b46212b76ccd23b79a69f
f4b19cf610494145c087aa0c5b395d8c346ffccb
refs/heads/master
2022-04-25T16:35:35.092000
2020-04-10T20:32:59
2020-04-10T20:32:59
254,528,386
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package assign.servlets; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import javax.servlet.RequestDispatcher; 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 assign.dbaccess.EMailAddressVOO; import assign.dbaccess.EMailBO; import assign.dbaccess.EMailValidationException; /* * Get All Email Addresses by Group Servlet */ @WebServlet("/bygroup") public class GetAllEMailListbyGroupServlet extends HttpServlet { @SuppressWarnings("unchecked") public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String errors = ""; String emailAddress = request.getParameter("emailaddress"); System.out.println("IN Servlet : " + emailAddress); response.setContentType("text/html"); EMailBO eMailBO = new EMailBO(); EMailAddressVOO[] eMailList = null; try { System.out.println("Inside "); ArrayList list = eMailBO.getAllEMailAddressListbyGroup(emailAddress); Object[] aList = list.toArray(new EMailAddressVOO[list.size()]); eMailList = new EMailAddressVOO[list.size()]; System.out.println("Inside try block"); for (int i = 0;i < aList.length;i++) { System.out.println("Inside for loop"); eMailList[i] = (EMailAddressVOO) aList[i]; System.out.println(eMailList[i].geteMailID()); } } catch (EMailValidationException emve) { errors = emve.getErrorMessage(); } catch (Exception e) { e.printStackTrace(); } if (errors.equals("")) { request.getSession().setAttribute("emaillist1", eMailList); //response.sendRedirect("/mysite/viewbygroupsuccess.jsp"); RequestDispatcher rd = request.getRequestDispatcher("/viewbygroupsuccess.jsp"); rd.forward(request, response); } else { request.getSession().setAttribute("Errors", errors); response.sendRedirect("/mysite/error.jsp"); } } public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { doGet(request, response); } }
UTF-8
Java
2,240
java
GetAllEMailListbyGroupServlet.java
Java
[]
null
[]
package assign.servlets; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import javax.servlet.RequestDispatcher; 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 assign.dbaccess.EMailAddressVOO; import assign.dbaccess.EMailBO; import assign.dbaccess.EMailValidationException; /* * Get All Email Addresses by Group Servlet */ @WebServlet("/bygroup") public class GetAllEMailListbyGroupServlet extends HttpServlet { @SuppressWarnings("unchecked") public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String errors = ""; String emailAddress = request.getParameter("emailaddress"); System.out.println("IN Servlet : " + emailAddress); response.setContentType("text/html"); EMailBO eMailBO = new EMailBO(); EMailAddressVOO[] eMailList = null; try { System.out.println("Inside "); ArrayList list = eMailBO.getAllEMailAddressListbyGroup(emailAddress); Object[] aList = list.toArray(new EMailAddressVOO[list.size()]); eMailList = new EMailAddressVOO[list.size()]; System.out.println("Inside try block"); for (int i = 0;i < aList.length;i++) { System.out.println("Inside for loop"); eMailList[i] = (EMailAddressVOO) aList[i]; System.out.println(eMailList[i].geteMailID()); } } catch (EMailValidationException emve) { errors = emve.getErrorMessage(); } catch (Exception e) { e.printStackTrace(); } if (errors.equals("")) { request.getSession().setAttribute("emaillist1", eMailList); //response.sendRedirect("/mysite/viewbygroupsuccess.jsp"); RequestDispatcher rd = request.getRequestDispatcher("/viewbygroupsuccess.jsp"); rd.forward(request, response); } else { request.getSession().setAttribute("Errors", errors); response.sendRedirect("/mysite/error.jsp"); } } public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { doGet(request, response); } }
2,240
0.729911
0.729018
66
31.939394
26.230261
116
false
false
0
0
0
0
0
0
2.106061
false
false
0
328286ab08f8fa3892ae3a8ef5950c20a00344c4
5,222,680,255,571
9d0746f1652d11172a0e6defc8b8fbc8e367ae39
/src/main/java/com/github/woooking/qa_sorting/code/cfg/CFG.java
c335c42d433b628b5f5fc5add6d515148ff3057c
[ "MIT" ]
permissive
woooking/qa_sorting
https://github.com/woooking/qa_sorting
c53a425cccd9ee48a2055cab530f0ac340b68e69
d6b0b61034f266c522d96b25cc7e1e44fdf154e4
refs/heads/master
2020-12-02T02:25:45.482000
2016-08-31T07:45:39
2016-08-31T07:45:39
66,826,261
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.github.woooking.qa_sorting.code.cfg; import com.github.woooking.qa_sorting.adt.graph.Graph; import com.google.common.collect.ImmutableSet; /** * Interface for CFG. A CFG consists of some basic block {%link CFGBlock} and variables. There is a entry block and a exit block in the basic blocks. */ public interface CFG extends Graph { /** * Get all basic blocks in the CFG, contains entry and exit. * @return the immutable set of all basic blocks */ ImmutableSet<? extends CFGBlock> getBlocks(); /** * Get the entry block of the CFG. * @return the entry block */ CFGBlock getEntry(); /** * Get the exit block of the CFG. * @return the entry block */ CFGBlock getExit(); /** * Get the variables of the CFG. * @return variables of the CFG */ ImmutableSet<? extends CFGVariable> getVariables(); }
UTF-8
Java
843
java
CFG.java
Java
[ { "context": "package com.github.woooking.qa_sorting.code.cfg;\n\nimport com.github.woooking.", "end": 27, "score": 0.9989173412322998, "start": 19, "tag": "USERNAME", "value": "woooking" }, { "context": ".woooking.qa_sorting.code.cfg;\n\nimport com.github.woooking.qa_sorting.adt.graph.Graph;\nimport com.google.com", "end": 76, "score": 0.999157726764679, "start": 68, "tag": "USERNAME", "value": "woooking" } ]
null
[]
package com.github.woooking.qa_sorting.code.cfg; import com.github.woooking.qa_sorting.adt.graph.Graph; import com.google.common.collect.ImmutableSet; /** * Interface for CFG. A CFG consists of some basic block {%link CFGBlock} and variables. There is a entry block and a exit block in the basic blocks. */ public interface CFG extends Graph { /** * Get all basic blocks in the CFG, contains entry and exit. * @return the immutable set of all basic blocks */ ImmutableSet<? extends CFGBlock> getBlocks(); /** * Get the entry block of the CFG. * @return the entry block */ CFGBlock getEntry(); /** * Get the exit block of the CFG. * @return the entry block */ CFGBlock getExit(); /** * Get the variables of the CFG. * @return variables of the CFG */ ImmutableSet<? extends CFGVariable> getVariables(); }
843
0.701068
0.701068
34
23.794117
29.43865
149
false
false
0
0
0
0
0
0
0.823529
false
false
0
7824f17f9a5cbbbb707bee7ff41846bd4ae81ab3
4,114,578,719,410
c7e6cf71fc5b105c5befc739582effd9ee849cd2
/mywebapp/src/main/java/com/covalense/mywebapp/servlets/IncdeServlet.java
2ecf3af8676a9d4a76c3719f8aec7b396940e8b6
[]
no_license
shailu1995/ELE-06June19-Covalense-ShailuG
https://github.com/shailu1995/ELE-06June19-Covalense-ShailuG
2b769f14a9fa6fd95a52881db45dd348b254a932
7d077025dbc80f9bab3b6dfdab102f404446bd35
refs/heads/master
2022-12-24T14:53:53.015000
2019-08-24T11:29:15
2019-08-24T11:29:15
192,527,530
0
0
null
false
2022-12-15T23:59:49
2019-06-18T11:33:34
2019-08-24T11:32:35
2022-12-15T23:59:45
8,874
0
0
49
Rich Text Format
false
false
package com.covalense.mywebapp.servlets; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class IncudeServlet */ public class IncdeServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { RequestDispatcher dispatcher=null; response.setContentType("text.html"); PrintWriter out=response.getWriter(); out.println("1111111"); out.print("<br>"); dispatcher=request.getRequestDispatcher("index.html"); dispatcher.include(request, response); out.print("</br>"); out.println("222222222"); out.print("<br>"); dispatcher=request.getRequestDispatcher("currentDate?fname=shailu&lname=gadmi"); dispatcher.include(request, response); out.print("</br>"); out.println("33333333"); out.print("<br>"); dispatcher=request.getRequestDispatcher("search?id=103"); dispatcher.include(request, response); out.print("</br>"); } }
UTF-8
Java
1,390
java
IncdeServlet.java
Java
[]
null
[]
package com.covalense.mywebapp.servlets; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class IncudeServlet */ public class IncdeServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { RequestDispatcher dispatcher=null; response.setContentType("text.html"); PrintWriter out=response.getWriter(); out.println("1111111"); out.print("<br>"); dispatcher=request.getRequestDispatcher("index.html"); dispatcher.include(request, response); out.print("</br>"); out.println("222222222"); out.print("<br>"); dispatcher=request.getRequestDispatcher("currentDate?fname=shailu&lname=gadmi"); dispatcher.include(request, response); out.print("</br>"); out.println("33333333"); out.print("<br>"); dispatcher=request.getRequestDispatcher("search?id=103"); dispatcher.include(request, response); out.print("</br>"); } }
1,390
0.763309
0.743165
47
28.574469
25.179985
118
false
false
0
0
0
0
0
0
1.787234
false
false
0
6d29e03e52f3d264486e5557afb5ada04094f0d2
24,481,313,630,736
df09790b7360a46d875369d7bfdf2e32f8880f30
/src/my/projects/ds/groupmessenger/Server.java
404ce2ddbe1170a5eb31d244d02083bf5e901920
[]
no_license
pradeepy/GroupMessenger
https://github.com/pradeepy/GroupMessenger
a6c7ca5bd88c6c80d54ee1533f341bb7664fa2ae
9013fefab847ee735acb194340ed418846358b5e
refs/heads/master
2020-06-05T11:25:29.044000
2013-04-23T17:13:15
2013-04-23T17:13:15
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package my.projects.ds.groupmessenger; import java.io.IOException; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; import my.projects.ds.groupmessenger.GroupMessengerActivity.*; import android.util.Log; public interface Server { /** * Launch the server at the given port. * Accept incoming messages and deliver them to the client after executing the * necessary algorithms for required ordering. * * @param port */ void launch(int port); } class ServerPort implements Server { private static final String TAG = "MyActivity"; public int portNo; @Override public void launch(int port) { // TODO Auto-generated method stub Log.v(TAG, " inside server... about to start thread"); portNo = port; // Thread St = new Thread (new ServerStartThread(portNo)); // St.start(); } } class servConnPort { static Socket servConnSocket = null; static ServerSocket serverSocket = null; static int count = 0; static Socket[] ServerConn = new Socket[4]; public servConnPort () { } public servConnPort (ServerSocket socket) { serverSocket = socket; } public servConnPort (Socket socket) { servConnSocket = socket; } public Socket serverConnRetrieve () { return servConnSocket; } public ServerSocket serverSocketRetrieve () { return serverSocket; } public void ServerConn_add (Socket socket) { ServerConn[count] = socket; count++; } public Socket ServerConn_rtrv (int n) { return ServerConn[n]; } } // end class serverPort
UTF-8
Java
1,554
java
Server.java
Java
[]
null
[]
package my.projects.ds.groupmessenger; import java.io.IOException; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; import my.projects.ds.groupmessenger.GroupMessengerActivity.*; import android.util.Log; public interface Server { /** * Launch the server at the given port. * Accept incoming messages and deliver them to the client after executing the * necessary algorithms for required ordering. * * @param port */ void launch(int port); } class ServerPort implements Server { private static final String TAG = "MyActivity"; public int portNo; @Override public void launch(int port) { // TODO Auto-generated method stub Log.v(TAG, " inside server... about to start thread"); portNo = port; // Thread St = new Thread (new ServerStartThread(portNo)); // St.start(); } } class servConnPort { static Socket servConnSocket = null; static ServerSocket serverSocket = null; static int count = 0; static Socket[] ServerConn = new Socket[4]; public servConnPort () { } public servConnPort (ServerSocket socket) { serverSocket = socket; } public servConnPort (Socket socket) { servConnSocket = socket; } public Socket serverConnRetrieve () { return servConnSocket; } public ServerSocket serverSocketRetrieve () { return serverSocket; } public void ServerConn_add (Socket socket) { ServerConn[count] = socket; count++; } public Socket ServerConn_rtrv (int n) { return ServerConn[n]; } } // end class serverPort
1,554
0.704633
0.703346
77
19.168831
18.743937
80
false
false
0
0
0
0
0
0
0.753247
false
false
0
5f76f9a5be5d27963fe57129fe984fc130be29bd
13,915,694,102,556
6caaf89189a5b9682f82a39345fe3fc5e23b3fbd
/example-1/src/main/java/com/eum602/security/basicAuth/DemoApplication.java
9c9d0f68c4cd0cd9d8918350e20edf04be101b7e
[]
no_license
eum602/spring-security
https://github.com/eum602/spring-security
082c77aa9b8ecc0bed96914cc5f3b80176400ee8
34e273b0ee82553c2a0c348c60319754354cdc72
refs/heads/master
2023-02-09T09:09:38.073000
2021-01-02T23:28:28
2021-01-02T23:28:28
324,851,424
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.eum602.security.basicAuth; import com.eum602.security.basicAuth.DAO.User; import com.eum602.security.basicAuth.jpa.UserRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.ApplicationRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.security.crypto.encrypt.BytesEncryptor; import org.springframework.security.crypto.encrypt.Encryptors; import org.springframework.security.crypto.encrypt.TextEncryptor; import org.springframework.security.crypto.keygen.KeyGenerators; import org.springframework.security.crypto.keygen.StringKeyGenerator; import java.util.stream.Stream; @SpringBootApplication public class DemoApplication { private static final Logger logger = LoggerFactory.getLogger(DemoApplication.class); public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); checkBytesEncryption(); checkStringEncryption(); } // This tells Hibernate to make a table out of this class @Bean ApplicationRunner init(UserRepository repository){ String[][] data = { {"eum602","password","read","1"}, {"r2d2","password","write","1"}, {"john","12345","write","1"} }; return args -> { Stream.of(data).forEach(array->{ try { User user = new User(array[0],array[1],array[2],Integer.parseInt(array[3])); repository.save(user); }catch (Exception e){ e.printStackTrace(); } }); repository.findAll().forEach(System.out::println); }; } public static void checkBytesEncryption(){ logger.info("*********************************************************************"); logger.info("****************************Bytes Encryption*************************"); StringKeyGenerator keyGenerator = KeyGenerators.string(); String salt = keyGenerator.generateKey(); String password = "password"; String valueToEncrypt = "Some confidential text"; BytesEncryptor e = Encryptors.stronger(password,salt); byte[] encrypted = e.encrypt(valueToEncrypt.getBytes()); //Uses CBC (cypher block chaining) -> not so secure byte[] decrypted = e.decrypt(encrypted); logger.info("Plain text: " + valueToEncrypt); logger.info("Salt: " + salt); logger.info("password: " + password); logger.info("Encrypted: " + encrypted); logger.info("Decrypted: " + decrypted); String decryptedString = new String(decrypted); logger.info("Decrypted plain text: " + decryptedString); logger.info("plain == Decrypted? " + decryptedString.equals(valueToEncrypt)); logger.info("*********************************************************************"); } public static void checkStringEncryption(){ logger.info("*********************************************************************"); logger.info("***************************String Encryption*************************"); String salt = KeyGenerators.string().generateKey(); String password = "password"; String valueToEncrypt = "Some confidential text"; TextEncryptor encryptor = Encryptors.queryableText(password,salt); String encrypted = encryptor.encrypt(valueToEncrypt); String decrypted = encryptor.decrypt(encrypted); logger.info("Plain text: " + valueToEncrypt); logger.info("Salt: " + salt); logger.info("password: " + password); logger.info("Encrypted: " + encrypted); logger.info("Decrypted: " + decrypted); logger.info("plain == Decrypted? " + decrypted.equals(valueToEncrypt)); logger.info("*********************************************************************"); } }
UTF-8
Java
3,650
java
DemoApplication.java
Java
[ { "context": "pository repository){\n\t\tString[][] data = {\n\t\t\t\t{\"eum602\",\"password\",\"read\",\"1\"},\n\t\t\t\t{\"r2d2\",\"password\",\"", "end": 1236, "score": 0.9962884783744812, "start": 1230, "tag": "USERNAME", "value": "eum602" }, { "context": "a = {\n\t\t\t\t{\"eum602\",\"password\",\"read\",\"1\"},\n\t\t\t\t{\"r2d2\",\"password\",\"write\",\"1\"},\n\t\t\t\t{\"john\",\"12345\",\"wr", "end": 1272, "score": 0.9901658296585083, "start": 1268, "tag": "USERNAME", "value": "r2d2" }, { "context": ",\"1\"},\n\t\t\t\t{\"r2d2\",\"password\",\"write\",\"1\"},\n\t\t\t\t{\"john\",\"12345\",\"write\",\"1\"}\n\t\t};\n\t\treturn args -> {\n\t\t\t", "end": 1309, "score": 0.9980936646461487, "start": 1305, "tag": "USERNAME", "value": "john" }, { "context": "\t\t\t\t{\"r2d2\",\"password\",\"write\",\"1\"},\n\t\t\t\t{\"john\",\"12345\",\"write\",\"1\"}\n\t\t};\n\t\treturn args -> {\n\t\t\tStream.o", "end": 1317, "score": 0.896598219871521, "start": 1312, "tag": "PASSWORD", "value": "12345" }, { "context": " keyGenerator.generateKey();\n\t\tString password = \"password\";\n\t\tString valueToEncrypt = \"Some confidential te", "end": 1993, "score": 0.9994685649871826, "start": 1985, "tag": "PASSWORD", "value": "password" }, { "context": "tors.string().generateKey();\n\t\tString password = \"password\";\n\t\tString valueToEncrypt = \"Some confidential te", "end": 3047, "score": 0.9995094537734985, "start": 3039, "tag": "PASSWORD", "value": "password" }, { "context": "nfo(\"Salt: \" + salt);\n\t\tlogger.info(\"password: \" + password);\n\t\tlogger.info(\"Encrypted: \" + encrypted);\n\t\tlog", "end": 3396, "score": 0.7694122791290283, "start": 3388, "tag": "PASSWORD", "value": "password" } ]
null
[]
package com.eum602.security.basicAuth; import com.eum602.security.basicAuth.DAO.User; import com.eum602.security.basicAuth.jpa.UserRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.ApplicationRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.security.crypto.encrypt.BytesEncryptor; import org.springframework.security.crypto.encrypt.Encryptors; import org.springframework.security.crypto.encrypt.TextEncryptor; import org.springframework.security.crypto.keygen.KeyGenerators; import org.springframework.security.crypto.keygen.StringKeyGenerator; import java.util.stream.Stream; @SpringBootApplication public class DemoApplication { private static final Logger logger = LoggerFactory.getLogger(DemoApplication.class); public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); checkBytesEncryption(); checkStringEncryption(); } // This tells Hibernate to make a table out of this class @Bean ApplicationRunner init(UserRepository repository){ String[][] data = { {"eum602","password","read","1"}, {"r2d2","password","write","1"}, {"john","<PASSWORD>","write","1"} }; return args -> { Stream.of(data).forEach(array->{ try { User user = new User(array[0],array[1],array[2],Integer.parseInt(array[3])); repository.save(user); }catch (Exception e){ e.printStackTrace(); } }); repository.findAll().forEach(System.out::println); }; } public static void checkBytesEncryption(){ logger.info("*********************************************************************"); logger.info("****************************Bytes Encryption*************************"); StringKeyGenerator keyGenerator = KeyGenerators.string(); String salt = keyGenerator.generateKey(); String password = "<PASSWORD>"; String valueToEncrypt = "Some confidential text"; BytesEncryptor e = Encryptors.stronger(password,salt); byte[] encrypted = e.encrypt(valueToEncrypt.getBytes()); //Uses CBC (cypher block chaining) -> not so secure byte[] decrypted = e.decrypt(encrypted); logger.info("Plain text: " + valueToEncrypt); logger.info("Salt: " + salt); logger.info("password: " + password); logger.info("Encrypted: " + encrypted); logger.info("Decrypted: " + decrypted); String decryptedString = new String(decrypted); logger.info("Decrypted plain text: " + decryptedString); logger.info("plain == Decrypted? " + decryptedString.equals(valueToEncrypt)); logger.info("*********************************************************************"); } public static void checkStringEncryption(){ logger.info("*********************************************************************"); logger.info("***************************String Encryption*************************"); String salt = KeyGenerators.string().generateKey(); String password = "<PASSWORD>"; String valueToEncrypt = "Some confidential text"; TextEncryptor encryptor = Encryptors.queryableText(password,salt); String encrypted = encryptor.encrypt(valueToEncrypt); String decrypted = encryptor.decrypt(encrypted); logger.info("Plain text: " + valueToEncrypt); logger.info("Salt: " + salt); logger.info("password: " + <PASSWORD>); logger.info("Encrypted: " + encrypted); logger.info("Decrypted: " + decrypted); logger.info("plain == Decrypted? " + decrypted.equals(valueToEncrypt)); logger.info("*********************************************************************"); } }
3,661
0.662466
0.654795
89
40.011234
26.58313
110
false
false
0
0
0
0
0
0
2.41573
false
false
0
99b50b7332471deebcb53355662ee4d78b239577
31,980,326,513,674
c221753baa7b929a40538a0b14964424dcfe7bbd
/src/main/java/com/example/service/UserDetailsServiceImpl.java
3c0594354d99010fcbe59c6838a567d91f1b53f0
[]
no_license
masashi-nose/contracts-management-project
https://github.com/masashi-nose/contracts-management-project
a7372553b8762818b68e43dc0bee47756ab1bfd0
986d1f5105f4d2b7d72449491676e8aeea5b26ec
refs/heads/master
2023-01-09T14:34:52.098000
2020-11-11T04:08:40
2020-11-11T04:08:40
306,490,803
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.service; import java.util.ArrayList; import java.util.Collection; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; import org.springframework.util.ObjectUtils; import com.example.domain.Admin; import com.example.domain.LoginUser; import com.example.mapper.AdminMapper; /** * ログイン後のユーザー情報に権限付与するサービスクラス. * * @author masashi.nose * */ @Service public class UserDetailsServiceImpl implements UserDetailsService{ @Autowired private AdminMapper adminMapper; @Override public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException{ Admin admin = adminMapper.selectByEmail(email); if(ObjectUtils.isEmpty(admin)) { throw new UsernameNotFoundException("そのメールアドレスは登録されていません。"); } //権限付与の例 Collection<GrantedAuthority> authorityList = new ArrayList<>(); authorityList.add(new SimpleGrantedAuthority("ROLE_ADMIN")); return new LoginUser(admin, authorityList); } }
UTF-8
Java
1,507
java
UserDetailsServiceImpl.java
Java
[ { "context": "*\r\n * ログイン後のユーザー情報に権限付与するサービスクラス.\r\n * \r\n * @author masashi.nose\r\n *\r\n */\r\n@Service\r\npublic class UserDetailsServi", "end": 790, "score": 0.9782489538192749, "start": 778, "tag": "USERNAME", "value": "masashi.nose" } ]
null
[]
package com.example.service; import java.util.ArrayList; import java.util.Collection; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; import org.springframework.util.ObjectUtils; import com.example.domain.Admin; import com.example.domain.LoginUser; import com.example.mapper.AdminMapper; /** * ログイン後のユーザー情報に権限付与するサービスクラス. * * @author masashi.nose * */ @Service public class UserDetailsServiceImpl implements UserDetailsService{ @Autowired private AdminMapper adminMapper; @Override public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException{ Admin admin = adminMapper.selectByEmail(email); if(ObjectUtils.isEmpty(admin)) { throw new UsernameNotFoundException("そのメールアドレスは登録されていません。"); } //権限付与の例 Collection<GrantedAuthority> authorityList = new ArrayList<>(); authorityList.add(new SimpleGrantedAuthority("ROLE_ADMIN")); return new LoginUser(admin, authorityList); } }
1,507
0.786885
0.786885
46
28.5
26.956285
86
false
false
0
0
0
0
0
0
1.152174
false
false
0
ead8e789907773e71da230a30ce8795ba399a3e8
23,484,881,229,809
cd15447d38629d1d4e6fc685f324acd0df8e2a3a
/core1/src/main/java/learn/core1/ch06/EmployeeSort.java
09266265297ebb812a03a0f5dd2d3c0744d68366
[]
no_license
dpopkov/learn
https://github.com/dpopkov/learn
f17a8fd578b45d7057f643c131334b2e39846da1
2f811fb37415cbd5a051bfe569dcace83330511a
refs/heads/master
2022-12-07T11:17:50.492000
2021-02-23T16:58:31
2021-02-23T16:58:31
117,227,906
1
0
null
false
2022-11-16T12:22:17
2018-01-12T10:29:38
2021-02-23T17:04:49
2022-11-16T12:22:17
2,498
0
0
42
Java
false
false
package learn.core1.ch06; import learn.core1.ch04.Employee; import learn.core1.ch05.Manager; import java.util.Arrays; public class EmployeeSort { public static void main(String[] args) { Employee[] staff = new Employee[4]; staff[0] = new Employee("Harry Hacker", 35_000); staff[1] = new Employee("Carl Cracker", 75_000); Manager timRobins = new Manager("Tim Robins", 30_000, 2000, 1, 1); timRobins.setBonus(100_000); staff[3] = timRobins; staff[2] = new Employee("Tony Tester", 38_000); Arrays.sort(staff); for (Employee e : staff) { System.out.printf("name=%s, salary=%f%n", e.getName(), e.getSalary()); } } }
UTF-8
Java
715
java
EmployeeSort.java
Java
[ { "context": "new Employee[4];\n staff[0] = new Employee(\"Harry Hacker\", 35_000);\n staff[1] = new Employee(\"Carl ", "end": 284, "score": 0.9998906254768372, "start": 271, "tag": "NAME", "value": "Harry Hacker" }, { "context": "acker\", 35_000);\n staff[1] = new Employee(\"Carl Cracker\", 75_000);\n Manager timRobins = new Manage", "end": 341, "score": 0.9998957514762878, "start": 329, "tag": "NAME", "value": "Carl Cracker" }, { "context": "loyee(\"Carl Cracker\", 75_000);\n Manager timRobins = new Manager(\"Tim Robins\", 30_000, 2000, 1, 1);\n", "end": 378, "score": 0.6993305683135986, "start": 372, "tag": "USERNAME", "value": "Robins" }, { "context": "75_000);\n Manager timRobins = new Manager(\"Tim Robins\", 30_000, 2000, 1, 1);\n timRobins.setBonus", "end": 404, "score": 0.9998959898948669, "start": 394, "tag": "NAME", "value": "Tim Robins" }, { "context": "imRobins.setBonus(100_000);\n staff[3] = timRobins;\n staff[2] = new Employee(\"Tony Tester\"", "end": 490, "score": 0.4987081289291382, "start": 487, "tag": "USERNAME", "value": "Rob" }, { "context": "[3] = timRobins;\n staff[2] = new Employee(\"Tony Tester\", 38_000);\n Arrays.sort(staff);\n fo", "end": 539, "score": 0.9998872876167297, "start": 528, "tag": "NAME", "value": "Tony Tester" } ]
null
[]
package learn.core1.ch06; import learn.core1.ch04.Employee; import learn.core1.ch05.Manager; import java.util.Arrays; public class EmployeeSort { public static void main(String[] args) { Employee[] staff = new Employee[4]; staff[0] = new Employee("<NAME>", 35_000); staff[1] = new Employee("<NAME>", 75_000); Manager timRobins = new Manager("<NAME>", 30_000, 2000, 1, 1); timRobins.setBonus(100_000); staff[3] = timRobins; staff[2] = new Employee("<NAME>", 38_000); Arrays.sort(staff); for (Employee e : staff) { System.out.printf("name=%s, salary=%f%n", e.getName(), e.getSalary()); } } }
693
0.606993
0.542657
22
31.5
23.09811
82
false
false
0
0
0
0
0
0
1.045455
false
false
0
b4ce038ddf942351523914ca717f0ba2a545afbc
7,481,833,066,499
b63a0e6f838731fee348391e4257e81ab9eb9983
/marathon-manage/marathon-manage-dao/src/main/java/com/marathon/manage/refactor/mapper/MarathonActivityInfoMapper.java
ec597c3f71287170eb28fb0d187062f1110133bc
[ "Apache-2.0" ]
permissive
zhouzhou2020/marathon
https://github.com/zhouzhou2020/marathon
d435a22cfdf5ce84257375b8c7e3ef48fc30b8be
d44b2699236616b58e7dbe63cdcb603aa6bece21
refs/heads/master
2021-02-04T11:55:58.669000
2019-01-07T09:34:51
2019-01-07T09:34:51
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.marathon.manage.refactor.mapper; import com.marathon.manage.refactor.pojo.MarathonActivityInfo; import com.marathon.manage.refactor.pojo.MarathonActivityInfoExample; import java.util.List; import org.apache.ibatis.annotations.Param; public interface MarathonActivityInfoMapper { int deleteByPrimaryKey(String activityUuid); int insert(MarathonActivityInfo record); int insertSelective(MarathonActivityInfo record); List<MarathonActivityInfo> selectByExample(MarathonActivityInfoExample example); MarathonActivityInfo selectByPrimaryKey(String activityUuid); int updateByExampleSelective(@Param("record") MarathonActivityInfo record, @Param("example") MarathonActivityInfoExample example); int updateByExample(@Param("record") MarathonActivityInfo record, @Param("example") MarathonActivityInfoExample example); int updateByPrimaryKeySelective(MarathonActivityInfo record); int updateByPrimaryKey(MarathonActivityInfo record); void deleteByMarathonId(String marathonUuid); }
UTF-8
Java
1,036
java
MarathonActivityInfoMapper.java
Java
[]
null
[]
package com.marathon.manage.refactor.mapper; import com.marathon.manage.refactor.pojo.MarathonActivityInfo; import com.marathon.manage.refactor.pojo.MarathonActivityInfoExample; import java.util.List; import org.apache.ibatis.annotations.Param; public interface MarathonActivityInfoMapper { int deleteByPrimaryKey(String activityUuid); int insert(MarathonActivityInfo record); int insertSelective(MarathonActivityInfo record); List<MarathonActivityInfo> selectByExample(MarathonActivityInfoExample example); MarathonActivityInfo selectByPrimaryKey(String activityUuid); int updateByExampleSelective(@Param("record") MarathonActivityInfo record, @Param("example") MarathonActivityInfoExample example); int updateByExample(@Param("record") MarathonActivityInfo record, @Param("example") MarathonActivityInfoExample example); int updateByPrimaryKeySelective(MarathonActivityInfo record); int updateByPrimaryKey(MarathonActivityInfo record); void deleteByMarathonId(String marathonUuid); }
1,036
0.822394
0.822394
28
36.035713
37.896931
134
false
false
0
0
0
0
0
0
0.607143
false
false
0
65e6edb6971ddc2961f6313663fcb3f0bf100806
30,683,246,383,055
e91f54f682a0b892f0841576437908db4e2a53c3
/springboot-zookeeper/src/main/java/com/jin/config/zookeeper/ZookeeperConfigProperties.java
75097be31d75df9b27cd5c7943b182ef96a6846b
[]
no_license
jinshuaishuai/IdeaGitTest
https://github.com/jinshuaishuai/IdeaGitTest
dae6385f9979a477c966b3be88c365704468c83e
6bd3f8eef1a00719876d5d8fe8743a60f39ea10a
refs/heads/master
2021-08-16T23:22:56.989000
2021-07-10T07:21:21
2021-07-10T07:21:21
204,450,223
0
0
null
false
2021-07-30T00:56:44
2019-08-26T10:15:01
2021-07-30T00:56:03
2021-07-30T00:56:43
411
0
0
3
Java
false
false
package com.jin.config.zookeeper; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; /** * @author shuai.jin * @date 2021/4/29 14:22 */ @Data @Component @ConfigurationProperties("zookeeper") public class ZookeeperConfigProperties { private String url; private String defaultPath; private String port; }
UTF-8
Java
417
java
ZookeeperConfigProperties.java
Java
[ { "context": "ingframework.stereotype.Component;\n\n/**\n * @author shuai.jin\n * @date 2021/4/29 14:22\n */\n@Data\n@Compone", "end": 199, "score": 0.7419153451919556, "start": 196, "tag": "NAME", "value": "shu" }, { "context": "ramework.stereotype.Component;\n\n/**\n * @author shuai.jin\n * @date 2021/4/29 14:22\n */\n@Data\n@Component\n@Co", "end": 205, "score": 0.7063392996788025, "start": 199, "tag": "USERNAME", "value": "ai.jin" } ]
null
[]
package com.jin.config.zookeeper; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; /** * @author shuai.jin * @date 2021/4/29 14:22 */ @Data @Component @ConfigurationProperties("zookeeper") public class ZookeeperConfigProperties { private String url; private String defaultPath; private String port; }
417
0.772182
0.745803
21
18.857143
19.599043
75
false
false
0
0
0
0
0
0
0.333333
false
false
0
5e5e7c4230a7853006d3627feaf6da0bfe56ff41
29,051,158,843,789
580681b8fb69f884c1e571919b96b7beeb4d0e0c
/production/src/main/java/com/engineering/controller/AnnealingControllerModelTwo.java
2b603ae4bf91fb012902c0eb9416f6b52b83b273
[]
no_license
wrobdomi/ProductionOptimization
https://github.com/wrobdomi/ProductionOptimization
2562c22a75d1a972e3efcfceb1b564570c85f970
781cb64710c4a5928fc39c969c925d73414eef11
refs/heads/master
2020-04-20T11:26:07.175000
2019-02-04T10:18:02
2019-02-04T10:18:02
168,816,149
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.engineering.controller; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Random; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; 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.ResponseBody; import com.engineering.entity.Machine; import com.engineering.entity.Task; import com.engineering.json.JsonResponse; import com.engineering.json.JsonReceive; import com.engineering.service.MachineService; import com.engineering.service.TaskService; import com.engineering.servicemodeltwo.AnnealingTwoService; import com.engineering.twotasks.DoubleTask; @Controller @RequestMapping("/annealingtwo") public class AnnealingControllerModelTwo { Map<Integer, DoubleTask> doubleTaskMachines; // Tasks DAO @Autowired private TaskService taskService; // Machines DAO @Autowired private MachineService machineService; // Simulated annealing service @Autowired private AnnealingTwoService annealingTwoService; private int[][] timeMatrix; private int[][] costMatrix; @GetMapping("/display") public String mainAnnealing(Model theModel) { List<Task> allTasks = taskService.getAllTasks(); List<Machine> allMachines = machineService.getAllMachines(); if( !allTasks.isEmpty() && !allMachines.isEmpty() ) { costMatrix = new int [allMachines.size()][allTasks.size()+1]; timeMatrix = new int [allMachines.size()][allTasks.size()+1]; // Get id of first task and machine int offsetTask = allTasks.get(0).getId(); int offsetMachine = allMachines.get(0).getId(); for(Task theTask : allTasks) { for(Machine theMachine : allMachines ) { List<Machine> tasksMachines = theTask.getMachines(); boolean choice = tasksMachines.contains(theMachine); if(choice) { costMatrix[theMachine.getId()-offsetMachine][theTask.getId()-offsetTask+1] = theTask.getDetailsNumber() * theMachine.getDetailCost(); timeMatrix[theMachine.getId()-offsetMachine][theTask.getId()-offsetTask+1] = theTask.getDetailsNumber() * theMachine.getDetailTime(); } else { costMatrix[theMachine.getId()-offsetMachine][theTask.getId()-offsetTask+1] = 0; timeMatrix[theMachine.getId()-offsetMachine][theTask.getId()-offsetTask+1] = 0; } } } for(int i = 0 ; i < allMachines.size() ; i++) { costMatrix[i][0] = allMachines.get(i).getId(); timeMatrix[i][0] = allMachines.get(i).getId(); } int [][] colors = annealingTwoService.getColorDoubleTasks(doubleTaskMachines, allTasks, allMachines); theModel.addAttribute("tasks", allTasks); theModel.addAttribute("machines", allMachines); theModel.addAttribute("costMatrix", costMatrix); theModel.addAttribute("timeMatrix", timeMatrix); theModel.addAttribute("rows", costMatrix.length-1); theModel.addAttribute("cols", costMatrix[0].length-1); theModel.addAttribute("colors", colors); } return "main-annealing-two"; } @GetMapping("/getassign") public String TestController() { this.getRandomDoubleTasks(); return "redirect:/annealingtwo/display"; } /** * get random assignments between tasks and machines * * @return */ public String getRandomDoubleTasks() { // get new HashMap doubleTaskMachines = new HashMap<Integer, DoubleTask>(); // get All Tasks List<Task> allTasks = taskService.getAllTasks(); // loop through all tasks for(Task theTask : allTasks) { // get all machines for a given task List<Machine> machines = theTask.getMachines(); if(machines.size() == 1) { // if only one machine assigned to theTask then doubleTask must be 0 doubleTaskMachines.put(theTask.getId(), new DoubleTask(null, null, 0)); } else { Random random = new Random(); // Get integer between >= 0 and < 2 int randomChoice = random.nextInt(2) + 0; System.out.println("Random is " + randomChoice); // 50 % chance for a task to need two machines to be completed if(randomChoice == 0) { doubleTaskMachines.put(theTask.getId(), new DoubleTask(null, null, 0)); } else { // if theTask needs two machines to be completed int [] one; int [] two; // Get integer between >= 1 and < size int randomNum = random.nextInt(machines.size()-1) + 1; // Get randomNum different random numbers >= 0 and < machines.size() final int[] ints = new Random().ints(0, machines.size()).distinct().limit(randomNum).toArray(); one = new int[ints.length]; two = new int[machines.size() - ints.length]; for(int i = 0 ; i < ints.length ; i++) { one[i] = machines.get(ints[i]).getId(); } int ind = 0; for(int i = 0 ; i < machines.size() ; i++) { int id = machines.get(i).getId(); boolean choice = true; for(int j : one) { if(id == j) { choice = false; break; } } if(choice) { two[ind] = id; ind++; } } DoubleTask doubleTask = new DoubleTask(one, two, 1); doubleTaskMachines.put(theTask.getId(), doubleTask ); } } } return "redirect:/annealingtwo/display"; } @PostMapping("/solve") public @ResponseBody JsonResponse simulatedAnnealingTwo(@RequestBody JsonReceive jsonReceive, Model theModel) { long startTime = System.currentTimeMillis(); List<Task> allTasks = taskService.getAllTasks(); List<Machine> allMachines = machineService.getAllMachines(); int tasksOffset = allTasks.get(0).getId(); int machineOffset = allMachines.get(0).getId(); int machineLength = allMachines.size(); // System.out.println("## ## ## ## ## ## This is from JSON ## ## ## ## ## ##"); // System.out.println(jsonReceive.getAlpha()); // System.out.println(jsonReceive.getCoolingWay()); // System.out.println(jsonReceive.getTemperature()); // System.out.println(jsonReceive.getIterations()); // System.out.println(jsonReceive.getAssignments()); // System.out.println(jsonReceive.getcWeight()); // System.out.println(jsonReceive.gettWeight()); // System.out.println(jsonReceive.isCostConEnabled()); // System.out.println(jsonReceive.isTimeConEnabled()); // System.out.println(jsonReceive.getCostCon()); // System.out.println(jsonReceive.getTimeCon()); // System.out.println("## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##"); List<Integer> listLoopNum = new ArrayList<Integer>(); List<Integer> listBestEnergy = new ArrayList<Integer>(); List<Double> listTemperature = new ArrayList<Double>(); List<Double> listAcceptanceProb = new ArrayList<Double>(); List<Integer> listAcceptance = new ArrayList<Integer>(); List<Integer> listCost = new ArrayList<Integer>(); List<Integer> listTime = new ArrayList<Integer>(); double temperature = jsonReceive.getTemperature(); // set initial temperature double initialTemperature = jsonReceive.getTemperature(); // get initial temperature double alpha = jsonReceive.getAlpha(); // used while changing temperature boolean cooling = jsonReceive.getCoolingWay().contains("T(i)"); int maxIter = jsonReceive.getIterations(); // max number of iterations int changes = jsonReceive.getAssignments(); // changes in solution double cWeight = jsonReceive.getcWeight(); double tWeight = jsonReceive.gettWeight(); boolean costConEnabled = jsonReceive.isCostConEnabled(); boolean timeConEnabled = jsonReceive.isTimeConEnabled(); int costCon = jsonReceive.getCostCon(); int timeCon = jsonReceive.getTimeCon(); double expUp; int [][] initialSolution = annealingTwoService.getRandomSolutionTwo(doubleTaskMachines, allTasks); // get initial solution int [][] bestSolution = initialSolution; // first best solution int [] bestArr = annealingTwoService.countEnergyTwo(bestSolution, cWeight, tWeight, allTasks, allMachines, costMatrix, timeMatrix); int bestEnergy = bestArr[0]; // initial energy int initialEnergy = bestEnergy; listBestEnergy.add(bestEnergy); listTemperature.add(temperature); listLoopNum.add(0); listAcceptanceProb.add(0.0); listAcceptance.add(0); listCost.add(bestArr[1]); listTime.add(bestArr[2]); for(int i = 0; i < maxIter; i++) { if(cooling) { temperature = alpha * temperature; } else { temperature = initialTemperature / ( 1 + Math.log10( i + 1 ) ); } listLoopNum.add(i+1); listTemperature.add(temperature); int [][] newSolution = annealingTwoService.changeSolutionTwo(bestSolution, changes, doubleTaskMachines, allTasks); int [] newArr = annealingTwoService.countEnergyTwo(newSolution, cWeight, tWeight, allTasks, allMachines, costMatrix, timeMatrix); int newEnergy = newArr[0]; // Applying time constraints -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- // if(newArr[2] > timeCon && timeConEnabled && !costConEnabled ) { do { newSolution = annealingTwoService.changeSolutionTwo(bestSolution, changes, doubleTaskMachines, allTasks); newArr = annealingTwoService.countEnergyTwo(newSolution, cWeight, tWeight, allTasks, allMachines, costMatrix, timeMatrix); newEnergy = newArr[0]; }while(newArr[2] > timeCon); } // Applying cost constraints if(newArr[1] > costCon && costConEnabled && !timeConEnabled ) { do { newSolution = annealingTwoService.changeSolutionTwo(bestSolution, changes, doubleTaskMachines, allTasks); newArr = annealingTwoService.countEnergyTwo(newSolution, cWeight, tWeight, allTasks, allMachines, costMatrix, timeMatrix); newEnergy = newArr[0]; }while(newArr[1] > costCon); } // Applying time and cost constraints if((newArr[1] > costCon || newArr[2] > timeCon) && costConEnabled && timeConEnabled ) { do { newSolution = annealingTwoService.changeSolutionTwo(bestSolution, changes, doubleTaskMachines, allTasks); newArr = annealingTwoService.countEnergyTwo(newSolution, cWeight, tWeight, allTasks, allMachines, costMatrix, timeMatrix); newEnergy = newArr[0]; }while( newArr[1] > costCon || newArr[2] > timeCon ); } // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- // int diff = Math.abs(newEnergy - bestEnergy); diff = -1 * diff; expUp = diff/temperature; double probFun = Math.exp(expUp); if(newEnergy <= bestEnergy) { bestSolution = newSolution; bestEnergy = newEnergy; bestArr = newArr; listBestEnergy.add(bestEnergy); listAcceptance.add(0); listAcceptanceProb.add(0.0); listCost.add(bestArr[1]); listTime.add(bestArr[2]); } else if( probFun > Math.random() ) { bestSolution = newSolution; bestEnergy = newEnergy; bestArr = newArr; System.out.println(" ^^ ^^ ^^ Worse solution accepted ^^ ^^ ^^ "); listBestEnergy.add(bestEnergy); listAcceptance.add(1); listAcceptanceProb.add(probFun); listCost.add(bestArr[1]); listTime.add(bestArr[2]); } else { listBestEnergy.add(bestEnergy); listAcceptance.add(0); listAcceptanceProb.add(0.0); listCost.add(bestArr[1]); listTime.add(bestArr[2]); } } // System.out.println("End energy is " + bestEnergy ); // System.out.println("Best found solution is "); // this.printMyTwoArray(bestSolution); theModel.addAttribute("energyList", listBestEnergy); theModel.addAttribute("foundSolution", bestSolution); int [] histogramData = new int[25]; for(int i = 0 ; i < bestSolution[0].length ; i ++) { for(int j = 0; j < bestSolution.length ; j++) { if(bestSolution[j][i] != -1) { histogramData[ bestSolution[j][i]-1 ] += 1; } } } // System.out.println("Histogram data: "); // this.printMyArray(histogramData); JsonResponse jsonResponse = new JsonResponse(bestSolution, tasksOffset, initialEnergy, bestEnergy, listLoopNum, listBestEnergy, listTemperature, listAcceptanceProb, listAcceptance, listTime, listCost, machineOffset, machineLength ); long stopTime = System.currentTimeMillis(); long elapsedTime = stopTime - startTime; System.out.println( "\n" + elapsedTime); System.out.println(initialEnergy + " & " + bestEnergy + " & " + Collections.min(listCost) + " & " + Collections.min(listTime) + " & " + Collections.max(listCost) + " & " + Collections.max(listTime) + " & " + elapsedTime); return jsonResponse; } // ***************************************************************************** // public void printMyArray(int [] arr) { if(arr == null) return; for(int i : arr) { System.out.print(" " + i ); } } public void printMyTwoArray(int [][] arr) { if(arr == null) return; for(int i = 0 ; i < arr.length ; i++) { for(int j = 0 ; j < arr[0].length ; j++) { System.out.print(arr[i][j] + " "); } System.out.println(" "); } } // ***************************************************************************** // }
UTF-8
Java
13,696
java
AnnealingControllerModelTwo.java
Java
[]
null
[]
package com.engineering.controller; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Random; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; 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.ResponseBody; import com.engineering.entity.Machine; import com.engineering.entity.Task; import com.engineering.json.JsonResponse; import com.engineering.json.JsonReceive; import com.engineering.service.MachineService; import com.engineering.service.TaskService; import com.engineering.servicemodeltwo.AnnealingTwoService; import com.engineering.twotasks.DoubleTask; @Controller @RequestMapping("/annealingtwo") public class AnnealingControllerModelTwo { Map<Integer, DoubleTask> doubleTaskMachines; // Tasks DAO @Autowired private TaskService taskService; // Machines DAO @Autowired private MachineService machineService; // Simulated annealing service @Autowired private AnnealingTwoService annealingTwoService; private int[][] timeMatrix; private int[][] costMatrix; @GetMapping("/display") public String mainAnnealing(Model theModel) { List<Task> allTasks = taskService.getAllTasks(); List<Machine> allMachines = machineService.getAllMachines(); if( !allTasks.isEmpty() && !allMachines.isEmpty() ) { costMatrix = new int [allMachines.size()][allTasks.size()+1]; timeMatrix = new int [allMachines.size()][allTasks.size()+1]; // Get id of first task and machine int offsetTask = allTasks.get(0).getId(); int offsetMachine = allMachines.get(0).getId(); for(Task theTask : allTasks) { for(Machine theMachine : allMachines ) { List<Machine> tasksMachines = theTask.getMachines(); boolean choice = tasksMachines.contains(theMachine); if(choice) { costMatrix[theMachine.getId()-offsetMachine][theTask.getId()-offsetTask+1] = theTask.getDetailsNumber() * theMachine.getDetailCost(); timeMatrix[theMachine.getId()-offsetMachine][theTask.getId()-offsetTask+1] = theTask.getDetailsNumber() * theMachine.getDetailTime(); } else { costMatrix[theMachine.getId()-offsetMachine][theTask.getId()-offsetTask+1] = 0; timeMatrix[theMachine.getId()-offsetMachine][theTask.getId()-offsetTask+1] = 0; } } } for(int i = 0 ; i < allMachines.size() ; i++) { costMatrix[i][0] = allMachines.get(i).getId(); timeMatrix[i][0] = allMachines.get(i).getId(); } int [][] colors = annealingTwoService.getColorDoubleTasks(doubleTaskMachines, allTasks, allMachines); theModel.addAttribute("tasks", allTasks); theModel.addAttribute("machines", allMachines); theModel.addAttribute("costMatrix", costMatrix); theModel.addAttribute("timeMatrix", timeMatrix); theModel.addAttribute("rows", costMatrix.length-1); theModel.addAttribute("cols", costMatrix[0].length-1); theModel.addAttribute("colors", colors); } return "main-annealing-two"; } @GetMapping("/getassign") public String TestController() { this.getRandomDoubleTasks(); return "redirect:/annealingtwo/display"; } /** * get random assignments between tasks and machines * * @return */ public String getRandomDoubleTasks() { // get new HashMap doubleTaskMachines = new HashMap<Integer, DoubleTask>(); // get All Tasks List<Task> allTasks = taskService.getAllTasks(); // loop through all tasks for(Task theTask : allTasks) { // get all machines for a given task List<Machine> machines = theTask.getMachines(); if(machines.size() == 1) { // if only one machine assigned to theTask then doubleTask must be 0 doubleTaskMachines.put(theTask.getId(), new DoubleTask(null, null, 0)); } else { Random random = new Random(); // Get integer between >= 0 and < 2 int randomChoice = random.nextInt(2) + 0; System.out.println("Random is " + randomChoice); // 50 % chance for a task to need two machines to be completed if(randomChoice == 0) { doubleTaskMachines.put(theTask.getId(), new DoubleTask(null, null, 0)); } else { // if theTask needs two machines to be completed int [] one; int [] two; // Get integer between >= 1 and < size int randomNum = random.nextInt(machines.size()-1) + 1; // Get randomNum different random numbers >= 0 and < machines.size() final int[] ints = new Random().ints(0, machines.size()).distinct().limit(randomNum).toArray(); one = new int[ints.length]; two = new int[machines.size() - ints.length]; for(int i = 0 ; i < ints.length ; i++) { one[i] = machines.get(ints[i]).getId(); } int ind = 0; for(int i = 0 ; i < machines.size() ; i++) { int id = machines.get(i).getId(); boolean choice = true; for(int j : one) { if(id == j) { choice = false; break; } } if(choice) { two[ind] = id; ind++; } } DoubleTask doubleTask = new DoubleTask(one, two, 1); doubleTaskMachines.put(theTask.getId(), doubleTask ); } } } return "redirect:/annealingtwo/display"; } @PostMapping("/solve") public @ResponseBody JsonResponse simulatedAnnealingTwo(@RequestBody JsonReceive jsonReceive, Model theModel) { long startTime = System.currentTimeMillis(); List<Task> allTasks = taskService.getAllTasks(); List<Machine> allMachines = machineService.getAllMachines(); int tasksOffset = allTasks.get(0).getId(); int machineOffset = allMachines.get(0).getId(); int machineLength = allMachines.size(); // System.out.println("## ## ## ## ## ## This is from JSON ## ## ## ## ## ##"); // System.out.println(jsonReceive.getAlpha()); // System.out.println(jsonReceive.getCoolingWay()); // System.out.println(jsonReceive.getTemperature()); // System.out.println(jsonReceive.getIterations()); // System.out.println(jsonReceive.getAssignments()); // System.out.println(jsonReceive.getcWeight()); // System.out.println(jsonReceive.gettWeight()); // System.out.println(jsonReceive.isCostConEnabled()); // System.out.println(jsonReceive.isTimeConEnabled()); // System.out.println(jsonReceive.getCostCon()); // System.out.println(jsonReceive.getTimeCon()); // System.out.println("## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##"); List<Integer> listLoopNum = new ArrayList<Integer>(); List<Integer> listBestEnergy = new ArrayList<Integer>(); List<Double> listTemperature = new ArrayList<Double>(); List<Double> listAcceptanceProb = new ArrayList<Double>(); List<Integer> listAcceptance = new ArrayList<Integer>(); List<Integer> listCost = new ArrayList<Integer>(); List<Integer> listTime = new ArrayList<Integer>(); double temperature = jsonReceive.getTemperature(); // set initial temperature double initialTemperature = jsonReceive.getTemperature(); // get initial temperature double alpha = jsonReceive.getAlpha(); // used while changing temperature boolean cooling = jsonReceive.getCoolingWay().contains("T(i)"); int maxIter = jsonReceive.getIterations(); // max number of iterations int changes = jsonReceive.getAssignments(); // changes in solution double cWeight = jsonReceive.getcWeight(); double tWeight = jsonReceive.gettWeight(); boolean costConEnabled = jsonReceive.isCostConEnabled(); boolean timeConEnabled = jsonReceive.isTimeConEnabled(); int costCon = jsonReceive.getCostCon(); int timeCon = jsonReceive.getTimeCon(); double expUp; int [][] initialSolution = annealingTwoService.getRandomSolutionTwo(doubleTaskMachines, allTasks); // get initial solution int [][] bestSolution = initialSolution; // first best solution int [] bestArr = annealingTwoService.countEnergyTwo(bestSolution, cWeight, tWeight, allTasks, allMachines, costMatrix, timeMatrix); int bestEnergy = bestArr[0]; // initial energy int initialEnergy = bestEnergy; listBestEnergy.add(bestEnergy); listTemperature.add(temperature); listLoopNum.add(0); listAcceptanceProb.add(0.0); listAcceptance.add(0); listCost.add(bestArr[1]); listTime.add(bestArr[2]); for(int i = 0; i < maxIter; i++) { if(cooling) { temperature = alpha * temperature; } else { temperature = initialTemperature / ( 1 + Math.log10( i + 1 ) ); } listLoopNum.add(i+1); listTemperature.add(temperature); int [][] newSolution = annealingTwoService.changeSolutionTwo(bestSolution, changes, doubleTaskMachines, allTasks); int [] newArr = annealingTwoService.countEnergyTwo(newSolution, cWeight, tWeight, allTasks, allMachines, costMatrix, timeMatrix); int newEnergy = newArr[0]; // Applying time constraints -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- // if(newArr[2] > timeCon && timeConEnabled && !costConEnabled ) { do { newSolution = annealingTwoService.changeSolutionTwo(bestSolution, changes, doubleTaskMachines, allTasks); newArr = annealingTwoService.countEnergyTwo(newSolution, cWeight, tWeight, allTasks, allMachines, costMatrix, timeMatrix); newEnergy = newArr[0]; }while(newArr[2] > timeCon); } // Applying cost constraints if(newArr[1] > costCon && costConEnabled && !timeConEnabled ) { do { newSolution = annealingTwoService.changeSolutionTwo(bestSolution, changes, doubleTaskMachines, allTasks); newArr = annealingTwoService.countEnergyTwo(newSolution, cWeight, tWeight, allTasks, allMachines, costMatrix, timeMatrix); newEnergy = newArr[0]; }while(newArr[1] > costCon); } // Applying time and cost constraints if((newArr[1] > costCon || newArr[2] > timeCon) && costConEnabled && timeConEnabled ) { do { newSolution = annealingTwoService.changeSolutionTwo(bestSolution, changes, doubleTaskMachines, allTasks); newArr = annealingTwoService.countEnergyTwo(newSolution, cWeight, tWeight, allTasks, allMachines, costMatrix, timeMatrix); newEnergy = newArr[0]; }while( newArr[1] > costCon || newArr[2] > timeCon ); } // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- // int diff = Math.abs(newEnergy - bestEnergy); diff = -1 * diff; expUp = diff/temperature; double probFun = Math.exp(expUp); if(newEnergy <= bestEnergy) { bestSolution = newSolution; bestEnergy = newEnergy; bestArr = newArr; listBestEnergy.add(bestEnergy); listAcceptance.add(0); listAcceptanceProb.add(0.0); listCost.add(bestArr[1]); listTime.add(bestArr[2]); } else if( probFun > Math.random() ) { bestSolution = newSolution; bestEnergy = newEnergy; bestArr = newArr; System.out.println(" ^^ ^^ ^^ Worse solution accepted ^^ ^^ ^^ "); listBestEnergy.add(bestEnergy); listAcceptance.add(1); listAcceptanceProb.add(probFun); listCost.add(bestArr[1]); listTime.add(bestArr[2]); } else { listBestEnergy.add(bestEnergy); listAcceptance.add(0); listAcceptanceProb.add(0.0); listCost.add(bestArr[1]); listTime.add(bestArr[2]); } } // System.out.println("End energy is " + bestEnergy ); // System.out.println("Best found solution is "); // this.printMyTwoArray(bestSolution); theModel.addAttribute("energyList", listBestEnergy); theModel.addAttribute("foundSolution", bestSolution); int [] histogramData = new int[25]; for(int i = 0 ; i < bestSolution[0].length ; i ++) { for(int j = 0; j < bestSolution.length ; j++) { if(bestSolution[j][i] != -1) { histogramData[ bestSolution[j][i]-1 ] += 1; } } } // System.out.println("Histogram data: "); // this.printMyArray(histogramData); JsonResponse jsonResponse = new JsonResponse(bestSolution, tasksOffset, initialEnergy, bestEnergy, listLoopNum, listBestEnergy, listTemperature, listAcceptanceProb, listAcceptance, listTime, listCost, machineOffset, machineLength ); long stopTime = System.currentTimeMillis(); long elapsedTime = stopTime - startTime; System.out.println( "\n" + elapsedTime); System.out.println(initialEnergy + " & " + bestEnergy + " & " + Collections.min(listCost) + " & " + Collections.min(listTime) + " & " + Collections.max(listCost) + " & " + Collections.max(listTime) + " & " + elapsedTime); return jsonResponse; } // ***************************************************************************** // public void printMyArray(int [] arr) { if(arr == null) return; for(int i : arr) { System.out.print(" " + i ); } } public void printMyTwoArray(int [][] arr) { if(arr == null) return; for(int i = 0 ; i < arr.length ; i++) { for(int j = 0 ; j < arr[0].length ; j++) { System.out.print(arr[i][j] + " "); } System.out.println(" "); } } // ***************************************************************************** // }
13,696
0.648072
0.641647
453
29.233995
26.242004
124
false
false
0
0
0
0
0
0
3.677704
false
false
0
30ba3b10d94a53c69c29a405185931bc4cfc78f8
20,031,727,490,369
81ee8266277af73b535d9849b4abd45def93dadb
/ssm_demo - 副本/src/main/java/com/insigma/IDao/StdQuestionMapper.java
0ed51eed8badd895a1ee2f4e0b39cf7ce99be5e9
[]
no_license
TinaHe/bigdata
https://github.com/TinaHe/bigdata
0781d30352044d3e3c2e7f399c9794f0be41803a
6e3a12aa2718a28ee449fd89ae384b54b5ff32f3
refs/heads/master
2020-03-28T01:15:57.310000
2018-09-20T14:17:05
2018-09-20T14:17:05
147,491,235
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.insigma.IDao; import com.insigma.domain.StdQuestion; public interface StdQuestionMapper { int deleteByPrimaryKey(Integer id); int deleteByCode(String code); int insert(StdQuestion record); int insertSelective(StdQuestion record); StdQuestion selectByPrimaryKey(Integer id); /** * 根据code获取问题 add by zhx * @param code * @return */ StdQuestion selectByCode(String stdQuestionCode); }
UTF-8
Java
462
java
StdQuestionMapper.java
Java
[]
null
[]
package com.insigma.IDao; import com.insigma.domain.StdQuestion; public interface StdQuestionMapper { int deleteByPrimaryKey(Integer id); int deleteByCode(String code); int insert(StdQuestion record); int insertSelective(StdQuestion record); StdQuestion selectByPrimaryKey(Integer id); /** * 根据code获取问题 add by zhx * @param code * @return */ StdQuestion selectByCode(String stdQuestionCode); }
462
0.704444
0.704444
23
18.608696
18.253622
53
false
false
0
0
0
0
0
0
0.347826
false
false
0
1660e46ed903a0476161ce5375749971f0004c8d
188,978,585,352
72b32da4e06500cc705ecea0c949d81fc03dcabb
/Code/chapter_06/examples/unit_6.7/ClassWithoutModifier.java
6d2c60aaae803f3639052482037f401897352a6b
[]
no_license
desioc/JFACode
https://github.com/desioc/JFACode
358c941f52a0a6a75e0c8be6ce4708296aa11e64
e0f40b14dde2fe43b3193fa02a865bc875e937e7
refs/heads/master
2023-05-15T03:01:00.575000
2021-06-09T07:48:52
2021-06-09T07:48:52
347,454,318
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cdsc.test; class ClassWithoutModifier { }
UTF-8
Java
54
java
ClassWithoutModifier.java
Java
[]
null
[]
package com.cdsc.test; class ClassWithoutModifier { }
54
0.796296
0.796296
4
12.75
12.437343
28
false
false
0
0
0
0
0
0
0.25
false
false
0
373b0bf612a7b3690bc7c64c15cb35d51b72d0b8
22,763,326,721,942
7ce61f8f7175542e4059506351669b048dfe7307
/app/src/main/java/com/tenone/gamebox/mode/mode/RebateModel.java
b63a043d3c838a7c39baabb4805f519fab7b6aab
[]
no_license
chanphy/GameBox
https://github.com/chanphy/GameBox
5f894124c529658ef0b056ac1e179e9f7a9bcc3b
81b8b0d234d177fd63b8918e4e70baef205041dd
refs/heads/master
2020-05-18T04:54:21.242000
2018-10-09T03:01:55
2018-10-09T03:01:55
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tenone.gamebox.mode.mode; import android.text.TextUtils; import com.tenone.gamebox.view.utils.TimeUtils; import java.io.Serializable; import java.util.ArrayList; import java.util.List; public class RebateModel implements Serializable { private static final long serialVersionUID = -2451408638823202524L; private String gameName; private String gameServer; private String gameRoleName; private String roleId; private String money; private String time; private int state; private String gameId; private List<RoleModel> roleModels = new ArrayList<RoleModel>(); public String getGameName() { return gameName; } public void setGameName(String gameName) { this.gameName = gameName; } public String getGameServer() { return gameServer; } public void setGameServer(String gameServer) { this.gameServer = gameServer; } public String getGameRoleName() { return gameRoleName; } public void setGameRoleName(String gameRoleName) { this.gameRoleName = gameRoleName; } public String getMoney() { return money; } public void setMoney(String money) { this.money = money; } public String getTime() { if (!TextUtils.isEmpty( time )) { try { long t = Long.valueOf( time ); t *= 1000; time = TimeUtils.formatData( t, "yyyy-MM-dd HH:mm:ss" ); } catch (NumberFormatException e) { return time; } } return time; } public void setTime(String time) { this.time = time; } public int getState() { return state; } public void setState(int state) { this.state = state; } public String getGameId() { return gameId; } public void setGameId(String gameId) { this.gameId = gameId; } public String getRoleId() { return roleId; } public void setRoleId(String roleId) { this.roleId = roleId; } public List<RoleModel> getRoleModels() { return roleModels; } public void setRoleModels(List<RoleModel> roleModels) { this.roleModels = roleModels; } }
UTF-8
Java
2,393
java
RebateModel.java
Java
[]
null
[]
package com.tenone.gamebox.mode.mode; import android.text.TextUtils; import com.tenone.gamebox.view.utils.TimeUtils; import java.io.Serializable; import java.util.ArrayList; import java.util.List; public class RebateModel implements Serializable { private static final long serialVersionUID = -2451408638823202524L; private String gameName; private String gameServer; private String gameRoleName; private String roleId; private String money; private String time; private int state; private String gameId; private List<RoleModel> roleModels = new ArrayList<RoleModel>(); public String getGameName() { return gameName; } public void setGameName(String gameName) { this.gameName = gameName; } public String getGameServer() { return gameServer; } public void setGameServer(String gameServer) { this.gameServer = gameServer; } public String getGameRoleName() { return gameRoleName; } public void setGameRoleName(String gameRoleName) { this.gameRoleName = gameRoleName; } public String getMoney() { return money; } public void setMoney(String money) { this.money = money; } public String getTime() { if (!TextUtils.isEmpty( time )) { try { long t = Long.valueOf( time ); t *= 1000; time = TimeUtils.formatData( t, "yyyy-MM-dd HH:mm:ss" ); } catch (NumberFormatException e) { return time; } } return time; } public void setTime(String time) { this.time = time; } public int getState() { return state; } public void setState(int state) { this.state = state; } public String getGameId() { return gameId; } public void setGameId(String gameId) { this.gameId = gameId; } public String getRoleId() { return roleId; } public void setRoleId(String roleId) { this.roleId = roleId; } public List<RoleModel> getRoleModels() { return roleModels; } public void setRoleModels(List<RoleModel> roleModels) { this.roleModels = roleModels; } }
2,393
0.583786
0.574175
105
20.790476
18.475052
72
false
false
0
0
0
0
0
0
0.371429
false
false
0
106b1084a3e8b222861ed2c28e37912a90961776
19,439,021,988,694
14746c4b8511abe301fd470a152de627327fe720
/soroush-android-1.10.0_source_from_JADX/com/google/android/gms/internal/cv.java
d10ade109bdf7ae456682cd4a0834f4758c38427
[]
no_license
maasalan/soroush-messenger-apis
https://github.com/maasalan/soroush-messenger-apis
3005c4a43123c6543dbcca3dd9084f95e934a6f4
29867bf53a113a30b1aa36719b1c7899b991d0a8
refs/heads/master
2020-03-21T21:23:20.693000
2018-06-28T19:57:01
2018-06-28T19:57:01
139,060,676
3
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.google.android.gms.internal; import android.os.IInterface; import com.google.android.gms.common.api.Status; public interface cv extends IInterface { void mo3027a(); void mo3028a(Status status); void mo3029b(); void mo3030c(); void mo3031d(); void mo3032e(); void mo3033f(); void mo3034g(); void mo3035h(); }
UTF-8
Java
366
java
cv.java
Java
[]
null
[]
package com.google.android.gms.internal; import android.os.IInterface; import com.google.android.gms.common.api.Status; public interface cv extends IInterface { void mo3027a(); void mo3028a(Status status); void mo3029b(); void mo3030c(); void mo3031d(); void mo3032e(); void mo3033f(); void mo3034g(); void mo3035h(); }
366
0.666667
0.568306
24
14.25
14.978456
48
false
false
0
0
0
0
0
0
0.5
false
false
0
846b9c6b1897b201e1ad900c5465eb11b7a31343
4,415,226,405,502
afc2d6ffa5ea77ddde34ee7ce898867c703dd2ed
/builder/src/main/java/adu/pattern/creation/builder/ProductA.java
936dd8b2278a4920f3f37e8700ef02dc4e8547c2
[]
no_license
ADU-21/pattern
https://github.com/ADU-21/pattern
51ed47286e9d45b716566e017db140f49c4a019c
8925c4ebe118769cb8c18dc849e67ddb82ef3018
refs/heads/master
2020-05-09T23:45:41.942000
2019-06-04T13:17:39
2019-06-04T13:17:39
181,511,237
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package adu.pattern.creation.builder; import java.io.Serializable; /** * @author adu * @data 2019/4/21 */ public class ProductA implements Serializable { private String elementA; private String elementB; private String elementC; public String getElementA() { return elementA; } public void setElementA(String elementA) { this.elementA = elementA; } public String getElementB() { return elementB; } public void setElementB(String elementB) { this.elementB = elementB; } public String getElementC() { return elementC; } public void setElementC(String elementC) { this.elementC = elementC; } @Override public String toString() { return "ProductA{" + "elementA='" + elementA + '\'' + ", elementB='" + elementB + '\'' + ", elementC='" + elementC + '\'' + '}'; } }
UTF-8
Java
947
java
ProductA.java
Java
[ { "context": "der;\n\nimport java.io.Serializable;\n\n/**\n * @author adu\n * @data 2019/4/21\n */\npublic class ProductA impl", "end": 87, "score": 0.9683672189712524, "start": 84, "tag": "USERNAME", "value": "adu" } ]
null
[]
package adu.pattern.creation.builder; import java.io.Serializable; /** * @author adu * @data 2019/4/21 */ public class ProductA implements Serializable { private String elementA; private String elementB; private String elementC; public String getElementA() { return elementA; } public void setElementA(String elementA) { this.elementA = elementA; } public String getElementB() { return elementB; } public void setElementB(String elementB) { this.elementB = elementB; } public String getElementC() { return elementC; } public void setElementC(String elementC) { this.elementC = elementC; } @Override public String toString() { return "ProductA{" + "elementA='" + elementA + '\'' + ", elementB='" + elementB + '\'' + ", elementC='" + elementC + '\'' + '}'; } }
947
0.576558
0.569166
46
19.586956
16.594362
47
false
false
0
0
0
0
0
0
0.304348
false
false
0
20d346021d385cd5c48ed28d04663a8025c68279
11,940,009,143,904
eb70c1b311c82a282fd744eb89b983a26a939ea0
/src/main/java/com/arjjs/ccm/modules/plm/allot/entity/PlmAllotDetail.java
8d758636ec7d130a49979a8e9c92be05f4bf5d3c
[]
no_license
arjccm/arjccm_std
https://github.com/arjccm/arjccm_std
dbf0e11fbc536cc3222628d2e96d03b319adacd3
10c58d5db58fbfa95d4f8ba6b6490276ad464486
refs/heads/master
2022-12-23T16:56:49.462000
2021-02-03T07:51:11
2021-02-03T07:51:11
239,068,652
2
4
null
false
2022-12-16T15:24:51
2020-02-08T04:25:37
2021-02-03T07:52:01
2022-12-16T15:24:48
464,849
0
4
22
JavaScript
false
false
/** * Copyright &copy; 2012-2018 All rights reserved. */ package com.arjjs.ccm.modules.plm.allot.entity; import org.hibernate.validator.constraints.Length; import com.arjjs.ccm.common.persistence.DataEntity; /** * 调拨详细Entity * @author dongqikai * @version 2018-08-21 */ public class PlmAllotDetail extends DataEntity<PlmAllotDetail> { private static final long serialVersionUID = 1L; private String allotId; // 调拨单id private String equCode; // 物资编号 private String extend1; // 扩展1 private String extend2; // 扩展2 private String code; //物资编号 private String name; // 物资名称 private String spec; // 规格型号 private String unit; // 计量单位 private Integer erialNumber = 1; // 物资数量(主要是耗材) private String price; //物资价格 private String sum; //总价 private String qrCode; //二维码base64 public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSpec() { return spec; } public void setSpec(String spec) { this.spec = spec; } public String getUnit() { return unit; } public void setUnit(String unit) { this.unit = unit; } public Integer getErialNumber() { return erialNumber; } public void setErialNumber(Integer erialNumber) { this.erialNumber = erialNumber; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } public String getSum() { return sum; } public void setSum(String sum) { this.sum = sum; } public String getQrCode() { return qrCode; } public void setQrCode(String qrCode) { this.qrCode = qrCode; } public static long getSerialversionuid() { return serialVersionUID; } public PlmAllotDetail() { super(); } public PlmAllotDetail(String id){ super(id); } @Length(min=1, max=64, message="调拨单id长度必须介于 1 和 64 之间") public String getAllotId() { return allotId; } public void setAllotId(String allotId) { this.allotId = allotId; } @Length(min=1, max=64, message="物资编号长度必须介于 1 和 64 之间") public String getEquCode() { return equCode; } public void setEquCode(String equCode) { this.equCode = equCode; } @Length(min=0, max=256, message="扩展1长度必须介于 0 和 256 之间") public String getExtend1() { return extend1; } public void setExtend1(String extend1) { this.extend1 = extend1; } @Length(min=0, max=256, message="扩展2长度必须介于 0 和 256 之间") public String getExtend2() { return extend2; } public void setExtend2(String extend2) { this.extend2 = extend2; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } }
UTF-8
Java
2,797
java
PlmAllotDetail.java
Java
[ { "context": "sistence.DataEntity;\n\n/**\n * 调拨详细Entity\n * @author dongqikai\n * @version 2018-08-21\n */\npublic class PlmAllotD", "end": 251, "score": 0.9994664192199707, "start": 242, "tag": "USERNAME", "value": "dongqikai" } ]
null
[]
/** * Copyright &copy; 2012-2018 All rights reserved. */ package com.arjjs.ccm.modules.plm.allot.entity; import org.hibernate.validator.constraints.Length; import com.arjjs.ccm.common.persistence.DataEntity; /** * 调拨详细Entity * @author dongqikai * @version 2018-08-21 */ public class PlmAllotDetail extends DataEntity<PlmAllotDetail> { private static final long serialVersionUID = 1L; private String allotId; // 调拨单id private String equCode; // 物资编号 private String extend1; // 扩展1 private String extend2; // 扩展2 private String code; //物资编号 private String name; // 物资名称 private String spec; // 规格型号 private String unit; // 计量单位 private Integer erialNumber = 1; // 物资数量(主要是耗材) private String price; //物资价格 private String sum; //总价 private String qrCode; //二维码base64 public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSpec() { return spec; } public void setSpec(String spec) { this.spec = spec; } public String getUnit() { return unit; } public void setUnit(String unit) { this.unit = unit; } public Integer getErialNumber() { return erialNumber; } public void setErialNumber(Integer erialNumber) { this.erialNumber = erialNumber; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } public String getSum() { return sum; } public void setSum(String sum) { this.sum = sum; } public String getQrCode() { return qrCode; } public void setQrCode(String qrCode) { this.qrCode = qrCode; } public static long getSerialversionuid() { return serialVersionUID; } public PlmAllotDetail() { super(); } public PlmAllotDetail(String id){ super(id); } @Length(min=1, max=64, message="调拨单id长度必须介于 1 和 64 之间") public String getAllotId() { return allotId; } public void setAllotId(String allotId) { this.allotId = allotId; } @Length(min=1, max=64, message="物资编号长度必须介于 1 和 64 之间") public String getEquCode() { return equCode; } public void setEquCode(String equCode) { this.equCode = equCode; } @Length(min=0, max=256, message="扩展1长度必须介于 0 和 256 之间") public String getExtend1() { return extend1; } public void setExtend1(String extend1) { this.extend1 = extend1; } @Length(min=0, max=256, message="扩展2长度必须介于 0 和 256 之间") public String getExtend2() { return extend2; } public void setExtend2(String extend2) { this.extend2 = extend2; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } }
2,797
0.691657
0.666282
143
17.195805
17.15591
64
false
false
0
0
0
0
0
0
1.391608
false
false
0
6de8b05b3ff1a1c705704db862693d3e3eaa26eb
9,560,597,225,151
a1612df60a8834fa1e8ef1fa6f0782a5f67fd387
/src/main/java/com/ice/operationlog/service/dto/UserDto.java
bf2cef7e454f2e9b3c5d5efd1dd1dccb2d62803b
[]
no_license
iceAcmen/operation-log
https://github.com/iceAcmen/operation-log
bce20feba93e18fa68ed04be1839903c80f3b8b7
95d411be5899828ea2c6124f27f70f6294b698db
refs/heads/master
2022-06-20T17:23:40.709000
2020-02-07T05:44:32
2020-02-07T05:44:32
238,450,924
0
0
null
false
2022-06-17T02:51:26
2020-02-05T12:59:30
2020-02-07T05:44:42
2022-06-17T02:51:26
79
0
0
1
Java
false
false
package com.ice.operationlog.service.dto; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Data @AllArgsConstructor @NoArgsConstructor public class UserDto { /** id */ private int id; /** username */ private String username; /** age */ private int age; /** birthday */ private Long birthday; /** user_address */ private String userAddress; /** sex */ private String sex; /** status */ private String status; }
UTF-8
Java
507
java
UserDto.java
Java
[]
null
[]
package com.ice.operationlog.service.dto; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Data @AllArgsConstructor @NoArgsConstructor public class UserDto { /** id */ private int id; /** username */ private String username; /** age */ private int age; /** birthday */ private Long birthday; /** user_address */ private String userAddress; /** sex */ private String sex; /** status */ private String status; }
507
0.654832
0.654832
25
19.280001
10.089678
41
false
false
0
0
0
0
0
0
0.44
false
false
0
671fe5385965f1e3d5ff79bc4ade8728fd06285a
19,292,993,159,336
a6fd8927874002ba1ea220decd238a6e2b2add2a
/src/main/java/com/test/java/collection/list/ArrayListImpl.java
753aa83a6de123d87a0345d4a88f650e841afc8e
[]
no_license
azagaurav/testing
https://github.com/azagaurav/testing
a9717f51f187586db77df432983e21c3fd0e12f0
39d5a90966b49f98f677d8a255cfcff1c8dda038
refs/heads/master
2018-09-09T08:56:38.220000
2018-07-30T17:05:59
2018-07-30T17:05:59
120,076,044
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.test.java.collection.list; import java.util.ArrayList; import com.test.java.bean.Employee; import com.test.java.bean.Users; public class ArrayListImpl { public ArrayList<Users> createUsers() { // TODO Auto-generated method stub ArrayList<Users> ts1 = new ArrayList<Users>(); ts1.add(new Users ("Andy","Admin")); ts1.add(new Users ("Smith","HR")); ts1.add(new Users ("Mark","Non Admin")); ts1.add(new Users ("Dwane","Executive")); return ts1; } public ArrayList<Employee> createEmployee() { // TODO Auto-generated method stub return null; } }
UTF-8
Java
625
java
ArrayListImpl.java
Java
[ { "context": "rayList<Users>();\n\t\t \n ts1.add(new Users (\"Andy\",\"Admin\"));\n \n ts1.add(new Users (\"Smith\",", "end": 335, "score": 0.999753475189209, "start": 331, "tag": "NAME", "value": "Andy" }, { "context": " (\"Andy\",\"Admin\"));\n \n ts1.add(new Users (\"Smith\",\"HR\"));\n \n ts1.add(new Users (\"Mark\",\"Non", "end": 383, "score": 0.9997429847717285, "start": 378, "tag": "NAME", "value": "Smith" }, { "context": "rs (\"Smith\",\"HR\"));\n \n ts1.add(new Users (\"Mark\",\"Non Admin\"));\n \n ts1.add(new Users (\"Dwa", "end": 427, "score": 0.9998672604560852, "start": 423, "tag": "NAME", "value": "Mark" }, { "context": "ark\",\"Non Admin\"));\n \n ts1.add(new Users (\"Dwane\",\"Executive\"));\n\t\treturn ts1;\n\t}\n\n\tpublic ArrayLi", "end": 479, "score": 0.9997934103012085, "start": 474, "tag": "NAME", "value": "Dwane" } ]
null
[]
package com.test.java.collection.list; import java.util.ArrayList; import com.test.java.bean.Employee; import com.test.java.bean.Users; public class ArrayListImpl { public ArrayList<Users> createUsers() { // TODO Auto-generated method stub ArrayList<Users> ts1 = new ArrayList<Users>(); ts1.add(new Users ("Andy","Admin")); ts1.add(new Users ("Smith","HR")); ts1.add(new Users ("Mark","Non Admin")); ts1.add(new Users ("Dwane","Executive")); return ts1; } public ArrayList<Employee> createEmployee() { // TODO Auto-generated method stub return null; } }
625
0.6512
0.6416
32
18.53125
19.065651
49
false
false
0
0
0
0
0
0
1.15625
false
false
0
823cdd5c31893e93828f4c2867d46eb95ae51201
15,358,803,072,928
2c49d826fbb94681ca87d6e2779ac65cbcc34aad
/src/main/java/com/codegym/god/repository/impl/ThingRepositoryImpl.java
96a5eb206f8df170725fb24d3bc7533d3ff2b239
[]
no_license
c10-AnhTN/god-create-things
https://github.com/c10-AnhTN/god-create-things
827a06d60a2506290fc41edc38dc20b73e75b405
a6fbd0bf0af2b77b760b8214ee8882e29c2e56df
refs/heads/master
2020-04-15T16:33:36.640000
2019-01-09T10:27:11
2019-01-09T10:27:11
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.codegym.god.repository.impl; import com.codegym.god.model.Thing; import com.codegym.god.repository.ThingRepository; import javax.persistence.EntityManager; import javax.persistence.NoResultException; import javax.persistence.PersistenceContext; import javax.persistence.TypedQuery; import javax.transaction.Transactional; import java.util.List; @Transactional public class ThingRepositoryImpl implements ThingRepository { @PersistenceContext private EntityManager em; @Override public List<Thing> findAll() { TypedQuery<Thing> query = em.createQuery("select t from Thing t", Thing.class); return query.getResultList(); } @Override public Thing findById(Long id) { TypedQuery<Thing> query = em.createQuery("select t from Thing t where t.id=:id", Thing.class); query.setParameter("id", id); try { return query.getSingleResult(); } catch (NoResultException e) { return null; } } @Override public void save(Thing model) { if (model.getId() != null) { em.merge(model); } else { em.persist(model); } } @Override public void remove(Long id) { Thing article = findById(id); if (article != null) { em.remove(article); } } }
UTF-8
Java
1,357
java
ThingRepositoryImpl.java
Java
[]
null
[]
package com.codegym.god.repository.impl; import com.codegym.god.model.Thing; import com.codegym.god.repository.ThingRepository; import javax.persistence.EntityManager; import javax.persistence.NoResultException; import javax.persistence.PersistenceContext; import javax.persistence.TypedQuery; import javax.transaction.Transactional; import java.util.List; @Transactional public class ThingRepositoryImpl implements ThingRepository { @PersistenceContext private EntityManager em; @Override public List<Thing> findAll() { TypedQuery<Thing> query = em.createQuery("select t from Thing t", Thing.class); return query.getResultList(); } @Override public Thing findById(Long id) { TypedQuery<Thing> query = em.createQuery("select t from Thing t where t.id=:id", Thing.class); query.setParameter("id", id); try { return query.getSingleResult(); } catch (NoResultException e) { return null; } } @Override public void save(Thing model) { if (model.getId() != null) { em.merge(model); } else { em.persist(model); } } @Override public void remove(Long id) { Thing article = findById(id); if (article != null) { em.remove(article); } } }
1,357
0.642594
0.642594
54
24.129629
21.454557
102
false
false
0
0
0
0
0
0
0.425926
false
false
0
5a68845e36ccd1677af56bd48093b8dda4ebf04b
17,102,559,791,225
0cf8d36b4a81214d72e43a444ed03f9571beb08a
/zheng-hospital/zheng-hospital-rpc-api/src/main/java/com/zheng/hospital/rpc/api/ChcUserInfoServiceMock.java
e58be7bf8bc28d9b0e41dde5f9d81b3ec6ce22de
[ "MIT" ]
permissive
shinyzo/zheng
https://github.com/shinyzo/zheng
22be6ac055267bf074f749b319b3dd711ed0f8ed
8897c0e646827011527e11afc9c64bdb2534fe50
refs/heads/master
2021-09-02T14:25:26.105000
2018-01-03T06:33:58
2018-01-03T06:33:58
114,653,594
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.zheng.hospital.rpc.api; import com.zheng.common.base.BaseServiceMock; import com.zheng.hospital.dao.mapper.ChcUserInfoMapper; import com.zheng.hospital.dao.model.ChcUserInfo; import com.zheng.hospital.dao.model.ChcUserInfoExample; /** * 降级实现ChcUserInfoService接口 * Created by shuzheng on 2017/12/18. */ public class ChcUserInfoServiceMock extends BaseServiceMock<ChcUserInfoMapper, ChcUserInfo, ChcUserInfoExample> implements ChcUserInfoService { }
UTF-8
Java
475
java
ChcUserInfoServiceMock.java
Java
[ { "context": "mple;\n\n/**\n* 降级实现ChcUserInfoService接口\n* Created by shuzheng on 2017/12/18.\n*/\npublic class ChcUserInfoService", "end": 297, "score": 0.999421238899231, "start": 289, "tag": "USERNAME", "value": "shuzheng" } ]
null
[]
package com.zheng.hospital.rpc.api; import com.zheng.common.base.BaseServiceMock; import com.zheng.hospital.dao.mapper.ChcUserInfoMapper; import com.zheng.hospital.dao.model.ChcUserInfo; import com.zheng.hospital.dao.model.ChcUserInfoExample; /** * 降级实现ChcUserInfoService接口 * Created by shuzheng on 2017/12/18. */ public class ChcUserInfoServiceMock extends BaseServiceMock<ChcUserInfoMapper, ChcUserInfo, ChcUserInfoExample> implements ChcUserInfoService { }
475
0.831533
0.814255
14
32.07143
37.453712
143
false
false
0
0
0
0
0
0
0.5
false
false
0
7a9506a78171ab0d5744f37917ab4fc4a3f22b6c
23,862,838,302,814
341165b839d231e284f76edab050d5bebe4ddce5
/comjacobdesignpattern/src/main/java/com/jacob/gettingstart/ModelDuck.java
a4da728f321eb175af504cd840425c38b3a39db9
[]
no_license
zhoujiahao123/designPattern
https://github.com/zhoujiahao123/designPattern
a518c622aa946eebefe62d0140c543ab8f903fc1
a69f92edc3c2e45141b83ccfb99253df83e06b79
refs/heads/master
2020-08-08T20:08:13.769000
2019-10-09T11:55:48
2019-10-09T11:55:48
213,905,890
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jacob.gettingstart; import com.sun.org.apache.xpath.internal.operations.Mod; public class ModelDuck extends Duck { public ModelDuck(){ //先让他不能飞 flyBehavior = new FlyNoWay(); } public void display() { System.out.println("i am a model duck"); } }
UTF-8
Java
312
java
ModelDuck.java
Java
[]
null
[]
package com.jacob.gettingstart; import com.sun.org.apache.xpath.internal.operations.Mod; public class ModelDuck extends Duck { public ModelDuck(){ //先让他不能飞 flyBehavior = new FlyNoWay(); } public void display() { System.out.println("i am a model duck"); } }
312
0.646667
0.646667
14
20.428572
18.634508
56
false
false
0
0
0
0
0
0
0.285714
false
false
0
82eab27bc1cc49fd0ec5f6eeb4df56e2fad3eb44
481,036,398,060
b0b5b38f9fbdc48dda21a8ce3c374390639f83d7
/RestMessengerAdv/src/main/java/org/chase/rest_messenger_adv/resources/MessageResource.java
444001d4cc28dfa4b19d7caceeafad40c2c3e0cf
[]
no_license
frezinhott/J2EE-Examples
https://github.com/frezinhott/J2EE-Examples
9b05a5ab76f164d080e620e822d7edae3d6559e9
2771b5fc01ae7b9f926bf0e090b5d0edad856874
refs/heads/master
2021-08-23T17:00:26.548000
2017-12-05T19:45:42
2017-12-05T19:45:42
110,754,911
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.chase.rest_messenger_adv.resources; import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.ws.rs.BeanParam; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; import org.chase.rest_messenger_adv.model.Comment; import org.chase.rest_messenger_adv.model.Message; import org.chase.rest_messenger_adv.resources.beans.MessageFilterBean; import org.chase.rest_messenger_adv.service.MessageService; /** * This resource is accessed by the following URL: * http://localhost:8080/REST-Messenger/webapi/messages * * @GET configures this method to be executed when ever there is a HTTP GET call on this resource * @POST configures this method to be executed when ever there is a HTTP POST call on this resource * @PUT configures this method to be executed when ever there is a HTTP PUT call on this resource * @DELETE configures this method to be executed when ever there is a HTTP DELETE call on this resource * * @Path Adds a sub-resource to the /messages resource * * @PathParam("variable") Separated by a "?". Adds the {variable} path parameter as a variable in the method * * @QueryParam("variable") Adds the "variable" as a variable in the method * * @BeanParam [bean class] Encapsulates all of the query params into a bean * * @Consumes: MediaType specifies the input content format * @Produces: MediaType specifies the return content format * * The @Consumes and @Produces annotations can overload a method to distinguish between 2 different GET methods * * MediaType.TEXT_PLAIN returns plain text * MediaType.APPLICATION_XML returns xml format. * JAX-B Annotation (@XmlRootElement) on the message model will be needed. * MediaType.APPLICATION_JSON returns JSON format. * * * @author Trevor Chase * */ /** * @Produces(value = { MediaType.APPLICATION_JSON, MediaType.TEXT_XML }) * Allows for both JSON or XML format. Needs "Accept" in the Header with the value that the client expects * Header: Accept * Value: text/xml OR text/plain OR application/json * * @Consumes(value = { MediaType.APPLICATION_JSON, MediaType.TEXT_XML }) * Allows for both JSON or XML format. Needs "Content-Type" in the Header with the value that the client expects * Header: Content-Type * Value: text/xml OR text/plain OR application/json * */ @Path("/messages") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public class MessageResource { MessageService messageService = new MessageService(); /** * Get all messages * http://localhost:8080/RestMessengerAdv/api/messages * * Get all messages for any given year * http://localhost:8080/RestMessengerAdv/api/messages?year=variable * * Get #=size messages starting at id=start * http://localhost:8080/RestMessengerAdv/api/messages?start=variable&size=variable * * @return returns a list of all messages */ @GET public Response getMessages(@BeanParam MessageFilterBean filterBean, @Context UriInfo uriInfo){ if(filterBean.getYear() > 0){ List<Message> messagesForYear = messageService.getAllMessagesForYear(filterBean.getYear()); return Response.status(Status.OK) // Add the new message to the Response .entity(messagesForYear) // Build the Response .build(); } if(filterBean.getStart() > 0 && filterBean.getSize() > 0){ List<Message> messagesPagenated = messageService.getAllMessagesPagenated(filterBean.getStart(), filterBean.getSize()); return Response.status(Status.OK) // Add the new message to the Response .entity(messagesPagenated) // Build the Response .build(); } List<Message> messages = messageService.getAllMessages(); // Loop through the messages and add the URI information to each message for(Message message : messages){ // Construct the URI link to self String uriSelf = getUriForSelf(uriInfo, message); // Construct the URI link to the author's profile String uriProfile = getUriForProfile(uriInfo, message); // Construct the URI link to the message comments String uriComments = getUriForComments(uriInfo, message); // Add the URI link to self message.addLink(uriSelf, "self"); // Add the URI link to profile message.addLink(uriProfile, "profile"); // Add the URI link to the comment message.addLink(uriComments, "comments"); // Get message comments and assign the URI information to them List<Comment> comments = new ArrayList<>(message.getComments().values()); Map<Long, Comment> messageComments = new HashMap<>(); long i=0; for(Comment comment : comments){ // Construct the URI link to the message comments String uriComment = getUriForComment(uriInfo, message, comment); // Add the URI link to the comment comment.addLink(uriComment, "comment"); // Add the updated comment to the new message comment map messageComments.put(i, comment); i++; } message.setComments(messageComments); } // Set the Response status to 200 (OK) return Response.status(Status.OK) // Add the new message to the Response .entity(messages) // Build the Response .build(); } /** * http://localhost:8080/RestMessengerAdv/api/messages/{messageId} * * @return returns the message corresponding to the messageId with HATEOAS URI link information */ @GET @Path("/{messageId}") public Response getMesaage(@PathParam("messageId") long messageId, @Context UriInfo uriInfo){ // Get the corresponding message Message message = messageService.getMessage(messageId); // Construct the URI link to self String uriSelf = getUriForSelf(uriInfo, message); // Construct the URI link to the author's profile String uriProfile = getUriForProfile(uriInfo, message); // Construct the URI link to the message comments String uriComments = getUriForComments(uriInfo, message); // Add the URI link to self message.addLink(uriSelf, "self"); // Add the URI link to profile message.addLink(uriProfile, "profile"); // Add the URI link to profile message.addLink(uriComments, "comments"); // Get message comments and assign the URI information to them List<Comment> comments = new ArrayList<>(message.getComments().values()); Map<Long, Comment> messageComments = new HashMap<>(); long i=0; for(Comment comment : comments){ // Construct the URI link to the message comments String uriComment = getUriForComment(uriInfo, message, comment); // Add the URI link to the comment comment.addLink(uriComment, "comment"); // Add the updated comment to the new message comment map messageComments.put(i, comment); i++; } message.setComments(messageComments); // Set the Response status to 201 (CREATED) return Response.status(Status.OK) // Add the new message to the Response .entity(message) // Build the Response .build(); } /** * This method constructs the URI link to the message comments resource * http://localhost:8080/RestMessengerAdv/api/messages/{messageId}/comments * * @param uriInfo * @param message * @return */ private String getUriForComments(UriInfo uriInfo, Message message) { // Build the URI link // http://localhost:8080/RestMessengerAdv/api String uri = uriInfo.getBaseUriBuilder() // Add /messages .path(MessageResource.class) // Add /{messageId}/comments // Pass in the resource class and the method that has the @Path annotation .path(MessageResource.class, "getCommentResource") // Add the messageId to the {messageId} variable .resolveTemplate("messageId", message.getId()) // Build the URI .build() // Convert the URI to a String .toString(); return uri; } /** * This method constructs the URI link to the message comments resource * http://localhost:8080/RestMessengerAdv/api/messages/{messageId}/comments/{commentId} * * @param uriInfo * @param message * @return */ private String getUriForComment(UriInfo uriInfo, Message message, Comment comment) { // Build the URI link // http://localhost:8080/RestMessengerAdv/api String uri = uriInfo.getBaseUriBuilder() // Add /messages .path(MessageResource.class) // Add /{messageId}/comments // Pass in the resource class and the method that has the @Path annotation .path(MessageResource.class, "getCommentResource") // Add /{commentId} // Pass in the resource class and the method that has the @Path annotation .path(CommentResource.class, "getComment") // Add the messageId to the {messageId} variable .resolveTemplate("messageId", message.getId()) // Add the messageId to the {messageId} variable .resolveTemplate("commentId", comment.getId()) // Build the URI .build() // Convert the URI to a String .toString(); return uri; } /** * This method constructs the URI link to the message author's profile * http://localhost:8080/RestMessengerAdv/api/profiles/{profileName} * * @param uriInfo * @param message * @return */ private String getUriForProfile(UriInfo uriInfo, Message message) { // Build the URI link // http://localhost:8080/RestMessengerAdv/api String uri = uriInfo.getBaseUriBuilder() // Add /profiles .path(ProfileResource.class) // Add /{profileName} .path(message.getAuthor()) // Build the URI .build() // Convert the URI to a String .toString(); return uri; } /** * This method constructs the URI link to self * http://localhost:8080/RestMessengerAdv/api/messages/{messageId} * * @param uriInfo * @param message * @return */ private String getUriForSelf(UriInfo uriInfo, Message message) { // Build the URI link // http://localhost:8080/RestMessengerAdv/api String uri = uriInfo.getBaseUriBuilder() // Add /messages .path(MessageResource.class) // Add /{messageId} .path(Long.toString(message.getId())) // Build the URI .build() // Convert the URI to a String .toString(); return uri; } /** * http://localhost:8080/RestMessengerAdv/api/messages * Adds a new message * * @return returns a Response with a 201 status code, the newly added message and the URI location * @throws URISyntaxException */ @POST public Response addMessage(@Context UriInfo uriInfo, Message message){ // Add the new message Message newMessage = messageService.addMessage(message); /* * The commented out code will cause duplicate links when getAllMessages() is called * // Construct the URI link to self String uriSelf = getUriForSelf(uriInfo, newMessage); // Construct the URI link to the author's profile String uriProfile = getUriForProfile(uriInfo, newMessage); // Construct the URI link to the message comments String uriComments = getUriForComments(uriInfo, newMessage); // Add the URI link to self newMessage.addLink(uriSelf, "self"); // Add the URI link to profile newMessage.addLink(uriProfile, "profile"); // Add the URI link to profile newMessage.addLink(uriComments, "comments"); */ // Assign the message ID to a string value String newId = String.valueOf(newMessage.getId()); // Create a new URI with the message ID in it and build URI uri =uriInfo.getAbsolutePathBuilder().path(newId).build(); // Set the Response status to 201 (CREATED) return Response.created(uri) // Add the new message to the Response .entity(newMessage) // Build the Response .build(); } /** * http://localhost:8080/RestMessengerAdv/api/messages/{messageId} * Updates an existing message * * @return returns the updated message corresponding to the messageId */ @PUT @Path("/{messageId}") public Response updateMessage(@Context UriInfo uriInfo, @PathParam("messageId") long messageId, Message message){ // We must set the ID in the message in order to update it message.setId(messageId); Message updatedMessage = messageService.updateMessage(message); // Construct the URI link to self String uriSelf = getUriForSelf(uriInfo, updatedMessage); // Construct the URI link to the author's profile String uriProfile = getUriForProfile(uriInfo, updatedMessage); // Construct the URI link to the message comments String uriComments = getUriForComments(uriInfo, updatedMessage); // Add the URI link to self updatedMessage.addLink(uriSelf, "self"); // Add the URI link to profile updatedMessage.addLink(uriProfile, "profile"); // Add the URI link to profile updatedMessage.addLink(uriComments, "comments"); // Set the Response status to 204 (NO_CONTENT) return Response.status(Status.NO_CONTENT) // Add the new message to the Response .entity(updatedMessage) // Build the Response .build(); } /** * http://localhost:8080/RestMessengerAdv/api/messages/{messageId} * Deletes an existing message * * @return returns the deleted message corresponding to the messageId */ @DELETE @Path("/{messageId}") public Response deleteMessage(@PathParam("messageId") long messageId){ Message message = messageService.removeMessage(messageId); // Set the Response status to 204 (OK) return Response.status(Status.OK) // Add the new message to the Response .entity(message) // Build the Response .build(); } /** * http://localhost:8080/RestMessengerAdv/api/messages/{messageId}/comments * * This method hands off the responsibilities to the CommentResource class * * @return */ @Path("/{messageId}/comments") public CommentResource getCommentResource(){ return new CommentResource(); } /** * http://localhost:8080/RestMessengerAdv/api/messages/test * * @return returns the text: Test */ @GET @Path("/test") public String getTest(){ return "Test"; } /** * http://localhost:8080/RestMessengerAdv/api/messages/test/{regExpression: * } * regExpression : \\d+ - only valid if input is a number * * @return returns the input as long as it meets the regular expression requirements */ @GET @Path("/test/{regExpression : \\d+}") public String getExpression(@PathParam("regExpression") String regExpression){ return regExpression; } }
UTF-8
Java
14,725
java
MessageResource.java
Java
[ { "context": "TION_JSON \treturns JSON format.\n * \n * \n * @author Trevor Chase\n *\n */\n\n/**\n * @Produces(value = { MediaType.APP", "end": 2223, "score": 0.9998443722724915, "start": 2211, "tag": "NAME", "value": "Trevor Chase" } ]
null
[]
package org.chase.rest_messenger_adv.resources; import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.ws.rs.BeanParam; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; import org.chase.rest_messenger_adv.model.Comment; import org.chase.rest_messenger_adv.model.Message; import org.chase.rest_messenger_adv.resources.beans.MessageFilterBean; import org.chase.rest_messenger_adv.service.MessageService; /** * This resource is accessed by the following URL: * http://localhost:8080/REST-Messenger/webapi/messages * * @GET configures this method to be executed when ever there is a HTTP GET call on this resource * @POST configures this method to be executed when ever there is a HTTP POST call on this resource * @PUT configures this method to be executed when ever there is a HTTP PUT call on this resource * @DELETE configures this method to be executed when ever there is a HTTP DELETE call on this resource * * @Path Adds a sub-resource to the /messages resource * * @PathParam("variable") Separated by a "?". Adds the {variable} path parameter as a variable in the method * * @QueryParam("variable") Adds the "variable" as a variable in the method * * @BeanParam [bean class] Encapsulates all of the query params into a bean * * @Consumes: MediaType specifies the input content format * @Produces: MediaType specifies the return content format * * The @Consumes and @Produces annotations can overload a method to distinguish between 2 different GET methods * * MediaType.TEXT_PLAIN returns plain text * MediaType.APPLICATION_XML returns xml format. * JAX-B Annotation (@XmlRootElement) on the message model will be needed. * MediaType.APPLICATION_JSON returns JSON format. * * * @author <NAME> * */ /** * @Produces(value = { MediaType.APPLICATION_JSON, MediaType.TEXT_XML }) * Allows for both JSON or XML format. Needs "Accept" in the Header with the value that the client expects * Header: Accept * Value: text/xml OR text/plain OR application/json * * @Consumes(value = { MediaType.APPLICATION_JSON, MediaType.TEXT_XML }) * Allows for both JSON or XML format. Needs "Content-Type" in the Header with the value that the client expects * Header: Content-Type * Value: text/xml OR text/plain OR application/json * */ @Path("/messages") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public class MessageResource { MessageService messageService = new MessageService(); /** * Get all messages * http://localhost:8080/RestMessengerAdv/api/messages * * Get all messages for any given year * http://localhost:8080/RestMessengerAdv/api/messages?year=variable * * Get #=size messages starting at id=start * http://localhost:8080/RestMessengerAdv/api/messages?start=variable&size=variable * * @return returns a list of all messages */ @GET public Response getMessages(@BeanParam MessageFilterBean filterBean, @Context UriInfo uriInfo){ if(filterBean.getYear() > 0){ List<Message> messagesForYear = messageService.getAllMessagesForYear(filterBean.getYear()); return Response.status(Status.OK) // Add the new message to the Response .entity(messagesForYear) // Build the Response .build(); } if(filterBean.getStart() > 0 && filterBean.getSize() > 0){ List<Message> messagesPagenated = messageService.getAllMessagesPagenated(filterBean.getStart(), filterBean.getSize()); return Response.status(Status.OK) // Add the new message to the Response .entity(messagesPagenated) // Build the Response .build(); } List<Message> messages = messageService.getAllMessages(); // Loop through the messages and add the URI information to each message for(Message message : messages){ // Construct the URI link to self String uriSelf = getUriForSelf(uriInfo, message); // Construct the URI link to the author's profile String uriProfile = getUriForProfile(uriInfo, message); // Construct the URI link to the message comments String uriComments = getUriForComments(uriInfo, message); // Add the URI link to self message.addLink(uriSelf, "self"); // Add the URI link to profile message.addLink(uriProfile, "profile"); // Add the URI link to the comment message.addLink(uriComments, "comments"); // Get message comments and assign the URI information to them List<Comment> comments = new ArrayList<>(message.getComments().values()); Map<Long, Comment> messageComments = new HashMap<>(); long i=0; for(Comment comment : comments){ // Construct the URI link to the message comments String uriComment = getUriForComment(uriInfo, message, comment); // Add the URI link to the comment comment.addLink(uriComment, "comment"); // Add the updated comment to the new message comment map messageComments.put(i, comment); i++; } message.setComments(messageComments); } // Set the Response status to 200 (OK) return Response.status(Status.OK) // Add the new message to the Response .entity(messages) // Build the Response .build(); } /** * http://localhost:8080/RestMessengerAdv/api/messages/{messageId} * * @return returns the message corresponding to the messageId with HATEOAS URI link information */ @GET @Path("/{messageId}") public Response getMesaage(@PathParam("messageId") long messageId, @Context UriInfo uriInfo){ // Get the corresponding message Message message = messageService.getMessage(messageId); // Construct the URI link to self String uriSelf = getUriForSelf(uriInfo, message); // Construct the URI link to the author's profile String uriProfile = getUriForProfile(uriInfo, message); // Construct the URI link to the message comments String uriComments = getUriForComments(uriInfo, message); // Add the URI link to self message.addLink(uriSelf, "self"); // Add the URI link to profile message.addLink(uriProfile, "profile"); // Add the URI link to profile message.addLink(uriComments, "comments"); // Get message comments and assign the URI information to them List<Comment> comments = new ArrayList<>(message.getComments().values()); Map<Long, Comment> messageComments = new HashMap<>(); long i=0; for(Comment comment : comments){ // Construct the URI link to the message comments String uriComment = getUriForComment(uriInfo, message, comment); // Add the URI link to the comment comment.addLink(uriComment, "comment"); // Add the updated comment to the new message comment map messageComments.put(i, comment); i++; } message.setComments(messageComments); // Set the Response status to 201 (CREATED) return Response.status(Status.OK) // Add the new message to the Response .entity(message) // Build the Response .build(); } /** * This method constructs the URI link to the message comments resource * http://localhost:8080/RestMessengerAdv/api/messages/{messageId}/comments * * @param uriInfo * @param message * @return */ private String getUriForComments(UriInfo uriInfo, Message message) { // Build the URI link // http://localhost:8080/RestMessengerAdv/api String uri = uriInfo.getBaseUriBuilder() // Add /messages .path(MessageResource.class) // Add /{messageId}/comments // Pass in the resource class and the method that has the @Path annotation .path(MessageResource.class, "getCommentResource") // Add the messageId to the {messageId} variable .resolveTemplate("messageId", message.getId()) // Build the URI .build() // Convert the URI to a String .toString(); return uri; } /** * This method constructs the URI link to the message comments resource * http://localhost:8080/RestMessengerAdv/api/messages/{messageId}/comments/{commentId} * * @param uriInfo * @param message * @return */ private String getUriForComment(UriInfo uriInfo, Message message, Comment comment) { // Build the URI link // http://localhost:8080/RestMessengerAdv/api String uri = uriInfo.getBaseUriBuilder() // Add /messages .path(MessageResource.class) // Add /{messageId}/comments // Pass in the resource class and the method that has the @Path annotation .path(MessageResource.class, "getCommentResource") // Add /{commentId} // Pass in the resource class and the method that has the @Path annotation .path(CommentResource.class, "getComment") // Add the messageId to the {messageId} variable .resolveTemplate("messageId", message.getId()) // Add the messageId to the {messageId} variable .resolveTemplate("commentId", comment.getId()) // Build the URI .build() // Convert the URI to a String .toString(); return uri; } /** * This method constructs the URI link to the message author's profile * http://localhost:8080/RestMessengerAdv/api/profiles/{profileName} * * @param uriInfo * @param message * @return */ private String getUriForProfile(UriInfo uriInfo, Message message) { // Build the URI link // http://localhost:8080/RestMessengerAdv/api String uri = uriInfo.getBaseUriBuilder() // Add /profiles .path(ProfileResource.class) // Add /{profileName} .path(message.getAuthor()) // Build the URI .build() // Convert the URI to a String .toString(); return uri; } /** * This method constructs the URI link to self * http://localhost:8080/RestMessengerAdv/api/messages/{messageId} * * @param uriInfo * @param message * @return */ private String getUriForSelf(UriInfo uriInfo, Message message) { // Build the URI link // http://localhost:8080/RestMessengerAdv/api String uri = uriInfo.getBaseUriBuilder() // Add /messages .path(MessageResource.class) // Add /{messageId} .path(Long.toString(message.getId())) // Build the URI .build() // Convert the URI to a String .toString(); return uri; } /** * http://localhost:8080/RestMessengerAdv/api/messages * Adds a new message * * @return returns a Response with a 201 status code, the newly added message and the URI location * @throws URISyntaxException */ @POST public Response addMessage(@Context UriInfo uriInfo, Message message){ // Add the new message Message newMessage = messageService.addMessage(message); /* * The commented out code will cause duplicate links when getAllMessages() is called * // Construct the URI link to self String uriSelf = getUriForSelf(uriInfo, newMessage); // Construct the URI link to the author's profile String uriProfile = getUriForProfile(uriInfo, newMessage); // Construct the URI link to the message comments String uriComments = getUriForComments(uriInfo, newMessage); // Add the URI link to self newMessage.addLink(uriSelf, "self"); // Add the URI link to profile newMessage.addLink(uriProfile, "profile"); // Add the URI link to profile newMessage.addLink(uriComments, "comments"); */ // Assign the message ID to a string value String newId = String.valueOf(newMessage.getId()); // Create a new URI with the message ID in it and build URI uri =uriInfo.getAbsolutePathBuilder().path(newId).build(); // Set the Response status to 201 (CREATED) return Response.created(uri) // Add the new message to the Response .entity(newMessage) // Build the Response .build(); } /** * http://localhost:8080/RestMessengerAdv/api/messages/{messageId} * Updates an existing message * * @return returns the updated message corresponding to the messageId */ @PUT @Path("/{messageId}") public Response updateMessage(@Context UriInfo uriInfo, @PathParam("messageId") long messageId, Message message){ // We must set the ID in the message in order to update it message.setId(messageId); Message updatedMessage = messageService.updateMessage(message); // Construct the URI link to self String uriSelf = getUriForSelf(uriInfo, updatedMessage); // Construct the URI link to the author's profile String uriProfile = getUriForProfile(uriInfo, updatedMessage); // Construct the URI link to the message comments String uriComments = getUriForComments(uriInfo, updatedMessage); // Add the URI link to self updatedMessage.addLink(uriSelf, "self"); // Add the URI link to profile updatedMessage.addLink(uriProfile, "profile"); // Add the URI link to profile updatedMessage.addLink(uriComments, "comments"); // Set the Response status to 204 (NO_CONTENT) return Response.status(Status.NO_CONTENT) // Add the new message to the Response .entity(updatedMessage) // Build the Response .build(); } /** * http://localhost:8080/RestMessengerAdv/api/messages/{messageId} * Deletes an existing message * * @return returns the deleted message corresponding to the messageId */ @DELETE @Path("/{messageId}") public Response deleteMessage(@PathParam("messageId") long messageId){ Message message = messageService.removeMessage(messageId); // Set the Response status to 204 (OK) return Response.status(Status.OK) // Add the new message to the Response .entity(message) // Build the Response .build(); } /** * http://localhost:8080/RestMessengerAdv/api/messages/{messageId}/comments * * This method hands off the responsibilities to the CommentResource class * * @return */ @Path("/{messageId}/comments") public CommentResource getCommentResource(){ return new CommentResource(); } /** * http://localhost:8080/RestMessengerAdv/api/messages/test * * @return returns the text: Test */ @GET @Path("/test") public String getTest(){ return "Test"; } /** * http://localhost:8080/RestMessengerAdv/api/messages/test/{regExpression: * } * regExpression : \\d+ - only valid if input is a number * * @return returns the input as long as it meets the regular expression requirements */ @GET @Path("/test/{regExpression : \\d+}") public String getExpression(@PathParam("regExpression") String regExpression){ return regExpression; } }
14,719
0.707776
0.700985
461
30.941431
26.454292
121
false
false
0
0
0
0
0
0
2.229935
false
false
0
662df95a82241ba3705a265461e544bbbb121fb3
16,836,271,858,481
a6fa054f437b0d2061d51b85258147b792337d7e
/ms-payment-merchant/src/main/java/com/ixiachong/platform/ms/payment/merchant/controller/ChannelMerchantController.java
a7fa953c422bffba883c3141a8f2f829045fd75a
[]
no_license
cenbow/payment-1
https://github.com/cenbow/payment-1
709c5e2ccc0da369bb8c554420411e31990d7c3c
c99d62d858a4071d58853f3f3d7e57bc60b63253
refs/heads/master
2022-12-05T02:19:02.839000
2020-09-01T06:09:20
2020-09-01T06:09:20
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Project: parent * Document: ChannelMerchantController * Date: 2020/8/19 16:33 * Author: wangcy * Copyright © 2020 www.ixiachong.com Inc. All rights reserved. * 注意:本内容仅限于深圳瞎充集团有限公司内部传阅,禁止外泄以及用于其他的商业目的 */ package com.ixiachong.platform.ms.payment.merchant.controller; import com.ixiachong.platform.ms.payment.merchant.service.ChannelMerchantService; import org.springframework.beans.factory.annotation.Autowired; 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.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.Map; /** * Author: wangcy */ @RestController @RequestMapping("/api/channels") public class ChannelMerchantController { private ChannelMerchantService service; @Autowired public void setService(ChannelMerchantService service) { this.service = service; } @GetMapping("{channel}/merchants/{no}") public Map<String, String> getChannel(@PathVariable String no, @PathVariable String channel) { return service.getChannel(no, channel); } @PostMapping("{channel}/merchants") public Object saveChannelMerchantsConfig(@PathVariable String channel, @RequestParam Map<String,String> merchantsConfig ) { return service.createChannelMerchantsConfig(channel,merchantsConfig); } }
UTF-8
Java
1,627
java
ChannelMerchantController.java
Java
[ { "context": "hantController\n * Date: 2020/8/19 16:33\n * Author: wangcy\n * Copyright © 2020 www.ixiachong.com Inc. All ri", "end": 104, "score": 0.9996197819709778, "start": 98, "tag": "USERNAME", "value": "wangcy" }, { "context": "Controller;\n\nimport java.util.Map;\n\n/**\n * Author: wangcy\n */\n@RestController\n@RequestMapping(\"/api/channel", "end": 837, "score": 0.9996487498283386, "start": 831, "tag": "USERNAME", "value": "wangcy" } ]
null
[]
/** * Project: parent * Document: ChannelMerchantController * Date: 2020/8/19 16:33 * Author: wangcy * Copyright © 2020 www.ixiachong.com Inc. All rights reserved. * 注意:本内容仅限于深圳瞎充集团有限公司内部传阅,禁止外泄以及用于其他的商业目的 */ package com.ixiachong.platform.ms.payment.merchant.controller; import com.ixiachong.platform.ms.payment.merchant.service.ChannelMerchantService; import org.springframework.beans.factory.annotation.Autowired; 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.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.Map; /** * Author: wangcy */ @RestController @RequestMapping("/api/channels") public class ChannelMerchantController { private ChannelMerchantService service; @Autowired public void setService(ChannelMerchantService service) { this.service = service; } @GetMapping("{channel}/merchants/{no}") public Map<String, String> getChannel(@PathVariable String no, @PathVariable String channel) { return service.getChannel(no, channel); } @PostMapping("{channel}/merchants") public Object saveChannelMerchantsConfig(@PathVariable String channel, @RequestParam Map<String,String> merchantsConfig ) { return service.createChannelMerchantsConfig(channel,merchantsConfig); } }
1,627
0.778424
0.768734
48
31.25
30.622364
127
false
false
0
0
0
0
0
0
0.416667
false
false
0
f4bf56527cd394cc0e10f19ab883c9f27a2c2b8f
6,055,903,946,117
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_f11e420438b6ec44f0d42c08163e088324726bbb/BaseQuizzActivity/2_f11e420438b6ec44f0d42c08163e088324726bbb_BaseQuizzActivity_t.java
e11fb79df0d438b8012693248ca7c37d09351b29
[]
no_license
zhongxingyu/Seer
https://github.com/zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516000
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
false
2023-06-22T07:55:57
2020-04-28T11:07:49
2023-06-21T00:53:27
2023-06-22T07:55:57
2,849,868
2
2
0
null
false
false
package com.quizz.core.activities; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Collection; import java.util.List; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.database.Cursor; import android.os.AsyncTask; import android.os.Bundle; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; import android.view.Window; import android.widget.HorizontalScrollView; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.ViewSwitcher; import com.actionbarsherlock.app.SherlockFragmentActivity; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import com.quizz.core.R; import com.quizz.core.application.BaseQuizzApplication; import com.quizz.core.db.BaseQuizzDAO; import com.quizz.core.db.DbHelper; import com.quizz.core.dialogs.ConfirmQuitDialog; import com.quizz.core.dialogs.ConfirmQuitDialog.Closeable; import com.quizz.core.interfaces.FragmentContainer; import com.quizz.core.models.Level; import com.quizz.core.models.Section; import com.quizz.core.widgets.QuizzActionBar; public class BaseQuizzActivity extends SherlockFragmentActivity implements FragmentContainer, Closeable { private static final String HIDE_AB_ON_ROTATION_CHANGE = "BaseQuizzActivity.HIDE_AB_ON_ROTATION_CHANGE"; private View mQuizzLayout; private View mConfirmQuitDialogView; private ImageView mBackgroundAnimatedImage; private QuizzActionBar mQuizzActionBar; private ConfirmQuitDialog mConfirmQuitDialog; private boolean mHideAbOnRotation = false; ViewSwitcher viewSwitcher; private List<Section> mSections; private TextView mTvProgress; private ProgressBar mPbProgressBar; @Override protected void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); viewSwitcher = new ViewSwitcher(BaseQuizzActivity.this); viewSwitcher.addView(ViewSwitcher.inflate(BaseQuizzActivity.this, R.layout.loading_screen, null)); viewSwitcher.addView(ViewSwitcher.inflate(BaseQuizzActivity.this, R.layout.activity_quizz, null)); setContentView(viewSwitcher); buildLoadingLayout(); buildGameLayout(savedInstanceState); DbHelper dbHelper = ((BaseQuizzApplication) getApplicationContext()).getDbHelper(); new LoadGameTask(dbHelper).execute(); } private void buildLoadingLayout() { mTvProgress = (TextView) viewSwitcher.findViewById(R.id.tv_progress); mPbProgressBar = (ProgressBar) viewSwitcher.findViewById(R.id.pb_progressbar); mPbProgressBar.setMax(100); } private void buildGameLayout(Bundle savedInstanceState) { mQuizzLayout = findViewById(R.id.quizzLayout); mBackgroundAnimatedImage = (ImageView) findViewById(R.id.backgroundAnimatedImage); mQuizzActionBar = (QuizzActionBar) findViewById(R.id.quizzTopActionBar); View shadowView = viewSwitcher.findViewById(R.id.ab_separator_shadow); mQuizzActionBar.setShadowView(shadowView); if (savedInstanceState != null) { mHideAbOnRotation = savedInstanceState.getBoolean(HIDE_AB_ON_ROTATION_CHANGE); if (mHideAbOnRotation) { mQuizzActionBar.hide(QuizzActionBar.MOVE_DIRECT); } } // FIXME: May not be displayed correctly on bigger screen when looping (bad transition) // TODO: Make an image with beginning left similar to right end // TODO: Scroll the horizontalScrollView instead of translating the // imageView HorizontalScrollView bgAnimatedImageContainer = (HorizontalScrollView) viewSwitcher.findViewById(R.id.backgroundAnimatedImageContainer); bgAnimatedImageContainer.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return true; } }); } @Override public void close() { finish(); } @Override public int getId() { return R.id.fragmentsContainer; } @Override public void onBackPressed() { if (getSupportFragmentManager().getBackStackEntryCount() == 0) { if (mConfirmQuitDialog == null) { mConfirmQuitDialog = (mConfirmQuitDialogView == null) ? new ConfirmQuitDialog(this) : new ConfirmQuitDialog(this, mConfirmQuitDialogView); mConfirmQuitDialog.setClosable(this); } mConfirmQuitDialog.show(); } else { super.onBackPressed(); } } @Override protected void onSaveInstanceState(Bundle outState) { outState.putBoolean(HIDE_AB_ON_ROTATION_CHANGE, mHideAbOnRotation); super.onSaveInstanceState(outState); } protected void setConfirmQuitDialogView(View view) { mConfirmQuitDialogView = view; } public View getQuizzLayout() { return mQuizzLayout; } public ImageView getBackgroundAnimatedImage() { return mBackgroundAnimatedImage; } public QuizzActionBar getQuizzActionBar() { return mQuizzActionBar; } /** * Default behaviour is 'false' * @param hide */ public void setHideAbOnRotationChange(boolean hide) { mHideAbOnRotation = hide; } ////////////////////////////////////////// // loading AsyncTask // ////////////////////////////////////////// private class LoadGameTask extends AsyncTask<Void, Integer, Void> { private int mProgress = 0; private static final String PREF_VERSION_KEY = "VERSION"; private static final int PREF_VERSION_VALUE = 1; private static final String BUNDLE_SECTION_KEY = "SECTION"; private BaseQuizzDAO mBaseQuizzDAO; public LoadGameTask(DbHelper dbHelper) { mBaseQuizzDAO = new BaseQuizzDAO(dbHelper); } @Override protected void onPreExecute() { } @Override protected void onProgressUpdate(Integer... progress) { if (progress[0] <= 100) { mTvProgress.setText(Integer.toString(progress[0]) + "%"); mPbProgressBar.setProgress(progress[0]); } } @Override protected void onPostExecute(Void result) { viewSwitcher.showNext(); } @Override protected Void doInBackground(Void... arg0) { SharedPreferences sharedPreferences = getPreferences(MODE_PRIVATE); if (!sharedPreferences.contains(PREF_VERSION_KEY)) { // need to create db Editor editor = sharedPreferences.edit(); editor.putInt(PREF_VERSION_KEY, PREF_VERSION_VALUE); editor.commit(); Gson gson = new Gson(); Type type = new TypeToken<Collection<Section>>(){}.getType(); InputStream is; try { is = getResources().getAssets().open("places.xml"); Reader reader = new InputStreamReader(is); mSections = gson.fromJson(reader, type); int ratio = 100 / mSections.size(); for (Section section : mSections) { mBaseQuizzDAO.insertSection(section); publishProgress(++mProgress * ratio); } } catch (IOException e) { e.printStackTrace(); } } else if (sharedPreferences.getInt(PREF_VERSION_KEY, 0) < PREF_VERSION_VALUE) { // need to upgrade db } else { // retrieve data from db mSections = readDbShowingProgression(); } return null; } private ArrayList<Section> readDbShowingProgression() { ArrayList<Section> sections = new ArrayList<Section>(); Cursor sectionsCursor = mBaseQuizzDAO.getSections(); int ratio = (sectionsCursor.getCount() > 0) ? 100 / sectionsCursor.getCount() : 100; int lastId = 0; Section section = null; List<Level> levels = new ArrayList<Level>(); sectionsCursor.moveToFirst(); while (!sectionsCursor.isAfterLast()) { if (sectionsCursor.getInt(sectionsCursor.getColumnIndex(DbHelper.COLUMN_ID))!=lastId && lastId != 0) { if (section != null) { section.levels.addAll(levels); sections.add(section); } levels.clear(); } section = mBaseQuizzDAO.cursorToSection(sectionsCursor); levels.add(mBaseQuizzDAO.cursorToLevel(sectionsCursor)); lastId = sectionsCursor.getInt(sectionsCursor.getColumnIndex(DbHelper.COLUMN_ID)); publishProgress(++mProgress * ratio); if (sectionsCursor.isLast()) { section.levels.addAll(levels); sections.add(section); } sectionsCursor.moveToNext(); } sectionsCursor.close(); return sections; } }; }
UTF-8
Java
8,981
java
2_f11e420438b6ec44f0d42c08163e088324726bbb_BaseQuizzActivity_t.java
Java
[ { "context": "\t\tprivate static final String PREF_VERSION_KEY = \"VERSION\";\r\n \t\tprivate static final int PREF_VERSION_VALUE", "end": 5828, "score": 0.7213881015777588, "start": 5821, "tag": "KEY", "value": "VERSION" }, { "context": "private static final String BUNDLE_SECTION_KEY = \"SECTION\";\r\n \t\t\r\n \t\tprivate BaseQuizzDAO mBaseQuizzDAO;\r\n ", "end": 5945, "score": 0.7456396818161011, "start": 5938, "tag": "KEY", "value": "SECTION" } ]
null
[]
package com.quizz.core.activities; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Collection; import java.util.List; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.database.Cursor; import android.os.AsyncTask; import android.os.Bundle; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; import android.view.Window; import android.widget.HorizontalScrollView; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.ViewSwitcher; import com.actionbarsherlock.app.SherlockFragmentActivity; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import com.quizz.core.R; import com.quizz.core.application.BaseQuizzApplication; import com.quizz.core.db.BaseQuizzDAO; import com.quizz.core.db.DbHelper; import com.quizz.core.dialogs.ConfirmQuitDialog; import com.quizz.core.dialogs.ConfirmQuitDialog.Closeable; import com.quizz.core.interfaces.FragmentContainer; import com.quizz.core.models.Level; import com.quizz.core.models.Section; import com.quizz.core.widgets.QuizzActionBar; public class BaseQuizzActivity extends SherlockFragmentActivity implements FragmentContainer, Closeable { private static final String HIDE_AB_ON_ROTATION_CHANGE = "BaseQuizzActivity.HIDE_AB_ON_ROTATION_CHANGE"; private View mQuizzLayout; private View mConfirmQuitDialogView; private ImageView mBackgroundAnimatedImage; private QuizzActionBar mQuizzActionBar; private ConfirmQuitDialog mConfirmQuitDialog; private boolean mHideAbOnRotation = false; ViewSwitcher viewSwitcher; private List<Section> mSections; private TextView mTvProgress; private ProgressBar mPbProgressBar; @Override protected void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); viewSwitcher = new ViewSwitcher(BaseQuizzActivity.this); viewSwitcher.addView(ViewSwitcher.inflate(BaseQuizzActivity.this, R.layout.loading_screen, null)); viewSwitcher.addView(ViewSwitcher.inflate(BaseQuizzActivity.this, R.layout.activity_quizz, null)); setContentView(viewSwitcher); buildLoadingLayout(); buildGameLayout(savedInstanceState); DbHelper dbHelper = ((BaseQuizzApplication) getApplicationContext()).getDbHelper(); new LoadGameTask(dbHelper).execute(); } private void buildLoadingLayout() { mTvProgress = (TextView) viewSwitcher.findViewById(R.id.tv_progress); mPbProgressBar = (ProgressBar) viewSwitcher.findViewById(R.id.pb_progressbar); mPbProgressBar.setMax(100); } private void buildGameLayout(Bundle savedInstanceState) { mQuizzLayout = findViewById(R.id.quizzLayout); mBackgroundAnimatedImage = (ImageView) findViewById(R.id.backgroundAnimatedImage); mQuizzActionBar = (QuizzActionBar) findViewById(R.id.quizzTopActionBar); View shadowView = viewSwitcher.findViewById(R.id.ab_separator_shadow); mQuizzActionBar.setShadowView(shadowView); if (savedInstanceState != null) { mHideAbOnRotation = savedInstanceState.getBoolean(HIDE_AB_ON_ROTATION_CHANGE); if (mHideAbOnRotation) { mQuizzActionBar.hide(QuizzActionBar.MOVE_DIRECT); } } // FIXME: May not be displayed correctly on bigger screen when looping (bad transition) // TODO: Make an image with beginning left similar to right end // TODO: Scroll the horizontalScrollView instead of translating the // imageView HorizontalScrollView bgAnimatedImageContainer = (HorizontalScrollView) viewSwitcher.findViewById(R.id.backgroundAnimatedImageContainer); bgAnimatedImageContainer.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return true; } }); } @Override public void close() { finish(); } @Override public int getId() { return R.id.fragmentsContainer; } @Override public void onBackPressed() { if (getSupportFragmentManager().getBackStackEntryCount() == 0) { if (mConfirmQuitDialog == null) { mConfirmQuitDialog = (mConfirmQuitDialogView == null) ? new ConfirmQuitDialog(this) : new ConfirmQuitDialog(this, mConfirmQuitDialogView); mConfirmQuitDialog.setClosable(this); } mConfirmQuitDialog.show(); } else { super.onBackPressed(); } } @Override protected void onSaveInstanceState(Bundle outState) { outState.putBoolean(HIDE_AB_ON_ROTATION_CHANGE, mHideAbOnRotation); super.onSaveInstanceState(outState); } protected void setConfirmQuitDialogView(View view) { mConfirmQuitDialogView = view; } public View getQuizzLayout() { return mQuizzLayout; } public ImageView getBackgroundAnimatedImage() { return mBackgroundAnimatedImage; } public QuizzActionBar getQuizzActionBar() { return mQuizzActionBar; } /** * Default behaviour is 'false' * @param hide */ public void setHideAbOnRotationChange(boolean hide) { mHideAbOnRotation = hide; } ////////////////////////////////////////// // loading AsyncTask // ////////////////////////////////////////// private class LoadGameTask extends AsyncTask<Void, Integer, Void> { private int mProgress = 0; private static final String PREF_VERSION_KEY = "VERSION"; private static final int PREF_VERSION_VALUE = 1; private static final String BUNDLE_SECTION_KEY = "SECTION"; private BaseQuizzDAO mBaseQuizzDAO; public LoadGameTask(DbHelper dbHelper) { mBaseQuizzDAO = new BaseQuizzDAO(dbHelper); } @Override protected void onPreExecute() { } @Override protected void onProgressUpdate(Integer... progress) { if (progress[0] <= 100) { mTvProgress.setText(Integer.toString(progress[0]) + "%"); mPbProgressBar.setProgress(progress[0]); } } @Override protected void onPostExecute(Void result) { viewSwitcher.showNext(); } @Override protected Void doInBackground(Void... arg0) { SharedPreferences sharedPreferences = getPreferences(MODE_PRIVATE); if (!sharedPreferences.contains(PREF_VERSION_KEY)) { // need to create db Editor editor = sharedPreferences.edit(); editor.putInt(PREF_VERSION_KEY, PREF_VERSION_VALUE); editor.commit(); Gson gson = new Gson(); Type type = new TypeToken<Collection<Section>>(){}.getType(); InputStream is; try { is = getResources().getAssets().open("places.xml"); Reader reader = new InputStreamReader(is); mSections = gson.fromJson(reader, type); int ratio = 100 / mSections.size(); for (Section section : mSections) { mBaseQuizzDAO.insertSection(section); publishProgress(++mProgress * ratio); } } catch (IOException e) { e.printStackTrace(); } } else if (sharedPreferences.getInt(PREF_VERSION_KEY, 0) < PREF_VERSION_VALUE) { // need to upgrade db } else { // retrieve data from db mSections = readDbShowingProgression(); } return null; } private ArrayList<Section> readDbShowingProgression() { ArrayList<Section> sections = new ArrayList<Section>(); Cursor sectionsCursor = mBaseQuizzDAO.getSections(); int ratio = (sectionsCursor.getCount() > 0) ? 100 / sectionsCursor.getCount() : 100; int lastId = 0; Section section = null; List<Level> levels = new ArrayList<Level>(); sectionsCursor.moveToFirst(); while (!sectionsCursor.isAfterLast()) { if (sectionsCursor.getInt(sectionsCursor.getColumnIndex(DbHelper.COLUMN_ID))!=lastId && lastId != 0) { if (section != null) { section.levels.addAll(levels); sections.add(section); } levels.clear(); } section = mBaseQuizzDAO.cursorToSection(sectionsCursor); levels.add(mBaseQuizzDAO.cursorToLevel(sectionsCursor)); lastId = sectionsCursor.getInt(sectionsCursor.getColumnIndex(DbHelper.COLUMN_ID)); publishProgress(++mProgress * ratio); if (sectionsCursor.isLast()) { section.levels.addAll(levels); sections.add(section); } sectionsCursor.moveToNext(); } sectionsCursor.close(); return sections; } }; }
8,981
0.676985
0.67409
268
31.578358
25.262012
107
false
false
0
0
0
0
0
0
2.264925
false
false
0
e06648f7952023a3c991a59bf4307f89e0ac6712
26,508,538,160,663
b6fcec123d6a90e528b5b9e8e0e1a3c6233f402e
/src/main/java/ch/icclab/cyclops/services/iaas/cloudstack/resource/impl/CloudStackMeterV2.java
0df781fff3636ecd88db56f5667e1be14eeeff34
[ "Apache-2.0" ]
permissive
icclab/cyclops-udr
https://github.com/icclab/cyclops-udr
77904f5b62cd0ba86f40b63a8044d24cc14a9b8a
d0d299c1738b5ba476d16ad0e044b93f8c722072
refs/heads/master
2020-12-24T05:10:16.721000
2016-07-01T13:00:04
2016-07-01T13:00:04
29,250,273
12
6
null
null
null
null
null
null
null
null
null
null
null
null
null
package ch.icclab.cyclops.services.iaas.cloudstack.resource.impl; import ch.icclab.cyclops.services.iaas.cloudstack.model.StandardMeter; import ch.icclab.cyclops.services.iaas.cloudstack.resource.dto.MeterList; import ch.icclab.cyclops.support.database.influxdb.client.InfluxDBClient; import ch.icclab.cyclops.util.APICallCounter; import com.google.gson.Gson; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.influxdb.dto.QueryResult; import org.restlet.resource.Get; import org.restlet.resource.ServerResource; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * Copyright (c) 2015. Zuercher Hochschule fuer Angewandte Wissenschaften * All Rights Reserved. * <p> * 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 * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * 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. * <p> * Created by Manu Perez on 24/02/16. */ public class CloudStackMeterV2 extends ServerResource { final static Logger logger = LogManager.getLogger(CloudStackMeterV2.class.getName()); // some required variables private final APICallCounter counter; private final static String endpoint = "/meters"; private final InfluxDBClient dbClient; public CloudStackMeterV2() { counter = APICallCounter.getInstance(); dbClient = new InfluxDBClient(); } @Get public String getMeterList() { counter.increment(endpoint); logger.trace("Meterlist v2 Request"); StandardMeter[] meterList = retrieveMeterList(); String json = new Gson().toJson(meterList); // return json logger.trace("Serving CloudStack meterList v2 back"); return json; } /** * Ask for meterList from database * * @return MeterList object */ protected StandardMeter[] retrieveMeterList() { String query = new MeterList().createDBQuery(); // run query QueryResult result = dbClient.runQuery(query); ArrayList<String> columns = new ArrayList<String>(); ArrayList<List<String>> points = new ArrayList<List<String>>(); Boolean onlyOnce = true; int nameIndex, sourceIndex; ArrayList<StandardMeter> meters = new ArrayList<StandardMeter>(); try { // go over all results for (QueryResult.Result data : result.getResults()) { // every series for (QueryResult.Series serie : data.getSeries()) { Map<String, String> tags = serie.getTags(); // add all column names if (onlyOnce) { if (tags != null) { columns.addAll(tags.keySet()); } columns.addAll(serie.getColumns()); onlyOnce = false; } // iterate over values for (List<Object> values : serie.getValues()) { List<String> line = new ArrayList<String>(); // don't forget to manually add tags here if (tags != null) { line.addAll(tags.values()); } // cast them to String for (Object value : values) { if (value == null) { line.add(""); } else { line.add(String.valueOf(value)); } } // and lastly, add them points.add(line); } } } nameIndex = columns.indexOf("metername"); sourceIndex = columns.indexOf("metersource"); for(List<String> point : points){ meters.add(new StandardMeter(point.get(nameIndex), point.get(sourceIndex))); } } catch (Exception ignored) { // in case of empty QueryResult body do nothing } StandardMeter[] ret = new StandardMeter[meters.size()]; ret = meters.toArray(ret); return ret; } }
UTF-8
Java
4,685
java
CloudStackMeterV2.java
Java
[ { "context": "tations\n * under the License.\n * <p>\n * Created by Manu Perez on 24/02/16.\n */\npublic class CloudStackMeterV2 e", "end": 1333, "score": 0.9998915791511536, "start": 1323, "tag": "NAME", "value": "Manu Perez" } ]
null
[]
package ch.icclab.cyclops.services.iaas.cloudstack.resource.impl; import ch.icclab.cyclops.services.iaas.cloudstack.model.StandardMeter; import ch.icclab.cyclops.services.iaas.cloudstack.resource.dto.MeterList; import ch.icclab.cyclops.support.database.influxdb.client.InfluxDBClient; import ch.icclab.cyclops.util.APICallCounter; import com.google.gson.Gson; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.influxdb.dto.QueryResult; import org.restlet.resource.Get; import org.restlet.resource.ServerResource; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * Copyright (c) 2015. Zuercher Hochschule fuer Angewandte Wissenschaften * All Rights Reserved. * <p> * 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 * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * 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. * <p> * Created by <NAME> on 24/02/16. */ public class CloudStackMeterV2 extends ServerResource { final static Logger logger = LogManager.getLogger(CloudStackMeterV2.class.getName()); // some required variables private final APICallCounter counter; private final static String endpoint = "/meters"; private final InfluxDBClient dbClient; public CloudStackMeterV2() { counter = APICallCounter.getInstance(); dbClient = new InfluxDBClient(); } @Get public String getMeterList() { counter.increment(endpoint); logger.trace("Meterlist v2 Request"); StandardMeter[] meterList = retrieveMeterList(); String json = new Gson().toJson(meterList); // return json logger.trace("Serving CloudStack meterList v2 back"); return json; } /** * Ask for meterList from database * * @return MeterList object */ protected StandardMeter[] retrieveMeterList() { String query = new MeterList().createDBQuery(); // run query QueryResult result = dbClient.runQuery(query); ArrayList<String> columns = new ArrayList<String>(); ArrayList<List<String>> points = new ArrayList<List<String>>(); Boolean onlyOnce = true; int nameIndex, sourceIndex; ArrayList<StandardMeter> meters = new ArrayList<StandardMeter>(); try { // go over all results for (QueryResult.Result data : result.getResults()) { // every series for (QueryResult.Series serie : data.getSeries()) { Map<String, String> tags = serie.getTags(); // add all column names if (onlyOnce) { if (tags != null) { columns.addAll(tags.keySet()); } columns.addAll(serie.getColumns()); onlyOnce = false; } // iterate over values for (List<Object> values : serie.getValues()) { List<String> line = new ArrayList<String>(); // don't forget to manually add tags here if (tags != null) { line.addAll(tags.values()); } // cast them to String for (Object value : values) { if (value == null) { line.add(""); } else { line.add(String.valueOf(value)); } } // and lastly, add them points.add(line); } } } nameIndex = columns.indexOf("metername"); sourceIndex = columns.indexOf("metersource"); for(List<String> point : points){ meters.add(new StandardMeter(point.get(nameIndex), point.get(sourceIndex))); } } catch (Exception ignored) { // in case of empty QueryResult body do nothing } StandardMeter[] ret = new StandardMeter[meters.size()]; ret = meters.toArray(ret); return ret; } }
4,681
0.580576
0.576094
122
37.401638
23.634047
92
false
false
0
0
0
0
0
0
0.467213
false
false
0
3506fa34c7a776efe6d5cc88328277d33d0f6194
9,002,251,514,596
a6c48d5d697cd0ba48bc7c6bd64e871326ce6458
/source_code/Java/TICAS4-Common/test/edu/umn/natsrl/pyticas/restapi/RHGETRoute.java
bae4c63277b1b81bbd015d040ec95f843942d4b7
[]
no_license
lakshmanamettu/tetres
https://github.com/lakshmanamettu/tetres
873a878cf06b313ee26537504e63f5efdecdc98f
1acf985f378106953cbff34fb99147cac5104328
refs/heads/master
2020-06-30T19:33:44.044000
2019-08-06T16:21:18
2019-08-06T16:21:18
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (C) 2018 NATSRL @ UMD (University Minnesota Duluth) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program 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. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package edu.umn.natsrl.pyticas.restapi; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.sun.net.httpserver.HttpExchange; import ticas.common.pyticas.HttpResult; import ticas.common.pyticas.responses.ResponseRoute; import ticas.common.route.Route; import java.io.IOException; import java.io.OutputStream; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; /** * * @author Chongmyung Park <chongmyung.park@gmail.com> */ public class RHGETRoute extends GETRequestHandler { private final String response; private final ResponseRoute rr; public RHGETRoute() { rr = new ResponseRoute(); rr.code = 1; rr.message = "success"; rr.obj = new Route(); rr.obj.name = "Test Route"; rr.obj.desc = "This is a test"; rr.obj.addRNode("rnd_1234"); rr.obj.addRNode("rnd_5678"); rr.obj.addRNode("rnd_9101112"); rr.obj.addRNode("rnd_131415"); rr.httpResult = null; this.response = this.toJson(rr); } @Override public void assertResponse(HttpResult res) { Gson gsonBuilder = new GsonBuilder().create(); ResponseRoute obj = gsonBuilder.fromJson(res.contents, ResponseRoute.class); System.out.println(" - http_code : " + res.res_code); assertTrue(res.res_code == 200); System.out.println(" - code : " + obj.code); assertEquals(obj.code, this.rr.code); System.out.println(" - message : " + obj.message); assertEquals(obj.message, this.rr.message); System.out.println(" - route : " + obj.obj.toString() + " > " + obj.obj.getRNodeNames().toString()); assertEquals(obj.obj.name, this.rr.obj.name); assertEquals(obj.obj.desc, this.rr.obj.desc); assertEquals(obj.obj.getRNodeNames(), this.rr.obj.getRNodeNames()); } @Override public void handle(HttpExchange t) throws IOException { t.sendResponseHeaders(200, response.length()); OutputStream os = t.getResponseBody(); os.write(response.getBytes()); os.close(); } }
UTF-8
Java
3,017
java
RHGETRoute.java
Java
[ { "context": "rg.junit.Assert.assertTrue;\r\n\r\n/**\r\n *\r\n * @author Chongmyung Park <chongmyung.park@gmail.com>\r\n */\r\npublic class RH", "end": 1298, "score": 0.9998782873153687, "start": 1283, "tag": "NAME", "value": "Chongmyung Park" }, { "context": "sertTrue;\r\n\r\n/**\r\n *\r\n * @author Chongmyung Park <chongmyung.park@gmail.com>\r\n */\r\npublic class RHGETRoute extends GETRequest", "end": 1325, "score": 0.9999204874038696, "start": 1300, "tag": "EMAIL", "value": "chongmyung.park@gmail.com" } ]
null
[]
/* * Copyright (C) 2018 NATSRL @ UMD (University Minnesota Duluth) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program 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. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package edu.umn.natsrl.pyticas.restapi; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.sun.net.httpserver.HttpExchange; import ticas.common.pyticas.HttpResult; import ticas.common.pyticas.responses.ResponseRoute; import ticas.common.route.Route; import java.io.IOException; import java.io.OutputStream; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; /** * * @author <NAME> <<EMAIL>> */ public class RHGETRoute extends GETRequestHandler { private final String response; private final ResponseRoute rr; public RHGETRoute() { rr = new ResponseRoute(); rr.code = 1; rr.message = "success"; rr.obj = new Route(); rr.obj.name = "Test Route"; rr.obj.desc = "This is a test"; rr.obj.addRNode("rnd_1234"); rr.obj.addRNode("rnd_5678"); rr.obj.addRNode("rnd_9101112"); rr.obj.addRNode("rnd_131415"); rr.httpResult = null; this.response = this.toJson(rr); } @Override public void assertResponse(HttpResult res) { Gson gsonBuilder = new GsonBuilder().create(); ResponseRoute obj = gsonBuilder.fromJson(res.contents, ResponseRoute.class); System.out.println(" - http_code : " + res.res_code); assertTrue(res.res_code == 200); System.out.println(" - code : " + obj.code); assertEquals(obj.code, this.rr.code); System.out.println(" - message : " + obj.message); assertEquals(obj.message, this.rr.message); System.out.println(" - route : " + obj.obj.toString() + " > " + obj.obj.getRNodeNames().toString()); assertEquals(obj.obj.name, this.rr.obj.name); assertEquals(obj.obj.desc, this.rr.obj.desc); assertEquals(obj.obj.getRNodeNames(), this.rr.obj.getRNodeNames()); } @Override public void handle(HttpExchange t) throws IOException { t.sendResponseHeaders(200, response.length()); OutputStream os = t.getResponseBody(); os.write(response.getBytes()); os.close(); } }
2,990
0.66059
0.649652
80
35.712502
24.380419
109
false
false
0
0
0
0
0
0
0.6875
false
false
12
bb2c36b83a9bed80d8bc0773383db2125bfc4f5c
4,286,377,361,805
02b954f0d013a4887803eb120a598c040a073de1
/app/src/main/java/com/example/booklapangan/apihelper/BaseApiService.java
c5bbe7b7a450b9db1e504d8b739ee021b716391a
[]
no_license
dandygunarsa/BookLapangan
https://github.com/dandygunarsa/BookLapangan
d8d60d4ee945dc5e973f0f9fea70237004867684
43a21fd64372c0dfec13c8cba2cc1428af11a825
refs/heads/master
2020-09-19T22:47:14.928000
2019-12-12T17:07:56
2019-12-12T17:07:56
224,315,731
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.booklapangan.apihelper; import com.example.booklapangan.model.ResponseCategory; import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.http.Field; import retrofit2.http.FormUrlEncoded; import retrofit2.http.GET; import retrofit2.http.Header; import retrofit2.http.POST; public interface BaseApiService { @GET("category") Call<ResponseCategory> getCategory(); @POST("details") Call<ResponseBody> authRequest(@Header("Authorization") String Authorization); @FormUrlEncoded @POST("login") Call<ResponseBody> loginRequest(@Field("email") String email, @Field("password") String password); @FormUrlEncoded @POST("register") Call<ResponseBody> registerRequest(@Field("name") String name, @Field("email") String email, @Field("password") String password, @Field("c_password") String c_password); @FormUrlEncoded @POST("edit") Call<ResponseBody> editRequest( @Field("id") String id, @Field("name") String name); @FormUrlEncoded @POST("editpass") Call<ResponseBody> chapassRequest( @Field("id") String id, @Field("password") String password, @Field("passwordbaru") String passwordbaru, @Field("c_passwordbaru") String c_passwordbaru); @FormUrlEncoded @POST("daftargoogle") Call<ResponseBody> googleRequest( @Field("name") String name, @Field("email") String email, @Field("password") String password); }
UTF-8
Java
1,808
java
BaseApiService.java
Java
[ { "context": " @Field(\"passwordbaru\") String passwordbaru,\n ", "end": 1430, "score": 0.7633622884750366, "start": 1426, "tag": "PASSWORD", "value": "baru" }, { "context": " @Field(\"passwordbaru\") String passwordbaru,\n @Field(\"", "end": 1452, "score": 0.7720739245414734, "start": 1448, "tag": "PASSWORD", "value": "baru" } ]
null
[]
package com.example.booklapangan.apihelper; import com.example.booklapangan.model.ResponseCategory; import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.http.Field; import retrofit2.http.FormUrlEncoded; import retrofit2.http.GET; import retrofit2.http.Header; import retrofit2.http.POST; public interface BaseApiService { @GET("category") Call<ResponseCategory> getCategory(); @POST("details") Call<ResponseBody> authRequest(@Header("Authorization") String Authorization); @FormUrlEncoded @POST("login") Call<ResponseBody> loginRequest(@Field("email") String email, @Field("password") String password); @FormUrlEncoded @POST("register") Call<ResponseBody> registerRequest(@Field("name") String name, @Field("email") String email, @Field("password") String password, @Field("c_password") String c_password); @FormUrlEncoded @POST("edit") Call<ResponseBody> editRequest( @Field("id") String id, @Field("name") String name); @FormUrlEncoded @POST("editpass") Call<ResponseBody> chapassRequest( @Field("id") String id, @Field("password") String password, @Field("password<PASSWORD>") String password<PASSWORD>, @Field("c_passwordbaru") String c_passwordbaru); @FormUrlEncoded @POST("daftargoogle") Call<ResponseBody> googleRequest( @Field("name") String name, @Field("email") String email, @Field("password") String password); }
1,820
0.573009
0.569137
51
34.450981
28.411068
88
false
false
0
0
0
0
0
0
0.509804
false
false
12
0c271cadc8af13cf0a62d4c44f1607458df18494
19,009,525,258,146
1987a8a6702a6e183434184d714538e5e986eb11
/eclispe.workspace/xbrlcore/src/xbrlcore/playground/PlaygroundDimension.java
b86011aba934e63a3b6dd7546e80cc625edea5da
[]
no_license
fauzi16/2019.CoreXBRL
https://github.com/fauzi16/2019.CoreXBRL
da6936c1c84e7b17fa9056b9938bb56e66be4c1f
e46d83b23f446ff732d2e2463d612095ec449f6f
refs/heads/master
2021-07-21T15:20:47.256000
2019-12-02T11:44:34
2019-12-02T11:44:34
223,566,628
0
0
null
false
2020-10-13T17:41:18
2019-11-23T09:53:11
2019-12-02T11:44:46
2020-10-13T17:41:16
4,605
0
0
1
HTML
false
false
package xbrlcore.playground; import java.io.File; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import xbrlcore.dimensions.Dimension; import xbrlcore.dimensions.Hypercube; import xbrlcore.taxonomy.DefaultTaxonomyLoader; import xbrlcore.taxonomy.DiscoverableTaxonomySet; import xbrlcore.xlink.ExtendedLinkElement; import xbrlcore.xlink.Locator; public class PlaygroundDimension { /** private static final String BASE_URL = "C:\\Users\\fauzi16\\Documents\\Work\\Fujitsu\\ID.OJK\\2019.ID.XBRL\\ID.XBRL\\Source\\XRDM\\XRDM-Basic\\CONFIGXBRL\\EXTRACTEDDIR\\taxonomy\\view\\pp\\2016-06-11\\bulanan\\gabungan\\531020300"; */ /* * Single Dimension Domain of Dimensional Taxonomy */ private static final String BASE_URL = "/Users/fauzi/xbrl-reporting-manager/2019.XBRL.ReportingManager/xbrlrootfolder/base/taxonomy/xbrl.ojk.go.id/view/pp/2016-06-11/bulanan/gabungan/531020300"; private static final String TAXONOMY_LOCATION = "531020300-2016-06-11.xsd"; public static void main(String[] args) throws Exception { drillHypercube(); } public static void drillHypercube() throws Exception { File taxonomyFile = new File(BASE_URL + File.separator + TAXONOMY_LOCATION); DiscoverableTaxonomySet dts = new DefaultTaxonomyLoader().loadTaxonomy(taxonomyFile, null); dts.getDefinitionLinkbase().buildLinkbase(); Set<Hypercube> hypes = dts.getDefinitionLinkbase().getHypercubeSet(); for (Hypercube hype : hypes) { Map<String, Set<Dimension>> dimensionSetMap = hype.getDimensionSetMap(); for (Entry<String, Set<Dimension>> dimSet : dimensionSetMap.entrySet()) { System.out .println("=============================== " + dimSet.getKey() + " ==========================="); Set<Dimension> dims = dimSet.getValue(); for (Dimension dim : dims) { System.out.println("|========================== " + dim.getConcept() + " ============================="); Set<ExtendedLinkElement> elements = dim.getDomainMemberSet(); for (ExtendedLinkElement element : elements) { Locator l = (Locator) element; System.out.println(l.getConcept()); } } } } } }
UTF-8
Java
2,152
java
PlaygroundDimension.java
Java
[ { "context": "rivate static final String BASE_URL = \"C:\\\\Users\\\\fauzi16\\\\Documents\\\\Work\\\\Fujitsu\\\\ID.OJK\\\\2019.ID.XBRL\\\\", "end": 473, "score": 0.9981050491333008, "start": 466, "tag": "USERNAME", "value": "fauzi16" } ]
null
[]
package xbrlcore.playground; import java.io.File; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import xbrlcore.dimensions.Dimension; import xbrlcore.dimensions.Hypercube; import xbrlcore.taxonomy.DefaultTaxonomyLoader; import xbrlcore.taxonomy.DiscoverableTaxonomySet; import xbrlcore.xlink.ExtendedLinkElement; import xbrlcore.xlink.Locator; public class PlaygroundDimension { /** private static final String BASE_URL = "C:\\Users\\fauzi16\\Documents\\Work\\Fujitsu\\ID.OJK\\2019.ID.XBRL\\ID.XBRL\\Source\\XRDM\\XRDM-Basic\\CONFIGXBRL\\EXTRACTEDDIR\\taxonomy\\view\\pp\\2016-06-11\\bulanan\\gabungan\\531020300"; */ /* * Single Dimension Domain of Dimensional Taxonomy */ private static final String BASE_URL = "/Users/fauzi/xbrl-reporting-manager/2019.XBRL.ReportingManager/xbrlrootfolder/base/taxonomy/xbrl.ojk.go.id/view/pp/2016-06-11/bulanan/gabungan/531020300"; private static final String TAXONOMY_LOCATION = "531020300-2016-06-11.xsd"; public static void main(String[] args) throws Exception { drillHypercube(); } public static void drillHypercube() throws Exception { File taxonomyFile = new File(BASE_URL + File.separator + TAXONOMY_LOCATION); DiscoverableTaxonomySet dts = new DefaultTaxonomyLoader().loadTaxonomy(taxonomyFile, null); dts.getDefinitionLinkbase().buildLinkbase(); Set<Hypercube> hypes = dts.getDefinitionLinkbase().getHypercubeSet(); for (Hypercube hype : hypes) { Map<String, Set<Dimension>> dimensionSetMap = hype.getDimensionSetMap(); for (Entry<String, Set<Dimension>> dimSet : dimensionSetMap.entrySet()) { System.out .println("=============================== " + dimSet.getKey() + " ==========================="); Set<Dimension> dims = dimSet.getValue(); for (Dimension dim : dims) { System.out.println("|========================== " + dim.getConcept() + " ============================="); Set<ExtendedLinkElement> elements = dim.getDomainMemberSet(); for (ExtendedLinkElement element : elements) { Locator l = (Locator) element; System.out.println(l.getConcept()); } } } } } }
2,152
0.692379
0.664033
59
35.474575
43.548279
232
false
false
0
0
0
0
0
0
2.186441
false
false
12
ec59ebc740dd831df7f5579ceb2e228f1764ae30
17,660,905,553,376
1774bb987286abd38822fe92e79c0ff2367b52a7
/src/entities/Exercise.java
91857c5904ae6eac798ee8053d04d832240c18cb
[]
no_license
a-epifanov/trainingDiary
https://github.com/a-epifanov/trainingDiary
2ca42d361cda96fc3b47c40aaf0105cff62d514d
ef1d0ad8b2f61b6262f2a939dd7c4cacbf271deb
refs/heads/master
2016-09-05T16:59:01.056000
2015-08-06T18:00:06
2015-08-06T18:00:06
40,319,218
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package entities; import java.awt.Image; /** * Exercise entity * * @version 1.5 * @author Nikita Levchenko */ public class Exercise { private Integer exerciseId; private String exerciseName; private String exerciseDescription; private String exerciseCategory; public Exercise(String name) { this.setName(name); this.setDescription("Описание отсутствует"); this.setCategory("Другое"); } /*public Exercise(String name, String description) { this.setName(name); this.setDescription(description); this.setCategory("Другое"); } public Exercise(String name, String category, String description) { this.setName(name); this.setDescription(description); this.setCategory(category); } public Exercise(String name, Image image) { this.setName(name); this.setDescription("Описание отсутствует"); this.setCategory("Другое"); }*/ public Exercise(String name, String description, String category) { this.setName(name); if (description == null) { this.setDescription("Описание отсутствует"); } else { this.setDescription(description); } if (description == null) { this.setCategory("Другое"); } else { this.setCategory(category); } } /*public Exercise(Integer Id, String name, String description) { this.exerciseId = Id; this.setName(name); this.setDescription(description); this.setCategory("Другое"); }*/ public Exercise(Integer Id, String name, String description, String category) { this.exerciseId = Id; this.setName(name); if (description == null) { this.setDescription("Описание отсутствует"); } else { this.setDescription(description); } if (description == null) { this.setCategory("Другое"); } else { this.setCategory(category); } } public void setId(int id) { this.exerciseId = id; } public Integer getId() { return exerciseId; } public String getName() { return exerciseName; } public void setName(String exerciseName) { this.exerciseName = exerciseName; } public String getDescription() { return exerciseDescription; } public void setDescription(String exerciseDescription) { this.exerciseDescription = exerciseDescription; } public String getCategory() { return exerciseCategory; } public void setCategory(String category) { this.exerciseCategory = category; } }
WINDOWS-1251
Java
2,447
java
Exercise.java
Java
[ { "context": "\n\n/**\n* Exercise entity\n*\n* @version 1.5\n* @author Nikita Levchenko\n*/\npublic class Exercise {\n\tprivate Integer exerc", "end": 108, "score": 0.9997117519378662, "start": 92, "tag": "NAME", "value": "Nikita Levchenko" } ]
null
[]
package entities; import java.awt.Image; /** * Exercise entity * * @version 1.5 * @author <NAME> */ public class Exercise { private Integer exerciseId; private String exerciseName; private String exerciseDescription; private String exerciseCategory; public Exercise(String name) { this.setName(name); this.setDescription("Описание отсутствует"); this.setCategory("Другое"); } /*public Exercise(String name, String description) { this.setName(name); this.setDescription(description); this.setCategory("Другое"); } public Exercise(String name, String category, String description) { this.setName(name); this.setDescription(description); this.setCategory(category); } public Exercise(String name, Image image) { this.setName(name); this.setDescription("Описание отсутствует"); this.setCategory("Другое"); }*/ public Exercise(String name, String description, String category) { this.setName(name); if (description == null) { this.setDescription("Описание отсутствует"); } else { this.setDescription(description); } if (description == null) { this.setCategory("Другое"); } else { this.setCategory(category); } } /*public Exercise(Integer Id, String name, String description) { this.exerciseId = Id; this.setName(name); this.setDescription(description); this.setCategory("Другое"); }*/ public Exercise(Integer Id, String name, String description, String category) { this.exerciseId = Id; this.setName(name); if (description == null) { this.setDescription("Описание отсутствует"); } else { this.setDescription(description); } if (description == null) { this.setCategory("Другое"); } else { this.setCategory(category); } } public void setId(int id) { this.exerciseId = id; } public Integer getId() { return exerciseId; } public String getName() { return exerciseName; } public void setName(String exerciseName) { this.exerciseName = exerciseName; } public String getDescription() { return exerciseDescription; } public void setDescription(String exerciseDescription) { this.exerciseDescription = exerciseDescription; } public String getCategory() { return exerciseCategory; } public void setCategory(String category) { this.exerciseCategory = category; } }
2,437
0.710064
0.709208
113
19.663717
18.356649
81
false
false
0
0
0
0
0
0
1.787611
false
false
12
6cdc935a66d04e7bb7f33b7dd52f20767d74259b
17,660,905,551,042
be29c33e03cf20cd1b7e11f7fcadcafa1aa29e1c
/src/main/java/org/jtwig/model/expression/FunctionExpression.java
3eb3edbd114634093b24e052b6968f0b7d4e34d4
[ "Apache-2.0" ]
permissive
MakerTim/jtwig-core
https://github.com/MakerTim/jtwig-core
65f30171325c5b17dca72870db2401845a8aaa3b
0f9e980534830295c7dc47c0a5ee050e0b524891
refs/heads/master
2021-07-10T07:46:03.735000
2017-10-06T15:59:09
2017-10-06T15:59:09
106,023,443
0
0
null
true
2017-10-06T15:56:21
2017-10-06T15:56:21
2017-08-09T14:34:32
2017-09-10T02:10:28
1,112
0
0
0
null
null
null
package org.jtwig.model.expression; import org.jtwig.model.position.Position; import java.util.ArrayList; import java.util.List; public class FunctionExpression extends InjectableExpression { private final String functionIdentifier; private final List<Expression> arguments; public FunctionExpression(Position position, String functionIdentifier, List<Expression> arguments) { super(position); this.functionIdentifier = functionIdentifier; this.arguments = arguments; } public String getFunctionIdentifier() { return functionIdentifier; } public List<Expression> getArguments() { return arguments; } @Override public Expression inject(Expression expression) { List<Expression> arguments = new ArrayList<>(); arguments.add(expression); arguments.addAll(getArguments()); return new FunctionExpression(getPosition(), functionIdentifier, arguments); } }
UTF-8
Java
973
java
FunctionExpression.java
Java
[]
null
[]
package org.jtwig.model.expression; import org.jtwig.model.position.Position; import java.util.ArrayList; import java.util.List; public class FunctionExpression extends InjectableExpression { private final String functionIdentifier; private final List<Expression> arguments; public FunctionExpression(Position position, String functionIdentifier, List<Expression> arguments) { super(position); this.functionIdentifier = functionIdentifier; this.arguments = arguments; } public String getFunctionIdentifier() { return functionIdentifier; } public List<Expression> getArguments() { return arguments; } @Override public Expression inject(Expression expression) { List<Expression> arguments = new ArrayList<>(); arguments.add(expression); arguments.addAll(getArguments()); return new FunctionExpression(getPosition(), functionIdentifier, arguments); } }
973
0.717369
0.717369
33
28.484848
26.022276
105
false
false
0
0
0
0
0
0
0.575758
false
false
12
39865b8a9c8c881087c8255a9e494bb144cfb92d
18,820,546,744,511
266189e916093de517503463060435c09390ef79
/src/main/java/com/tianyao/springbootcurd/config/MyMvcConfig.java
c1844777be109c33b24619e72f5057e368d5e79f
[]
no_license
tymanycool/spring-boot-curd
https://github.com/tymanycool/spring-boot-curd
75fd252c40d862438caac34e5ba6619efd815585
bbc486a852a0f260f37e03afb5197c24acd4566e
refs/heads/master
2020-03-21T04:40:21.129000
2018-05-08T11:55:51
2018-05-08T11:55:51
138,121,644
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tianyao.springbootcurd.config; import com.tianyao.springbootcurd.component.LoginHandlerIntercepter; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; @Configuration public class MyMvcConfig extends WebMvcConfigurerAdapter { @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/").setViewName("index"); registry.addViewController("/index.html").setViewName("index"); registry.addViewController("/main.html").setViewName("dashboard"); //super.addViewControllers(registry); } // Spring 2.x 需要排除静态资源 @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new LoginHandlerIntercepter()).addPathPatterns("/**") .excludePathPatterns("/", "/index.html","/webjars/**","/asserts/**","/user/login"); // super.addInterceptors(registry); } }
UTF-8
Java
1,197
java
MyMvcConfig.java
Java
[]
null
[]
package com.tianyao.springbootcurd.config; import com.tianyao.springbootcurd.component.LoginHandlerIntercepter; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; @Configuration public class MyMvcConfig extends WebMvcConfigurerAdapter { @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/").setViewName("index"); registry.addViewController("/index.html").setViewName("index"); registry.addViewController("/main.html").setViewName("dashboard"); //super.addViewControllers(registry); } // Spring 2.x 需要排除静态资源 @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new LoginHandlerIntercepter()).addPathPatterns("/**") .excludePathPatterns("/", "/index.html","/webjars/**","/asserts/**","/user/login"); // super.addInterceptors(registry); } }
1,197
0.754445
0.753599
26
44.423077
31.767391
99
false
false
0
0
0
0
0
0
0.615385
false
false
12
faebc70abf7f02577b71b1d522c4975080b9f795
13,915,694,053,651
99f2abe289b76b5ea9aeea560a9dd273e1a22317
/Shale/src/com/shale/client/element/LinkingPhraseModel.java
833b9f2dffdafc75d1ca254c94943a98c1b78e57
[]
no_license
istovatis/shale
https://github.com/istovatis/shale
962a1bcbef04ca32572fcd36e244c12b3b20d4a9
53a234a9a4e237fa90a746db87f944000292894f
refs/heads/master
2020-04-05T19:04:14.034000
2016-04-20T06:30:47
2016-04-20T06:30:47
26,558,006
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.shale.client.element; import com.google.gwt.user.client.rpc.IsSerializable; import com.orange.links.client.save.LinkModel; public class LinkingPhraseModel extends LinkModel implements IsSerializable { protected String id; protected String left; protected String top; public String getLeft() { return left; } public void setLeft(String left) { this.left = left; } public String getTop() { return top; } public void setTop(String top) { this.top = top; } public void setId(String id) { this.id = id; } public String getId() { return id; } }
UTF-8
Java
571
java
LinkingPhraseModel.java
Java
[]
null
[]
package com.shale.client.element; import com.google.gwt.user.client.rpc.IsSerializable; import com.orange.links.client.save.LinkModel; public class LinkingPhraseModel extends LinkModel implements IsSerializable { protected String id; protected String left; protected String top; public String getLeft() { return left; } public void setLeft(String left) { this.left = left; } public String getTop() { return top; } public void setTop(String top) { this.top = top; } public void setId(String id) { this.id = id; } public String getId() { return id; } }
571
0.737303
0.737303
21
26.190475
23.302603
77
false
false
0
0
0
0
0
0
1.190476
false
false
12
d95b6323716bde87e60b44ddae14f2f290d58e9e
30,142,080,518,336
19d2e234bd4f86fedfaf9011eabf9dc267d739a0
/app/src/main/java/example/com/playandroid/network/Api.java
0be3fb4b9f7c734d74e81ce5eefa4bc9bd694d91
[ "Apache-2.0" ]
permissive
DNF229298806/PlayAndroid
https://github.com/DNF229298806/PlayAndroid
b66893776cd20e202222ec370c0856749d93b43c
d6e29cc88805aedfe7c9d8468baa72d0f4cd388f
refs/heads/master
2020-03-29T06:31:55.506000
2019-03-22T02:55:09
2019-03-22T02:55:09
149,629,088
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package example.com.playandroid.network; import java.util.List; import example.com.playandroid.content.home.net.BannerEntity; import example.com.playandroid.content.home.net.PageEntity; import example.com.playandroid.content.main.CollectionPageEntity; import example.com.playandroid.content.navigation.NavigationTitleEntity; import example.com.playandroid.content.register.UserEntity; import example.com.playandroid.content.search.suggest.HotKeyEntity; import example.com.playandroid.content.system.SystemEntity; import example.com.playandroid.network.entity.InfoEntity; import io.reactivex.Observable; import retrofit2.http.Field; import retrofit2.http.FormUrlEncoded; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.Path; import retrofit2.http.Query; /** * @author Richard_Y_Wang * @des 2018/9/25 21:06 */ public interface Api { String HOST = "https://www.wanandroid.com"; /** * 公开的API */ String OPEN_API = "/openapis"; @POST("user/register") @FormUrlEncoded Observable<InfoEntity<UserEntity>> register(@Field("username") String username, @Field("password") String password, @Field("repassword") String repassword); /** * 登陆 * http://www.wanandroid.com/user/login * * @param username user name * @param password password * @return 登陆数据 */ @POST("user/login") @FormUrlEncoded Observable<InfoEntity<UserEntity>> login(@Field("username") String username, @Field("password") String password); /** * 广告栏 * http://www.wanandroid.com/banner/json * * @return 广告栏数据 */ @GET("banner/json") Observable<InfoEntity<List<BannerEntity>>> getBannerEntity(); /** * 获取首页文章列表 * * @param num 页数 * @return 首页文章列表数据 */ @GET("article/list/{num}/json") Observable<InfoEntity<PageEntity>> getFeedArticleList(@Path("num") int num); /** * 获取体系列表 * * @return 体系列表json */ @GET("tree/json") Observable<InfoEntity<List<SystemEntity>>> getSystemList(); /** * 获取体系分类下文章数据 * * @param page 页码 * @param cid id * @return 体系分类下文章数据 */ @GET("article/list/{page}/json") Observable<InfoEntity<PageEntity>> getHierarchyArticles(@Path("page") int page, @Query("cid") int cid); /** * 获取项目分类 * @return 项目分类 */ @GET("project/tree/json") Observable<InfoEntity<List<SystemEntity>>> getProjectCategories(); /** * 获取项目分类下文章数据 * @param page 页码 * @param cid id * @return 项目下的文章数据 */ @GET("project/list/{page}/json") Observable<InfoEntity<PageEntity>> getProjectArticles(@Path("page") int page, @Query("cid") int cid); /** * 获取导航数据 */ @GET("navi/json") Observable<InfoEntity<List<NavigationTitleEntity>>> getNavigationList(); /** * 公开的API */ @GET("openapis") Observable<String> getOpenAPIS(); /** * 收藏站内文章 * http://www.wanandroid.com/lg/collect/1165/json * * @param id article id * @return 收藏站内文章数据 */ @POST("lg/collect/{id}/json") Observable<InfoEntity> addCollectArticle(@Path("id") int id); /** * 获取收藏列表 * http://www.wanandroid.com/lg/collect/list/0/json * * @param page page number * @return 收藏列表数据 */ @GET("lg/collect/list/{page}/json") Observable<InfoEntity<CollectionPageEntity>> getCollectList(@Path("page") int page); /** * 搜索热词 * * @return 热词列表 */ @GET("hotkey/json") Observable<InfoEntity<List<HotKeyEntity>>> getHotKeyEntity(); /** * @param page 页码 * @param keyword 搜索关键词 * @return 搜索结果 */ @POST("article/query/{page}/json") @FormUrlEncoded Observable<InfoEntity<PageEntity>> searchArticles( @Path("page") int page, @Field("k") String keyword ); }
UTF-8
Java
4,176
java
Api.java
Java
[ { "context": "Path;\nimport retrofit2.http.Query;\n\n/**\n * @author Richard_Y_Wang\n * @des 2018/9/25 21:06\n */\npublic interface Api ", "end": 814, "score": 0.9942262768745422, "start": 800, "tag": "NAME", "value": "Richard_Y_Wang" }, { "context": "servable<InfoEntity<UserEntity>> register(@Field(\"username\") String username, @Field(\"password\") String pass", "end": 1091, "score": 0.5677844882011414, "start": 1083, "tag": "USERNAME", "value": "username" }, { "context": "droid.com/user/login\n *\n * @param username user name\n * @param password password\n * @return 登陆", "end": 1290, "score": 0.9951289892196655, "start": 1281, "tag": "USERNAME", "value": "user name" }, { "context": "* @param username user name\n * @param password password\n * @return 登陆数据\n */\n @POST(\"user/login", "end": 1322, "score": 0.9511107802391052, "start": 1314, "tag": "PASSWORD", "value": "password" }, { "context": " Observable<InfoEntity<UserEntity>> login(@Field(\"username\") String username, @Field(\"password\") String pass", "end": 1456, "score": 0.7948617339134216, "start": 1448, "tag": "USERNAME", "value": "username" } ]
null
[]
package example.com.playandroid.network; import java.util.List; import example.com.playandroid.content.home.net.BannerEntity; import example.com.playandroid.content.home.net.PageEntity; import example.com.playandroid.content.main.CollectionPageEntity; import example.com.playandroid.content.navigation.NavigationTitleEntity; import example.com.playandroid.content.register.UserEntity; import example.com.playandroid.content.search.suggest.HotKeyEntity; import example.com.playandroid.content.system.SystemEntity; import example.com.playandroid.network.entity.InfoEntity; import io.reactivex.Observable; import retrofit2.http.Field; import retrofit2.http.FormUrlEncoded; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.Path; import retrofit2.http.Query; /** * @author Richard_Y_Wang * @des 2018/9/25 21:06 */ public interface Api { String HOST = "https://www.wanandroid.com"; /** * 公开的API */ String OPEN_API = "/openapis"; @POST("user/register") @FormUrlEncoded Observable<InfoEntity<UserEntity>> register(@Field("username") String username, @Field("password") String password, @Field("repassword") String repassword); /** * 登陆 * http://www.wanandroid.com/user/login * * @param username user name * @param password <PASSWORD> * @return 登陆数据 */ @POST("user/login") @FormUrlEncoded Observable<InfoEntity<UserEntity>> login(@Field("username") String username, @Field("password") String password); /** * 广告栏 * http://www.wanandroid.com/banner/json * * @return 广告栏数据 */ @GET("banner/json") Observable<InfoEntity<List<BannerEntity>>> getBannerEntity(); /** * 获取首页文章列表 * * @param num 页数 * @return 首页文章列表数据 */ @GET("article/list/{num}/json") Observable<InfoEntity<PageEntity>> getFeedArticleList(@Path("num") int num); /** * 获取体系列表 * * @return 体系列表json */ @GET("tree/json") Observable<InfoEntity<List<SystemEntity>>> getSystemList(); /** * 获取体系分类下文章数据 * * @param page 页码 * @param cid id * @return 体系分类下文章数据 */ @GET("article/list/{page}/json") Observable<InfoEntity<PageEntity>> getHierarchyArticles(@Path("page") int page, @Query("cid") int cid); /** * 获取项目分类 * @return 项目分类 */ @GET("project/tree/json") Observable<InfoEntity<List<SystemEntity>>> getProjectCategories(); /** * 获取项目分类下文章数据 * @param page 页码 * @param cid id * @return 项目下的文章数据 */ @GET("project/list/{page}/json") Observable<InfoEntity<PageEntity>> getProjectArticles(@Path("page") int page, @Query("cid") int cid); /** * 获取导航数据 */ @GET("navi/json") Observable<InfoEntity<List<NavigationTitleEntity>>> getNavigationList(); /** * 公开的API */ @GET("openapis") Observable<String> getOpenAPIS(); /** * 收藏站内文章 * http://www.wanandroid.com/lg/collect/1165/json * * @param id article id * @return 收藏站内文章数据 */ @POST("lg/collect/{id}/json") Observable<InfoEntity> addCollectArticle(@Path("id") int id); /** * 获取收藏列表 * http://www.wanandroid.com/lg/collect/list/0/json * * @param page page number * @return 收藏列表数据 */ @GET("lg/collect/list/{page}/json") Observable<InfoEntity<CollectionPageEntity>> getCollectList(@Path("page") int page); /** * 搜索热词 * * @return 热词列表 */ @GET("hotkey/json") Observable<InfoEntity<List<HotKeyEntity>>> getHotKeyEntity(); /** * @param page 页码 * @param keyword 搜索关键词 * @return 搜索结果 */ @POST("article/query/{page}/json") @FormUrlEncoded Observable<InfoEntity<PageEntity>> searchArticles( @Path("page") int page, @Field("k") String keyword ); }
4,178
0.639721
0.634039
150
24.813334
26.144314
160
false
false
0
0
0
0
0
0
0.26
false
false
12
6ec613a0cea70929b7d0a674a80819c2378013a1
3,865,470,596,934
65a1c6446f6e2342ab1e3b4f21b8a0932d4282d7
/src/main/java/com/rms/rms/dto/user/UserRoleUpdateDto.java
312d53bb5717a0929b423aaaeddb4bcca8e8681c
[]
no_license
DhimitriosDuka/rms-backend
https://github.com/DhimitriosDuka/rms-backend
2c7e0a717fe6cd279c5263fda8e1c7a4e05fbc46
ed2c17d4106f5dae6c5425cb6288c7eb1e9fd701
refs/heads/master
2023-06-22T03:42:05.158000
2021-06-17T00:32:50
2021-06-17T00:32:50
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rms.rms.dto.user; import com.rms.rms.enums.Role; import lombok.Data; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; @Getter @Setter public class UserRoleUpdateDto { @NotNull(message = "Role must not be blank.") private Role role; }
UTF-8
Java
378
java
UserRoleUpdateDto.java
Java
[]
null
[]
package com.rms.rms.dto.user; import com.rms.rms.enums.Role; import lombok.Data; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; @Getter @Setter public class UserRoleUpdateDto { @NotNull(message = "Role must not be blank.") private Role role; }
378
0.777778
0.777778
19
18.894737
16.533522
49
false
false
0
0
0
0
0
0
0.473684
false
false
12
cc669acbda73b93bdb78cb8219d57f9fcd220bb3
20,710,332,325,560
011cfd72a84bd8326f5c1a4d0923aba6697f5273
/sp18/hw3/submissions/chokravis_4020676_45145003_kyc375_xl5587/TCPServer.java
6b7af87a0e2efe9f88631d43220aadd1f80e872b
[]
no_license
XIONGZHENGxz/DistributedSystem
https://github.com/XIONGZHENGxz/DistributedSystem
8939b8f62061e7a654fa8a505887edd7a6c54cac
837763aa47c6442d2ff2dd4a39be26f2300fbb09
refs/heads/master
2021-09-12T16:24:31.556000
2018-04-18T15:01:45
2018-04-18T15:01:45
77,963,462
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.*; import java.net.*; import java.util.*; public class TCPServer extends BookServer implements Runnable { private int tcpPort = 7000; @Override public void run(){ try{ @SuppressWarnings("resource") Socket Tsocket; while((Tsocket = serverSock.accept()) != null){ int port = Tsocket.getPort(); PrintWriter writer = new PrintWriter(Tsocket.getOutputStream()); ClientHandler client = new ClientHandler(Tsocket, writer); Thread t = new Thread(client); t.start(); } } catch (Exception e){ e.printStackTrace(); } } class ClientHandler implements Runnable{ private Socket s; private PrintWriter writer; private Scanner reader; ClientHandler(Socket s, PrintWriter writer) throws IOException{ this.s = s; this.writer = writer; } @Override public void run(){ try { reader = new Scanner(s.getInputStream()); }catch (IOException e){ e.printStackTrace(); } String message; while (reader.hasNext()) { if(DEBUG) System.out.println("Server trying to receive message"); message = reader.nextLine(); if(DEBUG) System.out.println("Message from ClientHandler: " + message); String ret = processCommand(message); if(DEBUG) System.out.println("Message output from ClientHandler: " + ret); String[] set = ret.split("\n"); ret = ""; for(String temp : set){ ret = ret + temp + "&&"; } writer.println(ret); writer.flush(); if(DEBUG) System.out.println("Server sent message"); if(s.isClosed()){ break; } } if(DEBUG){System.out.println("TCP disconnect from client: " + s.getPort());} } } }
UTF-8
Java
2,218
java
TCPServer.java
Java
[]
null
[]
import java.io.*; import java.net.*; import java.util.*; public class TCPServer extends BookServer implements Runnable { private int tcpPort = 7000; @Override public void run(){ try{ @SuppressWarnings("resource") Socket Tsocket; while((Tsocket = serverSock.accept()) != null){ int port = Tsocket.getPort(); PrintWriter writer = new PrintWriter(Tsocket.getOutputStream()); ClientHandler client = new ClientHandler(Tsocket, writer); Thread t = new Thread(client); t.start(); } } catch (Exception e){ e.printStackTrace(); } } class ClientHandler implements Runnable{ private Socket s; private PrintWriter writer; private Scanner reader; ClientHandler(Socket s, PrintWriter writer) throws IOException{ this.s = s; this.writer = writer; } @Override public void run(){ try { reader = new Scanner(s.getInputStream()); }catch (IOException e){ e.printStackTrace(); } String message; while (reader.hasNext()) { if(DEBUG) System.out.println("Server trying to receive message"); message = reader.nextLine(); if(DEBUG) System.out.println("Message from ClientHandler: " + message); String ret = processCommand(message); if(DEBUG) System.out.println("Message output from ClientHandler: " + ret); String[] set = ret.split("\n"); ret = ""; for(String temp : set){ ret = ret + temp + "&&"; } writer.println(ret); writer.flush(); if(DEBUG) System.out.println("Server sent message"); if(s.isClosed()){ break; } } if(DEBUG){System.out.println("TCP disconnect from client: " + s.getPort());} } } }
2,218
0.48422
0.482417
69
30.144928
24.11042
90
false
false
0
0
0
0
0
0
0.492754
false
false
12
ace1026226877f2383ec8296e3f518c3cc42c058
31,610,959,315,942
1a300d6641da698a34b3f7d8692415dcd5d3e166
/src/test/java/com/person/mail/CategoryMapperTests.java
7f3ae8ad39df7a9b294b2db80c81435de9030a56
[]
no_license
chengpopeye/mail
https://github.com/chengpopeye/mail
589f50cb581d3053f5464b0a8e4d4796ae0f995f
7019d1023f942619ba62c55c7ca9d8202c9e92d5
refs/heads/master
2022-07-29T16:42:00.954000
2020-05-22T11:55:24
2020-05-22T11:55:24
266,098,674
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.person.mail; import com.person.mail.dao.CategoryMapper; import com.person.mail.pojo.Category; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; /** * @Author popeye * @Date 2020/05/20 * @Version V1.0 **/ public class CategoryMapperTests extends BaseTests{ @Autowired private CategoryMapper categoryMapper; @Test public void queryById() { Category category = categoryMapper.queryById(100001); System.out.println(category.toString()); } }
UTF-8
Java
686
java
CategoryMapperTests.java
Java
[ { "context": ".test.context.junit4.SpringRunner;\n\n/**\n * @Author popeye\n * @Date 2020/05/20\n * @Version V1.0\n **/\n\npublic", "end": 370, "score": 0.9996653199195862, "start": 364, "tag": "USERNAME", "value": "popeye" } ]
null
[]
package com.person.mail; import com.person.mail.dao.CategoryMapper; import com.person.mail.pojo.Category; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; /** * @Author popeye * @Date 2020/05/20 * @Version V1.0 **/ public class CategoryMapperTests extends BaseTests{ @Autowired private CategoryMapper categoryMapper; @Test public void queryById() { Category category = categoryMapper.queryById(100001); System.out.println(category.toString()); } }
686
0.753644
0.728863
28
23.5
21.764158
62
false
false
0
0
0
0
0
0
0.392857
false
false
12
91aa633837aa1684741d3b855f7f4ba24b745f61
6,176,162,994,725
44d6fc6acc2980200165009966382b1f6cc7c129
/src/by/epam/courses/Linear/LinearTask39.java
dc6a514637d6236cbfc1893859f85b237d82bda4
[]
no_license
AliaksandrQA/IT-academy-LinearUnit
https://github.com/AliaksandrQA/IT-academy-LinearUnit
2cdc5bd4c4de1581d8274d816dde218fff71736b
4eddf0e0d28267f4e793555058bd7797435912a3
refs/heads/master
2021-02-10T23:17:22.795000
2020-03-02T17:26:28
2020-03-02T17:26:28
244,428,371
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package by.epam.courses.Linear; /* Дано действительное число х. Не пользуясь никакими другими арифметическими операциями, кроме умножения, сложения и вычитания, вычислите за минимальное число операций:*/ public class LinearTask39 { public static void solution() { //2x 4 - 3х 3 + 4х2 - 5х + 6. double x; double result; double x_4; double x_3; double x_2; x = 3.4; x_4 = Math.pow(x, 4); x_3 = Math.pow(x, 3); x_2 = Math.pow(x, 2); result = 2 * (x_4)- 3*(x_3) + 4*(x_2) - (5 * x) + 6; System.out.println("Значение ="+" "+ result); } }
UTF-8
Java
772
java
LinearTask39.java
Java
[]
null
[]
package by.epam.courses.Linear; /* Дано действительное число х. Не пользуясь никакими другими арифметическими операциями, кроме умножения, сложения и вычитания, вычислите за минимальное число операций:*/ public class LinearTask39 { public static void solution() { //2x 4 - 3х 3 + 4х2 - 5х + 6. double x; double result; double x_4; double x_3; double x_2; x = 3.4; x_4 = Math.pow(x, 4); x_3 = Math.pow(x, 3); x_2 = Math.pow(x, 2); result = 2 * (x_4)- 3*(x_3) + 4*(x_2) - (5 * x) + 6; System.out.println("Значение ="+" "+ result); } }
772
0.57189
0.52504
29
19.275862
23.597044
106
false
false
0
0
0
0
0
0
2.034483
false
false
12
ea088819008f8a788fe7c38bf57fb54eb1c22383
19,181,323,982,352
57766249c8d58e62ed0337d53828dd447ea2e69a
/204_singleton/singleton.java
087d48b473d91f68289e664cf092b5958ec58a24
[]
no_license
shaman2009/passed
https://github.com/shaman2009/passed
055666ea017111d17b13079a2db6ddf628030b3e
64265b08001ec314706517cfd5d818a114c94837
refs/heads/master
2021-06-07T11:42:57.729000
2016-11-10T00:51:54
2016-11-10T00:51:54
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* @Copyright:LintCode @Author: shaman @Problem: http://www.lintcode.com/problem/singleton @Language: Java @Datetime: 15-10-07 14:04 */ public class Solution { /** * @return: The same instance of this class every time */ private static Solution solution; public static Solution getInstance() { if (solution == null) { solution = new Solution(); } return solution; } }
UTF-8
Java
435
java
singleton.java
Java
[ { "context": "/*\n@Copyright:LintCode\n@Author: shaman\n@Problem: http://www.lintcode.com/problem/single", "end": 40, "score": 0.9547468423843384, "start": 34, "tag": "NAME", "value": "shaman" } ]
null
[]
/* @Copyright:LintCode @Author: shaman @Problem: http://www.lintcode.com/problem/singleton @Language: Java @Datetime: 15-10-07 14:04 */ public class Solution { /** * @return: The same instance of this class every time */ private static Solution solution; public static Solution getInstance() { if (solution == null) { solution = new Solution(); } return solution; } }
435
0.613793
0.590805
22
18.818182
17.364113
58
false
false
0
0
0
0
0
0
0.136364
false
false
12
c6745ac71c75785522421a8dc050392c60dba959
12,206,297,123,872
ecf5f4137ee7d68329f71cd48926858c8ac6b002
/spring-ioc-01/src/main/java/com/shsxt/bean/UserSerivce2.java
f0be3356771ecf652020d83ec51521121725c9cf
[]
no_license
ted-cs/spring-work
https://github.com/ted-cs/spring-work
d58623b5d5b6976ca8afdf092bf791cd6b4ee9ef
b6488132d4fa4226dc8e9a160f11671171e8b7a8
refs/heads/master
2020-02-17T16:44:30.517000
2019-05-04T04:05:25
2019-05-04T04:05:25
124,380,778
1
0
null
false
2019-05-04T02:17:18
2018-03-08T11:17:09
2019-05-04T02:12:12
2019-05-04T02:17:18
12
0
0
0
Java
false
false
package com.shsxt.bean; public class UserSerivce2 { public void print () { System.out.println("hello 实例化工厂 !"); } }
UTF-8
Java
143
java
UserSerivce2.java
Java
[]
null
[]
package com.shsxt.bean; public class UserSerivce2 { public void print () { System.out.println("hello 实例化工厂 !"); } }
143
0.62406
0.616541
9
12.777778
14.014102
38
false
false
0
0
0
0
0
0
0.777778
false
false
12
f33d715ca163dc28b53c200181b23cdc7bf5331f
26,053,271,621,523
4d855477905fd03fc19bd1df6560cf5d2acd5063
/LOC8R/src/FrontEnd.java
851578d522eba7644acb07c30013d4441a2ab964
[]
no_license
nalin29/LOC8R
https://github.com/nalin29/LOC8R
cec327515cd096b0a852db2c0c1429528fa1491a
4483a30afdd965878cddefe8d96203a7187b4029
refs/heads/master
2020-04-01T03:26:40.498000
2018-10-13T22:18:05
2018-10-13T22:18:05
151,303,502
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.BufferedReader; import java.io.File; import java.io.InputStreamReader; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.Set; import java.util.TreeMap; import org.json.JSONArray; import org.json.JSONObject; import javafx.animation.KeyFrame; import javafx.animation.KeyValue; import javafx.animation.Timeline; import javafx.application.Application; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; import javafx.scene.control.Label; import javafx.scene.control.ListView; import javafx.scene.control.Menu; import javafx.scene.control.MenuBar; import javafx.scene.control.MenuItem; import javafx.scene.control.ProgressBar; import javafx.scene.control.TextArea; import javafx.scene.control.TextField; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.KeyCode; import javafx.scene.input.KeyEvent; import javafx.scene.input.MouseEvent; import javafx.scene.layout.Background; import javafx.scene.layout.BackgroundImage; import javafx.scene.layout.BackgroundPosition; import javafx.scene.layout.BackgroundRepeat; import javafx.scene.layout.BackgroundSize; import javafx.scene.layout.BorderPane; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.scene.media.Media; import javafx.scene.media.MediaPlayer; import javafx.stage.Modality; import javafx.stage.Stage; import javafx.util.Duration; public class FrontEnd extends Application { ObservableList<String> items = FXCollections.observableArrayList (); ArrayList<String> temp = new ArrayList<>(); static double lat; static double longi; static String add; static int tempRev; static DataBase data = null; Scene lastScene; Location tempLocation; public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) throws Exception { //Error Scene_________________________________________________________________________________ Stage popupwindow=new Stage(); popupwindow.initModality(Modality.APPLICATION_MODAL); popupwindow.setTitle("Error pop up window"); Label label1= new Label("An error was detected"); Button button1= new Button("Close Application"); button1.setOnAction(e ->{ popupwindow.close(); stage.close(); }); VBox layout= new VBox(10); layout.getChildren().addAll(label1, button1); layout.setAlignment(Pos.CENTER); Scene scene1= new Scene(layout, 300, 250); popupwindow.setScene(scene1); popupwindow.hide(); //Loading Screen_________________________________________________________________________ try{data = new DataBase();} catch (Exception e1) { popupwindow.showAndWait();} stage.setTitle("Loading"); BorderPane loadingBar = new BorderPane(); ProgressBar progress = new ProgressBar(); VBox bar = new VBox(); bar.getChildren().addAll(progress); loadingBar.setBottom(bar); bar.setPadding(new Insets(30)); bar.setAlignment(Pos.CENTER); Scene loadingScreen = new Scene(loadingBar,906,515); stage.setScene(loadingScreen); String bip = "music.mp3"; Media hit = new Media(new File(bip).toURI().toString()); MediaPlayer mediaPlayer = new MediaPlayer(hit); mediaPlayer.play(); Image image = null; try {image = new Image("loading.png");} catch (Exception e1) { popupwindow.showAndWait();} //Image image = new Image("loading.png"); // new BackgroundSize(width, height, widthAsPercentage, heightAsPercentage, contain, cover) BackgroundSize backgroundSize = new BackgroundSize(906, 515, true, true, true, false); // new BackgroundImage(image, repeatX, repeatY, position, size) BackgroundImage backgroundImage = new BackgroundImage(image, BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER, backgroundSize); // new Background(images...) Background background = new Background(backgroundImage); loadingBar.setBackground(background); stage.setResizable(true); stage.show(); //HomePage_____________________________________________________________________________________ BorderPane homeScreen = new BorderPane(); MenuBar menu = new MenuBar(); Menu file = new Menu("File"); MenuItem save = new MenuItem("save"); file.getItems().add(save); menu.getMenus().add(file); homeScreen.setTop(menu); Image logo = null; try{logo= new Image("Loc8r_black.png");} catch (Exception e1) { popupwindow.showAndWait();} ImageView logoView = new ImageView(); logoView.setImage(logo); VBox logoMenu = new VBox(); logoMenu.setAlignment(Pos.CENTER); logoMenu.getChildren().addAll(menu,logoView); homeScreen.setTop(logoMenu); GridPane homeGrid = new GridPane(); ComboBox tag = new ComboBox(); tag.getItems().add("Type"); HashMap<String, ArrayList<Location>> loc = data.getLocData(); Set<String> keys = data.getLocData().keySet(); for(String s: keys) { tag.getItems().add(s); } Button search = new Button("LOC8"); search.setDisable(true); search.setAlignment(Pos.CENTER); Button reviewed = new Button("Reviewed"); reviewed.setAlignment(Pos.CENTER); Button recents = new Button("Recents"); recents.setAlignment(Pos.CENTER); homeGrid.add(tag, 0, 0); homeGrid.add(search, 1,0); homeGrid.add(reviewed, 1,1); homeGrid.add(recents, 1,2); homeGrid.setHgap(20); homeGrid.setVgap(20); homeGrid.setAlignment(Pos.CENTER); homeScreen.setCenter(homeGrid); Scene home = new Scene(homeScreen, 600,600 ); //stage.setScene(home); //Address Scene___________________________________________________________________________________ BorderPane address = new BorderPane(); VBox menuLogo2 = new VBox(); ImageView logoView2 = new ImageView(); logoView2.setImage(logo); logoView2.setTranslateX(135); address.setTop(logoView2); GridPane info = new GridPane(); TextField Address = new TextField("Enter Address Here"); Label label = new Label("Address: "); info.add(Address, 1, 0); info.add(label, 0, 0); info.setVgap(10); info.setAlignment(Pos.CENTER); address.setCenter(info); HBox buttons = new HBox(); Button next = new Button("Enter"); next.setPadding(new Insets(20)); Button back = new Button("Return"); back.setPadding(new Insets(20)); buttons.getChildren().addAll(back, next); buttons.setAlignment(Pos.CENTER); address.setBottom(buttons); Scene AdressScene = new Scene(address, 600,600); //List Scene for Locations________________________________________________________________________ BorderPane lists = new BorderPane(); ListView<String> locations = new ListView<String>(); locations.setItems(items); lists.setLeft(locations); TextArea locationData = new TextArea(); locationData.setEditable(false); lists.setRight(locationData); HBox buttonsList = new HBox(); Button backwards = new Button("Back"); Button enter = new Button("Go"); buttonsList.getChildren().addAll(backwards, enter); buttonsList.setSpacing(40); backwards.setAlignment(Pos.CENTER); enter.setAlignment(Pos.CENTER); buttonsList.setAlignment(Pos.CENTER); lists.setBottom(buttonsList); enter.setDisable(true); Scene list = new Scene(lists, 700,700); //Single Location Screen_________________________________________________________________________ BorderPane location = new BorderPane(); TextArea information = new TextArea(); Label titleLoc = new Label(); titleLoc.setAlignment(Pos.CENTER); Label rating = new Label("Please Rate"); VBox reviewBox = new VBox(); reviewBox.setAlignment(Pos.CENTER); Button Lstar1 = new Button(); try{Lstar1.setGraphic(new ImageView(new Image("regular_1.png")));} catch (Exception e1) { popupwindow.showAndWait();} Button Lstar2 = new Button(); reviewBox.setSpacing(20); try{Lstar2.setGraphic(new ImageView(new Image("regular_2.png")));} catch (Exception e1) { popupwindow.showAndWait();} Button Lstar3 = new Button(); try{Lstar3.setGraphic(new ImageView(new Image("regular_3.png")));} catch (Exception e1) { popupwindow.showAndWait();} Button Lstar4 = new Button(); try{Lstar4.setGraphic(new ImageView(new Image("regular_4.png")));} catch (Exception e1) { popupwindow.showAndWait();} Button Lstar5 = new Button(); try{Lstar5.setGraphic(new ImageView(new Image("regular_5.png")));} catch (Exception e1) { popupwindow.showAndWait();} Lstar1.setAlignment(Pos.CENTER); Lstar2.setAlignment(Pos.CENTER); Lstar3.setAlignment(Pos.CENTER); Lstar4.setAlignment(Pos.CENTER); Lstar5.setAlignment(Pos.CENTER); reviewBox.getChildren().addAll(Lstar1,Lstar2,Lstar3,Lstar4,Lstar5); reviewBox.setAlignment(Pos.CENTER); reviewBox.setPadding(new Insets(100)); location.setTop(titleLoc); location.setLeft(information); location.setRight(reviewBox); Button exit = new Button("exit"); VBox Button = new VBox(); Button.getChildren().add(exit); Button.setSpacing(20); Button.setAlignment(Pos.CENTER); exit.setAlignment(Pos.CENTER); location.setBottom(Button); Scene locationOne = new Scene(location,800,800); //Reviewed Scene___________________________________________________________________________________ BorderPane reviews = new BorderPane(); VBox but = new VBox(); Button star1 = new Button(); try{star1.setGraphic(new ImageView(new Image("regular_1.png")));} catch (Exception e1) { popupwindow.showAndWait();} Button star2 = new Button(); but.setSpacing(20); try{star2.setGraphic(new ImageView(new Image("regular_2.png")));} catch (Exception e1) { popupwindow.showAndWait();} Button star3 = new Button(); try{star3.setGraphic(new ImageView(new Image("regular_3.png")));} catch (Exception e1) { popupwindow.showAndWait();} Button star4 = new Button(); try{star4.setGraphic(new ImageView(new Image("regular_4.png")));} catch (Exception e1) { popupwindow.showAndWait();} Button star5 = new Button(); try{star5.setGraphic(new ImageView(new Image("regular_5.png")));} catch (Exception e1) { popupwindow.showAndWait();} Label rev = new Label("Select type of review"); but.setAlignment(Pos.CENTER); rev.setAlignment(Pos.CENTER); reviews.setTop(rev); but.getChildren().addAll(star1, star2,star3,star4,star5); reviews.setCenter(but); Button backs = new Button("Back"); backs.setAlignment(Pos.CENTER); reviews.setBottom(backs); Scene reviewScene = new Scene(reviews, 300,300); //Actions______________________________________________________________________________________ Timeline timeline = new Timeline( new KeyFrame(Duration.ZERO, new KeyValue(progress.progressProperty(), 0)), new KeyFrame(Duration.seconds(5), e-> { // do anything you need here on completion... System.out.println("loadi over"); stage.setScene(home); mediaPlayer.stop(); }, new KeyValue(progress.progressProperty(), 1)) ); timeline.setCycleCount(1); timeline.play(); //Home Actions____________________________________________________________________________________________ //LOC8R Button search.setOnAction( e-> { stage.setScene(AdressScene); lastScene = home; }); //tag ComboBox tag.setOnAction(e ->{ if(!tag.getValue().equals("Type")) search.setDisable(false); }); reviewed.setOnAction(e->{ stage.setScene(reviewScene); }); recents.setOnAction(e ->{ temp.clear(); for(Location l : data.getRecent()) temp.add(l.getName()); items =FXCollections.observableArrayList (temp); locations.setItems(items); locationData.clear(); stage.setScene(list); }); save.setOnAction(e ->{ data.save(); }); //Address Actions_________________________________________________________________ //Next Button next.setOnAction(e ->{ try { add = Address.getText(); location(Address.getText()); if(lastScene.equals(home)) { temp.clear(); TreeMap<Double ,ArrayList<Location>> sorted = new TreeMap<>(); HashMap<String, ArrayList<Location>> locData = data.getLocData(); for(int i =0; i<data.getLocData().get(tag.getValue()).size();i++){ double value = score(data.getLocData().get(tag.getValue()).get(i),dist(data.getLocData().get(tag.getValue()).get(i))); if(sorted.containsKey(value)) sorted.get(value).add((data.getLocData().get(tag.getValue()).get(i))); else { sorted.put(value, new ArrayList<Location>()); sorted.get(value).add(data.getLocData().get(tag.getValue()).get(i)); } } int i=0; for(double v: sorted.keySet()) { for(Location l : sorted.get(v)) { temp.add(l.getName()); i++; if(i==8) break; } if(i == 8) break; } } else if(lastScene.equals(reviewScene)) { temp.clear(); TreeMap<Double ,ArrayList<Location>> sorted = new TreeMap<>(); HashMap<Integer, ArrayList<Location>> reviewedList = data.getReviews(); for(Location l: reviewedList.get(tempRev)){ double value = score(l,dist(l)); if(sorted.containsKey(value)) sorted.get(value).add(l); else { sorted.put(value, new ArrayList<Location>()); sorted.get(value).add(l); } } for(double dist : sorted.keySet()) for(Location l : sorted.get(dist)) temp.add(l.getName()); } } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); popupwindow.showAndWait(); } finally{ System.out.println(temp); items =FXCollections.observableArrayList (temp); locations.setItems(items); locationData.clear(); stage.setScene(list); } }); // return Button back.setOnAction(e->{ stage.setScene(home); }); //Reviewed Scene Actions_____________________________________________________________________________________________ star1.setOnAction(e ->{ temp.clear(); for(Location l :data.getReviews().get(1)) temp.add(l.toString()); items =FXCollections.observableArrayList (temp); locations.setItems(items); stage.setScene(AdressScene); lastScene = reviewScene; tempRev =1; }); star2.setOnAction(e ->{ temp.clear(); for(Location l :data.getReviews().get(2)) temp.add(l.getName()); items =FXCollections.observableArrayList (temp); locations.setItems(items); stage.setScene(AdressScene); lastScene = reviewScene; tempRev =2; }); star3.setOnAction(e ->{ temp.clear(); for(Location l :data.getReviews().get(3)) temp.add(l.getName()); items =FXCollections.observableArrayList (temp); locations.setItems(items); stage.setScene(AdressScene); lastScene = reviewScene; tempRev =3; }); star4.setOnAction(e ->{ temp.clear(); for(Location l :data.getReviews().get(4)) temp.add(l.getName()); items =FXCollections.observableArrayList (temp); locations.setItems(items); stage.setScene(AdressScene); lastScene = reviewScene; tempRev =4; }); star5.setOnAction(e ->{ temp.clear(); for(Location l :data.getReviews().get(5)) temp.add(l.getName()); items =FXCollections.observableArrayList (temp); locations.setItems(items); stage.setScene(AdressScene); lastScene = reviewScene; tempRev =5; }); backs.setOnAction(e-> { stage.setScene(home); }); //Recent Scene Actions_______________________________________________________________________________________________ //Location List Actions _______________________________________________________________________________________________ // list commands locations.addEventHandler(MouseEvent.MOUSE_PRESSED,e ->{ int i = locations.getSelectionModel().getSelectedIndex(); if(i<0) return; for(Location l: data.getLocData().get(tag.getValue())) if(l.getName().equals(items.get(i))) { locationData.setText("Name: "+l.getName()+"\n"+"Type: "+l.getType()+"\nYour Review: "+l.getReview()+"\nLongitude: "+l.getLongitude()+"\nLatitude: "+l.getLatitude()+"\nDistance: "+dist(l)+"\nDirections: "+"https://www.google.com/maps/dir/add/"+l.getAddress()+"\n Yelp Reviews: "+"https://www.yelp.com/biz/"+l.getName().replaceAll("\\s","-")+"-austin-crossroads-austin?osq="+l.getAddress()); enter.setDisable(false); tempLocation = l; } }); locations.addEventHandler(KeyEvent.KEY_PRESSED,e ->{ if(e.getCode().equals(KeyCode.DOWN) ||e.getCode().equals(KeyCode.UP) ) { if(lastScene.equals(home)) { int s = locations.getSelectionModel().getSelectedIndex(); if(s<0) return; for(Location l: data.getLocData().get(tag.getValue())) if(l.getName().equals(items.get(s))) { locationData.setText("Name: "+l.getName()+"\n"+"Type: "+l.getType()+"\nYour Review: "+l.getReview()+"\nLongitude: "+l.getLongitude()+"\nLatitude: "+l.getLatitude()+"\nDistance: "+dist(l)+"\nDirections: "+"https://www.google.com/maps/dir/add/"+l.getAddress()+"\n Yelp Reviews: "+"https://www.yelp.com/biz/"+l.getName().replaceAll("\\s","-")+"-austin-crossroads-austin?osq="+l.getAddress()); enter.setDisable(false); tempLocation = l; } } } }); //backwards Buttons backwards.setOnAction(e->{ stage.setScene(AdressScene); }); enter.setOnAction(e->{ stage.setScene(locationOne); if(tempLocation!= null) information.setText("Name: "+tempLocation.getName()+"\n"+"Type: "+tempLocation.getType()+"\nYour Review: "+tempLocation.getReview()+"\nLongitude: "+tempLocation.getLongitude()+"\nLatitude: "+tempLocation.getLatitude()+"\nDistance: "+dist(tempLocation)+"\nDirections: "+"https://www.google.com/maps/dir/add/"+tempLocation.getAddress()+"\n Yelp Reviews: "+"https://www.yelp.com/biz/"+tempLocation.getName().replaceAll("\\s","-")+"-austin-crossroads-austin?osq="+tempLocation.getAddress()); data.getRecent().add(tempLocation); }); //Location Action Scene___________________________________________________________________________________ exit.setOnAction(e ->{ locationData.clear(); stage.setScene(list); }); Lstar1.setOnAction(e ->{ for(int j =0;j<data.getLocData().get(tempLocation.getType()).size();j++ ){ Location l = data.getLocData().get(tempLocation.getType()).get(j); if(l.equals(tempLocation)) { boolean isReviewed = true; if(l.getReview() == 0 ) isReviewed = false; if(isReviewed) { for(int i=0;i<data.getReviews().get(l.getReview()).size();i++) if(data.getReviews().get(l.getReview()).get(i).equals(tempLocation)) data.getReviews().get(l.getReview()).remove(i); } tempLocation.setReview(1); System.out.println(tempLocation); data.getReviews().get(1).add(tempLocation); data.getLocData().get(l.getType()).get(j).setReview(1); System.out.println(data.getLocData().get(l.getType()).get(j)); } } }); Lstar2.setOnAction(e ->{ for(int j =0;j<data.getLocData().get(tempLocation.getType()).size();j++ ){ Location l = data.getLocData().get(tempLocation.getType()).get(j); if(l.equals(tempLocation)) { boolean isReviewed = true; if(l.getReview() == 0 ) isReviewed = false; if(isReviewed) { for(int i=0;i<data.getReviews().get(l.getReview()).size();i++) if(data.getReviews().get(l.getReview()).get(i).equals(tempLocation)) data.getReviews().get(l.getReview()).remove(i); } tempLocation.setReview(2); data.getReviews().get(2).add(tempLocation); data.getLocData().get(l.getType()).get(j).setReview(2); } } }); Lstar3.setOnAction(e ->{ for(int j =0;j<data.getLocData().get(tempLocation.getType()).size();j++ ){ Location l = data.getLocData().get(tempLocation.getType()).get(j); if(l.equals(tempLocation)) { boolean isReviewed = true; if(l.getReview() == 0 ) isReviewed = false; if(isReviewed) { for(int i=0;i<data.getReviews().get(l.getReview()).size();i++) if(data.getReviews().get(l.getReview()).get(i).equals(tempLocation)) data.getReviews().get(l.getReview()).remove(i); } tempLocation.setReview(3); data.getReviews().get(3).add(tempLocation); data.getLocData().get(l.getType()).get(j).setReview(3); } } }); Lstar4.setOnAction(e ->{ for(int j =0;j<data.getLocData().get(tempLocation.getType()).size();j++ ){ Location l = data.getLocData().get(tempLocation.getType()).get(j); if(l.equals(tempLocation)) { boolean isReviewed = true; if(l.getReview() == 0 ) isReviewed = false; if(isReviewed) { for(int i=0;i<data.getReviews().get(l.getReview()).size();i++) if(data.getReviews().get(l.getReview()).get(i).equals(tempLocation)) data.getReviews().get(l.getReview()).remove(i); } tempLocation.setReview(4); data.getReviews().get(4).add(tempLocation); data.getLocData().get(l.getType()).get(j).setReview(4); } } }); Lstar5.setOnAction(e ->{ for(int j =0;j<data.getLocData().get(tempLocation.getType()).size();j++ ){ Location l = data.getLocData().get(tempLocation.getType()).get(j); if(l.equals(tempLocation)) { boolean isReviewed = true; if(l.getReview() == 0 ) isReviewed = false; if(isReviewed) { for(int i=0;i<data.getReviews().get(l.getReview()).size();i++) if(data.getReviews().get(l.getReview()).get(i).equals(tempLocation)) data.getReviews().get(l.getReview()).remove(i); } tempLocation.setReview(5); data.getReviews().get(5).add(tempLocation); data.getLocData().get(l.getType()).get(j).setReview(5); } } }); } public static double dist( Location l ) { return Math.sqrt(Math.pow(lat-l.getLatitude(), 2)+Math.pow(longi-l.getLongitude(), 2)); } public static double score(Location l, double dist) { if(l.getReview() ==0) return 1+dist; if(l.getReview() <=3) return 1+dist*l.getReview(); return 1+dist*1/Math.sqrt(l.getReview()); } public static void location(String add) throws Exception { //add = "11608 spicewood pkwy"; String address = add.replaceAll("\\s", "%"); URL url = new URL("http://www.mapquestapi.com/geocoding/v1/address?key=AAAUwZvzc7sPNu0bKvipXlFG8p6g4adI&location=" +address); BufferedReader br = null; try { br = new BufferedReader(new InputStreamReader(url.openStream())); String line; StringBuilder sb = new StringBuilder(); while ((line = br.readLine()) != null) { sb.append(line); } // System.out.println(sb.toString()); JSONObject obj = new JSONObject(sb.toString()); JSONArray res = obj.getJSONArray("results"); //System.out.println(res.toString()); JSONArray loc = res.getJSONObject(0).getJSONArray("locations"); //System.out.println(loc.toString()); JSONObject latLng = loc.getJSONObject(0); //System.out.println(latLng.toString()); lat = latLng.getJSONObject("latLng").getDouble("lat"); longi = latLng.getJSONObject("latLng").getDouble("lng"); System.out.println("latitude: "+ lat); System.out.println("Longitude: "+longi); } finally { if (br != null) { br.close(); } } } }
UTF-8
Java
26,633
java
FrontEnd.java
Java
[ { "context": "tp://www.mapquestapi.com/geocoding/v1/address?key=AAAUwZvzc7sPNu0bKvipXlFG8p6g4adI&location=\" +address);\t\t\r\n BufferedReader b", "end": 25477, "score": 0.9993982911109924, "start": 25445, "tag": "KEY", "value": "AAAUwZvzc7sPNu0bKvipXlFG8p6g4adI" } ]
null
[]
import java.io.BufferedReader; import java.io.File; import java.io.InputStreamReader; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.Set; import java.util.TreeMap; import org.json.JSONArray; import org.json.JSONObject; import javafx.animation.KeyFrame; import javafx.animation.KeyValue; import javafx.animation.Timeline; import javafx.application.Application; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; import javafx.scene.control.Label; import javafx.scene.control.ListView; import javafx.scene.control.Menu; import javafx.scene.control.MenuBar; import javafx.scene.control.MenuItem; import javafx.scene.control.ProgressBar; import javafx.scene.control.TextArea; import javafx.scene.control.TextField; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.KeyCode; import javafx.scene.input.KeyEvent; import javafx.scene.input.MouseEvent; import javafx.scene.layout.Background; import javafx.scene.layout.BackgroundImage; import javafx.scene.layout.BackgroundPosition; import javafx.scene.layout.BackgroundRepeat; import javafx.scene.layout.BackgroundSize; import javafx.scene.layout.BorderPane; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.scene.media.Media; import javafx.scene.media.MediaPlayer; import javafx.stage.Modality; import javafx.stage.Stage; import javafx.util.Duration; public class FrontEnd extends Application { ObservableList<String> items = FXCollections.observableArrayList (); ArrayList<String> temp = new ArrayList<>(); static double lat; static double longi; static String add; static int tempRev; static DataBase data = null; Scene lastScene; Location tempLocation; public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) throws Exception { //Error Scene_________________________________________________________________________________ Stage popupwindow=new Stage(); popupwindow.initModality(Modality.APPLICATION_MODAL); popupwindow.setTitle("Error pop up window"); Label label1= new Label("An error was detected"); Button button1= new Button("Close Application"); button1.setOnAction(e ->{ popupwindow.close(); stage.close(); }); VBox layout= new VBox(10); layout.getChildren().addAll(label1, button1); layout.setAlignment(Pos.CENTER); Scene scene1= new Scene(layout, 300, 250); popupwindow.setScene(scene1); popupwindow.hide(); //Loading Screen_________________________________________________________________________ try{data = new DataBase();} catch (Exception e1) { popupwindow.showAndWait();} stage.setTitle("Loading"); BorderPane loadingBar = new BorderPane(); ProgressBar progress = new ProgressBar(); VBox bar = new VBox(); bar.getChildren().addAll(progress); loadingBar.setBottom(bar); bar.setPadding(new Insets(30)); bar.setAlignment(Pos.CENTER); Scene loadingScreen = new Scene(loadingBar,906,515); stage.setScene(loadingScreen); String bip = "music.mp3"; Media hit = new Media(new File(bip).toURI().toString()); MediaPlayer mediaPlayer = new MediaPlayer(hit); mediaPlayer.play(); Image image = null; try {image = new Image("loading.png");} catch (Exception e1) { popupwindow.showAndWait();} //Image image = new Image("loading.png"); // new BackgroundSize(width, height, widthAsPercentage, heightAsPercentage, contain, cover) BackgroundSize backgroundSize = new BackgroundSize(906, 515, true, true, true, false); // new BackgroundImage(image, repeatX, repeatY, position, size) BackgroundImage backgroundImage = new BackgroundImage(image, BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER, backgroundSize); // new Background(images...) Background background = new Background(backgroundImage); loadingBar.setBackground(background); stage.setResizable(true); stage.show(); //HomePage_____________________________________________________________________________________ BorderPane homeScreen = new BorderPane(); MenuBar menu = new MenuBar(); Menu file = new Menu("File"); MenuItem save = new MenuItem("save"); file.getItems().add(save); menu.getMenus().add(file); homeScreen.setTop(menu); Image logo = null; try{logo= new Image("Loc8r_black.png");} catch (Exception e1) { popupwindow.showAndWait();} ImageView logoView = new ImageView(); logoView.setImage(logo); VBox logoMenu = new VBox(); logoMenu.setAlignment(Pos.CENTER); logoMenu.getChildren().addAll(menu,logoView); homeScreen.setTop(logoMenu); GridPane homeGrid = new GridPane(); ComboBox tag = new ComboBox(); tag.getItems().add("Type"); HashMap<String, ArrayList<Location>> loc = data.getLocData(); Set<String> keys = data.getLocData().keySet(); for(String s: keys) { tag.getItems().add(s); } Button search = new Button("LOC8"); search.setDisable(true); search.setAlignment(Pos.CENTER); Button reviewed = new Button("Reviewed"); reviewed.setAlignment(Pos.CENTER); Button recents = new Button("Recents"); recents.setAlignment(Pos.CENTER); homeGrid.add(tag, 0, 0); homeGrid.add(search, 1,0); homeGrid.add(reviewed, 1,1); homeGrid.add(recents, 1,2); homeGrid.setHgap(20); homeGrid.setVgap(20); homeGrid.setAlignment(Pos.CENTER); homeScreen.setCenter(homeGrid); Scene home = new Scene(homeScreen, 600,600 ); //stage.setScene(home); //Address Scene___________________________________________________________________________________ BorderPane address = new BorderPane(); VBox menuLogo2 = new VBox(); ImageView logoView2 = new ImageView(); logoView2.setImage(logo); logoView2.setTranslateX(135); address.setTop(logoView2); GridPane info = new GridPane(); TextField Address = new TextField("Enter Address Here"); Label label = new Label("Address: "); info.add(Address, 1, 0); info.add(label, 0, 0); info.setVgap(10); info.setAlignment(Pos.CENTER); address.setCenter(info); HBox buttons = new HBox(); Button next = new Button("Enter"); next.setPadding(new Insets(20)); Button back = new Button("Return"); back.setPadding(new Insets(20)); buttons.getChildren().addAll(back, next); buttons.setAlignment(Pos.CENTER); address.setBottom(buttons); Scene AdressScene = new Scene(address, 600,600); //List Scene for Locations________________________________________________________________________ BorderPane lists = new BorderPane(); ListView<String> locations = new ListView<String>(); locations.setItems(items); lists.setLeft(locations); TextArea locationData = new TextArea(); locationData.setEditable(false); lists.setRight(locationData); HBox buttonsList = new HBox(); Button backwards = new Button("Back"); Button enter = new Button("Go"); buttonsList.getChildren().addAll(backwards, enter); buttonsList.setSpacing(40); backwards.setAlignment(Pos.CENTER); enter.setAlignment(Pos.CENTER); buttonsList.setAlignment(Pos.CENTER); lists.setBottom(buttonsList); enter.setDisable(true); Scene list = new Scene(lists, 700,700); //Single Location Screen_________________________________________________________________________ BorderPane location = new BorderPane(); TextArea information = new TextArea(); Label titleLoc = new Label(); titleLoc.setAlignment(Pos.CENTER); Label rating = new Label("Please Rate"); VBox reviewBox = new VBox(); reviewBox.setAlignment(Pos.CENTER); Button Lstar1 = new Button(); try{Lstar1.setGraphic(new ImageView(new Image("regular_1.png")));} catch (Exception e1) { popupwindow.showAndWait();} Button Lstar2 = new Button(); reviewBox.setSpacing(20); try{Lstar2.setGraphic(new ImageView(new Image("regular_2.png")));} catch (Exception e1) { popupwindow.showAndWait();} Button Lstar3 = new Button(); try{Lstar3.setGraphic(new ImageView(new Image("regular_3.png")));} catch (Exception e1) { popupwindow.showAndWait();} Button Lstar4 = new Button(); try{Lstar4.setGraphic(new ImageView(new Image("regular_4.png")));} catch (Exception e1) { popupwindow.showAndWait();} Button Lstar5 = new Button(); try{Lstar5.setGraphic(new ImageView(new Image("regular_5.png")));} catch (Exception e1) { popupwindow.showAndWait();} Lstar1.setAlignment(Pos.CENTER); Lstar2.setAlignment(Pos.CENTER); Lstar3.setAlignment(Pos.CENTER); Lstar4.setAlignment(Pos.CENTER); Lstar5.setAlignment(Pos.CENTER); reviewBox.getChildren().addAll(Lstar1,Lstar2,Lstar3,Lstar4,Lstar5); reviewBox.setAlignment(Pos.CENTER); reviewBox.setPadding(new Insets(100)); location.setTop(titleLoc); location.setLeft(information); location.setRight(reviewBox); Button exit = new Button("exit"); VBox Button = new VBox(); Button.getChildren().add(exit); Button.setSpacing(20); Button.setAlignment(Pos.CENTER); exit.setAlignment(Pos.CENTER); location.setBottom(Button); Scene locationOne = new Scene(location,800,800); //Reviewed Scene___________________________________________________________________________________ BorderPane reviews = new BorderPane(); VBox but = new VBox(); Button star1 = new Button(); try{star1.setGraphic(new ImageView(new Image("regular_1.png")));} catch (Exception e1) { popupwindow.showAndWait();} Button star2 = new Button(); but.setSpacing(20); try{star2.setGraphic(new ImageView(new Image("regular_2.png")));} catch (Exception e1) { popupwindow.showAndWait();} Button star3 = new Button(); try{star3.setGraphic(new ImageView(new Image("regular_3.png")));} catch (Exception e1) { popupwindow.showAndWait();} Button star4 = new Button(); try{star4.setGraphic(new ImageView(new Image("regular_4.png")));} catch (Exception e1) { popupwindow.showAndWait();} Button star5 = new Button(); try{star5.setGraphic(new ImageView(new Image("regular_5.png")));} catch (Exception e1) { popupwindow.showAndWait();} Label rev = new Label("Select type of review"); but.setAlignment(Pos.CENTER); rev.setAlignment(Pos.CENTER); reviews.setTop(rev); but.getChildren().addAll(star1, star2,star3,star4,star5); reviews.setCenter(but); Button backs = new Button("Back"); backs.setAlignment(Pos.CENTER); reviews.setBottom(backs); Scene reviewScene = new Scene(reviews, 300,300); //Actions______________________________________________________________________________________ Timeline timeline = new Timeline( new KeyFrame(Duration.ZERO, new KeyValue(progress.progressProperty(), 0)), new KeyFrame(Duration.seconds(5), e-> { // do anything you need here on completion... System.out.println("loadi over"); stage.setScene(home); mediaPlayer.stop(); }, new KeyValue(progress.progressProperty(), 1)) ); timeline.setCycleCount(1); timeline.play(); //Home Actions____________________________________________________________________________________________ //LOC8R Button search.setOnAction( e-> { stage.setScene(AdressScene); lastScene = home; }); //tag ComboBox tag.setOnAction(e ->{ if(!tag.getValue().equals("Type")) search.setDisable(false); }); reviewed.setOnAction(e->{ stage.setScene(reviewScene); }); recents.setOnAction(e ->{ temp.clear(); for(Location l : data.getRecent()) temp.add(l.getName()); items =FXCollections.observableArrayList (temp); locations.setItems(items); locationData.clear(); stage.setScene(list); }); save.setOnAction(e ->{ data.save(); }); //Address Actions_________________________________________________________________ //Next Button next.setOnAction(e ->{ try { add = Address.getText(); location(Address.getText()); if(lastScene.equals(home)) { temp.clear(); TreeMap<Double ,ArrayList<Location>> sorted = new TreeMap<>(); HashMap<String, ArrayList<Location>> locData = data.getLocData(); for(int i =0; i<data.getLocData().get(tag.getValue()).size();i++){ double value = score(data.getLocData().get(tag.getValue()).get(i),dist(data.getLocData().get(tag.getValue()).get(i))); if(sorted.containsKey(value)) sorted.get(value).add((data.getLocData().get(tag.getValue()).get(i))); else { sorted.put(value, new ArrayList<Location>()); sorted.get(value).add(data.getLocData().get(tag.getValue()).get(i)); } } int i=0; for(double v: sorted.keySet()) { for(Location l : sorted.get(v)) { temp.add(l.getName()); i++; if(i==8) break; } if(i == 8) break; } } else if(lastScene.equals(reviewScene)) { temp.clear(); TreeMap<Double ,ArrayList<Location>> sorted = new TreeMap<>(); HashMap<Integer, ArrayList<Location>> reviewedList = data.getReviews(); for(Location l: reviewedList.get(tempRev)){ double value = score(l,dist(l)); if(sorted.containsKey(value)) sorted.get(value).add(l); else { sorted.put(value, new ArrayList<Location>()); sorted.get(value).add(l); } } for(double dist : sorted.keySet()) for(Location l : sorted.get(dist)) temp.add(l.getName()); } } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); popupwindow.showAndWait(); } finally{ System.out.println(temp); items =FXCollections.observableArrayList (temp); locations.setItems(items); locationData.clear(); stage.setScene(list); } }); // return Button back.setOnAction(e->{ stage.setScene(home); }); //Reviewed Scene Actions_____________________________________________________________________________________________ star1.setOnAction(e ->{ temp.clear(); for(Location l :data.getReviews().get(1)) temp.add(l.toString()); items =FXCollections.observableArrayList (temp); locations.setItems(items); stage.setScene(AdressScene); lastScene = reviewScene; tempRev =1; }); star2.setOnAction(e ->{ temp.clear(); for(Location l :data.getReviews().get(2)) temp.add(l.getName()); items =FXCollections.observableArrayList (temp); locations.setItems(items); stage.setScene(AdressScene); lastScene = reviewScene; tempRev =2; }); star3.setOnAction(e ->{ temp.clear(); for(Location l :data.getReviews().get(3)) temp.add(l.getName()); items =FXCollections.observableArrayList (temp); locations.setItems(items); stage.setScene(AdressScene); lastScene = reviewScene; tempRev =3; }); star4.setOnAction(e ->{ temp.clear(); for(Location l :data.getReviews().get(4)) temp.add(l.getName()); items =FXCollections.observableArrayList (temp); locations.setItems(items); stage.setScene(AdressScene); lastScene = reviewScene; tempRev =4; }); star5.setOnAction(e ->{ temp.clear(); for(Location l :data.getReviews().get(5)) temp.add(l.getName()); items =FXCollections.observableArrayList (temp); locations.setItems(items); stage.setScene(AdressScene); lastScene = reviewScene; tempRev =5; }); backs.setOnAction(e-> { stage.setScene(home); }); //Recent Scene Actions_______________________________________________________________________________________________ //Location List Actions _______________________________________________________________________________________________ // list commands locations.addEventHandler(MouseEvent.MOUSE_PRESSED,e ->{ int i = locations.getSelectionModel().getSelectedIndex(); if(i<0) return; for(Location l: data.getLocData().get(tag.getValue())) if(l.getName().equals(items.get(i))) { locationData.setText("Name: "+l.getName()+"\n"+"Type: "+l.getType()+"\nYour Review: "+l.getReview()+"\nLongitude: "+l.getLongitude()+"\nLatitude: "+l.getLatitude()+"\nDistance: "+dist(l)+"\nDirections: "+"https://www.google.com/maps/dir/add/"+l.getAddress()+"\n Yelp Reviews: "+"https://www.yelp.com/biz/"+l.getName().replaceAll("\\s","-")+"-austin-crossroads-austin?osq="+l.getAddress()); enter.setDisable(false); tempLocation = l; } }); locations.addEventHandler(KeyEvent.KEY_PRESSED,e ->{ if(e.getCode().equals(KeyCode.DOWN) ||e.getCode().equals(KeyCode.UP) ) { if(lastScene.equals(home)) { int s = locations.getSelectionModel().getSelectedIndex(); if(s<0) return; for(Location l: data.getLocData().get(tag.getValue())) if(l.getName().equals(items.get(s))) { locationData.setText("Name: "+l.getName()+"\n"+"Type: "+l.getType()+"\nYour Review: "+l.getReview()+"\nLongitude: "+l.getLongitude()+"\nLatitude: "+l.getLatitude()+"\nDistance: "+dist(l)+"\nDirections: "+"https://www.google.com/maps/dir/add/"+l.getAddress()+"\n Yelp Reviews: "+"https://www.yelp.com/biz/"+l.getName().replaceAll("\\s","-")+"-austin-crossroads-austin?osq="+l.getAddress()); enter.setDisable(false); tempLocation = l; } } } }); //backwards Buttons backwards.setOnAction(e->{ stage.setScene(AdressScene); }); enter.setOnAction(e->{ stage.setScene(locationOne); if(tempLocation!= null) information.setText("Name: "+tempLocation.getName()+"\n"+"Type: "+tempLocation.getType()+"\nYour Review: "+tempLocation.getReview()+"\nLongitude: "+tempLocation.getLongitude()+"\nLatitude: "+tempLocation.getLatitude()+"\nDistance: "+dist(tempLocation)+"\nDirections: "+"https://www.google.com/maps/dir/add/"+tempLocation.getAddress()+"\n Yelp Reviews: "+"https://www.yelp.com/biz/"+tempLocation.getName().replaceAll("\\s","-")+"-austin-crossroads-austin?osq="+tempLocation.getAddress()); data.getRecent().add(tempLocation); }); //Location Action Scene___________________________________________________________________________________ exit.setOnAction(e ->{ locationData.clear(); stage.setScene(list); }); Lstar1.setOnAction(e ->{ for(int j =0;j<data.getLocData().get(tempLocation.getType()).size();j++ ){ Location l = data.getLocData().get(tempLocation.getType()).get(j); if(l.equals(tempLocation)) { boolean isReviewed = true; if(l.getReview() == 0 ) isReviewed = false; if(isReviewed) { for(int i=0;i<data.getReviews().get(l.getReview()).size();i++) if(data.getReviews().get(l.getReview()).get(i).equals(tempLocation)) data.getReviews().get(l.getReview()).remove(i); } tempLocation.setReview(1); System.out.println(tempLocation); data.getReviews().get(1).add(tempLocation); data.getLocData().get(l.getType()).get(j).setReview(1); System.out.println(data.getLocData().get(l.getType()).get(j)); } } }); Lstar2.setOnAction(e ->{ for(int j =0;j<data.getLocData().get(tempLocation.getType()).size();j++ ){ Location l = data.getLocData().get(tempLocation.getType()).get(j); if(l.equals(tempLocation)) { boolean isReviewed = true; if(l.getReview() == 0 ) isReviewed = false; if(isReviewed) { for(int i=0;i<data.getReviews().get(l.getReview()).size();i++) if(data.getReviews().get(l.getReview()).get(i).equals(tempLocation)) data.getReviews().get(l.getReview()).remove(i); } tempLocation.setReview(2); data.getReviews().get(2).add(tempLocation); data.getLocData().get(l.getType()).get(j).setReview(2); } } }); Lstar3.setOnAction(e ->{ for(int j =0;j<data.getLocData().get(tempLocation.getType()).size();j++ ){ Location l = data.getLocData().get(tempLocation.getType()).get(j); if(l.equals(tempLocation)) { boolean isReviewed = true; if(l.getReview() == 0 ) isReviewed = false; if(isReviewed) { for(int i=0;i<data.getReviews().get(l.getReview()).size();i++) if(data.getReviews().get(l.getReview()).get(i).equals(tempLocation)) data.getReviews().get(l.getReview()).remove(i); } tempLocation.setReview(3); data.getReviews().get(3).add(tempLocation); data.getLocData().get(l.getType()).get(j).setReview(3); } } }); Lstar4.setOnAction(e ->{ for(int j =0;j<data.getLocData().get(tempLocation.getType()).size();j++ ){ Location l = data.getLocData().get(tempLocation.getType()).get(j); if(l.equals(tempLocation)) { boolean isReviewed = true; if(l.getReview() == 0 ) isReviewed = false; if(isReviewed) { for(int i=0;i<data.getReviews().get(l.getReview()).size();i++) if(data.getReviews().get(l.getReview()).get(i).equals(tempLocation)) data.getReviews().get(l.getReview()).remove(i); } tempLocation.setReview(4); data.getReviews().get(4).add(tempLocation); data.getLocData().get(l.getType()).get(j).setReview(4); } } }); Lstar5.setOnAction(e ->{ for(int j =0;j<data.getLocData().get(tempLocation.getType()).size();j++ ){ Location l = data.getLocData().get(tempLocation.getType()).get(j); if(l.equals(tempLocation)) { boolean isReviewed = true; if(l.getReview() == 0 ) isReviewed = false; if(isReviewed) { for(int i=0;i<data.getReviews().get(l.getReview()).size();i++) if(data.getReviews().get(l.getReview()).get(i).equals(tempLocation)) data.getReviews().get(l.getReview()).remove(i); } tempLocation.setReview(5); data.getReviews().get(5).add(tempLocation); data.getLocData().get(l.getType()).get(j).setReview(5); } } }); } public static double dist( Location l ) { return Math.sqrt(Math.pow(lat-l.getLatitude(), 2)+Math.pow(longi-l.getLongitude(), 2)); } public static double score(Location l, double dist) { if(l.getReview() ==0) return 1+dist; if(l.getReview() <=3) return 1+dist*l.getReview(); return 1+dist*1/Math.sqrt(l.getReview()); } public static void location(String add) throws Exception { //add = "11608 spicewood pkwy"; String address = add.replaceAll("\\s", "%"); URL url = new URL("http://www.mapquestapi.com/geocoding/v1/address?key=<KEY>&location=" +address); BufferedReader br = null; try { br = new BufferedReader(new InputStreamReader(url.openStream())); String line; StringBuilder sb = new StringBuilder(); while ((line = br.readLine()) != null) { sb.append(line); } // System.out.println(sb.toString()); JSONObject obj = new JSONObject(sb.toString()); JSONArray res = obj.getJSONArray("results"); //System.out.println(res.toString()); JSONArray loc = res.getJSONObject(0).getJSONArray("locations"); //System.out.println(loc.toString()); JSONObject latLng = loc.getJSONObject(0); //System.out.println(latLng.toString()); lat = latLng.getJSONObject("latLng").getDouble("lat"); longi = latLng.getJSONObject("latLng").getDouble("lng"); System.out.println("latitude: "+ lat); System.out.println("Longitude: "+longi); } finally { if (br != null) { br.close(); } } } }
26,606
0.561897
0.552698
669
37.810165
35.178318
497
false
false
0
0
0
0
0
0
3.019432
false
false
12
24ca1a11184ea0ea2746c83b9618e250f77d8114
38,972,533,264,538
e6938bace44c634aef26b5a4f21c13ff22ea794c
/springmvc-len5/src/main/java/com/atguigu/springmvc/crud/handlers/EmployeeHandler.java
35e6b861ab0eb98b2a487425bebf28748ec5629c
[]
no_license
youhuanhuan/springmvc-demo
https://github.com/youhuanhuan/springmvc-demo
1177ed69b1327a09c46751b5b60e4322a5974493
ead8eb6f4efa8f8f8b574a2dfcdd8be9987fe6fc
refs/heads/master
2020-03-27T18:12:48.856000
2019-09-25T13:06:28
2019-09-25T13:06:28
146,906,035
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.atguigu.springmvc.crud.handlers; import com.atguigu.springmvc.crud.dao.DepartmentDao; import com.atguigu.springmvc.crud.dao.EmployeeDao; import com.atguigu.springmvc.crud.entities.Employee; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.validation.Errors; import org.springframework.validation.FieldError; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import javax.validation.Valid; import java.util.HashMap; import java.util.Map; @Controller public class EmployeeHandler { @Autowired private EmployeeDao employeeDao; @Autowired private DepartmentDao departmentDao; //****************@InitBinder注解*********************// //@InitBinder标识的方法,可以对 WebDataBinder对象进行初始化 // @InitBinder // public void initBinder(WebDataBinder binder){ // //数据绑定是忽略lastName属性 // binder.setDisallowedFields("lastName"); // } /** * 1 查找所有员工 */ @RequestMapping("/emps") public String list(Map<String, Object> map){ map.put("employees", employeeDao.getAll()); return "list"; } /** * 2-1 进入添加员工信息页面input.jsp 必须经过此hander */ @RequestMapping(value="/emp", method=RequestMethod.GET) public String input(Map<String, Object> map){ Map<String, String> genders = new HashMap<>(); genders.put("1", "Male"); genders.put("0", "Female"); map.put("genders", genders); //对应input.jsp form表单的Department map.put("departments", departmentDao.getDepartments()); //对应input.jsp form表单的modelAttribute属性,用户回显 map.put("employee", new Employee()); return "input"; } /** * 2-2 保存员工方法 * * 需校验的 Bean(Employee)对象和其绑定结果对象(Errors)或错误对象时成对出现的,它们之间不允许声明其他的入参 */ @RequestMapping(value="/emp", method=RequestMethod.POST) public String save(@Valid Employee employee, Errors result, Map<String, Object> map){ System.out.println("save: " + employee); if(result.getErrorCount() > 0){ for(FieldError error:result.getFieldErrors()){ System.out.println(error.getField() + ":" + error.getDefaultMessage()); } Map<String, String> genders = new HashMap<>(); genders.put("1", "Male"); genders.put("0", "Female"); map.put("genders", genders); map.put("departments", departmentDao.getDepartments()); return "input"; //若验证出错, 则转向定制的页面 } employeeDao.save(employee); //重定向到首页面 return "redirect:/emps"; } /** * 3 删除员工 */ @RequestMapping(value="/emp/{id}", method=RequestMethod.DELETE) public String delete(@PathVariable("id") Integer id){ employeeDao.delete(id); return "redirect:/emps"; } }
UTF-8
Java
3,221
java
EmployeeHandler.java
Java
[]
null
[]
package com.atguigu.springmvc.crud.handlers; import com.atguigu.springmvc.crud.dao.DepartmentDao; import com.atguigu.springmvc.crud.dao.EmployeeDao; import com.atguigu.springmvc.crud.entities.Employee; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.validation.Errors; import org.springframework.validation.FieldError; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import javax.validation.Valid; import java.util.HashMap; import java.util.Map; @Controller public class EmployeeHandler { @Autowired private EmployeeDao employeeDao; @Autowired private DepartmentDao departmentDao; //****************@InitBinder注解*********************// //@InitBinder标识的方法,可以对 WebDataBinder对象进行初始化 // @InitBinder // public void initBinder(WebDataBinder binder){ // //数据绑定是忽略lastName属性 // binder.setDisallowedFields("lastName"); // } /** * 1 查找所有员工 */ @RequestMapping("/emps") public String list(Map<String, Object> map){ map.put("employees", employeeDao.getAll()); return "list"; } /** * 2-1 进入添加员工信息页面input.jsp 必须经过此hander */ @RequestMapping(value="/emp", method=RequestMethod.GET) public String input(Map<String, Object> map){ Map<String, String> genders = new HashMap<>(); genders.put("1", "Male"); genders.put("0", "Female"); map.put("genders", genders); //对应input.jsp form表单的Department map.put("departments", departmentDao.getDepartments()); //对应input.jsp form表单的modelAttribute属性,用户回显 map.put("employee", new Employee()); return "input"; } /** * 2-2 保存员工方法 * * 需校验的 Bean(Employee)对象和其绑定结果对象(Errors)或错误对象时成对出现的,它们之间不允许声明其他的入参 */ @RequestMapping(value="/emp", method=RequestMethod.POST) public String save(@Valid Employee employee, Errors result, Map<String, Object> map){ System.out.println("save: " + employee); if(result.getErrorCount() > 0){ for(FieldError error:result.getFieldErrors()){ System.out.println(error.getField() + ":" + error.getDefaultMessage()); } Map<String, String> genders = new HashMap<>(); genders.put("1", "Male"); genders.put("0", "Female"); map.put("genders", genders); map.put("departments", departmentDao.getDepartments()); return "input"; //若验证出错, 则转向定制的页面 } employeeDao.save(employee); //重定向到首页面 return "redirect:/emps"; } /** * 3 删除员工 */ @RequestMapping(value="/emp/{id}", method=RequestMethod.DELETE) public String delete(@PathVariable("id") Integer id){ employeeDao.delete(id); return "redirect:/emps"; } }
3,221
0.653807
0.650085
100
28.549999
23.572601
89
false
false
0
0
0
0
0
0
0.79
false
false
12
4866e5c06057e4469fdae518c21c5fbd66356c21
37,271,726,233,537
7fc3d3999300580755e20dd5c68ae124a629827e
/src/jdk7notes/chapter6/Guess.java
0c6921dfe3a5e0314456c2514b3d6bfd2f92541a
[]
no_license
asmca/JavaPractice
https://github.com/asmca/JavaPractice
99dca6a66dd2dd1c3e1bd9390e75e5df10dfa427
92f1667522c375bb359dba89d001f03f14bceb9c
refs/heads/master
2021-01-18T20:30:03.015000
2015-06-27T07:19:09
2015-06-27T07:19:09
27,024,100
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package jdk7notes.chapter6; import java.util.Scanner; /** * Created by suse on 11/25/14. */ public class Guess { public static void main(String[] args){ Scanner scanner=new Scanner(System.in); int number=(int)(Math.random()*10); int guess; do { System.out.print("请输入数字: "); guess=scanner.nextInt(); }while (guess!=number); System.out.println(" 猜中了! "); } }
UTF-8
Java
461
java
Guess.java
Java
[ { "context": "er6;\n\nimport java.util.Scanner;\n\n/**\n * Created by suse on 11/25/14.\n */\npublic class Guess {\n public ", "end": 79, "score": 0.9996060132980347, "start": 75, "tag": "USERNAME", "value": "suse" } ]
null
[]
package jdk7notes.chapter6; import java.util.Scanner; /** * Created by suse on 11/25/14. */ public class Guess { public static void main(String[] args){ Scanner scanner=new Scanner(System.in); int number=(int)(Math.random()*10); int guess; do { System.out.print("请输入数字: "); guess=scanner.nextInt(); }while (guess!=number); System.out.println(" 猜中了! "); } }
461
0.566591
0.544018
20
21.1
16.516356
47
false
false
0
0
0
0
0
0
0.45
false
false
12
256bbf20b83641ff75c7c33af31e3f4fd2524f7a
30,425,548,335,519
ae4dadd05ee272c76a15c4daedb4533d47bcf467
/src/main/java/net/pekkit/feathereconomy/vault/VaultImport.java
27cf7bacdad5733b3408708a9cf2e08125de25fa
[ "MIT" ]
permissive
Squawkers13/FeatherEconomy
https://github.com/Squawkers13/FeatherEconomy
ee6f56e3a184f38c020bb072a12efabe83fd2818
659c0dbef7a0d9e7c4bd3b483e98d9df55f5d755
refs/heads/master
2021-01-16T23:09:23.774000
2015-01-04T20:50:13
2015-01-04T20:50:13
22,790,965
0
3
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * The MIT License (MIT) * * Copyright (C) 2014 Squawkers13 <Squawkers13@pekkit.net> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package net.pekkit.feathereconomy.vault; import java.util.ArrayList; import java.util.Collection; import java.util.List; import net.milkbowl.vault.economy.Economy; import net.pekkit.feathereconomy.FeatherEconomy; import org.bukkit.OfflinePlayer; import org.bukkit.plugin.RegisteredServiceProvider; public class VaultImport { private final List<Economy> economies; private FeatherEconomy plugin; public VaultImport(FeatherEconomy pl) { this.economies = new ArrayList(); FeatherEconomy plugin = pl; Collection<RegisteredServiceProvider<Economy>> providers = plugin.getServer().getServicesManager().getRegistrations(Economy.class); if (providers == null) { return; } for (RegisteredServiceProvider<Economy> econProvider : providers) { Economy provider = econProvider.getProvider(); if (!(provider instanceof Economy_FeatherEcon)) { this.economies.add(provider); } } } public void doImport(String pluginName) { if (this.economies.size() <= 0) { plugin.getLogger().warning("No plugins to import!"); return; } for (Economy economy : this.economies) { if (economy.getName().equalsIgnoreCase(pluginName)) { doImport(economy); return; } } if (this.economies.size() <= 0) { plugin.getLogger().warning("Cannot find plugin '" + pluginName + "' to import."); } } public void doImport() { if (this.economies.size() <= 0) { plugin.getLogger().warning("No plugins to import!"); return; } for (Economy economy : this.economies) { doImport(economy); } } public boolean canImport(String pluginName) { for (Economy economy : this.economies) { if (economy.getName().equalsIgnoreCase(pluginName)) { return true; } } return false; } public void doImport(final Economy economy) { if (economy != null) { plugin.getServer().getScheduler().runTask(plugin, new Runnable() { public void run() { plugin.getLogger().info("[Plugin: " + economy.getName() + "] Iterating over all offline players..."); OfflinePlayer[] players = plugin.getServer().getOfflinePlayers(); int lastPercent = -1; for (int i = 0; i < players.length; i++) { int balance = (int) economy.getBalance(players[i]); plugin.getAPI().setBalance(players[i].getUniqueId(), balance); int percent = (int) (i / players.length * 100.0D); if ((percent % 10 == 0) && (percent != lastPercent)) { plugin.getLogger().info("[Plugin: " + economy.getName() + "]" + i + "/" + players.length + " imported. (" + percent + "%)"); lastPercent = percent; } } plugin.getLogger().info("[Plugin: " + economy.getName() + "] Import complete!"); } }); } } }
UTF-8
Java
4,562
java
VaultImport.java
Java
[ { "context": "* The MIT License (MIT)\r\n *\r\n * Copyright (C) 2014 Squawkers13 <Squawkers13@pekkit.net>\r\n *\r\n * Permission is he", "end": 67, "score": 0.9995636940002441, "start": 56, "tag": "USERNAME", "value": "Squawkers13" }, { "context": "nse (MIT)\r\n *\r\n * Copyright (C) 2014 Squawkers13 <Squawkers13@pekkit.net>\r\n *\r\n * Permission is hereby granted, free of ch", "end": 91, "score": 0.9999291896820068, "start": 69, "tag": "EMAIL", "value": "Squawkers13@pekkit.net" } ]
null
[]
/* * The MIT License (MIT) * * Copyright (C) 2014 Squawkers13 <<EMAIL>> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package net.pekkit.feathereconomy.vault; import java.util.ArrayList; import java.util.Collection; import java.util.List; import net.milkbowl.vault.economy.Economy; import net.pekkit.feathereconomy.FeatherEconomy; import org.bukkit.OfflinePlayer; import org.bukkit.plugin.RegisteredServiceProvider; public class VaultImport { private final List<Economy> economies; private FeatherEconomy plugin; public VaultImport(FeatherEconomy pl) { this.economies = new ArrayList(); FeatherEconomy plugin = pl; Collection<RegisteredServiceProvider<Economy>> providers = plugin.getServer().getServicesManager().getRegistrations(Economy.class); if (providers == null) { return; } for (RegisteredServiceProvider<Economy> econProvider : providers) { Economy provider = econProvider.getProvider(); if (!(provider instanceof Economy_FeatherEcon)) { this.economies.add(provider); } } } public void doImport(String pluginName) { if (this.economies.size() <= 0) { plugin.getLogger().warning("No plugins to import!"); return; } for (Economy economy : this.economies) { if (economy.getName().equalsIgnoreCase(pluginName)) { doImport(economy); return; } } if (this.economies.size() <= 0) { plugin.getLogger().warning("Cannot find plugin '" + pluginName + "' to import."); } } public void doImport() { if (this.economies.size() <= 0) { plugin.getLogger().warning("No plugins to import!"); return; } for (Economy economy : this.economies) { doImport(economy); } } public boolean canImport(String pluginName) { for (Economy economy : this.economies) { if (economy.getName().equalsIgnoreCase(pluginName)) { return true; } } return false; } public void doImport(final Economy economy) { if (economy != null) { plugin.getServer().getScheduler().runTask(plugin, new Runnable() { public void run() { plugin.getLogger().info("[Plugin: " + economy.getName() + "] Iterating over all offline players..."); OfflinePlayer[] players = plugin.getServer().getOfflinePlayers(); int lastPercent = -1; for (int i = 0; i < players.length; i++) { int balance = (int) economy.getBalance(players[i]); plugin.getAPI().setBalance(players[i].getUniqueId(), balance); int percent = (int) (i / players.length * 100.0D); if ((percent % 10 == 0) && (percent != lastPercent)) { plugin.getLogger().info("[Plugin: " + economy.getName() + "]" + i + "/" + players.length + " imported. (" + percent + "%)"); lastPercent = percent; } } plugin.getLogger().info("[Plugin: " + economy.getName() + "] Import complete!"); } }); } } }
4,547
0.586804
0.58242
111
39.099098
32.193657
152
false
false
0
0
0
0
0
0
0.558559
false
false
12
16fcf3c831e31c270644b24d9e4488e116beed39
22,660,247,464,541
3066eb81b4f66ca2f6924c15128bb28070f25770
/service/src/main/java/li/strolch/execution/command/SetActionToClosedCommand.java
d975f9c4b7c1171697e00db7bd986b9ec53ad692
[ "Apache-2.0" ]
permissive
strolch-li/strolch
https://github.com/strolch-li/strolch
5b2e4794fcdd9dbd04e493dcab43564efe21316c
d9da84093d0dcafc7ae1689e4832905f936c4ae3
refs/heads/develop
2023-08-29T14:02:15.451000
2023-08-28T13:47:29
2023-08-28T13:47:29
24,089,199
5
2
Apache-2.0
false
2023-07-18T05:32:17
2014-09-16T07:08:06
2022-11-15T12:55:41
2023-07-18T05:32:16
58,722
5
6
0
Java
false
false
package li.strolch.execution.command; import java.text.MessageFormat; import li.strolch.exception.StrolchException; import li.strolch.model.State; import li.strolch.model.activity.Action; import li.strolch.model.activity.Activity; import li.strolch.persistence.api.StrolchTransaction; import li.strolch.utils.dbc.DBC; public class SetActionToClosedCommand extends BasePlanningAndExecutionCommand { private Action action; public SetActionToClosedCommand(StrolchTransaction tx) { super(tx); } public void setAction(Action action) { this.action = action; } @Override public void validate() { DBC.PRE.assertNotNull("action can not be null", this.action); if (!this.action.getState().canSetToClosed()) { String msg = "Current state is {0} and can not be changed to {1} for action {2}"; msg = MessageFormat.format(msg, this.action.getState(), State.CLOSED, this.action.getLocator()); throw new StrolchException(msg); } } @Override public void doCommand() { if (this.action.getState() == State.CLOSED) { logger.warn("Action " + this.action.getLocator() + " is already in state CLOSED! Not changing."); return; } Activity rootElement = this.action.getRootElement(); State currentState = rootElement.getState(); this.action.setState(State.CLOSED); getConfirmationPolicy(this.action).toClosed(this.action); updateOrderState(tx(), rootElement, currentState, rootElement.getState()); } }
UTF-8
Java
1,439
java
SetActionToClosedCommand.java
Java
[]
null
[]
package li.strolch.execution.command; import java.text.MessageFormat; import li.strolch.exception.StrolchException; import li.strolch.model.State; import li.strolch.model.activity.Action; import li.strolch.model.activity.Activity; import li.strolch.persistence.api.StrolchTransaction; import li.strolch.utils.dbc.DBC; public class SetActionToClosedCommand extends BasePlanningAndExecutionCommand { private Action action; public SetActionToClosedCommand(StrolchTransaction tx) { super(tx); } public void setAction(Action action) { this.action = action; } @Override public void validate() { DBC.PRE.assertNotNull("action can not be null", this.action); if (!this.action.getState().canSetToClosed()) { String msg = "Current state is {0} and can not be changed to {1} for action {2}"; msg = MessageFormat.format(msg, this.action.getState(), State.CLOSED, this.action.getLocator()); throw new StrolchException(msg); } } @Override public void doCommand() { if (this.action.getState() == State.CLOSED) { logger.warn("Action " + this.action.getLocator() + " is already in state CLOSED! Not changing."); return; } Activity rootElement = this.action.getRootElement(); State currentState = rootElement.getState(); this.action.setState(State.CLOSED); getConfirmationPolicy(this.action).toClosed(this.action); updateOrderState(tx(), rootElement, currentState, rootElement.getState()); } }
1,439
0.747741
0.745657
51
27.215687
28.299736
100
false
false
0
0
0
0
0
0
1.54902
false
false
12
44a414bb7daf29f57e2f81644caf13156b2c058c
3,496,103,389,898
19ff4d91cb728424cb5a62ba2359ebf9f2183439
/src/com/flyong/others/sql/DBSQLTypeList.java
9249dd1ffd1ca2c57a6ccf9fb922792e5279b925
[]
no_license
xiyionxiong/framwork
https://github.com/xiyionxiong/framwork
b5afd1b6d53b4526b7e59f86e9e5989bafd2e462
785e533d9238f5b1a7705925de2d30d0032fb9bb
refs/heads/master
2021-05-29T21:08:06.591000
2009-07-03T05:58:49
2009-07-03T05:58:49
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.flyong.others.sql; import java.lang.reflect.Field; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.SQLException; import java.util.HashMap; import java.util.Map; /** * 得到数据库支持的数据类型. * * * */ public class DBSQLTypeList { public static void main(String[] args) { Connection connection = null; // 从其它地方获取链接 try { DatabaseMetaData dbmd = connection.getMetaData(); // 得到类型信息 ResultSet resultSet = dbmd.getTypeInfo(); while (resultSet.next()) { // 得到数据库指定的类型名 String typeName = resultSet.getString("TYPE_NAME"); // 得到 java.sql.Type 映射的类型 short dataType = resultSet.getShort("DATA_TYPE"); } } catch (SQLException e) { } } // 得到一个JDBC Type名字 public static String getJdbcTypeName(int jdbcType) { // Use reflection to populate a map of int values to names if (map == null) { map = new HashMap(); // Get all field in java.sql.Types Field[] fields = java.sql.Types.class.getFields(); for (int i = 0; i < fields.length; i++) { try { // Get field name String name = fields[i].getName(); // Get field value Integer value = (Integer) fields[i].get(null); // Add to map map.put(value, name); } catch (IllegalAccessException e) { } } } // Return the JDBC type name return (String) map.get(new Integer(jdbcType)); } static Map map; }
UTF-8
Java
1,703
java
DBSQLTypeList.java
Java
[]
null
[]
package com.flyong.others.sql; import java.lang.reflect.Field; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.SQLException; import java.util.HashMap; import java.util.Map; /** * 得到数据库支持的数据类型. * * * */ public class DBSQLTypeList { public static void main(String[] args) { Connection connection = null; // 从其它地方获取链接 try { DatabaseMetaData dbmd = connection.getMetaData(); // 得到类型信息 ResultSet resultSet = dbmd.getTypeInfo(); while (resultSet.next()) { // 得到数据库指定的类型名 String typeName = resultSet.getString("TYPE_NAME"); // 得到 java.sql.Type 映射的类型 short dataType = resultSet.getShort("DATA_TYPE"); } } catch (SQLException e) { } } // 得到一个JDBC Type名字 public static String getJdbcTypeName(int jdbcType) { // Use reflection to populate a map of int values to names if (map == null) { map = new HashMap(); // Get all field in java.sql.Types Field[] fields = java.sql.Types.class.getFields(); for (int i = 0; i < fields.length; i++) { try { // Get field name String name = fields[i].getName(); // Get field value Integer value = (Integer) fields[i].get(null); // Add to map map.put(value, name); } catch (IllegalAccessException e) { } } } // Return the JDBC type name return (String) map.get(new Integer(jdbcType)); } static Map map; }
1,703
0.579013
0.578389
70
20.871429
19.31241
62
false
false
0
0
0
0
0
0
0.328571
false
false
12
8a6581b19e3dec74f8178c50bb77de2046307f20
38,869,454,076,114
b0fafd423691028256f18942541b5bda72204a30
/app/src/main/java/com/example/skinnerapp/Recuperar_contraseña.java
a7b4e9ac7d23807d5ce0cfe0341caae3c4fe1586
[]
no_license
Gomezcri/SkinnerApp
https://github.com/Gomezcri/SkinnerApp
0334007ee7943257681919106e891380d3433578
e31070e4ab24b7cf10c9ac78cd746a6bd548ff51
refs/heads/master
2023-01-25T02:19:19.102000
2020-11-28T01:08:06
2020-11-28T01:08:06
280,728,529
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.skinnerapp; import android.content.Intent; import android.graphics.Paint; import android.os.Bundle; import android.os.Handler; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.example.skinnerapp.Interface.JsonPlaceHolderApi; import com.example.skinnerapp.Model.LoginUsuarioRequest; import com.example.skinnerapp.Model.LoginUsuarioResponse; import com.example.skinnerapp.Model.RecuperarContraseñaRequest; import com.example.skinnerapp.Model.RecuperarcontraseñaResponse; import org.w3c.dom.Text; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; import static util.Util.getConnection; public class Recuperar_contraseña extends AppCompatActivity { private TextView tv_email; private Button recuperarContraseña; private String texto; private TextView tv_gracias; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.recuperar_contrasenia); tv_email = (TextView) findViewById(R.id.tv_email_recuperarContraseña); recuperarContraseña = (Button) findViewById(R.id.bt_recuperarContraseña); tv_gracias = (TextView) findViewById(R.id.tv_final); tv_gracias.setPaintFlags(tv_gracias.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); recuperarContraseña.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { RecuperarPassword(); } }); } private void RecuperarPassword() { Retrofit retrofit = getConnection(); JsonPlaceHolderApi service = retrofit.create(JsonPlaceHolderApi.class); if(tv_email.getText()!=null){ texto=tv_email.getText().toString(); RecuperarContraseñaRequest req = new RecuperarContraseñaRequest(texto); Call<RecuperarcontraseñaResponse> call= service.postRecuperarContraseña(req); call.enqueue(new Callback<RecuperarcontraseñaResponse>() { @Override public void onResponse(Call<RecuperarcontraseñaResponse> call, Response<RecuperarcontraseñaResponse> response) { // Intent resultIntent = new Intent(Recuperar_contraseña.this, LoginActivity.class); Toast.makeText(Recuperar_contraseña.this, "Revise la casilla de mail ingresada y realice un nuevo ingreso", Toast.LENGTH_LONG).show(); Intent resultIntent = new Intent(); resultIntent.putExtra("change", true); setResult(RESULT_OK, resultIntent); finish(); // startActivity(resultIntent); } @Override public void onFailure(Call<RecuperarcontraseñaResponse> call, Throwable t) { Toast.makeText(Recuperar_contraseña.this, "No se pudo recuperar su contraseña, intente más tarde por favor", Toast.LENGTH_SHORT).show(); } }); } } }
UTF-8
Java
3,213
java
Recuperar_contraseña.java
Java
[]
null
[]
package com.example.skinnerapp; import android.content.Intent; import android.graphics.Paint; import android.os.Bundle; import android.os.Handler; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.example.skinnerapp.Interface.JsonPlaceHolderApi; import com.example.skinnerapp.Model.LoginUsuarioRequest; import com.example.skinnerapp.Model.LoginUsuarioResponse; import com.example.skinnerapp.Model.RecuperarContraseñaRequest; import com.example.skinnerapp.Model.RecuperarcontraseñaResponse; import org.w3c.dom.Text; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; import static util.Util.getConnection; public class Recuperar_contraseña extends AppCompatActivity { private TextView tv_email; private Button recuperarContraseña; private String texto; private TextView tv_gracias; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.recuperar_contrasenia); tv_email = (TextView) findViewById(R.id.tv_email_recuperarContraseña); recuperarContraseña = (Button) findViewById(R.id.bt_recuperarContraseña); tv_gracias = (TextView) findViewById(R.id.tv_final); tv_gracias.setPaintFlags(tv_gracias.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); recuperarContraseña.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { RecuperarPassword(); } }); } private void RecuperarPassword() { Retrofit retrofit = getConnection(); JsonPlaceHolderApi service = retrofit.create(JsonPlaceHolderApi.class); if(tv_email.getText()!=null){ texto=tv_email.getText().toString(); RecuperarContraseñaRequest req = new RecuperarContraseñaRequest(texto); Call<RecuperarcontraseñaResponse> call= service.postRecuperarContraseña(req); call.enqueue(new Callback<RecuperarcontraseñaResponse>() { @Override public void onResponse(Call<RecuperarcontraseñaResponse> call, Response<RecuperarcontraseñaResponse> response) { // Intent resultIntent = new Intent(Recuperar_contraseña.this, LoginActivity.class); Toast.makeText(Recuperar_contraseña.this, "Revise la casilla de mail ingresada y realice un nuevo ingreso", Toast.LENGTH_LONG).show(); Intent resultIntent = new Intent(); resultIntent.putExtra("change", true); setResult(RESULT_OK, resultIntent); finish(); // startActivity(resultIntent); } @Override public void onFailure(Call<RecuperarcontraseñaResponse> call, Throwable t) { Toast.makeText(Recuperar_contraseña.this, "No se pudo recuperar su contraseña, intente más tarde por favor", Toast.LENGTH_SHORT).show(); } }); } } }
3,213
0.688596
0.68703
82
37.92683
34.038994
156
false
false
0
0
0
0
0
0
0.707317
false
false
12
2c83ebfea4dfec3736007d653ba5be4b6faa9742
6,811,818,141,548
2407a1ee910cef32767396548e182f67c7360102
/src/lastassignment/items/StrengthPotion.java
09c3d618d0ee45e251f3ba38a1f6bb54b0b58e15
[ "Unlicense" ]
permissive
blat-blatnik/The-Last-Assignment
https://github.com/blat-blatnik/The-Last-Assignment
d0ef4c54b8cdd43b0d2bce96c640ab1e2656d91d
69ec10e7affeb374b264d79803e15d61ac4d97ef
refs/heads/master
2022-11-16T19:46:19.350000
2020-07-14T18:09:25
2020-07-14T18:09:25
277,578,892
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package lastassignment.items; import lastassignment.utils.Console; import lastassignment.Player; public class StrengthPotion extends Item { private final String ingestionMethod; private int damageModifier; public StrengthPotion(String description, String ingestionMethod, int damageModifier) { super(description); this.ingestionMethod = ingestionMethod; this.damageModifier = damageModifier; } @Override public void interact(Player player) { Console.printWithPause("You %s the %s", ingestionMethod, getDescription()); Console.printWithPause("It leaves you with a terrible aftertaste that you just can't seem to shake off"); if (damageModifier > 0) { Console.printWithPause("Your muscles feel tense"); Console.printWithPause("Like they are ready for anything you can throw at them"); } else if (damageModifier < 0) { Console.printWithPause("Your muscles start feeling limp"); Console.printWithPause("You can barely support the weight of your own body"); } player.setDamageModifier(damageModifier); } }
UTF-8
Java
1,186
java
StrengthPotion.java
Java
[]
null
[]
package lastassignment.items; import lastassignment.utils.Console; import lastassignment.Player; public class StrengthPotion extends Item { private final String ingestionMethod; private int damageModifier; public StrengthPotion(String description, String ingestionMethod, int damageModifier) { super(description); this.ingestionMethod = ingestionMethod; this.damageModifier = damageModifier; } @Override public void interact(Player player) { Console.printWithPause("You %s the %s", ingestionMethod, getDescription()); Console.printWithPause("It leaves you with a terrible aftertaste that you just can't seem to shake off"); if (damageModifier > 0) { Console.printWithPause("Your muscles feel tense"); Console.printWithPause("Like they are ready for anything you can throw at them"); } else if (damageModifier < 0) { Console.printWithPause("Your muscles start feeling limp"); Console.printWithPause("You can barely support the weight of your own body"); } player.setDamageModifier(damageModifier); } }
1,186
0.678752
0.677066
31
36.258064
32.087551
113
false
false
0
0
0
0
0
0
0.612903
false
false
12
116115f9059368d3ca078e76a2d3681a3ae8d091
28,982,439,324,099
29098d9c858578da1d3b9608369fe2f2a39d5ede
/SECOND/Android/app/src/main/java/com/moringaschool/myrestaurants/adapters/RestaurantListAdapter.java
9d0c7f6a4350ddce8ab1e3ad82d361afd8a27c50
[]
no_license
DENNINGKEVIN/Trends
https://github.com/DENNINGKEVIN/Trends
2d74f42b3fbd509df476ded6d885a3bf5012e4da
fcd44a68be34f585ebf7e4bf068ba3fd116d09d1
refs/heads/master
2023-01-10T09:00:20.055000
2020-01-29T11:42:56
2020-01-29T11:42:56
234,490,364
0
0
null
false
2023-01-07T14:14:55
2020-01-17T06:58:56
2020-01-29T11:43:29
2023-01-07T14:14:54
5,950
0
0
27
Java
false
false
package com.moringaschool.myrestaurants.adapters; public class RestaurantListAdapter { }
UTF-8
Java
90
java
RestaurantListAdapter.java
Java
[]
null
[]
package com.moringaschool.myrestaurants.adapters; public class RestaurantListAdapter { }
90
0.844444
0.844444
4
21.5
21.5
49
false
false
0
0
0
0
0
0
0.25
false
false
12
9121f9bab61919d5b7ae9577aa4532fad2deafac
77,309,424,828
7ca9cb3fbba57f57e135db1efc4cb6303601db0b
/src/main/java/com/javarush/test/level27/lesson15/big01/ad/AdvertisementManager.java
b5e1d72e4b1ce9b02f7cd69e152974bb4cbc2ce6
[]
no_license
Sergey-Rebrov/JavaRush
https://github.com/Sergey-Rebrov/JavaRush
13f5590551dd07060da26bac02a343575d869565
1717f33d86749a04e657ddee7f6c23f460ca2aa0
refs/heads/master
2021-01-13T03:56:09.574000
2017-04-03T07:14:48
2017-04-03T07:14:48
78,188,158
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.javarush.test.level27.lesson15.big01.ad; import com.javarush.test.level27.lesson15.big01.ConsoleHelper; import com.javarush.test.level27.lesson15.big01.statistic.StatisticEventManager; import com.javarush.test.level27.lesson15.big01.statistic.event.VideoSelectedEventDataRow; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; /** * Created by Sergey on 18.01.2017. */ public class AdvertisementManager { private final AdvertisementStorage storage = AdvertisementStorage.getInstance(); private int timeSeconds; public AdvertisementManager(int timeSeconds) { this.timeSeconds = timeSeconds; } public void processVideos() throws NoVideoAvailableException { List<Advertisement> set = new ArrayList<>(); List<Advertisement> videos = recursion(storage.list(), set, 0, storage.list().size() - 1); if (videos.isEmpty()) throw new NoVideoAvailableException(); Collections.sort(videos, new Comparator<Advertisement>() { @Override public int compare(Advertisement o1, Advertisement o2) { int result = Long.compare(o2.getAmountPerOneDisplaying(), o1.getAmountPerOneDisplaying()); if (result == 0) { result = Long.compare(o1.getAmountPerOneDisplaying() * 1000 / o1.getDuration(), o2.getAmountPerOneDisplaying() * 1000 / o2.getDuration()); return result; } else return result; } }); long totalAmount = 0; int totalDuration = 0; for (Advertisement advertisement : videos) { totalAmount += advertisement.getAmountPerOneDisplaying(); totalDuration += advertisement.getDuration(); } StatisticEventManager.getInstance().register(new VideoSelectedEventDataRow(videos, totalAmount, totalDuration)); for (Advertisement advertisement : videos) { ConsoleHelper.writeMessage(advertisement.getName() + " is displaying... " + advertisement.getAmountPerOneDisplaying() + ", " + advertisement.getAmountPerOneDisplaying() * 1000 / advertisement.getDuration()); advertisement.revalidate(); } } public List<Advertisement> recursion(List<Advertisement> list, List<Advertisement> set, int listPosition, int limit) { if (listPosition > limit) return set; List<Advertisement> oneList = recursion(list, set, listPosition + 1, limit); int duration = 0; List<Advertisement> newSet = new ArrayList<>(set); if (!newSet.isEmpty()) for (Advertisement ad : newSet) duration += ad.getDuration(); Advertisement advertisement = list.get(listPosition); if (duration + advertisement.getDuration() <= timeSeconds && !newSet.contains(advertisement) && advertisement.getHits() > 0) newSet.add(advertisement); List<Advertisement> twoList = recursion(list, newSet, listPosition + 1, limit); long oneMaxAmount = 0; int oneMaxDuration = 0; int oneMaxVideos = oneList.size(); for (Advertisement ad : oneList) { oneMaxAmount += ad.getAmountPerOneDisplaying(); oneMaxDuration += ad.getDuration(); } long twoMaxAmount = 0; int twoMaxDuration = 0; int twoMaxVideos = twoList.size(); for (Advertisement ad : twoList) { twoMaxAmount += ad.getAmountPerOneDisplaying(); twoMaxDuration += ad.getDuration(); } if (oneMaxAmount > twoMaxAmount) return oneList; else if (oneMaxAmount < twoMaxAmount) return twoList; else if (oneMaxDuration > twoMaxDuration) return oneList; else if (oneMaxDuration < twoMaxDuration) return twoList; else if (oneMaxVideos > twoMaxVideos) return twoList; else return oneList; } }
UTF-8
Java
4,164
java
AdvertisementManager.java
Java
[ { "context": "parator;\nimport java.util.List;\n\n/**\n * Created by Sergey on 18.01.2017.\n */\npublic class AdvertisementMana", "end": 426, "score": 0.9473681449890137, "start": 420, "tag": "NAME", "value": "Sergey" } ]
null
[]
package com.javarush.test.level27.lesson15.big01.ad; import com.javarush.test.level27.lesson15.big01.ConsoleHelper; import com.javarush.test.level27.lesson15.big01.statistic.StatisticEventManager; import com.javarush.test.level27.lesson15.big01.statistic.event.VideoSelectedEventDataRow; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; /** * Created by Sergey on 18.01.2017. */ public class AdvertisementManager { private final AdvertisementStorage storage = AdvertisementStorage.getInstance(); private int timeSeconds; public AdvertisementManager(int timeSeconds) { this.timeSeconds = timeSeconds; } public void processVideos() throws NoVideoAvailableException { List<Advertisement> set = new ArrayList<>(); List<Advertisement> videos = recursion(storage.list(), set, 0, storage.list().size() - 1); if (videos.isEmpty()) throw new NoVideoAvailableException(); Collections.sort(videos, new Comparator<Advertisement>() { @Override public int compare(Advertisement o1, Advertisement o2) { int result = Long.compare(o2.getAmountPerOneDisplaying(), o1.getAmountPerOneDisplaying()); if (result == 0) { result = Long.compare(o1.getAmountPerOneDisplaying() * 1000 / o1.getDuration(), o2.getAmountPerOneDisplaying() * 1000 / o2.getDuration()); return result; } else return result; } }); long totalAmount = 0; int totalDuration = 0; for (Advertisement advertisement : videos) { totalAmount += advertisement.getAmountPerOneDisplaying(); totalDuration += advertisement.getDuration(); } StatisticEventManager.getInstance().register(new VideoSelectedEventDataRow(videos, totalAmount, totalDuration)); for (Advertisement advertisement : videos) { ConsoleHelper.writeMessage(advertisement.getName() + " is displaying... " + advertisement.getAmountPerOneDisplaying() + ", " + advertisement.getAmountPerOneDisplaying() * 1000 / advertisement.getDuration()); advertisement.revalidate(); } } public List<Advertisement> recursion(List<Advertisement> list, List<Advertisement> set, int listPosition, int limit) { if (listPosition > limit) return set; List<Advertisement> oneList = recursion(list, set, listPosition + 1, limit); int duration = 0; List<Advertisement> newSet = new ArrayList<>(set); if (!newSet.isEmpty()) for (Advertisement ad : newSet) duration += ad.getDuration(); Advertisement advertisement = list.get(listPosition); if (duration + advertisement.getDuration() <= timeSeconds && !newSet.contains(advertisement) && advertisement.getHits() > 0) newSet.add(advertisement); List<Advertisement> twoList = recursion(list, newSet, listPosition + 1, limit); long oneMaxAmount = 0; int oneMaxDuration = 0; int oneMaxVideos = oneList.size(); for (Advertisement ad : oneList) { oneMaxAmount += ad.getAmountPerOneDisplaying(); oneMaxDuration += ad.getDuration(); } long twoMaxAmount = 0; int twoMaxDuration = 0; int twoMaxVideos = twoList.size(); for (Advertisement ad : twoList) { twoMaxAmount += ad.getAmountPerOneDisplaying(); twoMaxDuration += ad.getDuration(); } if (oneMaxAmount > twoMaxAmount) return oneList; else if (oneMaxAmount < twoMaxAmount) return twoList; else if (oneMaxDuration > twoMaxDuration) return oneList; else if (oneMaxDuration < twoMaxDuration) return twoList; else if (oneMaxVideos > twoMaxVideos) return twoList; else return oneList; } }
4,164
0.621998
0.606388
124
32.580647
32.248055
158
false
false
0
0
0
0
0
0
0.556452
false
false
12
1fa67b9bcd8f23e7eec3f77a4e0faba6bf60bff0
13,262,859,027,793
5ab9f8ccea354734b37bfb7e270cd87fd7af9a81
/Hibernate_Mysql/src/main/java/com/Hibernate/Mysql/Repository/UserRepository.java
b50c869b1090f181e1ddd0f349d253b8d05945eb
[]
no_license
Ysunil016/Java_Persistence
https://github.com/Ysunil016/Java_Persistence
780f06169985bf0aad3d833332e06945787d0f62
55004b1a6218ce99123e7ae148e2f81e299de12b
refs/heads/master
2021-05-23T17:47:12.139000
2020-05-03T20:09:40
2020-05-03T20:09:40
253,405,876
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.Hibernate.Mysql.Repository; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import com.Hibernate.Mysql.Bean.User; public interface UserRepository extends JpaRepository<User, String> { // Finding All Tuples with Username - List<User> findByUsername(String username); // Finding All Tuples with Password List<User> findByPassword(String password); }
UTF-8
Java
407
java
UserRepository.java
Java
[]
null
[]
package com.Hibernate.Mysql.Repository; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import com.Hibernate.Mysql.Bean.User; public interface UserRepository extends JpaRepository<User, String> { // Finding All Tuples with Username - List<User> findByUsername(String username); // Finding All Tuples with Password List<User> findByPassword(String password); }
407
0.796069
0.796069
16
24.4375
23.603413
69
false
false
0
0
0
0
0
0
0.6875
false
false
12
608619a568549736ce5b79833badcb8a993755c6
25,177,098,337,857
3a1512f87295ad8b01f50d08a1838034a01942b9
/up1/Message.java
a2f13515403201c132d57f9c0c4b6e59a5c5f831
[]
no_license
AKazak/Practice
https://github.com/AKazak/Practice
f45cbf10f2e7c498894dfb8f8cae875d3b3878d1
490b1154ff0dce164ec9b7dc21fa10b6e39bb01a
refs/heads/master
2021-01-17T07:14:28.115000
2016-05-30T11:36:23
2016-05-30T11:36:23
51,357,070
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package up1; import org.json.simple.JSONObject; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.UUID; public class Message { private String id; private String message; private String author; private long timestamp; Message(String author, String message, long timestamp){ this.message = message; this.author = author; id = UUID.randomUUID().toString(); this.timestamp = timestamp; } Message(String id, String author, String message, long timestamp){ this.message = message; this.author = author; this.id = id; this.timestamp = timestamp; } public String getId(){ return id; } public String getMessage(){ return message; } public String getAuthor(){ return author; } public long getTimestamp(){ return timestamp; } public JSONObject toJSON(){ JSONObject obj = new JSONObject(); obj.put("id:", id); obj.put("message:", message); obj.put("author:", author); obj.put("timestamp:", timestamp); return obj; } @Override public String toString() { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(this.getTimestamp() + 3600000); Date date = calendar.getTime(); SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy ',' HH:mm:ss"); String strDate = sdf.format(date); return "id: " + id + ", author: \"" + author + "\", message: \"" + message + "\", timestamp: " + strDate; } }
UTF-8
Java
1,645
java
Message.java
Java
[]
null
[]
package up1; import org.json.simple.JSONObject; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.UUID; public class Message { private String id; private String message; private String author; private long timestamp; Message(String author, String message, long timestamp){ this.message = message; this.author = author; id = UUID.randomUUID().toString(); this.timestamp = timestamp; } Message(String id, String author, String message, long timestamp){ this.message = message; this.author = author; this.id = id; this.timestamp = timestamp; } public String getId(){ return id; } public String getMessage(){ return message; } public String getAuthor(){ return author; } public long getTimestamp(){ return timestamp; } public JSONObject toJSON(){ JSONObject obj = new JSONObject(); obj.put("id:", id); obj.put("message:", message); obj.put("author:", author); obj.put("timestamp:", timestamp); return obj; } @Override public String toString() { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(this.getTimestamp() + 3600000); Date date = calendar.getTime(); SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy ',' HH:mm:ss"); String strDate = sdf.format(date); return "id: " + id + ", author: \"" + author + "\", message: \"" + message + "\", timestamp: " + strDate; } }
1,645
0.59696
0.592097
65
24.323076
19.746164
83
false
false
0
0
0
0
0
0
0.723077
false
false
12
b7eff69d43f7fa4602881658b9b267856d9b7ccf
25,993,142,090,903
cd1f311e21948bfda52ec1359ca642e55f38b013
/src/com/ct/PathSumII.java
b8cd6af004aa84d7551623a50e925bd6623a3904
[]
no_license
TuoCao/acmJava
https://github.com/TuoCao/acmJava
5474c9d769986c1a0abe5536c6fc9780968c0a93
d8ea82b2b209cf3051eeef1bf66c910694ccba34
refs/heads/master
2020-03-27T21:42:54.717000
2019-08-02T15:09:45
2019-08-02T15:09:45
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ct; import java.util.ArrayList; import java.util.List; /** * @ Author :Cao Tuo * @ Date :Created in 11:15 2018/9/18 * @ Description:LeetCode-113. Path Sum II */ public class PathSumII { public List<List<Integer>> pathSum(TreeNode root, int sum) { List<List<Integer>> ans = new ArrayList<>(); pathSum(root,sum,0,ans,new ArrayList<>()); return ans; } // 如果所有的values都不小于0的话,可以使用剪枝函数,但是这里的values可以是负数 public void pathSum(TreeNode root,int sum,int currentTotal,List<List<Integer>> ans,List<Integer> list){ if (root != null){ currentTotal+=root.val; list.add(root.val); if(sum==currentTotal && root.left==null && root.right==null){ ans.add(new ArrayList<>(list)); }else{ pathSum(root.left,sum,currentTotal,ans,list); pathSum(root.right,sum,currentTotal,ans,list); } list.remove(list.size()-1); } } }
UTF-8
Java
1,071
java
PathSumII.java
Java
[ { "context": "ist;\nimport java.util.List;\n\n/**\n * @ Author :Cao Tuo\n * @ Date :Created in 11:15 2018/9/18\n * @ ", "end": 97, "score": 0.9997836351394653, "start": 90, "tag": "NAME", "value": "Cao Tuo" } ]
null
[]
package com.ct; import java.util.ArrayList; import java.util.List; /** * @ Author :<NAME> * @ Date :Created in 11:15 2018/9/18 * @ Description:LeetCode-113. Path Sum II */ public class PathSumII { public List<List<Integer>> pathSum(TreeNode root, int sum) { List<List<Integer>> ans = new ArrayList<>(); pathSum(root,sum,0,ans,new ArrayList<>()); return ans; } // 如果所有的values都不小于0的话,可以使用剪枝函数,但是这里的values可以是负数 public void pathSum(TreeNode root,int sum,int currentTotal,List<List<Integer>> ans,List<Integer> list){ if (root != null){ currentTotal+=root.val; list.add(root.val); if(sum==currentTotal && root.left==null && root.right==null){ ans.add(new ArrayList<>(list)); }else{ pathSum(root.left,sum,currentTotal,ans,list); pathSum(root.right,sum,currentTotal,ans,list); } list.remove(list.size()-1); } } }
1,070
0.58325
0.566301
32
30.34375
25.359428
107
false
false
0
0
0
0
0
0
0.90625
false
false
12
3cf7987fc6f85cb1b86713fe3fd498d464bfb2bf
19,146,964,267,954
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/30/30_c8f9b76d3cc03defd2c9d4a27f9a7f42b294ff7d/BOPConfiguration/30_c8f9b76d3cc03defd2c9d4a27f9a7f42b294ff7d_BOPConfiguration_s.java
008f3b627660042fb4336b60f3dd7bc01378310d
[]
no_license
zhongxingyu/Seer
https://github.com/zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516000
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
false
2023-06-22T07:55:57
2020-04-28T11:07:49
2023-06-21T00:53:27
2023-06-22T07:55:57
2,849,868
2
2
0
null
false
false
package tdwp_ftw.biomesop.configuration; import java.io.File; import java.util.logging.Level; import net.minecraftforge.common.Configuration; import tdwp_ftw.biomesop.ClientProxy; import tdwp_ftw.biomesop.mod_BiomesOPlenty; import cpw.mods.fml.common.FMLLog; public class BOPConfiguration { public static Configuration config; // Configuration variables public static boolean skyColors; public static int biomeSize; public static boolean addToDefault; public static boolean achievements; public static boolean vanillaEnhanced; public static int promisedLandDimID; public static boolean alpsGen; public static boolean arcticGen; public static boolean badlandsGen; public static boolean bambooForestGen; public static boolean bayouGen; public static boolean birchForestGen; public static boolean bogGen; public static boolean borealForestGen; public static boolean canyonGen; public static boolean chaparralGen; public static boolean cherryBlossomGroveGen; public static boolean coniferousForestGen; public static boolean cragGen; public static boolean deadForestGen; public static boolean deadSwampGen; public static boolean deadlandsGen; public static boolean deciduousForestGen; public static boolean drylandsGen; public static boolean dunesGen; public static boolean fenGen; public static boolean fieldGen; public static boolean frostForestGen; public static boolean fungiForestGen; public static boolean gardenGen; public static boolean glacierGen; public static boolean grasslandGen; public static boolean groveGen; public static boolean heathlandGen; public static boolean highlandGen; public static boolean iceSheetGen; public static boolean icyHillsGen; public static boolean jadeCliffsGen; public static boolean lushDesertGen; public static boolean lushSwampGen; public static boolean mangroveGen; public static boolean mapleWoodsGen; public static boolean marshGen; public static boolean meadowGen; public static boolean mesaGen; public static boolean moorGen; public static boolean mountainGen; public static boolean mushroomIslandGen; public static boolean mysticGroveGen; public static boolean oasisGen; public static boolean ominousWoodsGen; public static boolean orchardGen; public static boolean originValleyGen; public static boolean outbackGen; public static boolean pastureGen; public static boolean prairieGen; public static boolean quagmireGen; public static boolean rainforestGen; public static boolean redwoodForestGen; public static boolean sacredSpringsGen; public static boolean savannaGen; public static boolean scrublandGen; public static boolean seasonalForestGen; public static boolean shieldGen; public static boolean shrublandGen; public static boolean snowyWoodsGen; public static boolean spruceWoodsGen; public static boolean steppeGen; public static boolean swampwoodsGen; public static boolean temperateRainforestGen; public static boolean thicketGen; public static boolean tropicalRainforestGen; public static boolean tropicsGen; public static boolean tundraGen; public static boolean volcanoGen; public static boolean wastelandGen; public static boolean wetlandGen; public static boolean woodlandGen; public static boolean plainsGen; public static boolean desertGen; public static boolean extremeHillsGen; public static boolean forestGen; public static boolean taigaGen; public static boolean swamplandGen; public static boolean jungleGen; public static int mudID; public static int driedDirtID; public static int redRockID; public static int ashID; public static int deadGrassID; public static int desertGrassID; public static int whiteFlowerID; public static int blueFlowerID; public static int purpleFlowerID; public static int orangeFlowerID; public static int tinyFlowerID; public static int glowFlowerID; public static int cattailID; public static int willowID; public static int autumnLeavesID; public static int thornID; public static int toadstoolID; public static int highGrassBottomID; public static int highGrassTopID; public static int ashStoneID; public static int hardIceID; public static int redLeavesID; public static int orangeLeavesID; public static int pinkLeavesID; public static int blueLeavesID; public static int whiteLeavesID; public static int deadLeavesID; public static int shortGrassID; public static int appleLeavesID; public static int sproutID; public static int bushID; public static int bambooID; public static int bambooLeavesID; public static int mudBrickBlockID; public static int mudBrickDoubleSlabID; public static int mudBrickSingleSlabID; public static int mudBrickStairsID; public static int originGrassID; public static int originLeavesID; public static int pinkFlowerID; public static int treeMossID; public static int deadWoodID; public static int appleLeavesFruitlessID; public static int barleyID; public static int giantFlowerStemID; public static int giantFlowerRedID; public static int giantFlowerYellowID; public static int tinyCactusID; public static int firSaplingID; public static int redwoodSaplingID; public static int palmSaplingID; public static int redSaplingID; public static int orangeSaplingID; public static int yellowSaplingID; public static int brownSaplingID; public static int willowSaplingID; public static int appleSaplingID; public static int originSaplingID; public static int pinkSaplingID; public static int whiteSaplingID; public static int darkSaplingID; public static int magicSaplingID; public static int deathbloomID; public static int redRockCobbleID; public static int redRockCobbleDoubleSlabID; public static int redRockCobbleSingleSlabID; public static int redRockCobbleStairsID; public static int redRockBrickID; public static int redRockBrickDoubleSlabID; public static int redRockBrickSingleSlabID; public static int redRockBrickStairsID; public static int hydrangeaID; public static int violetID; public static int mediumGrassID; public static int duneGrassID; public static int desertSproutsID; public static int mangroveSaplingID; public static int hardSandID; public static int acaciaSaplingID; public static int hardDirtID; public static int holyGrassID; public static int holyStoneID; public static int holyTallGrassID; public static int promisedLandPortalID; public static int holySaplingID; public static int amethystOreID; public static int amethystBlockID; public static int bambooThatchingID; public static int mossID; public static int algaeID; public static int smolderingGrassID; public static int cragRockID; public static int quicksandID; public static int bambooSaplingID; //Redwood public static int redwoodPlankID; public static int redwoodWoodID; public static int redwoodLeavesID; public static int redwoodDoubleSlabID; public static int redwoodSingleSlabID; public static int redwoodStairsID; //Willow public static int willowPlankID; public static int willowWoodID; public static int willowLeavesID; public static int willowDoubleSlabID; public static int willowSingleSlabID; public static int willowStairsID; //Fir public static int firPlankID; public static int firWoodID; public static int firLeavesID; public static int firDoubleSlabID; public static int firSingleSlabID; public static int firStairsID; //Acacia public static int acaciaPlankID; public static int acaciaWoodID; public static int acaciaLeavesID; public static int acaciaDoubleSlabID; public static int acaciaSingleSlabID; public static int acaciaStairsID; //Cherry public static int cherryPlankID; public static int cherryWoodID; public static int cherryDoubleSlabID; public static int cherrySingleSlabID; public static int cherryStairsID; //Dark public static int darkPlankID; public static int darkWoodID; public static int darkLeavesID; public static int darkDoubleSlabID; public static int darkSingleSlabID; public static int darkStairsID; //Magic public static int magicPlankID; public static int magicWoodID; public static int magicDoubleSlabID; public static int magicSingleSlabID; public static int magicStairsID; //Palm public static int palmPlankID; public static int palmWoodID; public static int palmLeavesID; public static int palmDoubleSlabID; public static int palmSingleSlabID; public static int palmStairsID; //Mangrove public static int mangrovePlankID; public static int mangroveWoodID; public static int mangroveLeavesID; public static int mangroveDoubleSlabID; public static int mangroveSingleSlabID; public static int mangroveStairsID; //Holy public static int holyPlankID; public static int holyWoodID; public static int holyLeavesID; public static int holyDoubleSlabID; public static int holySingleSlabID; public static int holyStairsID; public static int shroomPowderID; public static int mudBallID; public static int mudBrickID; public static int cattailItemID; public static int bambooItemID; public static int barleyItemID; public static int shortGrassItemID; public static int mediumGrassItemID; public static int bushItemID; public static int sproutItemID; public static int mossItemID; public static int ashesID; public static int ancientStaffID; public static int ancientStaffHandleID; public static int ancientStaffPoleID; public static int ancientStaffTopperID; public static int enderporterID; public static int bopDiscID; public static int bopDiscMudID; public static int swordMudID; public static int shovelMudID; public static int pickaxeMudID; public static int axeMudID; public static int hoeMudID; public static int helmetMudID; public static int chestplateMudID; public static int leggingsMudID; public static int bootsMudID; public static int amethystID; public static int swordAmethystID; public static int shovelAmethystID; public static int pickaxeAmethystID; public static int axeAmethystID; public static int hoeAmethystID; public static int helmetAmethystID; public static int chestplateAmethystID; public static int leggingsAmethystID; public static int bootsAmethystID; public static int alpsID; public static int arcticID; public static int arcticForestID; public static int badlandsID; public static int bambooForestID; public static int bayouID; public static int birchForestID; public static int bogID; public static int borealForestID; public static int canyonID; public static int chaparralID; public static int cherryBlossomGroveID; public static int coniferousForestID; public static int coniferousForestThinID; public static int cragID; public static int deadForestID; public static int deadSwampID; public static int deadlandsID; public static int deciduousForestID; public static int drylandsID; public static int dunesID; public static int fenID; public static int fieldID; public static int frostForestID; public static int fungiForestID; public static int gardenID; public static int glacierID; public static int grasslandID; public static int groveID; public static int groveThinID; public static int heathlandID; public static int highlandID; public static int iceSheetID; public static int icyHillsID; public static int jadeCliffsID; public static int lushDesertID; public static int lushSwampID; public static int mangroveID; public static int mapleWoodsID; public static int marshID; public static int meadowID; public static int meadowForestID; public static int mesaID; public static int moorID; public static int mountainID; public static int mysticGroveID; public static int oasisID; public static int ominousWoodsID; public static int orchardID; public static int originValleyID; public static int outbackID; public static int pastureID; public static int prairieID; public static int promisedLandID; public static int promisedLandHillsID; public static int promisedLandPlainsID; public static int promisedLandSwampID; public static int quagmireID; public static int rainforestID; public static int redwoodForestID; public static int reefID; public static int sacredSpringsID; public static int savannaID; public static int savannaThickID; public static int scrublandID; public static int seasonalForestID; public static int shieldID; public static int shoreID; public static int shrublandID; public static int snowyWoodsID; public static int spruceWoodsID; public static int steppeID; public static int swampwoodsID; public static int temperateRainforestID; public static int thicketID; public static int tropicalRainforestID; public static int tropicsID; public static int tundraID; public static int tundraDryID; public static int volcanoID; public static int wastelandID; public static int wastelandTreesID; public static int wetlandID; public static int woodlandID; public static int plainsNewID; public static int desertNewID; public static int desertHillsNewID; public static int extremeHillsNewID; public static int extremeHillsEdgeNewID; public static int forestNewID; public static int forestHillsNewID; public static int taigaNewID; public static int taigaHillsNewID; public static int swamplandNewID; public static int jungleNewID; public static int jungleHillsNewID; public static int jungleSpiderID; public static int rosesterID; public static void init(File configFile) { boolean isClient = mod_BiomesOPlenty.proxy instanceof ClientProxy; config = new Configuration(configFile); try { config.load(); skyColors = true; biomeSize = config.get("Biome Settings", "Biome Size", 4, null).getInt(); achievements = config.get("Achievement Settings", "Add Biomes O Plenty Achievemnets (Currently Broken)", false).getBoolean(false); vanillaEnhanced = config.get("Biome Settings", "Enhanced Vanilla Biomes", true).getBoolean(false); promisedLandDimID = config.get("Dimension Settings", "Promised Land Dimension ID", 20, null).getInt(); if (!isClient) { addToDefault = config.get("Biome Settings", "Add Biomes To Default World", true).getBoolean(true); } else { addToDefault = config.get("Biome Settings", "Add Biomes To Default World", false).getBoolean(false); } alpsGen = config.get("Biomes To Generate", "Alps", true).getBoolean(false); arcticGen = config.get("Biomes To Generate", "Arctic", true).getBoolean(false); badlandsGen = config.get("Biomes To Generate", "Badlands", true).getBoolean(false); bambooForestGen = config.get("Biomes To Generate", "BambooForest", true).getBoolean(false); bayouGen = config.get("Biomes To Generate", "Bayou", true).getBoolean(false); birchForestGen = config.get("Biomes To Generate", "BirchForest", true).getBoolean(false); bogGen = config.get("Biomes To Generate", "Bog", true).getBoolean(false); borealForestGen = config.get("Biomes To Generate", "BorealForest", true).getBoolean(false); canyonGen = config.get("Biomes To Generate", "Canyon", true).getBoolean(false); chaparralGen = config.get("Biomes To Generate", "Chaparral", true).getBoolean(false); cherryBlossomGroveGen = config.get("Biomes To Generate", "CherryBlossomGrove", true).getBoolean(false); coniferousForestGen = config.get("Biomes To Generate", "ConiferousForest", true).getBoolean(false); cragGen = config.get("Biomes To Generate", "Crag", true).getBoolean(false); deadForestGen = config.get("Biomes To Generate", "DeadForest", true).getBoolean(false); deadSwampGen = config.get("Biomes To Generate", "DeadSwamp", true).getBoolean(false); deadlandsGen = config.get("Biomes To Generate", "Deadlands", true).getBoolean(false); deciduousForestGen = config.get("Biomes To Generate", "DeciduousForest", true).getBoolean(false); desertGen = config.get("Biomes To Generate", "Desert", true).getBoolean(false); drylandsGen = config.get("Biomes To Generate", "Drylands", true).getBoolean(false); dunesGen = config.get("Biomes To Generate", "Dunes", true).getBoolean(false); extremeHillsGen = config.get("Biomes To Generate", "ExtremeHills", true).getBoolean(false); fenGen = config.get("Biomes To Generate", "Fen", true).getBoolean(false); fieldGen = config.get("Biomes To Generate", "Field", true).getBoolean(false); forestGen = config.get("Biomes To Generate", "Forest", true).getBoolean(false); frostForestGen = config.get("Biomes To Generate", "FrostForest", true).getBoolean(false); fungiForestGen = config.get("Biomes To Generate", "FungiForest", true).getBoolean(false); gardenGen = config.get("Biomes To Generate", "Garden", true).getBoolean(false); glacierGen = config.get("Biomes To Generate", "Glacier", true).getBoolean(false); grasslandGen = config.get("Biomes To Generate", "Grassland", true).getBoolean(false); groveGen = config.get("Biomes To Generate", "Grove", true).getBoolean(false); heathlandGen = config.get("Biomes To Generate", "Heathland", true).getBoolean(false); highlandGen = config.get("Biomes To Generate", "Highland", true).getBoolean(false); iceSheetGen = config.get("Biomes To Generate", "IcySheet", true).getBoolean(false); icyHillsGen = config.get("Biomes To Generate", "IcyHills", true).getBoolean(false); jadeCliffsGen = config.get("Biomes To Generate", "JadeCliffs", true).getBoolean(false); jungleGen = config.get("Biomes To Generate", "Jungle", true).getBoolean(false); lushDesertGen = config.get("Biomes To Generate", "LushDesert", true).getBoolean(false); lushSwampGen = config.get("Biomes To Generate", "LushSwamp", true).getBoolean(false); mangroveGen = config.get("Biomes To Generate", "Mangrove", true).getBoolean(false); mapleWoodsGen = config.get("Biomes To Generate", "MapleWoods", true).getBoolean(false); marshGen = config.get("Biomes To Generate", "Marsh", true).getBoolean(false); meadowGen = config.get("Biomes To Generate", "Meadow", true).getBoolean(false); mesaGen = config.get("Biomes To Generate", "Mesa", true).getBoolean(false); moorGen = config.get("Biomes To Generate", "Moor", true).getBoolean(false); mountainGen = config.get("Biomes To Generate", "Mountain", true).getBoolean(false); mushroomIslandGen = config.get("Biomes To Generate", "MushroomIsland", true).getBoolean(false); mysticGroveGen = config.get("Biomes To Generate", "MysticGrove", true).getBoolean(false); oasisGen = config.get("Biomes To Generate", "Oasis", true).getBoolean(false); ominousWoodsGen = config.get("Biomes To Generate", "OminousWoods", true).getBoolean(false); orchardGen = config.get("Biomes To Generate", "Orchard", true).getBoolean(false); originValleyGen = config.get("Biomes To Generate", "OriginValley", true).getBoolean(false); outbackGen = config.get("Biomes To Generate", "Outback", true).getBoolean(false); pastureGen = config.get("Biomes To Generate", "Pasture", true).getBoolean(false); plainsGen = config.get("Biomes To Generate", "Plains", true).getBoolean(false); prairieGen = config.get("Biomes To Generate", "Prairie", true).getBoolean(false); quagmireGen = config.get("Biomes To Generate", "Quagmire", true).getBoolean(false); rainforestGen = config.get("Biomes To Generate", "Rainforest", true).getBoolean(false); redwoodForestGen = config.get("Biomes To Generate", "RedwoodForest", true).getBoolean(false); sacredSpringsGen = config.get("Biomes To Generate", "SacredSprings", true).getBoolean(false); savannaGen = config.get("Biomes To Generate", "Savanna", true).getBoolean(false); scrublandGen = config.get("Biomes To Generate", "Scrubland", true).getBoolean(false); seasonalForestGen = config.get("Biomes To Generate", "SeasonalForest", true).getBoolean(false); shieldGen = config.get("Biomes To Generate", "Shield", true).getBoolean(false); shrublandGen = config.get("Biomes To Generate", "Shrubland", true).getBoolean(false); snowyWoodsGen = config.get("Biomes To Generate", "SnowyWoods", true).getBoolean(false); spruceWoodsGen = config.get("Biomes To Generate", "SpruceWoods", true).getBoolean(false); steppeGen = config.get("Biomes To Generate", "Steppe", true).getBoolean(false); swamplandGen = config.get("Biomes To Generate", "Swampland", true).getBoolean(false); swampwoodsGen = config.get("Biomes To Generate", "Swampwoods", true).getBoolean(false); taigaGen = config.get("Biomes To Generate", "Taiga", true).getBoolean(false); temperateRainforestGen = config.get("Biomes To Generate", "TemperateRainforest", true).getBoolean(false); thicketGen = config.get("Biomes To Generate", "Thicket", true).getBoolean(false); tropicalRainforestGen = config.get("Biomes To Generate", "TropicalRainforest", true).getBoolean(false); tropicsGen = config.get("Biomes To Generate", "Tropics", true).getBoolean(false); tundraGen = config.get("Biomes To Generate", "Tundra", true).getBoolean(false); volcanoGen = config.get("Biomes To Generate", "Volcano", true).getBoolean(false); wastelandGen = config.get("Biomes To Generate", "Wasteland", true).getBoolean(false); wetlandGen = config.get("Biomes To Generate", "Wetland", true).getBoolean(false); woodlandGen = config.get("Biomes To Generate", "Woodland", true).getBoolean(false); // Get Terrain Block ID's mudID = config.getTerrainBlock("Terrain Block IDs", "Mud ID", 160, null).getInt(); driedDirtID = config.getTerrainBlock("Terrain Block IDs", "Dried Dirt ID", 161, null).getInt(); redRockID = config.getTerrainBlock("Terrain Block IDs", "Red Rock ID", 162, null).getInt(); ashID = config.getTerrainBlock("Terrain Block IDs", "Ash Block ID", 163, null).getInt(); ashStoneID = config.getTerrainBlock("Terrain Block IDs", "Ash Stone ID", 164, null).getInt(); hardIceID = config.getTerrainBlock("Terrain Block IDs", "Hard Ice ID", 165, null).getInt(); originGrassID = config.getTerrainBlock("Terrain Block IDs", "Origin Grass ID", 166, null).getInt(); hardSandID = config.getTerrainBlock("Terrain Block IDs", "Hard Sand ID", 167, null).getInt(); hardDirtID = config.getTerrainBlock("Terrain Block IDs", "Hard Dirt ID", 168, null).getInt(); holyGrassID = config.getTerrainBlock("Terrain Block IDs", "Holy Grass ID", 169, null).getInt(); holyStoneID = config.getTerrainBlock("Terrain Block IDs", "Holy Stone ID", 170, null).getInt(); cragRockID = config.getTerrainBlock("Terrain Block IDs", "Crag Rock ID", 171, null).getInt(); // Get Crafted Block ID's mudBrickBlockID = config.getBlock("Mud Bricks ID", 256, null).getInt(); redwoodPlankID = config.getBlock("Redwood Plank ID", 257, null).getInt(); redwoodDoubleSlabID = config.getBlock("Redwood Double Slab ID", 258, null).getInt(); redwoodSingleSlabID = config.getBlock("Redwood Single Slab ID", 259, null).getInt(); redwoodStairsID = config.getBlock("Redwood Stairs ID", 260, null).getInt(); willowPlankID = config.getBlock("Willow Plank ID", 261, null).getInt(); willowDoubleSlabID = config.getBlock("Willow Double Slab ID", 262, null).getInt(); willowSingleSlabID = config.getBlock("Willow Single Slab ID", 263, null).getInt(); willowStairsID = config.getBlock("Willow Stairs ID", 264, null).getInt(); firPlankID = config.getBlock("Fir Plank ID", 265, null).getInt(); firDoubleSlabID = config.getBlock("Fir Double Slab ID", 266, null).getInt(); firSingleSlabID = config.getBlock("Fir Single Slab ID", 267, null).getInt(); firStairsID = config.getBlock("Fir Stairs ID", 268, null).getInt(); acaciaPlankID = config.getBlock("Acacia Plank ID", 269, null).getInt(); acaciaDoubleSlabID = config.getBlock("Acacia Double Slab ID", 270, null).getInt(); acaciaSingleSlabID = config.getBlock("Acacia Single Slab ID", 271, null).getInt(); acaciaStairsID = config.getBlock("Acacia Stairs ID", 272, null).getInt(); cherryPlankID = config.getBlock("Cherry Plank ID", 273, null).getInt(); cherryDoubleSlabID = config.getBlock("Cherry Double Slab ID", 274, null).getInt(); cherrySingleSlabID = config.getBlock("Cherry Single Slab ID", 275, null).getInt(); cherryStairsID = config.getBlock("Cherry Stairs ID", 276, null).getInt(); darkPlankID = config.getBlock("Dark Plank ID", 277, null).getInt(); darkDoubleSlabID = config.getBlock("Dark Double Slab ID", 278, null).getInt(); darkSingleSlabID = config.getBlock("Dark Single Slab ID", 279, null).getInt(); darkStairsID = config.getBlock("Dark Stairs ID", 280, null).getInt(); magicPlankID = config.getBlock("Magic Plank ID", 281, null).getInt(); magicDoubleSlabID = config.getBlock("Magic Double Slab ID", 282, null).getInt(); magicSingleSlabID = config.getBlock("Magic Single Slab ID", 283, null).getInt(); magicStairsID = config.getBlock("Magic Stairs ID", 284, null).getInt(); palmPlankID = config.getBlock("Palm Plank ID", 285, null).getInt(); palmDoubleSlabID = config.getBlock("Palm Double Slab ID", 286, null).getInt(); palmSingleSlabID = config.getBlock("Palm Single Slab ID", 287, null).getInt(); palmStairsID = config.getBlock("Palm Stairs ID", 288, null).getInt(); originLeavesID = config.getBlock("Origin Leaves ID", 289, null).getInt(); redwoodWoodID = config.getBlock("Redwood Log ID", 290, null).getInt(); redwoodLeavesID = config.getBlock("Redwood Leaves ID", 291, null).getInt(); willowWoodID = config.getBlock("Willow Log ID", 292, null).getInt(); willowLeavesID = config.getBlock("Willow Leaves ID", 293, null).getInt(); firWoodID = config.getBlock("Fir Log ID", 294, null).getInt(); firLeavesID = config.getBlock("Fir Leaves ID", 295, null).getInt(); acaciaWoodID = config.getBlock("Acacia Log ID", 296, null).getInt(); acaciaLeavesID = config.getBlock("Acacia Leaves ID", 297, null).getInt(); cherryWoodID = config.getBlock("Cherry Log ID", 298, null).getInt(); pinkFlowerID = config.getBlock("Pink Flower ID", 299, null).getInt(); darkWoodID = config.getBlock("Dark Log ID", 300, null).getInt(); darkLeavesID = config.getBlock("Dark Leaves ID", 301, null).getInt(); treeMossID = config.getBlock("Tree Moss ID", 302, null).getInt(); magicWoodID = config.getBlock("Magic Log ID", 303, null).getInt(); deadWoodID = config.getBlock("Dead Log ID", 304, null).getInt(); appleLeavesFruitlessID = config.getBlock("Fruitless Apple Leaves ID", 305, null).getInt(); barleyID = config.getBlock("Barley ID", 306, null).getInt(); palmWoodID = config.getBlock("Palm Log ID", 307, null).getInt(); palmLeavesID = config.getBlock("Palm Leaves ID", 308, null).getInt(); giantFlowerRedID = config.getBlock("Giant Red Flower ID", 309, null).getInt(); giantFlowerStemID = config.getBlock("Giant Flower Stem ID", 310, null).getInt(); giantFlowerYellowID = config.getBlock("Giant Yellow Flower ID", 311, null).getInt(); redLeavesID = config.getBlock("Maple Leaves ID", 312, null).getInt(); orangeLeavesID = config.getBlock("Orange Autumn Leaves ID", 313, null).getInt(); pinkLeavesID = config.getBlock("Pink Cherry Leaves ID", 314, null).getInt(); blueLeavesID = config.getBlock("Magic Leaves ID", 315, null).getInt(); whiteLeavesID = config.getBlock("White Cherry Leaves ID", 316, null).getInt(); deadLeavesID = config.getBlock("Dying Leaves ID", 317, null).getInt(); shortGrassID = config.getBlock("Short Grass ID", 318, null).getInt(); appleLeavesID = config.getBlock("Apple Leaves ID", 319, null).getInt(); sproutID = config.getBlock("Sprout ID", 320, null).getInt(); bushID = config.getBlock("Bush ID", 321, null).getInt(); bambooID = config.getBlock("Bamboo ID", 322, null).getInt(); bambooLeavesID = config.getBlock("Bamboo Leaves ID", 323, null).getInt(); deadGrassID = config.getBlock("Dead Grass ID", 324, null).getInt(); desertGrassID = config.getBlock("Desert Grass ID", 325, null).getInt(); whiteFlowerID = config.getBlock("Anenome ID", 326, null).getInt(); blueFlowerID = config.getBlock("Swampflower ID", 327, null).getInt(); purpleFlowerID = config.getBlock("Wildflower ID", 328, null).getInt(); orangeFlowerID = config.getBlock("Daisy ID", 329, null).getInt(); tinyFlowerID = config.getBlock("Clover ID", 330, null).getInt(); glowFlowerID = config.getBlock("Glowflower ID", 331, null).getInt(); cattailID = config.getBlock("Cattail ID", 332, null).getInt(); willowID = config.getBlock("Willow ID", 333, null).getInt(); autumnLeavesID = config.getBlock("Yellow Autumn Leaves ID", 334, null).getInt(); thornID = config.getBlock("Thorns ID", 335, null).getInt(); toadstoolID = config.getBlock("Toadstool ID", 336, null).getInt(); highGrassBottomID = config.getBlock("High Grass Bottom ID", 337, null).getInt(); highGrassTopID = config.getBlock("High Grass Top ID", 338, null).getInt(); tinyCactusID = config.getBlock("Tiny Cactus ID", 339, null).getInt(); firSaplingID = config.getBlock("Fir Sapling ID", 340, null).getInt(); redwoodSaplingID = config.getBlock("Redwood Sapling ID", 341, null).getInt(); palmSaplingID = config.getBlock("Palm Sapling ID", 342, null).getInt(); redSaplingID = config.getBlock("Maple Sapling ID", 343, null).getInt(); orangeSaplingID = config.getBlock("Orange Autumn Sapling ID", 344, null).getInt(); yellowSaplingID = config.getBlock("Yellow Autumn Sapling ID", 345, null).getInt(); brownSaplingID = config.getBlock("Dying Sapling ID", 346, null).getInt(); willowSaplingID = config.getBlock("Willow Sapling ID", 347, null).getInt(); appleSaplingID = config.getBlock("Apple Sapling ID", 348, null).getInt(); originSaplingID = config.getBlock("Origin Sapling ID", 349, null).getInt(); pinkSaplingID = config.getBlock("Pink Cherry Sapling ID", 350, null).getInt(); whiteSaplingID = config.getBlock("White Cherry Sapling ID", 351, null).getInt(); darkSaplingID = config.getBlock("Dark Sapling ID", 352, null).getInt(); magicSaplingID = config.getBlock("Magic Sapling ID", 353, null).getInt(); deathbloomID = config.getBlock("Deathbloom ID", 354, null).getInt(); redRockCobbleID = config.getBlock("Red Rock Cobblestone ID", 355, null).getInt(); redRockBrickID = config.getBlock("Red Rock Bricks ID", 356, null).getInt(); hydrangeaID = config.getBlock("Hydrangea ID", 357, null).getInt(); violetID = config.getBlock("Violet ID", 358, null).getInt(); mediumGrassID = config.getBlock("Medium Grass ID", 359, null).getInt(); duneGrassID = config.getBlock("Dune Grass ID", 360, null).getInt(); desertSproutsID = config.getBlock("Desert Sprouts ID", 361, null).getInt(); redRockCobbleDoubleSlabID = config.getBlock("Red Rock Cobblestone Double Slab ID", 362, null).getInt(); redRockCobbleSingleSlabID = config.getBlock("Red Rock Cobblestone Single Slab ID", 363, null).getInt(); redRockCobbleStairsID = config.getBlock("Red Rock Cobblestone Stairs ID", 364, null).getInt(); redRockBrickDoubleSlabID = config.getBlock("Red Rock Brick Double Slab ID", 365, null).getInt(); redRockBrickSingleSlabID = config.getBlock("Red Rock Brick Single Slab ID", 366, null).getInt(); redRockBrickStairsID = config.getBlock("Red Rock Brick Stairs ID", 367, null).getInt(); mudBrickDoubleSlabID = config.getBlock("Mud Brick Double Slab ID", 368, null).getInt(); mudBrickSingleSlabID = config.getBlock("Mud Brick Single Slab ID", 369, null).getInt(); mudBrickStairsID = config.getBlock("Mud Brick Stairs ID", 370, null).getInt(); mangroveWoodID = config.getBlock("Mangrove Log ID", 371, null).getInt(); mangroveLeavesID = config.getBlock("Mangrove Leaves ID", 372, null).getInt(); mangroveSaplingID = config.getBlock("Mangrove Sapling ID", 373, null).getInt(); mangrovePlankID = config.getBlock("Mangrove Plank ID", 374, null).getInt(); mangroveDoubleSlabID = config.getBlock("Mangrove Double Slab ID", 375, null).getInt(); mangroveSingleSlabID = config.getBlock("Mangrove Single Slab ID", 376, null).getInt(); mangroveStairsID = config.getBlock("Mangrove Stairs ID", 377, null).getInt(); acaciaSaplingID = config.getBlock("Acacia Sapling ID", 378, null).getInt(); holyTallGrassID = config.getBlock("Holy Tall Grass ID", 379, null).getInt(); promisedLandPortalID = config.getBlock("Promised Land Portal ID", 380, null).getInt(); holyWoodID = config.getBlock("Holy Log ID", 381, null).getInt(); holyLeavesID = config.getBlock("Holy Leaves ID", 382, null).getInt(); holySaplingID = config.getBlock("Holy Sapling ID", 383, null).getInt(); holyPlankID = config.getBlock("Holy Plank ID", 384, null).getInt(); holyDoubleSlabID = config.getBlock("Holy Double Slab ID", 385, null).getInt(); holySingleSlabID = config.getBlock("Holy Single Slab ID", 386, null).getInt(); holyStairsID = config.getBlock("Holy Stairs ID", 387, null).getInt(); amethystOreID = config.getBlock("Amethyst Ore ID", 388, null).getInt(); amethystBlockID = config.getBlock("Block of Amethyst ID", 389, null).getInt(); bambooThatchingID = config.getBlock("Bamboo Thatching ID", 390, null).getInt(); mossID = config.getBlock("Moss ID", 391, null).getInt(); algaeID = config.getBlock("Algae ID", 392, null).getInt(); smolderingGrassID = config.getBlock("Smoldering Grass ID", 393, null).getInt(); quicksandID = config.getBlock("Quicksand ID", 394, null).getInt(); bambooSaplingID = config.getBlock("Bamboo Sapling ID", 395, null).getInt(); // Get Item ID's shroomPowderID = config.getItem("Shroom Powder ID", 1001, null).getInt(); mudBallID = config.getItem("Mud Ball ID", 1002, null).getInt(); mudBrickID = config.getItem("Mud Brick ID", 1003, null).getInt(); bambooItemID = config.getItem("Bamboo ID", 1004).getInt(); cattailItemID = config.getItem("Cattail ID", 1005).getInt(); ancientStaffID = config.getItem("Ancient Staff ID", 1006).getInt(); enderporterID = config.getItem("Enderporter ID", 1007).getInt(); ashesID = config.getItem("Pile of Ashes ID", 1008, null).getInt(); barleyItemID = config.getItem("Barley ID", 1009).getInt(); amethystID = config.getItem("Amethyst ID", 1010).getInt(); ancientStaffHandleID = config.getItem("Ancient Staff Handle ID", 1011, null).getInt(); ancientStaffPoleID = config.getItem("Ancient Staff Pole ID", 1012, null).getInt(); ancientStaffTopperID = config.getItem("Ancient Staff Topper ID", 1013, null).getInt(); shortGrassItemID = config.getItem("Short Grass (Item) ID", 1014, null).getInt(); mediumGrassItemID = config.getItem("Medium Grass (Item) ID", 1015, null).getInt(); bushItemID = config.getItem("Bush (Item) ID", 1016, null).getInt(); sproutItemID = config.getItem("Sprout (Item) ID", 1017, null).getInt(); mossItemID = config.getItem("Moss (Item) ID", 1018, null).getInt(); bopDiscID = config.getItem("Traversia Music Disc ID", 1019, null).getInt(); bopDiscMudID = config.getItem("Muddy Music Disc ID", 1020, null).getInt(); swordMudID = config.getItem("Muddy Sword ID", 1060, null).getInt(); shovelMudID = config.getItem("Muddy Shovel ID", 1061, null).getInt(); pickaxeMudID = config.getItem("Muddy Pickaxe ID", 1062, null).getInt(); axeMudID = config.getItem("Muddy Axe ID", 1063, null).getInt(); hoeMudID = config.getItem("Muddy Hoe ID", 1064, null).getInt(); helmetMudID = config.getItem("Muddy Helmet ID", 1065, null).getInt(); chestplateMudID = config.getItem("Muddy Chestplate ID", 1066, null).getInt(); leggingsMudID = config.getItem("Muddy Leggings ID", 1067, null).getInt(); bootsMudID = config.getItem("Muddy Boots ID", 1068, null).getInt(); swordAmethystID = config.getItem("Amethyst Sword ID", 1069, null).getInt(); shovelAmethystID = config.getItem("Amethyst Shovel ID", 1070, null).getInt(); pickaxeAmethystID = config.getItem("Amethyst Pickaxe ID", 1071, null).getInt(); axeAmethystID = config.getItem("Amethyst Axe ID", 1072, null).getInt(); hoeAmethystID = config.getItem("Amethyst Hoe ID", 1073, null).getInt(); helmetAmethystID = config.getItem("Amethyst Helmet ID", 1074, null).getInt(); chestplateAmethystID = config.getItem("Amethyst Chestplate ID", 1075, null).getInt(); leggingsAmethystID = config.getItem("Amethyst Leggings ID", 1076, null).getInt(); bootsAmethystID = config.getItem("Amethyst Boots ID", 1077, null).getInt(); //Mob IDs jungleSpiderID = config.get("Mob IDs", "Jungle Spider ID", 101, null).getInt(); rosesterID = config.get("Mob IDs", "Rosester ID", 102, null).getInt(); System.out.println("Generating Biome ID's"); alpsID = config.get("Biome IDs", "Alps ID", 176).getInt(); arcticID = config.get("Biome IDs", "Arctic ID", 177).getInt(); badlandsID = config.get("Biome IDs", "Badlands ID", 178).getInt(); bambooForestID = config.get("Biome IDs", "Bamboo Forest ID", 179).getInt(); bayouID = config.get("Biome IDs", "Bayou ID", 180).getInt(); birchForestID = config.get("Biome IDs", "Birch Forest ID", 181).getInt(); bogID = config.get("Biome IDs", "Bog ID", 182).getInt(); borealForestID = config.get("Biome IDs", "Boreal Forest ID", 183).getInt(); canyonID = config.get("Biome IDs", "Canyon ID", 184).getInt(); chaparralID = config.get("Biome IDs", "Chaparral ID", 185).getInt(); cherryBlossomGroveID = config.get("Biome IDs", "Cherry Blossom Grove ID", 186).getInt(); coniferousForestID = config.get("Biome IDs", "Coniferous Forest ID", 187).getInt(); cragID = config.get("Biome IDs", "Crag ID", 188).getInt(); deadForestID = config.get("Biome IDs", "Dead Forest ID", 189).getInt(); deadSwampID = config.get("Biome IDs", "Dead Swamp ID", 190).getInt(); deadlandsID = config.get("Biome IDs", "Deadlands ID", 191).getInt(); deciduousForestID = config.get("Biome IDs", "Deciduous Forest ID", 192).getInt(); drylandsID = config.get("Biome IDs", "Drylands ID", 193).getInt(); dunesID = config.get("Biome IDs", "Dunes ID", 194).getInt(); fenID = config.get("Biome IDs", "Fen ID", 195).getInt(); fieldID = config.get("Biome IDs", "Field ID", 196).getInt(); frostForestID = config.get("Biome IDs", "Frost Forest ID", 197).getInt(); fungiForestID = config.get("Biome IDs", "Fungi Forest ID", 198).getInt(); gardenID = config.get("Biome IDs", "Garden ID", 199).getInt(); glacierID = config.get("Biome IDs", "Glacier ID", 200).getInt(); grasslandID = config.get("Biome IDs", "Grassland ID", 201).getInt(); groveID = config.get("Biome IDs", "Grove ID", 202).getInt(); heathlandID = config.get("Biome IDs", "Heathland ID", 203).getInt(); highlandID = config.get("Biome IDs", "Highland ID", 204).getInt(); iceSheetID = config.get("Biome IDs", "Ice Sheet ID", 205).getInt(); icyHillsID = config.get("Biome IDs", "Icy Hills ID", 206).getInt(); jadeCliffsID = config.get("Biome IDs", "Jade Cliffs ID", 207).getInt(); lushDesertID = config.get("Biome IDs", "Lush Desert ID", 208).getInt(); lushSwampID = config.get("Biome IDs", "Lush Swamp ID", 209).getInt(); mangroveID = config.get("Biome IDs", "Mangrove ID", 210).getInt(); mapleWoodsID = config.get("Biome IDs", "Maple Woods ID", 211).getInt(); marshID = config.get("Biome IDs", "Marsh ID", 212).getInt(); meadowID = config.get("Biome IDs", "Meadow ID", 213).getInt(); mesaID = config.get("Biome IDs", "Mesa ID", 214).getInt(); moorID = config.get("Biome IDs", "Moor ID", 215).getInt(); mountainID = config.get("Biome IDs", "Mountain ID", 216).getInt(); mysticGroveID = config.get("Biome IDs", "Mystic Grove ID", 217).getInt(); oasisID = config.get("Biome IDs", "Oasis ID", 218).getInt(); ominousWoodsID = config.get("Biome IDs", "Ominous Woods ID", 219).getInt(); orchardID = config.get("Biome IDs", "Orchard ID", 220).getInt(); originValleyID = config.get("Biome IDs", "Origin Valley ID", 221).getInt(); outbackID = config.get("Biome IDs", "Outback ID", 222).getInt(); pastureID = config.get("Biome IDs", "Pasture ID", 223).getInt(); prairieID = config.get("Biome IDs", "Prairie ID", 224).getInt(); promisedLandID = config.get("Biome IDs", "Promised Land ID", 225).getInt(); quagmireID = config.get("Biome IDs", "Quagmire ID", 226).getInt(); rainforestID = config.get("Biome IDs", "Rainforest ID", 227).getInt(); redwoodForestID = config.get("Biome IDs", "Redwood Forest ID", 228).getInt(); sacredSpringsID = config.get("Biome IDs", "Sacred Springs ID", 229).getInt(); savannaID = config.get("Biome IDs", "Savanna ID", 230).getInt(); scrublandID = config.get("Biome IDs", "Scrubland ID", 231).getInt(); seasonalForestID = config.get("Biome IDs", "Seasonal Forest ID", 232).getInt(); shieldID = config.get("Biome IDs", "Shield ID", 233).getInt(); shoreID = config.get("Biome IDs", "Shore ID", 234).getInt(); shrublandID = config.get("Biome IDs", "Shrubland ID", 235).getInt(); snowyWoodsID = config.get("Biome IDs", "Snowy Woods ID", 236).getInt(); spruceWoodsID = config.get("Biome IDs", "Spruce Woods ID", 237).getInt(); steppeID = config.get("Biome IDs", "Steppe ID", 238).getInt(); swampwoodsID = config.get("Biome IDs", "Swampwoods ID", 239).getInt(); temperateRainforestID = config.get("Biome IDs", "Temperate Rainforest ID", 240).getInt(); thicketID = config.get("Biome IDs", "Thicket ID", 241).getInt(); tropicalRainforestID = config.get("Biome IDs", "Tropical Rainforest ID", 242).getInt(); tropicsID = config.get("Biome IDs", "Tropics ID", 243).getInt(); tundraID = config.get("Biome IDs", "Tundra ID", 244).getInt(); volcanoID = config.get("Biome IDs", "Volcano ID", 245)getInt(); wastelandID = config.get("Biome IDs", "Wasteland ID", 246).getInt(); wetlandID = config.get("Biome IDs", "Wetland ID", 247).getInt(); woodlandID = config.get("Biome IDs", "Woodland ID", 248).getInt(); plainsNewID = config.get("Biome IDs", "Plains (New) ID", 249).getInt(); desertNewID = config.get("Biome IDs", "Desert (New) ID", 250).getInt(); forestNewID = config.get("Biome IDs", "Forest (New) ID", 251).getInt(); taigaNewID = config.get("Biome IDs", "Taiga (New) ID", 252).getInt(); swamplandNewID = config.get("Biome IDs", "Swampland (New) ID", 253).getInt(); extremeHillsNewID = config.get("Biome IDs", "Extreme Hills (New) ID", 254).getInt(); jungleNewID = config.get("Biome IDs", "Jungle (New) ID", 255).getInt(); System.out.println("[BiomesOPlenty] Generated Config!"); } catch (Exception e) { FMLLog.log(Level.SEVERE, e, "Biomes O Plenty has had a problem loading its configuration"); } finally { config.save(); } } }
UTF-8
Java
43,217
java
30_c8f9b76d3cc03defd2c9d4a27f9a7f42b294ff7d_BOPConfiguration_s.java
Java
[]
null
[]
package tdwp_ftw.biomesop.configuration; import java.io.File; import java.util.logging.Level; import net.minecraftforge.common.Configuration; import tdwp_ftw.biomesop.ClientProxy; import tdwp_ftw.biomesop.mod_BiomesOPlenty; import cpw.mods.fml.common.FMLLog; public class BOPConfiguration { public static Configuration config; // Configuration variables public static boolean skyColors; public static int biomeSize; public static boolean addToDefault; public static boolean achievements; public static boolean vanillaEnhanced; public static int promisedLandDimID; public static boolean alpsGen; public static boolean arcticGen; public static boolean badlandsGen; public static boolean bambooForestGen; public static boolean bayouGen; public static boolean birchForestGen; public static boolean bogGen; public static boolean borealForestGen; public static boolean canyonGen; public static boolean chaparralGen; public static boolean cherryBlossomGroveGen; public static boolean coniferousForestGen; public static boolean cragGen; public static boolean deadForestGen; public static boolean deadSwampGen; public static boolean deadlandsGen; public static boolean deciduousForestGen; public static boolean drylandsGen; public static boolean dunesGen; public static boolean fenGen; public static boolean fieldGen; public static boolean frostForestGen; public static boolean fungiForestGen; public static boolean gardenGen; public static boolean glacierGen; public static boolean grasslandGen; public static boolean groveGen; public static boolean heathlandGen; public static boolean highlandGen; public static boolean iceSheetGen; public static boolean icyHillsGen; public static boolean jadeCliffsGen; public static boolean lushDesertGen; public static boolean lushSwampGen; public static boolean mangroveGen; public static boolean mapleWoodsGen; public static boolean marshGen; public static boolean meadowGen; public static boolean mesaGen; public static boolean moorGen; public static boolean mountainGen; public static boolean mushroomIslandGen; public static boolean mysticGroveGen; public static boolean oasisGen; public static boolean ominousWoodsGen; public static boolean orchardGen; public static boolean originValleyGen; public static boolean outbackGen; public static boolean pastureGen; public static boolean prairieGen; public static boolean quagmireGen; public static boolean rainforestGen; public static boolean redwoodForestGen; public static boolean sacredSpringsGen; public static boolean savannaGen; public static boolean scrublandGen; public static boolean seasonalForestGen; public static boolean shieldGen; public static boolean shrublandGen; public static boolean snowyWoodsGen; public static boolean spruceWoodsGen; public static boolean steppeGen; public static boolean swampwoodsGen; public static boolean temperateRainforestGen; public static boolean thicketGen; public static boolean tropicalRainforestGen; public static boolean tropicsGen; public static boolean tundraGen; public static boolean volcanoGen; public static boolean wastelandGen; public static boolean wetlandGen; public static boolean woodlandGen; public static boolean plainsGen; public static boolean desertGen; public static boolean extremeHillsGen; public static boolean forestGen; public static boolean taigaGen; public static boolean swamplandGen; public static boolean jungleGen; public static int mudID; public static int driedDirtID; public static int redRockID; public static int ashID; public static int deadGrassID; public static int desertGrassID; public static int whiteFlowerID; public static int blueFlowerID; public static int purpleFlowerID; public static int orangeFlowerID; public static int tinyFlowerID; public static int glowFlowerID; public static int cattailID; public static int willowID; public static int autumnLeavesID; public static int thornID; public static int toadstoolID; public static int highGrassBottomID; public static int highGrassTopID; public static int ashStoneID; public static int hardIceID; public static int redLeavesID; public static int orangeLeavesID; public static int pinkLeavesID; public static int blueLeavesID; public static int whiteLeavesID; public static int deadLeavesID; public static int shortGrassID; public static int appleLeavesID; public static int sproutID; public static int bushID; public static int bambooID; public static int bambooLeavesID; public static int mudBrickBlockID; public static int mudBrickDoubleSlabID; public static int mudBrickSingleSlabID; public static int mudBrickStairsID; public static int originGrassID; public static int originLeavesID; public static int pinkFlowerID; public static int treeMossID; public static int deadWoodID; public static int appleLeavesFruitlessID; public static int barleyID; public static int giantFlowerStemID; public static int giantFlowerRedID; public static int giantFlowerYellowID; public static int tinyCactusID; public static int firSaplingID; public static int redwoodSaplingID; public static int palmSaplingID; public static int redSaplingID; public static int orangeSaplingID; public static int yellowSaplingID; public static int brownSaplingID; public static int willowSaplingID; public static int appleSaplingID; public static int originSaplingID; public static int pinkSaplingID; public static int whiteSaplingID; public static int darkSaplingID; public static int magicSaplingID; public static int deathbloomID; public static int redRockCobbleID; public static int redRockCobbleDoubleSlabID; public static int redRockCobbleSingleSlabID; public static int redRockCobbleStairsID; public static int redRockBrickID; public static int redRockBrickDoubleSlabID; public static int redRockBrickSingleSlabID; public static int redRockBrickStairsID; public static int hydrangeaID; public static int violetID; public static int mediumGrassID; public static int duneGrassID; public static int desertSproutsID; public static int mangroveSaplingID; public static int hardSandID; public static int acaciaSaplingID; public static int hardDirtID; public static int holyGrassID; public static int holyStoneID; public static int holyTallGrassID; public static int promisedLandPortalID; public static int holySaplingID; public static int amethystOreID; public static int amethystBlockID; public static int bambooThatchingID; public static int mossID; public static int algaeID; public static int smolderingGrassID; public static int cragRockID; public static int quicksandID; public static int bambooSaplingID; //Redwood public static int redwoodPlankID; public static int redwoodWoodID; public static int redwoodLeavesID; public static int redwoodDoubleSlabID; public static int redwoodSingleSlabID; public static int redwoodStairsID; //Willow public static int willowPlankID; public static int willowWoodID; public static int willowLeavesID; public static int willowDoubleSlabID; public static int willowSingleSlabID; public static int willowStairsID; //Fir public static int firPlankID; public static int firWoodID; public static int firLeavesID; public static int firDoubleSlabID; public static int firSingleSlabID; public static int firStairsID; //Acacia public static int acaciaPlankID; public static int acaciaWoodID; public static int acaciaLeavesID; public static int acaciaDoubleSlabID; public static int acaciaSingleSlabID; public static int acaciaStairsID; //Cherry public static int cherryPlankID; public static int cherryWoodID; public static int cherryDoubleSlabID; public static int cherrySingleSlabID; public static int cherryStairsID; //Dark public static int darkPlankID; public static int darkWoodID; public static int darkLeavesID; public static int darkDoubleSlabID; public static int darkSingleSlabID; public static int darkStairsID; //Magic public static int magicPlankID; public static int magicWoodID; public static int magicDoubleSlabID; public static int magicSingleSlabID; public static int magicStairsID; //Palm public static int palmPlankID; public static int palmWoodID; public static int palmLeavesID; public static int palmDoubleSlabID; public static int palmSingleSlabID; public static int palmStairsID; //Mangrove public static int mangrovePlankID; public static int mangroveWoodID; public static int mangroveLeavesID; public static int mangroveDoubleSlabID; public static int mangroveSingleSlabID; public static int mangroveStairsID; //Holy public static int holyPlankID; public static int holyWoodID; public static int holyLeavesID; public static int holyDoubleSlabID; public static int holySingleSlabID; public static int holyStairsID; public static int shroomPowderID; public static int mudBallID; public static int mudBrickID; public static int cattailItemID; public static int bambooItemID; public static int barleyItemID; public static int shortGrassItemID; public static int mediumGrassItemID; public static int bushItemID; public static int sproutItemID; public static int mossItemID; public static int ashesID; public static int ancientStaffID; public static int ancientStaffHandleID; public static int ancientStaffPoleID; public static int ancientStaffTopperID; public static int enderporterID; public static int bopDiscID; public static int bopDiscMudID; public static int swordMudID; public static int shovelMudID; public static int pickaxeMudID; public static int axeMudID; public static int hoeMudID; public static int helmetMudID; public static int chestplateMudID; public static int leggingsMudID; public static int bootsMudID; public static int amethystID; public static int swordAmethystID; public static int shovelAmethystID; public static int pickaxeAmethystID; public static int axeAmethystID; public static int hoeAmethystID; public static int helmetAmethystID; public static int chestplateAmethystID; public static int leggingsAmethystID; public static int bootsAmethystID; public static int alpsID; public static int arcticID; public static int arcticForestID; public static int badlandsID; public static int bambooForestID; public static int bayouID; public static int birchForestID; public static int bogID; public static int borealForestID; public static int canyonID; public static int chaparralID; public static int cherryBlossomGroveID; public static int coniferousForestID; public static int coniferousForestThinID; public static int cragID; public static int deadForestID; public static int deadSwampID; public static int deadlandsID; public static int deciduousForestID; public static int drylandsID; public static int dunesID; public static int fenID; public static int fieldID; public static int frostForestID; public static int fungiForestID; public static int gardenID; public static int glacierID; public static int grasslandID; public static int groveID; public static int groveThinID; public static int heathlandID; public static int highlandID; public static int iceSheetID; public static int icyHillsID; public static int jadeCliffsID; public static int lushDesertID; public static int lushSwampID; public static int mangroveID; public static int mapleWoodsID; public static int marshID; public static int meadowID; public static int meadowForestID; public static int mesaID; public static int moorID; public static int mountainID; public static int mysticGroveID; public static int oasisID; public static int ominousWoodsID; public static int orchardID; public static int originValleyID; public static int outbackID; public static int pastureID; public static int prairieID; public static int promisedLandID; public static int promisedLandHillsID; public static int promisedLandPlainsID; public static int promisedLandSwampID; public static int quagmireID; public static int rainforestID; public static int redwoodForestID; public static int reefID; public static int sacredSpringsID; public static int savannaID; public static int savannaThickID; public static int scrublandID; public static int seasonalForestID; public static int shieldID; public static int shoreID; public static int shrublandID; public static int snowyWoodsID; public static int spruceWoodsID; public static int steppeID; public static int swampwoodsID; public static int temperateRainforestID; public static int thicketID; public static int tropicalRainforestID; public static int tropicsID; public static int tundraID; public static int tundraDryID; public static int volcanoID; public static int wastelandID; public static int wastelandTreesID; public static int wetlandID; public static int woodlandID; public static int plainsNewID; public static int desertNewID; public static int desertHillsNewID; public static int extremeHillsNewID; public static int extremeHillsEdgeNewID; public static int forestNewID; public static int forestHillsNewID; public static int taigaNewID; public static int taigaHillsNewID; public static int swamplandNewID; public static int jungleNewID; public static int jungleHillsNewID; public static int jungleSpiderID; public static int rosesterID; public static void init(File configFile) { boolean isClient = mod_BiomesOPlenty.proxy instanceof ClientProxy; config = new Configuration(configFile); try { config.load(); skyColors = true; biomeSize = config.get("Biome Settings", "Biome Size", 4, null).getInt(); achievements = config.get("Achievement Settings", "Add Biomes O Plenty Achievemnets (Currently Broken)", false).getBoolean(false); vanillaEnhanced = config.get("Biome Settings", "Enhanced Vanilla Biomes", true).getBoolean(false); promisedLandDimID = config.get("Dimension Settings", "Promised Land Dimension ID", 20, null).getInt(); if (!isClient) { addToDefault = config.get("Biome Settings", "Add Biomes To Default World", true).getBoolean(true); } else { addToDefault = config.get("Biome Settings", "Add Biomes To Default World", false).getBoolean(false); } alpsGen = config.get("Biomes To Generate", "Alps", true).getBoolean(false); arcticGen = config.get("Biomes To Generate", "Arctic", true).getBoolean(false); badlandsGen = config.get("Biomes To Generate", "Badlands", true).getBoolean(false); bambooForestGen = config.get("Biomes To Generate", "BambooForest", true).getBoolean(false); bayouGen = config.get("Biomes To Generate", "Bayou", true).getBoolean(false); birchForestGen = config.get("Biomes To Generate", "BirchForest", true).getBoolean(false); bogGen = config.get("Biomes To Generate", "Bog", true).getBoolean(false); borealForestGen = config.get("Biomes To Generate", "BorealForest", true).getBoolean(false); canyonGen = config.get("Biomes To Generate", "Canyon", true).getBoolean(false); chaparralGen = config.get("Biomes To Generate", "Chaparral", true).getBoolean(false); cherryBlossomGroveGen = config.get("Biomes To Generate", "CherryBlossomGrove", true).getBoolean(false); coniferousForestGen = config.get("Biomes To Generate", "ConiferousForest", true).getBoolean(false); cragGen = config.get("Biomes To Generate", "Crag", true).getBoolean(false); deadForestGen = config.get("Biomes To Generate", "DeadForest", true).getBoolean(false); deadSwampGen = config.get("Biomes To Generate", "DeadSwamp", true).getBoolean(false); deadlandsGen = config.get("Biomes To Generate", "Deadlands", true).getBoolean(false); deciduousForestGen = config.get("Biomes To Generate", "DeciduousForest", true).getBoolean(false); desertGen = config.get("Biomes To Generate", "Desert", true).getBoolean(false); drylandsGen = config.get("Biomes To Generate", "Drylands", true).getBoolean(false); dunesGen = config.get("Biomes To Generate", "Dunes", true).getBoolean(false); extremeHillsGen = config.get("Biomes To Generate", "ExtremeHills", true).getBoolean(false); fenGen = config.get("Biomes To Generate", "Fen", true).getBoolean(false); fieldGen = config.get("Biomes To Generate", "Field", true).getBoolean(false); forestGen = config.get("Biomes To Generate", "Forest", true).getBoolean(false); frostForestGen = config.get("Biomes To Generate", "FrostForest", true).getBoolean(false); fungiForestGen = config.get("Biomes To Generate", "FungiForest", true).getBoolean(false); gardenGen = config.get("Biomes To Generate", "Garden", true).getBoolean(false); glacierGen = config.get("Biomes To Generate", "Glacier", true).getBoolean(false); grasslandGen = config.get("Biomes To Generate", "Grassland", true).getBoolean(false); groveGen = config.get("Biomes To Generate", "Grove", true).getBoolean(false); heathlandGen = config.get("Biomes To Generate", "Heathland", true).getBoolean(false); highlandGen = config.get("Biomes To Generate", "Highland", true).getBoolean(false); iceSheetGen = config.get("Biomes To Generate", "IcySheet", true).getBoolean(false); icyHillsGen = config.get("Biomes To Generate", "IcyHills", true).getBoolean(false); jadeCliffsGen = config.get("Biomes To Generate", "JadeCliffs", true).getBoolean(false); jungleGen = config.get("Biomes To Generate", "Jungle", true).getBoolean(false); lushDesertGen = config.get("Biomes To Generate", "LushDesert", true).getBoolean(false); lushSwampGen = config.get("Biomes To Generate", "LushSwamp", true).getBoolean(false); mangroveGen = config.get("Biomes To Generate", "Mangrove", true).getBoolean(false); mapleWoodsGen = config.get("Biomes To Generate", "MapleWoods", true).getBoolean(false); marshGen = config.get("Biomes To Generate", "Marsh", true).getBoolean(false); meadowGen = config.get("Biomes To Generate", "Meadow", true).getBoolean(false); mesaGen = config.get("Biomes To Generate", "Mesa", true).getBoolean(false); moorGen = config.get("Biomes To Generate", "Moor", true).getBoolean(false); mountainGen = config.get("Biomes To Generate", "Mountain", true).getBoolean(false); mushroomIslandGen = config.get("Biomes To Generate", "MushroomIsland", true).getBoolean(false); mysticGroveGen = config.get("Biomes To Generate", "MysticGrove", true).getBoolean(false); oasisGen = config.get("Biomes To Generate", "Oasis", true).getBoolean(false); ominousWoodsGen = config.get("Biomes To Generate", "OminousWoods", true).getBoolean(false); orchardGen = config.get("Biomes To Generate", "Orchard", true).getBoolean(false); originValleyGen = config.get("Biomes To Generate", "OriginValley", true).getBoolean(false); outbackGen = config.get("Biomes To Generate", "Outback", true).getBoolean(false); pastureGen = config.get("Biomes To Generate", "Pasture", true).getBoolean(false); plainsGen = config.get("Biomes To Generate", "Plains", true).getBoolean(false); prairieGen = config.get("Biomes To Generate", "Prairie", true).getBoolean(false); quagmireGen = config.get("Biomes To Generate", "Quagmire", true).getBoolean(false); rainforestGen = config.get("Biomes To Generate", "Rainforest", true).getBoolean(false); redwoodForestGen = config.get("Biomes To Generate", "RedwoodForest", true).getBoolean(false); sacredSpringsGen = config.get("Biomes To Generate", "SacredSprings", true).getBoolean(false); savannaGen = config.get("Biomes To Generate", "Savanna", true).getBoolean(false); scrublandGen = config.get("Biomes To Generate", "Scrubland", true).getBoolean(false); seasonalForestGen = config.get("Biomes To Generate", "SeasonalForest", true).getBoolean(false); shieldGen = config.get("Biomes To Generate", "Shield", true).getBoolean(false); shrublandGen = config.get("Biomes To Generate", "Shrubland", true).getBoolean(false); snowyWoodsGen = config.get("Biomes To Generate", "SnowyWoods", true).getBoolean(false); spruceWoodsGen = config.get("Biomes To Generate", "SpruceWoods", true).getBoolean(false); steppeGen = config.get("Biomes To Generate", "Steppe", true).getBoolean(false); swamplandGen = config.get("Biomes To Generate", "Swampland", true).getBoolean(false); swampwoodsGen = config.get("Biomes To Generate", "Swampwoods", true).getBoolean(false); taigaGen = config.get("Biomes To Generate", "Taiga", true).getBoolean(false); temperateRainforestGen = config.get("Biomes To Generate", "TemperateRainforest", true).getBoolean(false); thicketGen = config.get("Biomes To Generate", "Thicket", true).getBoolean(false); tropicalRainforestGen = config.get("Biomes To Generate", "TropicalRainforest", true).getBoolean(false); tropicsGen = config.get("Biomes To Generate", "Tropics", true).getBoolean(false); tundraGen = config.get("Biomes To Generate", "Tundra", true).getBoolean(false); volcanoGen = config.get("Biomes To Generate", "Volcano", true).getBoolean(false); wastelandGen = config.get("Biomes To Generate", "Wasteland", true).getBoolean(false); wetlandGen = config.get("Biomes To Generate", "Wetland", true).getBoolean(false); woodlandGen = config.get("Biomes To Generate", "Woodland", true).getBoolean(false); // Get Terrain Block ID's mudID = config.getTerrainBlock("Terrain Block IDs", "Mud ID", 160, null).getInt(); driedDirtID = config.getTerrainBlock("Terrain Block IDs", "Dried Dirt ID", 161, null).getInt(); redRockID = config.getTerrainBlock("Terrain Block IDs", "Red Rock ID", 162, null).getInt(); ashID = config.getTerrainBlock("Terrain Block IDs", "Ash Block ID", 163, null).getInt(); ashStoneID = config.getTerrainBlock("Terrain Block IDs", "Ash Stone ID", 164, null).getInt(); hardIceID = config.getTerrainBlock("Terrain Block IDs", "Hard Ice ID", 165, null).getInt(); originGrassID = config.getTerrainBlock("Terrain Block IDs", "Origin Grass ID", 166, null).getInt(); hardSandID = config.getTerrainBlock("Terrain Block IDs", "Hard Sand ID", 167, null).getInt(); hardDirtID = config.getTerrainBlock("Terrain Block IDs", "Hard Dirt ID", 168, null).getInt(); holyGrassID = config.getTerrainBlock("Terrain Block IDs", "Holy Grass ID", 169, null).getInt(); holyStoneID = config.getTerrainBlock("Terrain Block IDs", "Holy Stone ID", 170, null).getInt(); cragRockID = config.getTerrainBlock("Terrain Block IDs", "Crag Rock ID", 171, null).getInt(); // Get Crafted Block ID's mudBrickBlockID = config.getBlock("Mud Bricks ID", 256, null).getInt(); redwoodPlankID = config.getBlock("Redwood Plank ID", 257, null).getInt(); redwoodDoubleSlabID = config.getBlock("Redwood Double Slab ID", 258, null).getInt(); redwoodSingleSlabID = config.getBlock("Redwood Single Slab ID", 259, null).getInt(); redwoodStairsID = config.getBlock("Redwood Stairs ID", 260, null).getInt(); willowPlankID = config.getBlock("Willow Plank ID", 261, null).getInt(); willowDoubleSlabID = config.getBlock("Willow Double Slab ID", 262, null).getInt(); willowSingleSlabID = config.getBlock("Willow Single Slab ID", 263, null).getInt(); willowStairsID = config.getBlock("Willow Stairs ID", 264, null).getInt(); firPlankID = config.getBlock("Fir Plank ID", 265, null).getInt(); firDoubleSlabID = config.getBlock("Fir Double Slab ID", 266, null).getInt(); firSingleSlabID = config.getBlock("Fir Single Slab ID", 267, null).getInt(); firStairsID = config.getBlock("Fir Stairs ID", 268, null).getInt(); acaciaPlankID = config.getBlock("Acacia Plank ID", 269, null).getInt(); acaciaDoubleSlabID = config.getBlock("Acacia Double Slab ID", 270, null).getInt(); acaciaSingleSlabID = config.getBlock("Acacia Single Slab ID", 271, null).getInt(); acaciaStairsID = config.getBlock("Acacia Stairs ID", 272, null).getInt(); cherryPlankID = config.getBlock("Cherry Plank ID", 273, null).getInt(); cherryDoubleSlabID = config.getBlock("Cherry Double Slab ID", 274, null).getInt(); cherrySingleSlabID = config.getBlock("Cherry Single Slab ID", 275, null).getInt(); cherryStairsID = config.getBlock("Cherry Stairs ID", 276, null).getInt(); darkPlankID = config.getBlock("Dark Plank ID", 277, null).getInt(); darkDoubleSlabID = config.getBlock("Dark Double Slab ID", 278, null).getInt(); darkSingleSlabID = config.getBlock("Dark Single Slab ID", 279, null).getInt(); darkStairsID = config.getBlock("Dark Stairs ID", 280, null).getInt(); magicPlankID = config.getBlock("Magic Plank ID", 281, null).getInt(); magicDoubleSlabID = config.getBlock("Magic Double Slab ID", 282, null).getInt(); magicSingleSlabID = config.getBlock("Magic Single Slab ID", 283, null).getInt(); magicStairsID = config.getBlock("Magic Stairs ID", 284, null).getInt(); palmPlankID = config.getBlock("Palm Plank ID", 285, null).getInt(); palmDoubleSlabID = config.getBlock("Palm Double Slab ID", 286, null).getInt(); palmSingleSlabID = config.getBlock("Palm Single Slab ID", 287, null).getInt(); palmStairsID = config.getBlock("Palm Stairs ID", 288, null).getInt(); originLeavesID = config.getBlock("Origin Leaves ID", 289, null).getInt(); redwoodWoodID = config.getBlock("Redwood Log ID", 290, null).getInt(); redwoodLeavesID = config.getBlock("Redwood Leaves ID", 291, null).getInt(); willowWoodID = config.getBlock("Willow Log ID", 292, null).getInt(); willowLeavesID = config.getBlock("Willow Leaves ID", 293, null).getInt(); firWoodID = config.getBlock("Fir Log ID", 294, null).getInt(); firLeavesID = config.getBlock("Fir Leaves ID", 295, null).getInt(); acaciaWoodID = config.getBlock("Acacia Log ID", 296, null).getInt(); acaciaLeavesID = config.getBlock("Acacia Leaves ID", 297, null).getInt(); cherryWoodID = config.getBlock("Cherry Log ID", 298, null).getInt(); pinkFlowerID = config.getBlock("Pink Flower ID", 299, null).getInt(); darkWoodID = config.getBlock("Dark Log ID", 300, null).getInt(); darkLeavesID = config.getBlock("Dark Leaves ID", 301, null).getInt(); treeMossID = config.getBlock("Tree Moss ID", 302, null).getInt(); magicWoodID = config.getBlock("Magic Log ID", 303, null).getInt(); deadWoodID = config.getBlock("Dead Log ID", 304, null).getInt(); appleLeavesFruitlessID = config.getBlock("Fruitless Apple Leaves ID", 305, null).getInt(); barleyID = config.getBlock("Barley ID", 306, null).getInt(); palmWoodID = config.getBlock("Palm Log ID", 307, null).getInt(); palmLeavesID = config.getBlock("Palm Leaves ID", 308, null).getInt(); giantFlowerRedID = config.getBlock("Giant Red Flower ID", 309, null).getInt(); giantFlowerStemID = config.getBlock("Giant Flower Stem ID", 310, null).getInt(); giantFlowerYellowID = config.getBlock("Giant Yellow Flower ID", 311, null).getInt(); redLeavesID = config.getBlock("Maple Leaves ID", 312, null).getInt(); orangeLeavesID = config.getBlock("Orange Autumn Leaves ID", 313, null).getInt(); pinkLeavesID = config.getBlock("Pink Cherry Leaves ID", 314, null).getInt(); blueLeavesID = config.getBlock("Magic Leaves ID", 315, null).getInt(); whiteLeavesID = config.getBlock("White Cherry Leaves ID", 316, null).getInt(); deadLeavesID = config.getBlock("Dying Leaves ID", 317, null).getInt(); shortGrassID = config.getBlock("Short Grass ID", 318, null).getInt(); appleLeavesID = config.getBlock("Apple Leaves ID", 319, null).getInt(); sproutID = config.getBlock("Sprout ID", 320, null).getInt(); bushID = config.getBlock("Bush ID", 321, null).getInt(); bambooID = config.getBlock("Bamboo ID", 322, null).getInt(); bambooLeavesID = config.getBlock("Bamboo Leaves ID", 323, null).getInt(); deadGrassID = config.getBlock("Dead Grass ID", 324, null).getInt(); desertGrassID = config.getBlock("Desert Grass ID", 325, null).getInt(); whiteFlowerID = config.getBlock("Anenome ID", 326, null).getInt(); blueFlowerID = config.getBlock("Swampflower ID", 327, null).getInt(); purpleFlowerID = config.getBlock("Wildflower ID", 328, null).getInt(); orangeFlowerID = config.getBlock("Daisy ID", 329, null).getInt(); tinyFlowerID = config.getBlock("Clover ID", 330, null).getInt(); glowFlowerID = config.getBlock("Glowflower ID", 331, null).getInt(); cattailID = config.getBlock("Cattail ID", 332, null).getInt(); willowID = config.getBlock("Willow ID", 333, null).getInt(); autumnLeavesID = config.getBlock("Yellow Autumn Leaves ID", 334, null).getInt(); thornID = config.getBlock("Thorns ID", 335, null).getInt(); toadstoolID = config.getBlock("Toadstool ID", 336, null).getInt(); highGrassBottomID = config.getBlock("High Grass Bottom ID", 337, null).getInt(); highGrassTopID = config.getBlock("High Grass Top ID", 338, null).getInt(); tinyCactusID = config.getBlock("Tiny Cactus ID", 339, null).getInt(); firSaplingID = config.getBlock("Fir Sapling ID", 340, null).getInt(); redwoodSaplingID = config.getBlock("Redwood Sapling ID", 341, null).getInt(); palmSaplingID = config.getBlock("Palm Sapling ID", 342, null).getInt(); redSaplingID = config.getBlock("Maple Sapling ID", 343, null).getInt(); orangeSaplingID = config.getBlock("Orange Autumn Sapling ID", 344, null).getInt(); yellowSaplingID = config.getBlock("Yellow Autumn Sapling ID", 345, null).getInt(); brownSaplingID = config.getBlock("Dying Sapling ID", 346, null).getInt(); willowSaplingID = config.getBlock("Willow Sapling ID", 347, null).getInt(); appleSaplingID = config.getBlock("Apple Sapling ID", 348, null).getInt(); originSaplingID = config.getBlock("Origin Sapling ID", 349, null).getInt(); pinkSaplingID = config.getBlock("Pink Cherry Sapling ID", 350, null).getInt(); whiteSaplingID = config.getBlock("White Cherry Sapling ID", 351, null).getInt(); darkSaplingID = config.getBlock("Dark Sapling ID", 352, null).getInt(); magicSaplingID = config.getBlock("Magic Sapling ID", 353, null).getInt(); deathbloomID = config.getBlock("Deathbloom ID", 354, null).getInt(); redRockCobbleID = config.getBlock("Red Rock Cobblestone ID", 355, null).getInt(); redRockBrickID = config.getBlock("Red Rock Bricks ID", 356, null).getInt(); hydrangeaID = config.getBlock("Hydrangea ID", 357, null).getInt(); violetID = config.getBlock("Violet ID", 358, null).getInt(); mediumGrassID = config.getBlock("Medium Grass ID", 359, null).getInt(); duneGrassID = config.getBlock("Dune Grass ID", 360, null).getInt(); desertSproutsID = config.getBlock("Desert Sprouts ID", 361, null).getInt(); redRockCobbleDoubleSlabID = config.getBlock("Red Rock Cobblestone Double Slab ID", 362, null).getInt(); redRockCobbleSingleSlabID = config.getBlock("Red Rock Cobblestone Single Slab ID", 363, null).getInt(); redRockCobbleStairsID = config.getBlock("Red Rock Cobblestone Stairs ID", 364, null).getInt(); redRockBrickDoubleSlabID = config.getBlock("Red Rock Brick Double Slab ID", 365, null).getInt(); redRockBrickSingleSlabID = config.getBlock("Red Rock Brick Single Slab ID", 366, null).getInt(); redRockBrickStairsID = config.getBlock("Red Rock Brick Stairs ID", 367, null).getInt(); mudBrickDoubleSlabID = config.getBlock("Mud Brick Double Slab ID", 368, null).getInt(); mudBrickSingleSlabID = config.getBlock("Mud Brick Single Slab ID", 369, null).getInt(); mudBrickStairsID = config.getBlock("Mud Brick Stairs ID", 370, null).getInt(); mangroveWoodID = config.getBlock("Mangrove Log ID", 371, null).getInt(); mangroveLeavesID = config.getBlock("Mangrove Leaves ID", 372, null).getInt(); mangroveSaplingID = config.getBlock("Mangrove Sapling ID", 373, null).getInt(); mangrovePlankID = config.getBlock("Mangrove Plank ID", 374, null).getInt(); mangroveDoubleSlabID = config.getBlock("Mangrove Double Slab ID", 375, null).getInt(); mangroveSingleSlabID = config.getBlock("Mangrove Single Slab ID", 376, null).getInt(); mangroveStairsID = config.getBlock("Mangrove Stairs ID", 377, null).getInt(); acaciaSaplingID = config.getBlock("Acacia Sapling ID", 378, null).getInt(); holyTallGrassID = config.getBlock("Holy Tall Grass ID", 379, null).getInt(); promisedLandPortalID = config.getBlock("Promised Land Portal ID", 380, null).getInt(); holyWoodID = config.getBlock("Holy Log ID", 381, null).getInt(); holyLeavesID = config.getBlock("Holy Leaves ID", 382, null).getInt(); holySaplingID = config.getBlock("Holy Sapling ID", 383, null).getInt(); holyPlankID = config.getBlock("Holy Plank ID", 384, null).getInt(); holyDoubleSlabID = config.getBlock("Holy Double Slab ID", 385, null).getInt(); holySingleSlabID = config.getBlock("Holy Single Slab ID", 386, null).getInt(); holyStairsID = config.getBlock("Holy Stairs ID", 387, null).getInt(); amethystOreID = config.getBlock("Amethyst Ore ID", 388, null).getInt(); amethystBlockID = config.getBlock("Block of Amethyst ID", 389, null).getInt(); bambooThatchingID = config.getBlock("Bamboo Thatching ID", 390, null).getInt(); mossID = config.getBlock("Moss ID", 391, null).getInt(); algaeID = config.getBlock("Algae ID", 392, null).getInt(); smolderingGrassID = config.getBlock("Smoldering Grass ID", 393, null).getInt(); quicksandID = config.getBlock("Quicksand ID", 394, null).getInt(); bambooSaplingID = config.getBlock("Bamboo Sapling ID", 395, null).getInt(); // Get Item ID's shroomPowderID = config.getItem("Shroom Powder ID", 1001, null).getInt(); mudBallID = config.getItem("Mud Ball ID", 1002, null).getInt(); mudBrickID = config.getItem("Mud Brick ID", 1003, null).getInt(); bambooItemID = config.getItem("Bamboo ID", 1004).getInt(); cattailItemID = config.getItem("Cattail ID", 1005).getInt(); ancientStaffID = config.getItem("Ancient Staff ID", 1006).getInt(); enderporterID = config.getItem("Enderporter ID", 1007).getInt(); ashesID = config.getItem("Pile of Ashes ID", 1008, null).getInt(); barleyItemID = config.getItem("Barley ID", 1009).getInt(); amethystID = config.getItem("Amethyst ID", 1010).getInt(); ancientStaffHandleID = config.getItem("Ancient Staff Handle ID", 1011, null).getInt(); ancientStaffPoleID = config.getItem("Ancient Staff Pole ID", 1012, null).getInt(); ancientStaffTopperID = config.getItem("Ancient Staff Topper ID", 1013, null).getInt(); shortGrassItemID = config.getItem("Short Grass (Item) ID", 1014, null).getInt(); mediumGrassItemID = config.getItem("Medium Grass (Item) ID", 1015, null).getInt(); bushItemID = config.getItem("Bush (Item) ID", 1016, null).getInt(); sproutItemID = config.getItem("Sprout (Item) ID", 1017, null).getInt(); mossItemID = config.getItem("Moss (Item) ID", 1018, null).getInt(); bopDiscID = config.getItem("Traversia Music Disc ID", 1019, null).getInt(); bopDiscMudID = config.getItem("Muddy Music Disc ID", 1020, null).getInt(); swordMudID = config.getItem("Muddy Sword ID", 1060, null).getInt(); shovelMudID = config.getItem("Muddy Shovel ID", 1061, null).getInt(); pickaxeMudID = config.getItem("Muddy Pickaxe ID", 1062, null).getInt(); axeMudID = config.getItem("Muddy Axe ID", 1063, null).getInt(); hoeMudID = config.getItem("Muddy Hoe ID", 1064, null).getInt(); helmetMudID = config.getItem("Muddy Helmet ID", 1065, null).getInt(); chestplateMudID = config.getItem("Muddy Chestplate ID", 1066, null).getInt(); leggingsMudID = config.getItem("Muddy Leggings ID", 1067, null).getInt(); bootsMudID = config.getItem("Muddy Boots ID", 1068, null).getInt(); swordAmethystID = config.getItem("Amethyst Sword ID", 1069, null).getInt(); shovelAmethystID = config.getItem("Amethyst Shovel ID", 1070, null).getInt(); pickaxeAmethystID = config.getItem("Amethyst Pickaxe ID", 1071, null).getInt(); axeAmethystID = config.getItem("Amethyst Axe ID", 1072, null).getInt(); hoeAmethystID = config.getItem("Amethyst Hoe ID", 1073, null).getInt(); helmetAmethystID = config.getItem("Amethyst Helmet ID", 1074, null).getInt(); chestplateAmethystID = config.getItem("Amethyst Chestplate ID", 1075, null).getInt(); leggingsAmethystID = config.getItem("Amethyst Leggings ID", 1076, null).getInt(); bootsAmethystID = config.getItem("Amethyst Boots ID", 1077, null).getInt(); //Mob IDs jungleSpiderID = config.get("Mob IDs", "Jungle Spider ID", 101, null).getInt(); rosesterID = config.get("Mob IDs", "Rosester ID", 102, null).getInt(); System.out.println("Generating Biome ID's"); alpsID = config.get("Biome IDs", "Alps ID", 176).getInt(); arcticID = config.get("Biome IDs", "Arctic ID", 177).getInt(); badlandsID = config.get("Biome IDs", "Badlands ID", 178).getInt(); bambooForestID = config.get("Biome IDs", "Bamboo Forest ID", 179).getInt(); bayouID = config.get("Biome IDs", "Bayou ID", 180).getInt(); birchForestID = config.get("Biome IDs", "Birch Forest ID", 181).getInt(); bogID = config.get("Biome IDs", "Bog ID", 182).getInt(); borealForestID = config.get("Biome IDs", "Boreal Forest ID", 183).getInt(); canyonID = config.get("Biome IDs", "Canyon ID", 184).getInt(); chaparralID = config.get("Biome IDs", "Chaparral ID", 185).getInt(); cherryBlossomGroveID = config.get("Biome IDs", "Cherry Blossom Grove ID", 186).getInt(); coniferousForestID = config.get("Biome IDs", "Coniferous Forest ID", 187).getInt(); cragID = config.get("Biome IDs", "Crag ID", 188).getInt(); deadForestID = config.get("Biome IDs", "Dead Forest ID", 189).getInt(); deadSwampID = config.get("Biome IDs", "Dead Swamp ID", 190).getInt(); deadlandsID = config.get("Biome IDs", "Deadlands ID", 191).getInt(); deciduousForestID = config.get("Biome IDs", "Deciduous Forest ID", 192).getInt(); drylandsID = config.get("Biome IDs", "Drylands ID", 193).getInt(); dunesID = config.get("Biome IDs", "Dunes ID", 194).getInt(); fenID = config.get("Biome IDs", "Fen ID", 195).getInt(); fieldID = config.get("Biome IDs", "Field ID", 196).getInt(); frostForestID = config.get("Biome IDs", "Frost Forest ID", 197).getInt(); fungiForestID = config.get("Biome IDs", "Fungi Forest ID", 198).getInt(); gardenID = config.get("Biome IDs", "Garden ID", 199).getInt(); glacierID = config.get("Biome IDs", "Glacier ID", 200).getInt(); grasslandID = config.get("Biome IDs", "Grassland ID", 201).getInt(); groveID = config.get("Biome IDs", "Grove ID", 202).getInt(); heathlandID = config.get("Biome IDs", "Heathland ID", 203).getInt(); highlandID = config.get("Biome IDs", "Highland ID", 204).getInt(); iceSheetID = config.get("Biome IDs", "Ice Sheet ID", 205).getInt(); icyHillsID = config.get("Biome IDs", "Icy Hills ID", 206).getInt(); jadeCliffsID = config.get("Biome IDs", "Jade Cliffs ID", 207).getInt(); lushDesertID = config.get("Biome IDs", "Lush Desert ID", 208).getInt(); lushSwampID = config.get("Biome IDs", "Lush Swamp ID", 209).getInt(); mangroveID = config.get("Biome IDs", "Mangrove ID", 210).getInt(); mapleWoodsID = config.get("Biome IDs", "Maple Woods ID", 211).getInt(); marshID = config.get("Biome IDs", "Marsh ID", 212).getInt(); meadowID = config.get("Biome IDs", "Meadow ID", 213).getInt(); mesaID = config.get("Biome IDs", "Mesa ID", 214).getInt(); moorID = config.get("Biome IDs", "Moor ID", 215).getInt(); mountainID = config.get("Biome IDs", "Mountain ID", 216).getInt(); mysticGroveID = config.get("Biome IDs", "Mystic Grove ID", 217).getInt(); oasisID = config.get("Biome IDs", "Oasis ID", 218).getInt(); ominousWoodsID = config.get("Biome IDs", "Ominous Woods ID", 219).getInt(); orchardID = config.get("Biome IDs", "Orchard ID", 220).getInt(); originValleyID = config.get("Biome IDs", "Origin Valley ID", 221).getInt(); outbackID = config.get("Biome IDs", "Outback ID", 222).getInt(); pastureID = config.get("Biome IDs", "Pasture ID", 223).getInt(); prairieID = config.get("Biome IDs", "Prairie ID", 224).getInt(); promisedLandID = config.get("Biome IDs", "Promised Land ID", 225).getInt(); quagmireID = config.get("Biome IDs", "Quagmire ID", 226).getInt(); rainforestID = config.get("Biome IDs", "Rainforest ID", 227).getInt(); redwoodForestID = config.get("Biome IDs", "Redwood Forest ID", 228).getInt(); sacredSpringsID = config.get("Biome IDs", "Sacred Springs ID", 229).getInt(); savannaID = config.get("Biome IDs", "Savanna ID", 230).getInt(); scrublandID = config.get("Biome IDs", "Scrubland ID", 231).getInt(); seasonalForestID = config.get("Biome IDs", "Seasonal Forest ID", 232).getInt(); shieldID = config.get("Biome IDs", "Shield ID", 233).getInt(); shoreID = config.get("Biome IDs", "Shore ID", 234).getInt(); shrublandID = config.get("Biome IDs", "Shrubland ID", 235).getInt(); snowyWoodsID = config.get("Biome IDs", "Snowy Woods ID", 236).getInt(); spruceWoodsID = config.get("Biome IDs", "Spruce Woods ID", 237).getInt(); steppeID = config.get("Biome IDs", "Steppe ID", 238).getInt(); swampwoodsID = config.get("Biome IDs", "Swampwoods ID", 239).getInt(); temperateRainforestID = config.get("Biome IDs", "Temperate Rainforest ID", 240).getInt(); thicketID = config.get("Biome IDs", "Thicket ID", 241).getInt(); tropicalRainforestID = config.get("Biome IDs", "Tropical Rainforest ID", 242).getInt(); tropicsID = config.get("Biome IDs", "Tropics ID", 243).getInt(); tundraID = config.get("Biome IDs", "Tundra ID", 244).getInt(); volcanoID = config.get("Biome IDs", "Volcano ID", 245)getInt(); wastelandID = config.get("Biome IDs", "Wasteland ID", 246).getInt(); wetlandID = config.get("Biome IDs", "Wetland ID", 247).getInt(); woodlandID = config.get("Biome IDs", "Woodland ID", 248).getInt(); plainsNewID = config.get("Biome IDs", "Plains (New) ID", 249).getInt(); desertNewID = config.get("Biome IDs", "Desert (New) ID", 250).getInt(); forestNewID = config.get("Biome IDs", "Forest (New) ID", 251).getInt(); taigaNewID = config.get("Biome IDs", "Taiga (New) ID", 252).getInt(); swamplandNewID = config.get("Biome IDs", "Swampland (New) ID", 253).getInt(); extremeHillsNewID = config.get("Biome IDs", "Extreme Hills (New) ID", 254).getInt(); jungleNewID = config.get("Biome IDs", "Jungle (New) ID", 255).getInt(); System.out.println("[BiomesOPlenty] Generated Config!"); } catch (Exception e) { FMLLog.log(Level.SEVERE, e, "Biomes O Plenty has had a problem loading its configuration"); } finally { config.save(); } } }
43,217
0.727052
0.707222
815
52.025768
26.886593
134
false
false
0
0
0
0
0
0
3.692024
false
false
12
cdf4c980319923ba6a9074302bcb9340e2ab6144
16,406,775,107,961
f91f6b9fb68089f9f4f50b944c6095c7bc31092d
/app/src/main/java/capic/com/karttracker/ui/sessiondatas/DatasLocationReceiver.java
00af9c9ce2da3e6a5a9e12c5019b833e155017cf
[]
no_license
capic/KartTracker
https://github.com/capic/KartTracker
96b8d4d8748e819409a92137ddfb5229c85e7e9b
43ad81886a1602e64f528fc5e013ecc978a9bdb5
refs/heads/master
2022-07-11T22:38:12.695000
2017-06-27T07:53:55
2017-06-27T07:53:55
55,363,697
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package capic.com.karttracker.ui.sessiondatas; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; import com.google.android.gms.location.LocationResult; import capic.com.karttracker.services.datas.models.SessionAccelerometerData; import capic.com.karttracker.services.datas.models.SessionData; import capic.com.karttracker.services.datas.models.SessionGpsData; import capic.com.karttracker.utils.Constants; /** * Created by capic on 08/06/2017. */ public class DatasLocationReceiver extends BroadcastReceiver { private SessionDatasFragment mActivity; public DatasLocationReceiver(SessionDatasFragment mActivity) { this.mActivity = mActivity; } @Override public void onReceive(Context context, Intent intent) { final SessionDatasFragment activity = mActivity; if (activity != null) { SessionData sessionData = new SessionData(); if (intent.hasExtra(Constants.BROADCASTER_SESSION_DATA_EXTRA_GPS_NAME)) { sessionData.setMSessionGpsData((SessionGpsData) intent.getSerializableExtra(Constants.BROADCASTER_SESSION_DATA_EXTRA_GPS_NAME)); } else if (intent.hasExtra(Constants.BROADCASTER_SESSION_DATA_EXTRA_ACCELEROMETER_NAME)) { sessionData.setMSessionAccelerometerData((SessionAccelerometerData) intent.getSerializableExtra(Constants.BROADCASTER_SESSION_DATA_EXTRA_ACCELEROMETER_NAME)); } else if (intent.hasExtra(Constants.BROADCASTER_SESSION_DATA_EXTRA_DATAS_NAME)) { sessionData = ((SessionData)intent.getSerializableExtra(Constants.BROADCASTER_SESSION_DATA_EXTRA_DATAS_NAME)); } mActivity.setValues(sessionData); } } }
UTF-8
Java
1,782
java
DatasLocationReceiver.java
Java
[ { "context": "om.karttracker.utils.Constants;\n\n/**\n * Created by capic on 08/06/2017.\n */\n\npublic class DatasLocationRec", "end": 513, "score": 0.9995322823524475, "start": 508, "tag": "USERNAME", "value": "capic" } ]
null
[]
package capic.com.karttracker.ui.sessiondatas; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; import com.google.android.gms.location.LocationResult; import capic.com.karttracker.services.datas.models.SessionAccelerometerData; import capic.com.karttracker.services.datas.models.SessionData; import capic.com.karttracker.services.datas.models.SessionGpsData; import capic.com.karttracker.utils.Constants; /** * Created by capic on 08/06/2017. */ public class DatasLocationReceiver extends BroadcastReceiver { private SessionDatasFragment mActivity; public DatasLocationReceiver(SessionDatasFragment mActivity) { this.mActivity = mActivity; } @Override public void onReceive(Context context, Intent intent) { final SessionDatasFragment activity = mActivity; if (activity != null) { SessionData sessionData = new SessionData(); if (intent.hasExtra(Constants.BROADCASTER_SESSION_DATA_EXTRA_GPS_NAME)) { sessionData.setMSessionGpsData((SessionGpsData) intent.getSerializableExtra(Constants.BROADCASTER_SESSION_DATA_EXTRA_GPS_NAME)); } else if (intent.hasExtra(Constants.BROADCASTER_SESSION_DATA_EXTRA_ACCELEROMETER_NAME)) { sessionData.setMSessionAccelerometerData((SessionAccelerometerData) intent.getSerializableExtra(Constants.BROADCASTER_SESSION_DATA_EXTRA_ACCELEROMETER_NAME)); } else if (intent.hasExtra(Constants.BROADCASTER_SESSION_DATA_EXTRA_DATAS_NAME)) { sessionData = ((SessionData)intent.getSerializableExtra(Constants.BROADCASTER_SESSION_DATA_EXTRA_DATAS_NAME)); } mActivity.setValues(sessionData); } } }
1,782
0.745791
0.741302
43
40.465115
41.44952
174
false
false
0
0
0
0
0
0
0.44186
false
false
12
dbd0a5967fb8104ce3b7ab0c1b78d25762e63520
18,476,949,349,595
32e3f5120e3f9d9299d6e758ae9884efc61c4b39
/wbd/Main.java
ee83313eca0288dac0ccbd63f21c9a19f193900b
[]
no_license
pjanuszewski/WBD_Client
https://github.com/pjanuszewski/WBD_Client
6585fdcf3c9bab397ab2eed34f0de75a2dde6ed4
cf16c0f8b942fe4e0315bc7f57001923cd07ef37
refs/heads/master
2018-12-29T16:45:15.130000
2016-06-13T20:53:35
2016-06-13T20:53:35
58,924,018
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Created by ene on 16.05.16. */ import javax.swing.*; import java.sql.SQLException; public class Main { public static void main(String args[]) throws SQLException{ try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } Window window = new Window(); } }
UTF-8
Java
653
java
Main.java
Java
[ { "context": "/**\n * Created by ene on 16.05.16.\n */\n\nimport javax.swing.*;\nimport ja", "end": 21, "score": 0.9956204891204834, "start": 18, "tag": "USERNAME", "value": "ene" } ]
null
[]
/** * Created by ene on 16.05.16. */ import javax.swing.*; import java.sql.SQLException; public class Main { public static void main(String args[]) throws SQLException{ try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } Window window = new Window(); } }
653
0.603369
0.594181
27
23.185184
21.751181
80
false
false
0
0
0
0
0
0
0.296296
false
false
12
ae545a0bca81831f808be2b02b35a66769fab0f6
21,457,656,662,478
d038de033212c30d4f7e52ff21f29ac35c5b188b
/gamecenter/src/org/robovm/bindings/cocoatouch/gamekit/GKAchievement.java
15a9cdd3ea59a87691cf50222f0d47fef23eef6f
[ "Apache-2.0" ]
permissive
SophiaHadash/robovm-ios-bindings
https://github.com/SophiaHadash/robovm-ios-bindings
9fde177e9106502aae5b8cf89d1ff128dba9fe63
5a6dab6cbbbafed12680525f5274264564cc13a5
refs/heads/master
2021-05-27T01:41:33.225000
2013-12-01T15:13:55
2013-12-01T15:13:55
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.robovm.bindings.cocoatouch.gamekit; import org.robovm.bindings.cocoatouch.blocks.VoidNSArrayNSErrorBlock; import org.robovm.bindings.cocoatouch.blocks.VoidNSErrorBlock; import org.robovm.cocoatouch.foundation.NSArray; import org.robovm.cocoatouch.foundation.NSDate; import org.robovm.cocoatouch.foundation.NSObject; import org.robovm.objc.ObjCClass; import org.robovm.objc.ObjCRuntime; import org.robovm.objc.ObjCSuper; import org.robovm.objc.Selector; import org.robovm.objc.annotation.NativeClass; import org.robovm.rt.bro.annotation.Bridge; import org.robovm.rt.bro.annotation.Library; @Library("GameKit") @NativeClass public class GKAchievement extends NSObject { private static final ObjCClass objCClass = ObjCClass.getByType(GKAchievement.class); static{ ObjCRuntime.bind(GKAchievement.class); } //- (id)initWithIdentifier:(NSString *)identifier; private static final Selector initWithIdentifier = Selector.register("initWithIdentifier:"); @Bridge private native static void objc_initWithIdentifier(GKAchievement __self__, Selector __cmd__, String identifier); @Bridge private native static void objc_initWithIdentifierSuper(ObjCSuper __super__, Selector __cmd__, String identifier); /** * Designate initializer * @param identifier */ public GKAchievement(String identifier){ if(customClass){ objc_initWithIdentifierSuper(getSuper(), initWithIdentifier, identifier); }else{ objc_initWithIdentifier(this, initWithIdentifier, identifier); } } //- (id)initWithIdentifier:(NSString *)identifier forPlayer:(NSString *)playerID __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_7_0); private static final Selector initWithIdentifier$forPlayer = Selector.register("initWithIdentifier:forPlayer:"); @Bridge private native static void objc_initWithIdentifier(GKAchievement __self__, Selector __cmd__, String identifier, String playerID); @Bridge private native static void objc_initWithIdentifierSuper(ObjCSuper __super__, Selector __cmd__, String identifier, String playerID); /** * Will initialize the achievement for a player. Can be used for submitting participant achievements when ending a turn-based match. * @param identifier * @param playerID */ public GKAchievement(String identifier, String playerID){ if(customClass){ objc_initWithIdentifierSuper(getSuper(), initWithIdentifier$forPlayer, identifier, playerID); }else{ objc_initWithIdentifier(this, initWithIdentifier$forPlayer, identifier, playerID); } } //@property(copy, NS_NONATOMIC_IOSONLY) NSString *identifier; private static final Selector identifier = Selector.register("identifier"); @Bridge private native static String objc_getIdentifier(GKAchievement __self__, Selector __cmd__); @Bridge private native static String objc_getIdentifierSuper(ObjCSuper __super__, Selector __cmd__); /** * Get the Achievement identifier * @return */ public String getIdentifier(){ if(customClass){ return objc_getIdentifierSuper(getSuper(), identifier); }else{ return objc_getIdentifier(this, identifier); } } //@property(assign, NS_NONATOMIC_IOSONLY) double percentComplete; private static final Selector percentComplete = Selector.register("percentComplete"); @Bridge private native static double objc_getPercentComplete(GKAchievement __self__, Selector __cmd__); @Bridge private native static double objc_getPercentCompleteSuper(ObjCSuper __super__, Selector __cmd__); /** * Get the Percentage of achievement completion. * @return */ public double getPercentComplete(){ if(customClass){ return objc_getPercentCompleteSuper(getSuper(), identifier); }else{ return objc_getPercentComplete(this, identifier); } } private static final Selector setPercentComplete = Selector.register("setPercentComplete:"); @Bridge private native static void objc_setPercentComplete(GKAchievement __self__, Selector __cmd__, double percentComplete); @Bridge private native static void objc_setPercentCompleteSuper(ObjCSuper __super__, Selector __cmd__, double percentComplete); /** * Set the Percentage of achievement completion. * @param percentComplete */ public void setPercentComplete(double percentComplete){ if(customClass){ objc_setPercentCompleteSuper(getSuper(), setPercentComplete, percentComplete); }else{ objc_setPercentComplete(this, setPercentComplete, percentComplete); } } //@property(readonly, getter=isCompleted, NS_NONATOMIC_IOSONLY) BOOL completed; private static final Selector isCompleted = Selector.register("isCompleted"); @Bridge private native static boolean objc_isCompleted(GKAchievement __self__, Selector __cmd__); @Bridge private native static boolean objc_isCompletedSuper(ObjCSuper __super__, Selector __cmd__); /** * Set to NO until percentComplete = 100. * @return */ public boolean isCompleted(){ if(customClass){ return objc_isCompletedSuper(getSuper(), isCompleted); }else{ return objc_isCompleted(this, isCompleted); } } //@property(copy, readonly, NS_NONATOMIC_IOSONLY) NSDate *lastReportedDate; private static final Selector lastReportedDate = Selector.register("lastReportedDate"); @Bridge private native static NSDate objc_lastReportedDate(GKAchievement __self__, Selector __cmd__); @Bridge private native static NSDate objc_lastReportedDateSuper(ObjCSuper __super__, Selector __cmd__); /** * Date the achievement was last reported. Read-only. Created at initialization * @return */ public NSDate getLastReportedDate(){ if(customClass){ return objc_lastReportedDateSuper(getSuper(), lastReportedDate); }else{ return objc_lastReportedDate(this, lastReportedDate); } } //@property(assign, NS_NONATOMIC_IOSONLY) BOOL showsCompletionBanner private static final Selector setShowsCompletionBanner = Selector.register("setShowsCompletionBanner:"); @Bridge private native static void objc_setShowsCompletionBanner(GKAchievement __self__, Selector __cmd__, boolean showsCompletionBanner); @Bridge private native static void objc_setShowsCompletionBannerSuper(ObjCSuper __super__, Selector __cmd__, boolean showsCompletionBanner); /** * A banner will be momentarily displayed after reporting a completed achievement if set to true * @param showsCompletionBanner */ public void setShowsCompletionBanner(boolean showsCompletionBanner){ if(customClass){ objc_setShowsCompletionBannerSuper(getSuper(), setShowsCompletionBanner, showsCompletionBanner); }else{ objc_setShowsCompletionBanner(this, setShowsCompletionBanner, showsCompletionBanner); } } //- (void)reportAchievementWithCompletionHandler:(void(^)(NSError *error))completionHandler __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_8,__MAC_NA,__IPHONE_4_1,__IPHONE_7_0); private static final Selector reportAchievementWithCompletionHandler = Selector.register("reportAchievementWithCompletionHandler:"); @Bridge private native static void objc_reportAchievement(GKAchievement __self__, Selector __cmd__, VoidNSErrorBlock completionHandler); @Bridge private native static void objc_reportAchievementSuper(ObjCSuper __super__, Selector __cmd__, VoidNSErrorBlock completionHandler); /** * Report this achievement to the server. Percent complete is required. Points, completed state are set based on percentComplete. isHidden is set to NO anytime this method is invoqued. Date is optional. Error will be nil on success. * Possible reasons for error: * 1. Local player not authenticated * 2. Communications failure * 3. Reported Achievement does not exist * @param completionHandler */ @Deprecated public void reportAchievement(VoidNSErrorBlock completionHandler){ if(customClass){ objc_reportAchievementSuper(getSuper(), reportAchievementWithCompletionHandler, completionHandler); }else{ objc_reportAchievement(this, reportAchievementWithCompletionHandler, completionHandler); } } //+ (void)reportAchievements:(NSArray *)achievements withCompletionHandler:(void(^)(NSError *error))completionHandler __OSX_AVAILABLE_STARTING(__MAC_10_8,__IPHONE_6_0); private static final Selector reportAchievements$withCompletionHandler = Selector.register("reportAchievements:withCompletionHandler:"); @SuppressWarnings("rawtypes") @Bridge private native static void objc_reportAchievements(ObjCClass __self__, Selector __cmd__, NSArray achievements, VoidNSErrorBlock completionHandler); /** * Report an array of achievements to the server. Percent complete is required. Points, completed state are set based on percentComplete. isHidden is set to NO anytime this method is invoked. Date is optional. Error will be nil on success. * Possible reasons for error: * 1. Local player not authenticated * 2. Communications failure * 3. Reported Achievement does not exist * @param achievements * @param completionHandler */ @SuppressWarnings("rawtypes") public static void reportAchievements(NSArray achievements, VoidNSErrorBlock completionHandler){ objc_reportAchievements(objCClass, reportAchievements$withCompletionHandler, achievements, completionHandler); } //+ (void)loadAchievementsWithCompletionHandler:(void(^)(NSArray *achievements, NSError *error))completionHandler; private static final Selector loadAchievementsWithCompletionHandler = Selector.register("loadAchievementsWithCompletionHandler:"); @Bridge private native static void objc_loadAchievements(ObjCClass __self__, Selector __cmd__, VoidNSArrayNSErrorBlock completionHandler); /** * Asynchronously load all achievements for the local player * @param completionHandler */ public static void loadAchievements(VoidNSArrayNSErrorBlock completionHandler){ objc_loadAchievements(objCClass, loadAchievementsWithCompletionHandler, completionHandler); } //+ (void)resetAchievementsWithCompletionHandler:(void(^)(NSError *error))completionHandler; private static final Selector resetAchievementsWithCompletionHandler = Selector.register("resetAchievementsWithCompletionHandler:"); @Bridge private native static void objc_resetAchievements(ObjCClass __self__, Selector __cmd__, VoidNSErrorBlock completionHandler); /** * Reset the achievements progress for the local player. All the entries for the local player are removed from the server. Error will be nil on success. * Possible reasons for error: * 1. Local player not authenticated * 2. Communications failure * @param completionHandler */ public static void resetAchievements(VoidNSErrorBlock completionHandler){ objc_resetAchievements(objCClass, resetAchievementsWithCompletionHandler, completionHandler); } }
UTF-8
Java
11,201
java
GKAchievement.java
Java
[]
null
[]
package org.robovm.bindings.cocoatouch.gamekit; import org.robovm.bindings.cocoatouch.blocks.VoidNSArrayNSErrorBlock; import org.robovm.bindings.cocoatouch.blocks.VoidNSErrorBlock; import org.robovm.cocoatouch.foundation.NSArray; import org.robovm.cocoatouch.foundation.NSDate; import org.robovm.cocoatouch.foundation.NSObject; import org.robovm.objc.ObjCClass; import org.robovm.objc.ObjCRuntime; import org.robovm.objc.ObjCSuper; import org.robovm.objc.Selector; import org.robovm.objc.annotation.NativeClass; import org.robovm.rt.bro.annotation.Bridge; import org.robovm.rt.bro.annotation.Library; @Library("GameKit") @NativeClass public class GKAchievement extends NSObject { private static final ObjCClass objCClass = ObjCClass.getByType(GKAchievement.class); static{ ObjCRuntime.bind(GKAchievement.class); } //- (id)initWithIdentifier:(NSString *)identifier; private static final Selector initWithIdentifier = Selector.register("initWithIdentifier:"); @Bridge private native static void objc_initWithIdentifier(GKAchievement __self__, Selector __cmd__, String identifier); @Bridge private native static void objc_initWithIdentifierSuper(ObjCSuper __super__, Selector __cmd__, String identifier); /** * Designate initializer * @param identifier */ public GKAchievement(String identifier){ if(customClass){ objc_initWithIdentifierSuper(getSuper(), initWithIdentifier, identifier); }else{ objc_initWithIdentifier(this, initWithIdentifier, identifier); } } //- (id)initWithIdentifier:(NSString *)identifier forPlayer:(NSString *)playerID __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_7_0); private static final Selector initWithIdentifier$forPlayer = Selector.register("initWithIdentifier:forPlayer:"); @Bridge private native static void objc_initWithIdentifier(GKAchievement __self__, Selector __cmd__, String identifier, String playerID); @Bridge private native static void objc_initWithIdentifierSuper(ObjCSuper __super__, Selector __cmd__, String identifier, String playerID); /** * Will initialize the achievement for a player. Can be used for submitting participant achievements when ending a turn-based match. * @param identifier * @param playerID */ public GKAchievement(String identifier, String playerID){ if(customClass){ objc_initWithIdentifierSuper(getSuper(), initWithIdentifier$forPlayer, identifier, playerID); }else{ objc_initWithIdentifier(this, initWithIdentifier$forPlayer, identifier, playerID); } } //@property(copy, NS_NONATOMIC_IOSONLY) NSString *identifier; private static final Selector identifier = Selector.register("identifier"); @Bridge private native static String objc_getIdentifier(GKAchievement __self__, Selector __cmd__); @Bridge private native static String objc_getIdentifierSuper(ObjCSuper __super__, Selector __cmd__); /** * Get the Achievement identifier * @return */ public String getIdentifier(){ if(customClass){ return objc_getIdentifierSuper(getSuper(), identifier); }else{ return objc_getIdentifier(this, identifier); } } //@property(assign, NS_NONATOMIC_IOSONLY) double percentComplete; private static final Selector percentComplete = Selector.register("percentComplete"); @Bridge private native static double objc_getPercentComplete(GKAchievement __self__, Selector __cmd__); @Bridge private native static double objc_getPercentCompleteSuper(ObjCSuper __super__, Selector __cmd__); /** * Get the Percentage of achievement completion. * @return */ public double getPercentComplete(){ if(customClass){ return objc_getPercentCompleteSuper(getSuper(), identifier); }else{ return objc_getPercentComplete(this, identifier); } } private static final Selector setPercentComplete = Selector.register("setPercentComplete:"); @Bridge private native static void objc_setPercentComplete(GKAchievement __self__, Selector __cmd__, double percentComplete); @Bridge private native static void objc_setPercentCompleteSuper(ObjCSuper __super__, Selector __cmd__, double percentComplete); /** * Set the Percentage of achievement completion. * @param percentComplete */ public void setPercentComplete(double percentComplete){ if(customClass){ objc_setPercentCompleteSuper(getSuper(), setPercentComplete, percentComplete); }else{ objc_setPercentComplete(this, setPercentComplete, percentComplete); } } //@property(readonly, getter=isCompleted, NS_NONATOMIC_IOSONLY) BOOL completed; private static final Selector isCompleted = Selector.register("isCompleted"); @Bridge private native static boolean objc_isCompleted(GKAchievement __self__, Selector __cmd__); @Bridge private native static boolean objc_isCompletedSuper(ObjCSuper __super__, Selector __cmd__); /** * Set to NO until percentComplete = 100. * @return */ public boolean isCompleted(){ if(customClass){ return objc_isCompletedSuper(getSuper(), isCompleted); }else{ return objc_isCompleted(this, isCompleted); } } //@property(copy, readonly, NS_NONATOMIC_IOSONLY) NSDate *lastReportedDate; private static final Selector lastReportedDate = Selector.register("lastReportedDate"); @Bridge private native static NSDate objc_lastReportedDate(GKAchievement __self__, Selector __cmd__); @Bridge private native static NSDate objc_lastReportedDateSuper(ObjCSuper __super__, Selector __cmd__); /** * Date the achievement was last reported. Read-only. Created at initialization * @return */ public NSDate getLastReportedDate(){ if(customClass){ return objc_lastReportedDateSuper(getSuper(), lastReportedDate); }else{ return objc_lastReportedDate(this, lastReportedDate); } } //@property(assign, NS_NONATOMIC_IOSONLY) BOOL showsCompletionBanner private static final Selector setShowsCompletionBanner = Selector.register("setShowsCompletionBanner:"); @Bridge private native static void objc_setShowsCompletionBanner(GKAchievement __self__, Selector __cmd__, boolean showsCompletionBanner); @Bridge private native static void objc_setShowsCompletionBannerSuper(ObjCSuper __super__, Selector __cmd__, boolean showsCompletionBanner); /** * A banner will be momentarily displayed after reporting a completed achievement if set to true * @param showsCompletionBanner */ public void setShowsCompletionBanner(boolean showsCompletionBanner){ if(customClass){ objc_setShowsCompletionBannerSuper(getSuper(), setShowsCompletionBanner, showsCompletionBanner); }else{ objc_setShowsCompletionBanner(this, setShowsCompletionBanner, showsCompletionBanner); } } //- (void)reportAchievementWithCompletionHandler:(void(^)(NSError *error))completionHandler __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_8,__MAC_NA,__IPHONE_4_1,__IPHONE_7_0); private static final Selector reportAchievementWithCompletionHandler = Selector.register("reportAchievementWithCompletionHandler:"); @Bridge private native static void objc_reportAchievement(GKAchievement __self__, Selector __cmd__, VoidNSErrorBlock completionHandler); @Bridge private native static void objc_reportAchievementSuper(ObjCSuper __super__, Selector __cmd__, VoidNSErrorBlock completionHandler); /** * Report this achievement to the server. Percent complete is required. Points, completed state are set based on percentComplete. isHidden is set to NO anytime this method is invoqued. Date is optional. Error will be nil on success. * Possible reasons for error: * 1. Local player not authenticated * 2. Communications failure * 3. Reported Achievement does not exist * @param completionHandler */ @Deprecated public void reportAchievement(VoidNSErrorBlock completionHandler){ if(customClass){ objc_reportAchievementSuper(getSuper(), reportAchievementWithCompletionHandler, completionHandler); }else{ objc_reportAchievement(this, reportAchievementWithCompletionHandler, completionHandler); } } //+ (void)reportAchievements:(NSArray *)achievements withCompletionHandler:(void(^)(NSError *error))completionHandler __OSX_AVAILABLE_STARTING(__MAC_10_8,__IPHONE_6_0); private static final Selector reportAchievements$withCompletionHandler = Selector.register("reportAchievements:withCompletionHandler:"); @SuppressWarnings("rawtypes") @Bridge private native static void objc_reportAchievements(ObjCClass __self__, Selector __cmd__, NSArray achievements, VoidNSErrorBlock completionHandler); /** * Report an array of achievements to the server. Percent complete is required. Points, completed state are set based on percentComplete. isHidden is set to NO anytime this method is invoked. Date is optional. Error will be nil on success. * Possible reasons for error: * 1. Local player not authenticated * 2. Communications failure * 3. Reported Achievement does not exist * @param achievements * @param completionHandler */ @SuppressWarnings("rawtypes") public static void reportAchievements(NSArray achievements, VoidNSErrorBlock completionHandler){ objc_reportAchievements(objCClass, reportAchievements$withCompletionHandler, achievements, completionHandler); } //+ (void)loadAchievementsWithCompletionHandler:(void(^)(NSArray *achievements, NSError *error))completionHandler; private static final Selector loadAchievementsWithCompletionHandler = Selector.register("loadAchievementsWithCompletionHandler:"); @Bridge private native static void objc_loadAchievements(ObjCClass __self__, Selector __cmd__, VoidNSArrayNSErrorBlock completionHandler); /** * Asynchronously load all achievements for the local player * @param completionHandler */ public static void loadAchievements(VoidNSArrayNSErrorBlock completionHandler){ objc_loadAchievements(objCClass, loadAchievementsWithCompletionHandler, completionHandler); } //+ (void)resetAchievementsWithCompletionHandler:(void(^)(NSError *error))completionHandler; private static final Selector resetAchievementsWithCompletionHandler = Selector.register("resetAchievementsWithCompletionHandler:"); @Bridge private native static void objc_resetAchievements(ObjCClass __self__, Selector __cmd__, VoidNSErrorBlock completionHandler); /** * Reset the achievements progress for the local player. All the entries for the local player are removed from the server. Error will be nil on success. * Possible reasons for error: * 1. Local player not authenticated * 2. Communications failure * @param completionHandler */ public static void resetAchievements(VoidNSErrorBlock completionHandler){ objc_resetAchievements(objCClass, resetAchievementsWithCompletionHandler, completionHandler); } }
11,201
0.737523
0.735291
241
45.477177
48.262257
243
false
false
0
0
0
0
0
0
1.058091
false
false
12
840638742b832aff7f322ef6c22104da31bd5992
27,693,949,155,906
4a5bda70774e3a19e788da88150e72d42c9b07f1
/src/main/java/org/springframework/samples/flatbook/model/pojos/PerformanceTestInfo.java
d67ef433cf75731562a3b177e966418f225bc233
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
permissive
dp2-g1-13/DP2-G1-13
https://github.com/dp2-g1-13/DP2-G1-13
7eb899aaba021e1f584782fcefec2f70715b5567
f6283d36101d9defa83716cea5340ce66d551054
refs/heads/master
2022-09-22T18:25:00.285000
2020-06-02T07:20:03
2020-06-02T07:20:03
242,989,272
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.springframework.samples.flatbook.model.pojos; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonPropertyOrder({ "flatId", "hostId", "tenantId" }) public class PerformanceTestInfo { @JsonProperty("flatId") private Integer flatId; @JsonProperty("hostId") private String hostId; @JsonProperty("tenantId") private String tenantId; @JsonProperty("requestId") private Integer requestId; @JsonProperty("reviewId") private Integer reviewId; @JsonProperty("advertisementId") private Integer advertisementId; @JsonProperty("advertisementId") public Integer getAdvertisementId() { return this.advertisementId; } @JsonProperty("advertisementId") public void setAdvertisementId(final Integer advertisementId) { this.advertisementId = advertisementId; } @JsonProperty("reviewId") public Integer getReviewId() { return this.reviewId; } @JsonProperty("reviewId") public void setReviewId(final Integer reviewId) { this.reviewId = reviewId; } @JsonProperty("requestId") public Integer getRequestId() { return this.requestId; } @JsonProperty("requestId") public void setRequestId(final Integer requestId) { this.requestId = requestId; } @JsonProperty("flatId") public Integer getFlatId() { return this.flatId; } @JsonProperty("flatId") public void setFlatId(final Integer flatId) { this.flatId = flatId; } @JsonProperty("hostId") public String getHostId() { return this.hostId; } @JsonProperty("hostId") public void setHostId(final String hostId) { this.hostId = hostId; } @JsonProperty("tenantId") public String getTenantId() { return this.tenantId; } @JsonProperty("tenantId") public void setTenantId(final String tenantId) { this.tenantId = tenantId; } }
UTF-8
Java
1,810
java
PerformanceTestInfo.java
Java
[]
null
[]
package org.springframework.samples.flatbook.model.pojos; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonPropertyOrder({ "flatId", "hostId", "tenantId" }) public class PerformanceTestInfo { @JsonProperty("flatId") private Integer flatId; @JsonProperty("hostId") private String hostId; @JsonProperty("tenantId") private String tenantId; @JsonProperty("requestId") private Integer requestId; @JsonProperty("reviewId") private Integer reviewId; @JsonProperty("advertisementId") private Integer advertisementId; @JsonProperty("advertisementId") public Integer getAdvertisementId() { return this.advertisementId; } @JsonProperty("advertisementId") public void setAdvertisementId(final Integer advertisementId) { this.advertisementId = advertisementId; } @JsonProperty("reviewId") public Integer getReviewId() { return this.reviewId; } @JsonProperty("reviewId") public void setReviewId(final Integer reviewId) { this.reviewId = reviewId; } @JsonProperty("requestId") public Integer getRequestId() { return this.requestId; } @JsonProperty("requestId") public void setRequestId(final Integer requestId) { this.requestId = requestId; } @JsonProperty("flatId") public Integer getFlatId() { return this.flatId; } @JsonProperty("flatId") public void setFlatId(final Integer flatId) { this.flatId = flatId; } @JsonProperty("hostId") public String getHostId() { return this.hostId; } @JsonProperty("hostId") public void setHostId(final String hostId) { this.hostId = hostId; } @JsonProperty("tenantId") public String getTenantId() { return this.tenantId; } @JsonProperty("tenantId") public void setTenantId(final String tenantId) { this.tenantId = tenantId; } }
1,810
0.751381
0.751381
85
20.282352
16.965441
64
false
false
0
0
0
0
0
0
1.2
false
false
12
95a07569975d05d1d483fe1fe294392afd799720
6,700,149,007,793
932df5f5782340ff10def6c27845359afc541b67
/day3.1/src/Course.java
b3bc871332827847dcb73e8cb58d01a27efac1e3
[]
no_license
mertaltunn/Kodlama.io_odev_3.2
https://github.com/mertaltunn/Kodlama.io_odev_3.2
d37d647cb5a4020cdd90cf3601918656a2dd45c7
b109dbc4f7d27d332a7b13faab21a1c79d6e839a
refs/heads/main
2023-04-28T23:20:58.764000
2021-05-08T17:22:17
2021-05-08T17:22:17
363,464,936
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Course { private String name; private String id;// Üstünde hiçbir işlem yapılmayacağını düşünerek "String" türünde yaratıldı. private String assignments; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getAssignments() { return assignments; } public void setAssignments(String assignments) { this.assignments = assignments; } public Course(String name, String id) { this.name = name; this.id = id; } }
ISO-8859-9
Java
617
java
Course.java
Java
[]
null
[]
public class Course { private String name; private String id;// Üstünde hiçbir işlem yapılmayacağını düşünerek "String" türünde yaratıldı. private String assignments; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getAssignments() { return assignments; } public void setAssignments(String assignments) { this.assignments = assignments; } public Course(String name, String id) { this.name = name; this.id = id; } }
617
0.699336
0.699336
34
16.67647
19.572971
96
false
false
0
0
0
0
0
0
1.323529
false
false
12
978c26833f1ad7384bb86cbf234352f55d0372b9
94,489,305,656
fe794e066121691a50e81d2ad3dd2d7bdb84646d
/src/main/java/com/kargo/core/PageBase.java
e799258b83e840499053d70fa2fcfe135c0118d8
[]
no_license
waseyrabby/Kargo
https://github.com/waseyrabby/Kargo
8ea98ad7b091e8235ca2e288407a04b43d35d29e
c37bc438dc8cabdaed3eb8193255e05cf397b71d
refs/heads/master
2020-09-17T05:07:19.090000
2016-08-18T06:47:16
2016-08-18T06:47:16
65,971,443
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.kargo.core; import com.google.common.base.Function; import org.openqa.selenium.*; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.interactions.HasInputDevices; import org.openqa.selenium.interactions.Mouse; import org.openqa.selenium.internal.Locatable; import org.openqa.selenium.support.ui.FluentWait; import org.openqa.selenium.support.ui.Wait; import java.util.Set; import java.util.concurrent.TimeUnit; /** * Created by wasey on 8/16/16. */ public class PageBase { private WebDriver driver = null; private boolean acceptNextAlert = true; public PageBase(WebDriver driver) { this.driver = driver;} public PageBase() { } public void delayFor(int secInMili){ try { Thread.sleep(secInMili); } catch (InterruptedException e) { e.printStackTrace(); } } public WebElement waitForElement(final By locator) { return waitForElement(locator,20); } public WebElement waitForElement(final By locator, int timeToWaitInSec) { Wait<WebDriver> wait = new FluentWait<WebDriver>(driver) .withTimeout(timeToWaitInSec, TimeUnit.SECONDS) .pollingEvery(100, TimeUnit.MILLISECONDS) .ignoring(NoSuchElementException.class); return wait.until(new Function<WebDriver, WebElement>() { public WebElement apply(WebDriver driver1) { return driver1.findElement(locator); } }); } public WebElement waitForElementDisplayed(final By locator) { return waitForElementDisplayed(locator,20); } public WebElement waitForElementDisplayed(final By locator,int timeToWaitInSec) { Wait<WebDriver> wait = new FluentWait<WebDriver>(driver) .withTimeout(timeToWaitInSec, TimeUnit.SECONDS) .pollingEvery(100, TimeUnit.MILLISECONDS) .ignoring(NoSuchElementException.class); return wait.until(new Function<WebDriver, WebElement>() { public WebElement apply(WebDriver driver1) { WebElement element = driver1.findElement(locator); if (element != null && element.isDisplayed()) { highlight(element); return element; } return null; } }); } public WebElement waitForElementEnabled(final By locator) { return waitForElementEnabled(locator,20); } public WebElement waitForElementEnabled(final By locator,int timeToWaitInSec) { Wait<WebDriver> wait = new FluentWait<WebDriver>(driver) .withTimeout(timeToWaitInSec, TimeUnit.SECONDS) .pollingEvery(100, TimeUnit.MILLISECONDS) .ignoring(NoSuchElementException.class); return wait.until(new Function<WebDriver, WebElement>() { public WebElement apply(WebDriver driver1) { WebElement element = driver1.findElement(locator); if (element != null && element.isEnabled()) { return element; } return null; } }); } public void jsClick(WebElement element){ JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("arguments[0].click()", element); } public void highlight(WebElement element) { for (int i = 0; i < 2; i++) { JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript( "arguments[0].setAttribute('style', arguments[1]);", element, "border: 2px solid yellow;"); delayFor(200); js.executeScript( "arguments[0].setAttribute('style', arguments[1]);", element, ""); delayFor(200); } } public void jsSetAttribute(WebElement element, String attributeName, String attributeValue){ JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("arguments[0].setAttribute(arguments[1],arguments[2])",element, attributeName, attributeValue); } public void jsScrollElementIntoView(WebElement element){ ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", element); } public void hoverItem(WebElement element){ Actions actions = new Actions(driver); actions.moveToElement(element); actions.perform(); } public void hoverItemEx(WebElement element){ Locatable hoverItem = (Locatable) element; Mouse mouse = ((HasInputDevices) driver).getMouse(); mouse.mouseMove(hoverItem.getCoordinates()); } public String switchWindowByTitle(String titleToMatch) { String currentWindow = driver.getWindowHandle(); Set<String> windows = driver.getWindowHandles(); for (String item : windows) { System.out.println(item); if (item.contentEquals(item)) { driver.switchTo().window(item); currentWindow = item; String title = driver.getTitle(); if (title.contains(titleToMatch)) { break; } } } return currentWindow; } private boolean isElementPresent(By by) { try { driver.findElement(by); return true; } catch (NoSuchElementException e) { return false; } } private boolean isAlertPresent() { try { driver.switchTo().alert(); return true; } catch (NoAlertPresentException e) { return false; } } private String closeAlertAndGetItsText() { try { Alert alert = driver.switchTo().alert(); String alertText = alert.getText(); if (acceptNextAlert) { alert.accept(); } else { alert.dismiss(); } return alertText; } finally { acceptNextAlert = true; } } }
UTF-8
Java
6,165
java
PageBase.java
Java
[ { "context": " java.util.concurrent.TimeUnit;\n\n/**\n * Created by wasey on 8/16/16.\n */\npublic class PageBase {\n\n priv", "end": 474, "score": 0.9996636509895325, "start": 469, "tag": "USERNAME", "value": "wasey" } ]
null
[]
package com.kargo.core; import com.google.common.base.Function; import org.openqa.selenium.*; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.interactions.HasInputDevices; import org.openqa.selenium.interactions.Mouse; import org.openqa.selenium.internal.Locatable; import org.openqa.selenium.support.ui.FluentWait; import org.openqa.selenium.support.ui.Wait; import java.util.Set; import java.util.concurrent.TimeUnit; /** * Created by wasey on 8/16/16. */ public class PageBase { private WebDriver driver = null; private boolean acceptNextAlert = true; public PageBase(WebDriver driver) { this.driver = driver;} public PageBase() { } public void delayFor(int secInMili){ try { Thread.sleep(secInMili); } catch (InterruptedException e) { e.printStackTrace(); } } public WebElement waitForElement(final By locator) { return waitForElement(locator,20); } public WebElement waitForElement(final By locator, int timeToWaitInSec) { Wait<WebDriver> wait = new FluentWait<WebDriver>(driver) .withTimeout(timeToWaitInSec, TimeUnit.SECONDS) .pollingEvery(100, TimeUnit.MILLISECONDS) .ignoring(NoSuchElementException.class); return wait.until(new Function<WebDriver, WebElement>() { public WebElement apply(WebDriver driver1) { return driver1.findElement(locator); } }); } public WebElement waitForElementDisplayed(final By locator) { return waitForElementDisplayed(locator,20); } public WebElement waitForElementDisplayed(final By locator,int timeToWaitInSec) { Wait<WebDriver> wait = new FluentWait<WebDriver>(driver) .withTimeout(timeToWaitInSec, TimeUnit.SECONDS) .pollingEvery(100, TimeUnit.MILLISECONDS) .ignoring(NoSuchElementException.class); return wait.until(new Function<WebDriver, WebElement>() { public WebElement apply(WebDriver driver1) { WebElement element = driver1.findElement(locator); if (element != null && element.isDisplayed()) { highlight(element); return element; } return null; } }); } public WebElement waitForElementEnabled(final By locator) { return waitForElementEnabled(locator,20); } public WebElement waitForElementEnabled(final By locator,int timeToWaitInSec) { Wait<WebDriver> wait = new FluentWait<WebDriver>(driver) .withTimeout(timeToWaitInSec, TimeUnit.SECONDS) .pollingEvery(100, TimeUnit.MILLISECONDS) .ignoring(NoSuchElementException.class); return wait.until(new Function<WebDriver, WebElement>() { public WebElement apply(WebDriver driver1) { WebElement element = driver1.findElement(locator); if (element != null && element.isEnabled()) { return element; } return null; } }); } public void jsClick(WebElement element){ JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("arguments[0].click()", element); } public void highlight(WebElement element) { for (int i = 0; i < 2; i++) { JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript( "arguments[0].setAttribute('style', arguments[1]);", element, "border: 2px solid yellow;"); delayFor(200); js.executeScript( "arguments[0].setAttribute('style', arguments[1]);", element, ""); delayFor(200); } } public void jsSetAttribute(WebElement element, String attributeName, String attributeValue){ JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("arguments[0].setAttribute(arguments[1],arguments[2])",element, attributeName, attributeValue); } public void jsScrollElementIntoView(WebElement element){ ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", element); } public void hoverItem(WebElement element){ Actions actions = new Actions(driver); actions.moveToElement(element); actions.perform(); } public void hoverItemEx(WebElement element){ Locatable hoverItem = (Locatable) element; Mouse mouse = ((HasInputDevices) driver).getMouse(); mouse.mouseMove(hoverItem.getCoordinates()); } public String switchWindowByTitle(String titleToMatch) { String currentWindow = driver.getWindowHandle(); Set<String> windows = driver.getWindowHandles(); for (String item : windows) { System.out.println(item); if (item.contentEquals(item)) { driver.switchTo().window(item); currentWindow = item; String title = driver.getTitle(); if (title.contains(titleToMatch)) { break; } } } return currentWindow; } private boolean isElementPresent(By by) { try { driver.findElement(by); return true; } catch (NoSuchElementException e) { return false; } } private boolean isAlertPresent() { try { driver.switchTo().alert(); return true; } catch (NoAlertPresentException e) { return false; } } private String closeAlertAndGetItsText() { try { Alert alert = driver.switchTo().alert(); String alertText = alert.getText(); if (acceptNextAlert) { alert.accept(); } else { alert.dismiss(); } return alertText; } finally { acceptNextAlert = true; } } }
6,165
0.59708
0.589943
193
30.943005
25.096537
120
false
false
0
0
0
0
0
0
0.53886
false
false
12
73f028d2bc65d8202f31d980bf95ee71dac717bd
5,952,824,708,562
c73e0e4c2e510af031e5ad22ed655083af68e3ce
/src/main/java/util/DataTransformUtil.java
5358d13544bfac6579dd6ec84ae7e347dccb3157
[]
no_license
48183811/fdyt
https://github.com/48183811/fdyt
5cdd55cb21961565bda4b6352ecb163c5bf95d38
f7f627c67bf243ab96b7350c28691e427359714a
refs/heads/master
2022-09-01T03:11:44.496000
2020-05-29T08:17:10
2020-05-29T08:17:10
267,505,233
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package util; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.OutputStream; import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; //数据校验工具类 public class DataTransformUtil { /** * 校验宗地附件的文件类型 * @param fileType 文件类型 * @return 文件类型的类别序号,当不存在/错误时返回“-1” */ public static String checkLandEnclosureFileType(String fileType){ if (StringUtil.isEmpty(fileType)){ return "-1"; } if (fileType.equals("权利人身份证明及其他材料")){ return "1"; } if (fileType.equals("实景照片")){ return "2"; } if (fileType.equals("户口本")){ return "3"; } if (fileType.equals("土地来源证明材料")){ return "4"; } if (fileType.equals("房屋合法产权证明(房产证)") || fileType.equals("房屋合法产权证明(房产证)")){ return "5"; } if (fileType.equals("指界通知书")){ return "6"; } if (fileType.equals("房屋调查表")){ return "7"; } if (fileType.equals("地籍调查表")){ return "8"; } if (fileType.equals("界址点成果表")){ return "9"; } if (fileType.equals("宗地图")){ return "10"; } if (fileType.equals("房产分户图")){ return "11"; } if (fileType.equals("不动产测量报告书")){ return "12"; } return "-1"; } /** * 将土规_建设用地管制区代码转换成名称 * @param code 建设用地管制区代码 * @return 建设用地管制区名称 */ public static String jconstructionLandControlArea_transform(String code){ String str = StringUtil.removeBeginAndEnd(code," "); if (str.equals("010")){ return "允许建设区"; } if (str.equals("020")){ return "有条件建设区"; } if (str.equals("030")){ return "限制建设区"; } if (str.equals("040")){ return "禁止建设区"; } return str; } }
UTF-8
Java
2,393
java
DataTransformUtil.java
Java
[]
null
[]
package util; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.OutputStream; import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; //数据校验工具类 public class DataTransformUtil { /** * 校验宗地附件的文件类型 * @param fileType 文件类型 * @return 文件类型的类别序号,当不存在/错误时返回“-1” */ public static String checkLandEnclosureFileType(String fileType){ if (StringUtil.isEmpty(fileType)){ return "-1"; } if (fileType.equals("权利人身份证明及其他材料")){ return "1"; } if (fileType.equals("实景照片")){ return "2"; } if (fileType.equals("户口本")){ return "3"; } if (fileType.equals("土地来源证明材料")){ return "4"; } if (fileType.equals("房屋合法产权证明(房产证)") || fileType.equals("房屋合法产权证明(房产证)")){ return "5"; } if (fileType.equals("指界通知书")){ return "6"; } if (fileType.equals("房屋调查表")){ return "7"; } if (fileType.equals("地籍调查表")){ return "8"; } if (fileType.equals("界址点成果表")){ return "9"; } if (fileType.equals("宗地图")){ return "10"; } if (fileType.equals("房产分户图")){ return "11"; } if (fileType.equals("不动产测量报告书")){ return "12"; } return "-1"; } /** * 将土规_建设用地管制区代码转换成名称 * @param code 建设用地管制区代码 * @return 建设用地管制区名称 */ public static String jconstructionLandControlArea_transform(String code){ String str = StringUtil.removeBeginAndEnd(code," "); if (str.equals("010")){ return "允许建设区"; } if (str.equals("020")){ return "有条件建设区"; } if (str.equals("030")){ return "限制建设区"; } if (str.equals("040")){ return "禁止建设区"; } return str; } }
2,393
0.498762
0.483903
85
22.752941
16.500914
82
false
false
0
0
0
0
0
0
0.364706
false
false
12
1fb4186c1a45be624c8e49f2341ccb1a23cd4e66
29,669,634,134,773
9eb595e7eab85ad3a346df0e801904a7ff42d288
/sdk/dataprotection/azure-resourcemanager-dataprotection/src/test/java/com/azure/resourcemanager/dataprotection/generated/DatasourceSetTests.java
5d205d1d560924d76cc6691cf3d331def5d83cd0
[ "LicenseRef-scancode-generic-cla", "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-or-later", "CC0-1.0", "BSD-3-Clause", "UPL-1.0", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
permissive
veniuscloudpower/azure-sdk-for-java
https://github.com/veniuscloudpower/azure-sdk-for-java
5dcd018582d6eb5a0a9478e7a27f0d6b7b8289c9
4c48960cfa9aa638c2f888a24f357599600e412a
refs/heads/main
2023-06-28T09:48:32.768000
2023-06-23T21:18:46
2023-06-23T21:18:46
391,180,928
0
1
MIT
true
2021-07-30T20:25:14
2021-07-30T20:25:14
2021-07-30T19:10:42
2021-07-30T20:16:51
2,117,546
0
0
0
null
false
false
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.dataprotection.generated; import com.azure.core.util.BinaryData; import com.azure.resourcemanager.dataprotection.models.DatasourceSet; import org.junit.jupiter.api.Assertions; public final class DatasourceSetTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { DatasourceSet model = BinaryData .fromString( "{\"datasourceType\":\"xbczwtruwiqz\",\"objectType\":\"j\",\"resourceID\":\"sovmyokacspkwl\",\"resourceLocation\":\"dobpxjmflbvvn\",\"resourceName\":\"rkcciwwzjuqk\",\"resourceType\":\"sa\",\"resourceUri\":\"wkuofoskghsauu\"}") .toObject(DatasourceSet.class); Assertions.assertEquals("xbczwtruwiqz", model.datasourceType()); Assertions.assertEquals("j", model.objectType()); Assertions.assertEquals("sovmyokacspkwl", model.resourceId()); Assertions.assertEquals("dobpxjmflbvvn", model.resourceLocation()); Assertions.assertEquals("rkcciwwzjuqk", model.resourceName()); Assertions.assertEquals("sa", model.resourceType()); Assertions.assertEquals("wkuofoskghsauu", model.resourceUri()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { DatasourceSet model = new DatasourceSet() .withDatasourceType("xbczwtruwiqz") .withObjectType("j") .withResourceId("sovmyokacspkwl") .withResourceLocation("dobpxjmflbvvn") .withResourceName("rkcciwwzjuqk") .withResourceType("sa") .withResourceUri("wkuofoskghsauu"); model = BinaryData.fromObject(model).toObject(DatasourceSet.class); Assertions.assertEquals("xbczwtruwiqz", model.datasourceType()); Assertions.assertEquals("j", model.objectType()); Assertions.assertEquals("sovmyokacspkwl", model.resourceId()); Assertions.assertEquals("dobpxjmflbvvn", model.resourceLocation()); Assertions.assertEquals("rkcciwwzjuqk", model.resourceName()); Assertions.assertEquals("sa", model.resourceType()); Assertions.assertEquals("wkuofoskghsauu", model.resourceUri()); } }
UTF-8
Java
2,408
java
DatasourceSetTests.java
Java
[]
null
[]
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.dataprotection.generated; import com.azure.core.util.BinaryData; import com.azure.resourcemanager.dataprotection.models.DatasourceSet; import org.junit.jupiter.api.Assertions; public final class DatasourceSetTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { DatasourceSet model = BinaryData .fromString( "{\"datasourceType\":\"xbczwtruwiqz\",\"objectType\":\"j\",\"resourceID\":\"sovmyokacspkwl\",\"resourceLocation\":\"dobpxjmflbvvn\",\"resourceName\":\"rkcciwwzjuqk\",\"resourceType\":\"sa\",\"resourceUri\":\"wkuofoskghsauu\"}") .toObject(DatasourceSet.class); Assertions.assertEquals("xbczwtruwiqz", model.datasourceType()); Assertions.assertEquals("j", model.objectType()); Assertions.assertEquals("sovmyokacspkwl", model.resourceId()); Assertions.assertEquals("dobpxjmflbvvn", model.resourceLocation()); Assertions.assertEquals("rkcciwwzjuqk", model.resourceName()); Assertions.assertEquals("sa", model.resourceType()); Assertions.assertEquals("wkuofoskghsauu", model.resourceUri()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { DatasourceSet model = new DatasourceSet() .withDatasourceType("xbczwtruwiqz") .withObjectType("j") .withResourceId("sovmyokacspkwl") .withResourceLocation("dobpxjmflbvvn") .withResourceName("rkcciwwzjuqk") .withResourceType("sa") .withResourceUri("wkuofoskghsauu"); model = BinaryData.fromObject(model).toObject(DatasourceSet.class); Assertions.assertEquals("xbczwtruwiqz", model.datasourceType()); Assertions.assertEquals("j", model.objectType()); Assertions.assertEquals("sovmyokacspkwl", model.resourceId()); Assertions.assertEquals("dobpxjmflbvvn", model.resourceLocation()); Assertions.assertEquals("rkcciwwzjuqk", model.resourceName()); Assertions.assertEquals("sa", model.resourceType()); Assertions.assertEquals("wkuofoskghsauu", model.resourceUri()); } }
2,408
0.67608
0.67608
48
49.166668
36.990051
247
false
false
0
0
0
0
0
0
0.854167
false
false
12
38a2d0f5ea690956c1863141764028926fd7b28e
11,381,663,353,027
892602da84e5798e40b0af1af04df1bc274d8fd6
/prep/src/main/java/com/john/Nov2022/leetcode/q1100_1199/Question1127.java
9602e3ca87f249081d14519b539e9907877596e7
[]
no_license
deviantthread/InterviewPrepQuestions
https://github.com/deviantthread/InterviewPrepQuestions
f6002e3cbf4c6ace099a8ae6f734fc2e1c3d5023
d93077dad611dce8e86e483de36ba6e8704166f5
refs/heads/master
2023-04-13T04:29:34.114000
2023-04-04T21:36:44
2023-04-04T21:36:44
37,752,719
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.john.Nov2022.leetcode.q1100_1199; public class Question1127 { }
UTF-8
Java
77
java
Question1127.java
Java
[]
null
[]
package com.john.Nov2022.leetcode.q1100_1199; public class Question1127 { }
77
0.792208
0.584416
4
18.25
18.859678
45
false
false
0
0
0
0
0
0
0.25
false
false
12
0891f903aad2c9e517e1dddb0a7c6637b74d1fdb
32,684,701,187,980
99e9a5ed41886ec62411e531313e115f8e2944a2
/small-spring/small-spring-v2/src/main/java/com/itsz/small/spring/core/AbstractApplicationContext.java
a57f82a5c79144c86ebd2b2c8dac933321dc44ad
[]
no_license
hbzhou/hello-world
https://github.com/hbzhou/hello-world
aef92fca6b8cdedcbe57ee67d3b068290d153fa7
b09f95b0dfa9e5b26c3a6cd2526b402328feed78
refs/heads/master
2022-07-07T16:01:15.737000
2020-06-08T13:30:29
2020-06-08T13:30:29
206,464,023
1
0
null
false
2022-06-21T04:06:45
2019-09-05T03:10:31
2022-05-12T09:15:28
2022-06-21T04:06:44
2,759
0
0
8
Java
false
false
package com.itsz.small.spring.core; import com.itsz.small.spring.exception.BeanCreationeException; public abstract class AbstractApplicationContext implements ApplicationContext { protected DefaultBeanFactory factory; public AbstractApplicationContext(String filePath) { factory = new DefaultBeanFactory(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(factory); reader.loadBeanDefinition(getResourceByPath(filePath)); } public abstract Resource getResourceByPath(String filePath); @Override public Object getBean(String beanId) throws BeanCreationeException { return factory.getBean(beanId); } }
UTF-8
Java
679
java
AbstractApplicationContext.java
Java
[]
null
[]
package com.itsz.small.spring.core; import com.itsz.small.spring.exception.BeanCreationeException; public abstract class AbstractApplicationContext implements ApplicationContext { protected DefaultBeanFactory factory; public AbstractApplicationContext(String filePath) { factory = new DefaultBeanFactory(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(factory); reader.loadBeanDefinition(getResourceByPath(filePath)); } public abstract Resource getResourceByPath(String filePath); @Override public Object getBean(String beanId) throws BeanCreationeException { return factory.getBean(beanId); } }
679
0.768778
0.768778
22
29.863636
29.839413
80
false
false
0
0
0
0
0
0
0.363636
false
false
12
04993fe5781184e926ee75b83a13c48abe7091eb
17,257,178,617,068
adfdf386962cc4e21db2e67f59de36bf65d615a0
/src/main/Game.java
4b2ced23a51f6945afef7b40be17a8aaa3871c38
[]
no_license
prince776/Archery
https://github.com/prince776/Archery
ab0c06d3971088452aeb4ee630d141ff1219671c
c013d5f0aa32ce377f231c7c79c841dbb4d6376b
refs/heads/master
2020-07-26T04:59:17.363000
2019-09-15T05:11:55
2019-09-15T05:11:55
208,541,696
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package main; import java.awt.Canvas; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.image.BufferStrategy; import javax.swing.JFrame; public class Game implements Runnable{ private JFrame frame; private Canvas canvas; private Thread thread; public int width,height; public String title; private boolean running = false; private BufferStrategy bs; private Graphics g; public KeyManager keyManager; public MouseManager mouseManager; public Assets assets; public Sounds sounds; // private Player player; public static Vector gravity = new Vector(0,0.14f); public Game(String title, int width,int height){ this.width = width; this.height = height; this.title = title; initDisplay(); } public void initDisplay(){ frame = new JFrame(title); frame.setSize(width,height); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.setLocationRelativeTo(null); frame.setResizable(false); canvas = new Canvas(); canvas.setPreferredSize(new Dimension(width,height)); canvas.setMaximumSize(new Dimension(width,height)); canvas.setMinimumSize(new Dimension(width,height)); canvas.setFocusable(false); frame.add(canvas); frame.pack(); keyManager = new KeyManager(); frame.addKeyListener(keyManager); mouseManager = new MouseManager(); frame.addMouseListener(mouseManager); frame.addMouseMotionListener(mouseManager); canvas.addMouseListener(mouseManager); canvas.addMouseMotionListener(mouseManager); } public void init(){ assets = new Assets(); assets.init(); sounds = new Sounds(); sounds.init(); player = new Player(80, 350, Color.white); } public void tick(){ player.tick(this); } public void render(){ bs = canvas.getBufferStrategy(); if(bs == null){ canvas.createBufferStrategy(3); return; } g = bs.getDrawGraphics(); Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.clearRect(0, 0, width, height); // g.setColor(Color.DARK_GRAY); g.fillRect(0, 0, width, height); player.render(g,assets); // bs.show(); g.dispose(); } public void run(){ init(); long lastTime = System.nanoTime(),now,timer=0; double delta =0, nsPerTick = 1000000000/60; int frames = 0; while(running){ now = System.nanoTime(); timer += now-lastTime; delta += (now-lastTime)/nsPerTick; lastTime=now; if(delta >= 1){ tick(); render(); frames++; delta--; } if(timer >= 1000000000){ frame.setTitle(title + " FPS: " + frames); frames = 0; timer = 0; } } } public void start(){ if(!running){ running = true; thread = new Thread(this); thread.start(); } } public void stop(){ if(running){ try { thread.join(); } catch (InterruptedException e) { System.err.println("Error while terminating the thread!"); } } } }
UTF-8
Java
3,064
java
Game.java
Java
[]
null
[]
package main; import java.awt.Canvas; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.image.BufferStrategy; import javax.swing.JFrame; public class Game implements Runnable{ private JFrame frame; private Canvas canvas; private Thread thread; public int width,height; public String title; private boolean running = false; private BufferStrategy bs; private Graphics g; public KeyManager keyManager; public MouseManager mouseManager; public Assets assets; public Sounds sounds; // private Player player; public static Vector gravity = new Vector(0,0.14f); public Game(String title, int width,int height){ this.width = width; this.height = height; this.title = title; initDisplay(); } public void initDisplay(){ frame = new JFrame(title); frame.setSize(width,height); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.setLocationRelativeTo(null); frame.setResizable(false); canvas = new Canvas(); canvas.setPreferredSize(new Dimension(width,height)); canvas.setMaximumSize(new Dimension(width,height)); canvas.setMinimumSize(new Dimension(width,height)); canvas.setFocusable(false); frame.add(canvas); frame.pack(); keyManager = new KeyManager(); frame.addKeyListener(keyManager); mouseManager = new MouseManager(); frame.addMouseListener(mouseManager); frame.addMouseMotionListener(mouseManager); canvas.addMouseListener(mouseManager); canvas.addMouseMotionListener(mouseManager); } public void init(){ assets = new Assets(); assets.init(); sounds = new Sounds(); sounds.init(); player = new Player(80, 350, Color.white); } public void tick(){ player.tick(this); } public void render(){ bs = canvas.getBufferStrategy(); if(bs == null){ canvas.createBufferStrategy(3); return; } g = bs.getDrawGraphics(); Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.clearRect(0, 0, width, height); // g.setColor(Color.DARK_GRAY); g.fillRect(0, 0, width, height); player.render(g,assets); // bs.show(); g.dispose(); } public void run(){ init(); long lastTime = System.nanoTime(),now,timer=0; double delta =0, nsPerTick = 1000000000/60; int frames = 0; while(running){ now = System.nanoTime(); timer += now-lastTime; delta += (now-lastTime)/nsPerTick; lastTime=now; if(delta >= 1){ tick(); render(); frames++; delta--; } if(timer >= 1000000000){ frame.setTitle(title + " FPS: " + frames); frames = 0; timer = 0; } } } public void start(){ if(!running){ running = true; thread = new Thread(this); thread.start(); } } public void stop(){ if(running){ try { thread.join(); } catch (InterruptedException e) { System.err.println("Error while terminating the thread!"); } } } }
3,064
0.67983
0.664491
154
18.896105
16.2745
90
false
false
0
0
0
0
0
0
2.402597
false
false
12
a7f02be79a664b4440585bd379706b3ddfb7f067
12,343,736,064,445
94d4a3e1ab5ec6654c5cb2ef84429777277d47ec
/src/main/java/fr/diginamic/essais/TestMoyenne.java
330de1e0a5f0c94487cbc6d3c8d91f5badbf662c
[]
no_license
AudreyM26/approche-objet-j3
https://github.com/AudreyM26/approche-objet-j3
012067e30ebf0f5e908ae1ee64958793cee3d3fe
7367eba2c11c255ee21b25e5f937ec22572c7114
refs/heads/master
2021-07-19T13:11:14.162000
2020-02-16T15:30:41
2020-02-16T15:30:41
222,026,324
0
0
null
false
2020-10-13T17:56:31
2019-11-16T00:48:01
2020-02-16T15:31:02
2020-10-13T17:56:31
24
0
0
1
Java
false
false
package fr.diginamic.essais; import fr.diginamic.operations.*; public class TestMoyenne { public static void main(String[] args) { // TODO Auto-generated method stub CalculMoyenne tabCalcul = new CalculMoyenne(); tabCalcul.ajout(14); tabCalcul.ajout(12); tabCalcul.ajout(15.9); tabCalcul.ajout(14.2); double moyenne = tabCalcul.calculMoyenne(); System.out.println("La moyenne du tableau : "+moyenne); tabCalcul.ajout(18); tabCalcul.ajout(11.5); moyenne = tabCalcul.calculMoyenne(); System.out.println("Nouvelle moyenne du tableau : "+moyenne); } }
UTF-8
Java
614
java
TestMoyenne.java
Java
[]
null
[]
package fr.diginamic.essais; import fr.diginamic.operations.*; public class TestMoyenne { public static void main(String[] args) { // TODO Auto-generated method stub CalculMoyenne tabCalcul = new CalculMoyenne(); tabCalcul.ajout(14); tabCalcul.ajout(12); tabCalcul.ajout(15.9); tabCalcul.ajout(14.2); double moyenne = tabCalcul.calculMoyenne(); System.out.println("La moyenne du tableau : "+moyenne); tabCalcul.ajout(18); tabCalcul.ajout(11.5); moyenne = tabCalcul.calculMoyenne(); System.out.println("Nouvelle moyenne du tableau : "+moyenne); } }
614
0.68241
0.65798
26
21.615385
19.181475
63
false
false
0
0
0
0
0
0
1.730769
false
false
12
2125c6fc8d3df7ab941b8eac8b84fb8caf55d4ea
9,474,697,919,359
70f28802e72bb65c5299dc6fbf487c1f83ade709
/android/src/com/badlogic/gdx/backends/android/W_AndroidApplication.java
ffd71ed757ea8dc412e382d5fb1ff912fe283ae6
[]
no_license
littlelogic/wipeStarGame
https://github.com/littlelogic/wipeStarGame
c982329fe407e1e0397c9e9c544909bb26b1a381
89cc4ecb6d10604133b5198d397927f54b536ea9
refs/heads/main
2023-04-04T15:14:29.086000
2021-04-11T13:05:41
2021-04-11T13:05:41
339,073,576
2
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.badlogic.gdx.backends.android; import android.app.Activity; import android.content.res.Configuration; import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.util.TypedValue; import android.view.Gravity; import android.view.View; import android.view.ViewGroup.LayoutParams; import android.view.Window; import android.view.WindowManager; import android.widget.FrameLayout; import android.widget.TextView; import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.LifecycleListener; import com.badlogic.gdx.backends.android.surfaceview.FillResolutionStrategy; import com.badlogic.gdx.utils.GdxRuntimeException; import com.gdx.game.android.LogAndroid; import java.lang.reflect.Method; public class W_AndroidApplication extends AndroidApplication { public void initialize (ApplicationListener listener) { AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); initialize(listener, config); } public void initialize (ApplicationListener listener, AndroidApplicationConfiguration config) { init(listener, config, false); } public View initializeForView (ApplicationListener listener) { AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); return initializeForView(listener, config); } public View initializeForView (ApplicationListener listener, AndroidApplicationConfiguration config) { init(listener, config, true); return graphics.getView(); } private void init (ApplicationListener listener, AndroidApplicationConfiguration config, boolean isForView) { if (this.getVersion() < MINIMUM_SDK) { throw new GdxRuntimeException("LibGDX requires Android API Level " + MINIMUM_SDK + " or later."); } setApplicationLogger(new AndroidApplicationLogger()); graphics = new AndroidGraphics(this, config, config.resolutionStrategy == null ? new FillResolutionStrategy() : config.resolutionStrategy); input = createInput(this, this, graphics.view, config); audio = createAudio(this, config); files = createFiles(); net = new AndroidNet(this, config); this.listener = listener; this.handler = new Handler(); this.useImmersiveMode = config.useImmersiveMode; this.hideStatusBar = config.hideStatusBar; this.clipboard = new AndroidClipboard(this); // Add a specialized audio lifecycle listener addLifecycleListener(new LifecycleListener() { @Override public void resume () { // No need to resume audio here } @Override public void pause () { audio.pause(); } @Override public void dispose () { audio.dispose(); } }); Gdx.app = this; Gdx.input = this.getInput(); Gdx.audio = this.getAudio(); Gdx.files = this.getFiles(); Gdx.graphics = this.getGraphics(); Gdx.net = this.getNet(); if (!isForView) { try { requestWindowFeature(Window.FEATURE_NO_TITLE); } catch (Exception ex) { log("AndroidApplication", "Content already displayed, cannot request FEATURE_NO_TITLE", ex); } getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); setContentView(graphics.getView(), createLayoutParams()); ///<<-------------------- FrameLayout mFrameLayout=new FrameLayout(this); /** * 禁止多点触控 */ mFrameLayout.setMotionEventSplittingEnabled(false); setContentView(mFrameLayout, createLayoutParams()); mFrameLayout.addView(graphics.getView(),createLayoutParams()); TextView mTextView=new TextView(this); LogAndroid.mTextView=mTextView;//---temp mTextView.setText("wjw"); mTextView.setTextColor(Color.WHITE); mTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP,16); FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); layoutParams.gravity = Gravity.TOP|Gravity.RIGHT; mTextView.setLayoutParams(layoutParams); mFrameLayout.addView(mTextView); ///>>-------------------- } createWakeLock(config.useWakelock); hideStatusBar(this.hideStatusBar); useImmersiveMode(this.useImmersiveMode); if (this.useImmersiveMode && getVersion() >= Build.VERSION_CODES.KITKAT) { AndroidVisibilityListener vlistener = new AndroidVisibilityListener(); vlistener.createListener(this); } // detect an already connected bluetooth keyboardAvailable if (getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS) input.setKeyboardAvailable(true); } }
UTF-8
Java
5,308
java
W_AndroidApplication.java
Java
[]
null
[]
package com.badlogic.gdx.backends.android; import android.app.Activity; import android.content.res.Configuration; import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.util.TypedValue; import android.view.Gravity; import android.view.View; import android.view.ViewGroup.LayoutParams; import android.view.Window; import android.view.WindowManager; import android.widget.FrameLayout; import android.widget.TextView; import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.LifecycleListener; import com.badlogic.gdx.backends.android.surfaceview.FillResolutionStrategy; import com.badlogic.gdx.utils.GdxRuntimeException; import com.gdx.game.android.LogAndroid; import java.lang.reflect.Method; public class W_AndroidApplication extends AndroidApplication { public void initialize (ApplicationListener listener) { AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); initialize(listener, config); } public void initialize (ApplicationListener listener, AndroidApplicationConfiguration config) { init(listener, config, false); } public View initializeForView (ApplicationListener listener) { AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); return initializeForView(listener, config); } public View initializeForView (ApplicationListener listener, AndroidApplicationConfiguration config) { init(listener, config, true); return graphics.getView(); } private void init (ApplicationListener listener, AndroidApplicationConfiguration config, boolean isForView) { if (this.getVersion() < MINIMUM_SDK) { throw new GdxRuntimeException("LibGDX requires Android API Level " + MINIMUM_SDK + " or later."); } setApplicationLogger(new AndroidApplicationLogger()); graphics = new AndroidGraphics(this, config, config.resolutionStrategy == null ? new FillResolutionStrategy() : config.resolutionStrategy); input = createInput(this, this, graphics.view, config); audio = createAudio(this, config); files = createFiles(); net = new AndroidNet(this, config); this.listener = listener; this.handler = new Handler(); this.useImmersiveMode = config.useImmersiveMode; this.hideStatusBar = config.hideStatusBar; this.clipboard = new AndroidClipboard(this); // Add a specialized audio lifecycle listener addLifecycleListener(new LifecycleListener() { @Override public void resume () { // No need to resume audio here } @Override public void pause () { audio.pause(); } @Override public void dispose () { audio.dispose(); } }); Gdx.app = this; Gdx.input = this.getInput(); Gdx.audio = this.getAudio(); Gdx.files = this.getFiles(); Gdx.graphics = this.getGraphics(); Gdx.net = this.getNet(); if (!isForView) { try { requestWindowFeature(Window.FEATURE_NO_TITLE); } catch (Exception ex) { log("AndroidApplication", "Content already displayed, cannot request FEATURE_NO_TITLE", ex); } getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); setContentView(graphics.getView(), createLayoutParams()); ///<<-------------------- FrameLayout mFrameLayout=new FrameLayout(this); /** * 禁止多点触控 */ mFrameLayout.setMotionEventSplittingEnabled(false); setContentView(mFrameLayout, createLayoutParams()); mFrameLayout.addView(graphics.getView(),createLayoutParams()); TextView mTextView=new TextView(this); LogAndroid.mTextView=mTextView;//---temp mTextView.setText("wjw"); mTextView.setTextColor(Color.WHITE); mTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP,16); FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); layoutParams.gravity = Gravity.TOP|Gravity.RIGHT; mTextView.setLayoutParams(layoutParams); mFrameLayout.addView(mTextView); ///>>-------------------- } createWakeLock(config.useWakelock); hideStatusBar(this.hideStatusBar); useImmersiveMode(this.useImmersiveMode); if (this.useImmersiveMode && getVersion() >= Build.VERSION_CODES.KITKAT) { AndroidVisibilityListener vlistener = new AndroidVisibilityListener(); vlistener.createListener(this); } // detect an already connected bluetooth keyboardAvailable if (getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS) input.setKeyboardAvailable(true); } }
5,308
0.660687
0.66031
137
37.656933
29.213644
121
false
false
0
0
0
0
0
0
0.737226
false
false
12
d530291ff70091bd43ccb93157b1d5250fd818e3
11,914,239,339,767
28800a7b0e084b322ac7a87ca7572b25b53e77da
/src/main/java/commands/bank.java
f9e30f38c4ea28f2d23837d9734642f22a3234d7
[]
no_license
GordoLeal/GordoBotJavaEdition
https://github.com/GordoLeal/GordoBotJavaEdition
49b421165be0226f3ebbafe594bf2904749792d2
d23d719bb73120b9b92aa68cbda88378cfd02c0e
refs/heads/master
2021-09-13T11:51:45.435000
2018-04-29T12:59:34
2018-04-29T12:59:34
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package commands; import com.jagrosh.jdautilities.command.Command; import com.jagrosh.jdautilities.command.CommandEvent; import net.dv8tion.jda.core.EmbedBuilder; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; /* COMANDO PARA VER QUANTO TEM DE PIZZAS NA CONTA */ public class bank extends Command { public bank(){ this.name = "bank"; this.aliases = new String[]{"banco","cofrinho","cofre","dindin","conta"}; this.arguments = "<info>"; this.guildOnly = true; } public void execute(CommandEvent event){ if(event.getAuthor().isBot()){ return; } String[] test = event.getArgs().split(" "); EmbedBuilder EB = new EmbedBuilder(); if(test[0].equals("info")){ EB.setAuthor("O QUE É PIZZAS?"); EB.setTitle(":pizza:"); EB.setColor(14395649); EB.setDescription("Pizzas é uma moeda que pode ser usada para comandos aleatorios (EM DESENVOLVIMENTO)"); EB.setFooter("Comando executado por: "+event.getAuthor().getName(),event.getAuthor().getEffectiveAvatarUrl()); EB.setTimestamp(event.getMessage().getCreationTime()); event.reply(EB.build()); return; } String guildId = event.getGuild().getId(); String authorId = event.getAuthor().getId(); String finalPath = ("GeneralConfig\\Data\\"+guildId+"\\"+authorId); String authorFile = ("coinQuantity.txt"); Path pathtxt = Paths.get(finalPath + "\\" + authorFile); File file = new File(finalPath); file.mkdirs(); String readFileGiveResult = "100"; if(!event.getMessage().getMentionedMembers().isEmpty()){ authorId = event.getMessage().getMentionedMembers().get(0).getUser().getId(); finalPath = ("GeneralConfig\\Data\\"+guildId+"\\"+authorId); authorFile = ("coinQuantity.txt"); pathtxt = Paths.get(finalPath + "\\" + authorFile); try { readFileGiveResult = Files.readAllLines(pathtxt).get(0); } catch (IOException ignored) { event.reply(event.getAuthor().getAsMention()+" este usuario não possui uma conta do banco"); return; } EB.setAuthor("\uD83D\uDCB0 Bem vindo ao Banco"); EB.setTitle(event.getMessage().getMentionedMembers().get(0).getEffectiveName()+" tem:"); EB.setDescription(readFileGiveResult + " pizzas"); EB.setColor(14395649); EB.addField("Info:","Para mais informações digite ``gordo banco info``",false); EB.setFooter("Comando executado por: "+event.getAuthor().getName(),event.getAuthor().getEffectiveAvatarUrl()); EB.setTimestamp(event.getMessage().getCreationTime()); EB.setThumbnail(event.getMessage().getMentionedMembers().get(0).getUser().getEffectiveAvatarUrl()); event.reply(EB.build()); return; } try { readFileGiveResult = Files.readAllLines(pathtxt).get(0); } catch (IOException e) { event.reply(event.getAuthor().getAsMention()+" Parece que você não tem uma conta no banco, eu estou criando uma para você."); String freeCoins = "100"; byte[] banknew = freeCoins.getBytes(); try { Files.write(pathtxt, banknew); Files.createFile(Paths.get(finalPath + "\\" + authorFile)); }catch (Exception ignored){ } event.reply(event.getAuthor().getAsMention()+" pronto, agora você pode guardar suas pizzas no banco :yum: "); } EB.setAuthor("\uD83D\uDCB0 Bem vindo ao Banco"); EB.setTitle("Você tem:"); EB.setDescription(readFileGiveResult + " pizzas"); EB.setColor(14395649); EB.addField("Info:","Para mais informações digite ``gordo banco info``",false); EB.setFooter("Comando executado por: "+event.getAuthor().getName(),event.getAuthor().getEffectiveAvatarUrl()); EB.setTimestamp(event.getMessage().getCreationTime()); event.reply(EB.build()); } }
UTF-8
Java
4,257
java
bank.java
Java
[]
null
[]
package commands; import com.jagrosh.jdautilities.command.Command; import com.jagrosh.jdautilities.command.CommandEvent; import net.dv8tion.jda.core.EmbedBuilder; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; /* COMANDO PARA VER QUANTO TEM DE PIZZAS NA CONTA */ public class bank extends Command { public bank(){ this.name = "bank"; this.aliases = new String[]{"banco","cofrinho","cofre","dindin","conta"}; this.arguments = "<info>"; this.guildOnly = true; } public void execute(CommandEvent event){ if(event.getAuthor().isBot()){ return; } String[] test = event.getArgs().split(" "); EmbedBuilder EB = new EmbedBuilder(); if(test[0].equals("info")){ EB.setAuthor("O QUE É PIZZAS?"); EB.setTitle(":pizza:"); EB.setColor(14395649); EB.setDescription("Pizzas é uma moeda que pode ser usada para comandos aleatorios (EM DESENVOLVIMENTO)"); EB.setFooter("Comando executado por: "+event.getAuthor().getName(),event.getAuthor().getEffectiveAvatarUrl()); EB.setTimestamp(event.getMessage().getCreationTime()); event.reply(EB.build()); return; } String guildId = event.getGuild().getId(); String authorId = event.getAuthor().getId(); String finalPath = ("GeneralConfig\\Data\\"+guildId+"\\"+authorId); String authorFile = ("coinQuantity.txt"); Path pathtxt = Paths.get(finalPath + "\\" + authorFile); File file = new File(finalPath); file.mkdirs(); String readFileGiveResult = "100"; if(!event.getMessage().getMentionedMembers().isEmpty()){ authorId = event.getMessage().getMentionedMembers().get(0).getUser().getId(); finalPath = ("GeneralConfig\\Data\\"+guildId+"\\"+authorId); authorFile = ("coinQuantity.txt"); pathtxt = Paths.get(finalPath + "\\" + authorFile); try { readFileGiveResult = Files.readAllLines(pathtxt).get(0); } catch (IOException ignored) { event.reply(event.getAuthor().getAsMention()+" este usuario não possui uma conta do banco"); return; } EB.setAuthor("\uD83D\uDCB0 Bem vindo ao Banco"); EB.setTitle(event.getMessage().getMentionedMembers().get(0).getEffectiveName()+" tem:"); EB.setDescription(readFileGiveResult + " pizzas"); EB.setColor(14395649); EB.addField("Info:","Para mais informações digite ``gordo banco info``",false); EB.setFooter("Comando executado por: "+event.getAuthor().getName(),event.getAuthor().getEffectiveAvatarUrl()); EB.setTimestamp(event.getMessage().getCreationTime()); EB.setThumbnail(event.getMessage().getMentionedMembers().get(0).getUser().getEffectiveAvatarUrl()); event.reply(EB.build()); return; } try { readFileGiveResult = Files.readAllLines(pathtxt).get(0); } catch (IOException e) { event.reply(event.getAuthor().getAsMention()+" Parece que você não tem uma conta no banco, eu estou criando uma para você."); String freeCoins = "100"; byte[] banknew = freeCoins.getBytes(); try { Files.write(pathtxt, banknew); Files.createFile(Paths.get(finalPath + "\\" + authorFile)); }catch (Exception ignored){ } event.reply(event.getAuthor().getAsMention()+" pronto, agora você pode guardar suas pizzas no banco :yum: "); } EB.setAuthor("\uD83D\uDCB0 Bem vindo ao Banco"); EB.setTitle("Você tem:"); EB.setDescription(readFileGiveResult + " pizzas"); EB.setColor(14395649); EB.addField("Info:","Para mais informações digite ``gordo banco info``",false); EB.setFooter("Comando executado por: "+event.getAuthor().getName(),event.getAuthor().getEffectiveAvatarUrl()); EB.setTimestamp(event.getMessage().getCreationTime()); event.reply(EB.build()); } }
4,257
0.607774
0.597644
101
41.029701
33.623852
137
false
false
0
0
0
0
0
0
0.772277
false
false
12
6bf0afde47f97bf915f9829e4ce7a292a87f125b
15,384,572,913,344
a848f8ea7d1b6ed829afad82f24d9210da007138
/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/InterruptibleByteChannel.java
23a52d4259dec959fa55b5ea286617dbbaafd76b
[ "LGPL-2.1-only", "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
Liloveyang/stratosphere
https://github.com/Liloveyang/stratosphere
fbd1c566695f0feef5fcbeb3c39b8fdd09ce7cdd
7fd8ca2438adc13dc1a407619ee2a355508082ed
refs/heads/master
2022-04-24T12:49:57.102000
2020-04-22T13:08:11
2020-04-22T13:08:11
257,899,260
0
0
Apache-2.0
true
2020-04-22T12:46:57
2020-04-22T12:46:57
2020-03-19T03:52:09
2020-02-11T16:09:44
109,925
0
0
0
null
false
false
/*********************************************************************************************************************** * Copyright (C) 2010-2013 by the Stratosphere project (http://stratosphere.eu) * * 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 eu.stratosphere.nephele.util; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.ClosedChannelException; import java.nio.channels.ReadableByteChannel; import java.nio.channels.WritableByteChannel; import java.util.ArrayDeque; import java.util.Queue; /** * This class is a special test implementation of a {@link ReadableByteChannel} and {@link WritableByteChannel}. Data is * first written into main memory through the {@link WritableByteChannel} interface. Afterwards, the data can be read * again through the {@link ReadableByteChannel} abstraction. The implementation is capable of simulating interruptions * in the byte stream. * <p> * This class is not thread-safe. * */ public class InterruptibleByteChannel implements ReadableByteChannel, WritableByteChannel { /** * The initial size of the internal memory buffer in bytes. */ private static final int INITIAL_BUFFER_SIZE = 8192; /** * Stores the requested interruptions of the byte stream during write operations that still have to be processed. */ private final Queue<Integer> writeInterruptPositions = new ArrayDeque<Integer>(); /** * Stores the requested interruptions of the byte stream during read operations that still have to be processed. */ private final Queue<Integer> readInterruptPositions = new ArrayDeque<Integer>(); /** * The internal memory buffer used to hold the written data. */ private ByteBuffer buffer = ByteBuffer.allocate(INITIAL_BUFFER_SIZE); /** * Stores if the channel is still open. */ private boolean isOpen = true; /** * Stores if the channel is still in write phase. */ private boolean isInWritePhase = true; /** * Constructs a new interruptible byte channel. * * @param writeInterruptPositions * the positions to interrupt the byte stream during write operations or <code>null</code> if no * interruptions are requested * @param readInterruptPositions * the positions to interrupt the byte stream during read operations or <code>null</code> if no interruptions * are requested */ public InterruptibleByteChannel(final int[] writeInterruptPositions, final int[] readInterruptPositions) { if (writeInterruptPositions != null) { for (int i = 0; i < writeInterruptPositions.length - 1; ++i) { if (writeInterruptPositions[i] > writeInterruptPositions[i + 1]) { throw new IllegalArgumentException("Write interrupt positions must be ordered ascendingly"); } this.writeInterruptPositions.add(Integer.valueOf(writeInterruptPositions[i])); } this.writeInterruptPositions.add(Integer .valueOf(writeInterruptPositions[writeInterruptPositions.length - 1])); } if (readInterruptPositions != null) { for (int i = 0; i < readInterruptPositions.length - 1; ++i) { if (readInterruptPositions[i] > readInterruptPositions[i + 1]) { throw new IllegalArgumentException("Read interrupt positions must be ordered ascendingly"); } this.readInterruptPositions.add(Integer.valueOf(readInterruptPositions[i])); } this.readInterruptPositions.add(Integer .valueOf(readInterruptPositions[readInterruptPositions.length - 1])); } } @Override public boolean isOpen() { return this.isOpen; } @Override public void close() throws IOException { this.isOpen = false; } @Override public int write(final ByteBuffer src) throws IOException { if (!this.isOpen) { throw new ClosedChannelException(); } if (!this.isInWritePhase) { throw new IllegalStateException("Channel is not in write phase anymore"); } if (src.remaining() > this.buffer.remaining()) { increaseBufferSize(); } int numberOfBytesToAccept = src.remaining(); if (!this.writeInterruptPositions.isEmpty() && (this.buffer.position() + numberOfBytesToAccept < this.writeInterruptPositions.peek().intValue())) { numberOfBytesToAccept = this.writeInterruptPositions.poll().intValue() - this.buffer.position(); this.buffer.limit(this.buffer.position() + numberOfBytesToAccept); this.buffer.put(src); this.buffer.limit(this.buffer.capacity()); return numberOfBytesToAccept; } this.buffer.put(src); return numberOfBytesToAccept; } @Override public int read(final ByteBuffer dst) throws IOException { if (!this.isOpen) { throw new ClosedChannelException(); } if (this.isInWritePhase) { throw new IllegalStateException("Channel is still in write phase"); } if (!this.buffer.hasRemaining()) { return -1; } int numberOfBytesToRetrieve = Math.min(this.buffer.remaining(), dst.remaining()); if (!this.readInterruptPositions.isEmpty() && (this.buffer.position() + numberOfBytesToRetrieve > this.readInterruptPositions.peek().intValue())) { numberOfBytesToRetrieve = this.readInterruptPositions.poll().intValue() - this.buffer.position(); } final int oldLimit = this.buffer.limit(); this.buffer.limit(this.buffer.position() + numberOfBytesToRetrieve); dst.put(this.buffer); this.buffer.limit(oldLimit); return numberOfBytesToRetrieve; } /** * Switches the channel to read phase. */ public void switchToReadPhase() { if (!this.isInWritePhase) { throw new IllegalStateException("Channel is already in read phase"); } this.isInWritePhase = false; this.buffer.flip(); } /** * Doubles the capacity of the internal byte buffer while preserving its content. */ private void increaseBufferSize() { final ByteBuffer newBuf = ByteBuffer.allocate(this.buffer.capacity() * 2); this.buffer.flip(); newBuf.put(this.buffer); this.buffer = newBuf; } }
UTF-8
Java
6,490
java
InterruptibleByteChannel.java
Java
[]
null
[]
/*********************************************************************************************************************** * Copyright (C) 2010-2013 by the Stratosphere project (http://stratosphere.eu) * * 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 eu.stratosphere.nephele.util; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.ClosedChannelException; import java.nio.channels.ReadableByteChannel; import java.nio.channels.WritableByteChannel; import java.util.ArrayDeque; import java.util.Queue; /** * This class is a special test implementation of a {@link ReadableByteChannel} and {@link WritableByteChannel}. Data is * first written into main memory through the {@link WritableByteChannel} interface. Afterwards, the data can be read * again through the {@link ReadableByteChannel} abstraction. The implementation is capable of simulating interruptions * in the byte stream. * <p> * This class is not thread-safe. * */ public class InterruptibleByteChannel implements ReadableByteChannel, WritableByteChannel { /** * The initial size of the internal memory buffer in bytes. */ private static final int INITIAL_BUFFER_SIZE = 8192; /** * Stores the requested interruptions of the byte stream during write operations that still have to be processed. */ private final Queue<Integer> writeInterruptPositions = new ArrayDeque<Integer>(); /** * Stores the requested interruptions of the byte stream during read operations that still have to be processed. */ private final Queue<Integer> readInterruptPositions = new ArrayDeque<Integer>(); /** * The internal memory buffer used to hold the written data. */ private ByteBuffer buffer = ByteBuffer.allocate(INITIAL_BUFFER_SIZE); /** * Stores if the channel is still open. */ private boolean isOpen = true; /** * Stores if the channel is still in write phase. */ private boolean isInWritePhase = true; /** * Constructs a new interruptible byte channel. * * @param writeInterruptPositions * the positions to interrupt the byte stream during write operations or <code>null</code> if no * interruptions are requested * @param readInterruptPositions * the positions to interrupt the byte stream during read operations or <code>null</code> if no interruptions * are requested */ public InterruptibleByteChannel(final int[] writeInterruptPositions, final int[] readInterruptPositions) { if (writeInterruptPositions != null) { for (int i = 0; i < writeInterruptPositions.length - 1; ++i) { if (writeInterruptPositions[i] > writeInterruptPositions[i + 1]) { throw new IllegalArgumentException("Write interrupt positions must be ordered ascendingly"); } this.writeInterruptPositions.add(Integer.valueOf(writeInterruptPositions[i])); } this.writeInterruptPositions.add(Integer .valueOf(writeInterruptPositions[writeInterruptPositions.length - 1])); } if (readInterruptPositions != null) { for (int i = 0; i < readInterruptPositions.length - 1; ++i) { if (readInterruptPositions[i] > readInterruptPositions[i + 1]) { throw new IllegalArgumentException("Read interrupt positions must be ordered ascendingly"); } this.readInterruptPositions.add(Integer.valueOf(readInterruptPositions[i])); } this.readInterruptPositions.add(Integer .valueOf(readInterruptPositions[readInterruptPositions.length - 1])); } } @Override public boolean isOpen() { return this.isOpen; } @Override public void close() throws IOException { this.isOpen = false; } @Override public int write(final ByteBuffer src) throws IOException { if (!this.isOpen) { throw new ClosedChannelException(); } if (!this.isInWritePhase) { throw new IllegalStateException("Channel is not in write phase anymore"); } if (src.remaining() > this.buffer.remaining()) { increaseBufferSize(); } int numberOfBytesToAccept = src.remaining(); if (!this.writeInterruptPositions.isEmpty() && (this.buffer.position() + numberOfBytesToAccept < this.writeInterruptPositions.peek().intValue())) { numberOfBytesToAccept = this.writeInterruptPositions.poll().intValue() - this.buffer.position(); this.buffer.limit(this.buffer.position() + numberOfBytesToAccept); this.buffer.put(src); this.buffer.limit(this.buffer.capacity()); return numberOfBytesToAccept; } this.buffer.put(src); return numberOfBytesToAccept; } @Override public int read(final ByteBuffer dst) throws IOException { if (!this.isOpen) { throw new ClosedChannelException(); } if (this.isInWritePhase) { throw new IllegalStateException("Channel is still in write phase"); } if (!this.buffer.hasRemaining()) { return -1; } int numberOfBytesToRetrieve = Math.min(this.buffer.remaining(), dst.remaining()); if (!this.readInterruptPositions.isEmpty() && (this.buffer.position() + numberOfBytesToRetrieve > this.readInterruptPositions.peek().intValue())) { numberOfBytesToRetrieve = this.readInterruptPositions.poll().intValue() - this.buffer.position(); } final int oldLimit = this.buffer.limit(); this.buffer.limit(this.buffer.position() + numberOfBytesToRetrieve); dst.put(this.buffer); this.buffer.limit(oldLimit); return numberOfBytesToRetrieve; } /** * Switches the channel to read phase. */ public void switchToReadPhase() { if (!this.isInWritePhase) { throw new IllegalStateException("Channel is already in read phase"); } this.isInWritePhase = false; this.buffer.flip(); } /** * Doubles the capacity of the internal byte buffer while preserving its content. */ private void increaseBufferSize() { final ByteBuffer newBuf = ByteBuffer.allocate(this.buffer.capacity() * 2); this.buffer.flip(); newBuf.put(this.buffer); this.buffer = newBuf; } }
6,490
0.706009
0.702003
204
30.813726
35.660362
120
false
false
0
0
0
0
0
0
1.495098
false
false
12
3b6733cca2538a1e3e8471caf1435091b634ac28
24,361,054,508,334
4d742f2931acc3f26a64319575d4f9b97abddbcb
/src/test/java/pageclasses/SearchScreen.java
aadcd8335af4ff968d63c44e25fbd9f3c356c684
[]
no_license
ccsrao/TestMobile
https://github.com/ccsrao/TestMobile
3ec47ed2332ae0a2ea54ab986c8248a5eef45c5c
bd6a6155862aa9f96216c0bdf097188d37048ee7
refs/heads/master
2022-07-14T05:12:33.583000
2020-05-01T14:30:28
2020-05-01T14:30:28
146,868,237
0
0
null
false
2022-06-29T18:06:36
2018-08-31T09:04:46
2020-05-01T14:30:44
2022-06-29T18:06:34
40,292
0
0
13
HTML
false
false
package pageclasses; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.How; import org.openqa.selenium.support.PageFactory; import io.appium.java_client.AppiumDriver; import io.appium.java_client.MobileElement; import io.appium.java_client.pagefactory.AppiumFieldDecorator; import utilities.MobileBase; public class SearchScreen extends MobileBase { public SearchScreen(AppiumDriver<MobileElement> appiumDriver) { this.appiumDriver = appiumDriver; PageFactory.initElements(new AppiumFieldDecorator(appiumDriver), this); } @FindBy(how = How.XPATH, using = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.support.v4.widget.DrawerLayout/android.widget.RelativeLayout/android.widget.RelativeLayout[2]/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.ViewAnimator/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View/android.view.View/android.view.View/android.view.View/android.view.View[1]/android.view.View[2]/android.view.View[4]/android.view.View/android.view.View/android.view.View[1]/android.view.View/android.widget.TextView[1]") private MobileElement itemStatus; public String getItemStatus() { String getItemStatus = getTextValue(appiumDriver, itemStatus, 120); return getItemStatus; } @FindBy(how = How.ID, using = "add-to-wishlist-button-submit") private MobileElement wishListButton; public void tapWishListButton() { taponElement(appiumDriver, wishListButton, 120); } }
UTF-8
Java
1,879
java
SearchScreen.java
Java
[]
null
[]
package pageclasses; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.How; import org.openqa.selenium.support.PageFactory; import io.appium.java_client.AppiumDriver; import io.appium.java_client.MobileElement; import io.appium.java_client.pagefactory.AppiumFieldDecorator; import utilities.MobileBase; public class SearchScreen extends MobileBase { public SearchScreen(AppiumDriver<MobileElement> appiumDriver) { this.appiumDriver = appiumDriver; PageFactory.initElements(new AppiumFieldDecorator(appiumDriver), this); } @FindBy(how = How.XPATH, using = "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.support.v4.widget.DrawerLayout/android.widget.RelativeLayout/android.widget.RelativeLayout[2]/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.LinearLayout[2]/android.widget.ViewAnimator/android.widget.LinearLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.webkit.WebView/android.webkit.WebView/android.view.View/android.view.View/android.view.View/android.view.View/android.view.View/android.view.View[1]/android.view.View[2]/android.view.View[4]/android.view.View/android.view.View/android.view.View[1]/android.view.View/android.widget.TextView[1]") private MobileElement itemStatus; public String getItemStatus() { String getItemStatus = getTextValue(appiumDriver, itemStatus, 120); return getItemStatus; } @FindBy(how = How.ID, using = "add-to-wishlist-button-submit") private MobileElement wishListButton; public void tapWishListButton() { taponElement(appiumDriver, wishListButton, 120); } }
1,879
0.825971
0.81852
31
59.612904
164.417191
951
false
false
0
0
0
0
0
0
1.580645
false
false
12
3d71adcefe8e2f773d49f57cb783cc2f221fd426
18,442,589,569,275
f2671d48696ec14590d7306f9f53207366ba631d
/pinot-server/src/main/java/org/apache/pinot/server/api/resources/HealthCheckResource.java
2d123b725fdf28d8e7a512574f55b37883aa0a1a
[ "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-free-unknown", "LGPL-2.0-or-later", "LicenseRef-scancode-unicode", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-unknown-license-reference", "NAIST-2003", "bzip2-1.0.6", "OpenSSL", "CC-BY-2.5", "CC-BY-SA-3.0", "CDDL-1.0", "MIT", "CPL-1.0", "LicenseRef-scancode-public-domain", "CDDL-1.1", "EPL-1.0", "CC-BY-4.0", "WTFPL", "EPL-2.0", "ISC", "BSD-2-Clause" ]
permissive
mcvsubbu/incubator-pinot
https://github.com/mcvsubbu/incubator-pinot
5602f1bc925aec6f400f93f53915d1ca10d1f217
dc3b6fd3192b9301017e91a564241479e67727b9
refs/heads/master
2023-07-13T13:34:05.824000
2023-05-14T01:28:55
2023-05-14T01:28:55
175,093,979
2
0
Apache-2.0
true
2019-03-11T22:33:11
2019-03-11T22:33:11
2019-03-11T21:28:37
2019-03-11T21:34:10
165,772
0
0
0
null
false
null
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.pinot.server.api.resources; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import java.util.concurrent.atomic.AtomicBoolean; import javax.annotation.Nullable; import javax.inject.Inject; import javax.inject.Named; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.pinot.common.metrics.ServerMeter; import org.apache.pinot.common.metrics.ServerMetrics; import org.apache.pinot.common.utils.ServiceStatus; import org.apache.pinot.common.utils.ServiceStatus.Status; import org.apache.pinot.server.api.AdminApiApplication; /** * REST API to do health check through ServiceStatus. */ @Api(tags = "Health") @Path("/") public class HealthCheckResource { @Inject private AtomicBoolean _shutDownInProgress; @Inject @Named(AdminApiApplication.SERVER_INSTANCE_ID) private String _instanceId; @Inject private ServerMetrics _serverMetrics; @GET @Path("/health") @Produces(MediaType.TEXT_PLAIN) @ApiOperation(value = "Checking server health") @ApiResponses(value = { @ApiResponse(code = 200, message = "Server is healthy"), @ApiResponse(code = 503, message = "Server is not healthy") }) public String checkHealth( @ApiParam(value = "health check type: liveness or readiness") @QueryParam("checkType") @Nullable String checkType) { if ("liveness".equalsIgnoreCase(checkType)) { return checkLiveness(); } else { return checkReadiness(); } } @GET @Path("/health/liveness") @Produces(MediaType.TEXT_PLAIN) @ApiOperation(value = "Checking server liveness status.") @ApiResponses(value = { @ApiResponse(code = 200, message = "Server is live"), @ApiResponse(code = 503, message = "Server is not live") }) public String checkLiveness() { // Returns OK since if we reached here, the admin application is running. return "OK"; } @GET @Path("/health/readiness") @Produces(MediaType.TEXT_PLAIN) @ApiOperation(value = "Checking server readiness status") @ApiResponses(value = { @ApiResponse(code = 200, message = "Server is ready to serve queries"), @ApiResponse(code = 503, message = "Server is not ready to serve queries") }) public String checkReadiness() { if (_shutDownInProgress.get()) { String errMessage = "Server is shutting down"; throw new WebApplicationException(errMessage, Response.status(Response.Status.SERVICE_UNAVAILABLE).entity(errMessage).build()); } Status status = ServiceStatus.getServiceStatus(_instanceId); if (status == Status.GOOD) { _serverMetrics.addMeteredGlobalValue(ServerMeter.READINESS_CHECK_OK_CALLS, 1); return "OK"; } _serverMetrics.addMeteredGlobalValue(ServerMeter.READINESS_CHECK_BAD_CALLS, 1); String errMessage = String.format("Pinot server status is %s", status); Response response = Response.status(Response.Status.SERVICE_UNAVAILABLE).entity(errMessage).build(); throw new WebApplicationException(errMessage, response); } }
UTF-8
Java
4,150
java
HealthCheckResource.java
Java
[]
null
[]
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.pinot.server.api.resources; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import java.util.concurrent.atomic.AtomicBoolean; import javax.annotation.Nullable; import javax.inject.Inject; import javax.inject.Named; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.pinot.common.metrics.ServerMeter; import org.apache.pinot.common.metrics.ServerMetrics; import org.apache.pinot.common.utils.ServiceStatus; import org.apache.pinot.common.utils.ServiceStatus.Status; import org.apache.pinot.server.api.AdminApiApplication; /** * REST API to do health check through ServiceStatus. */ @Api(tags = "Health") @Path("/") public class HealthCheckResource { @Inject private AtomicBoolean _shutDownInProgress; @Inject @Named(AdminApiApplication.SERVER_INSTANCE_ID) private String _instanceId; @Inject private ServerMetrics _serverMetrics; @GET @Path("/health") @Produces(MediaType.TEXT_PLAIN) @ApiOperation(value = "Checking server health") @ApiResponses(value = { @ApiResponse(code = 200, message = "Server is healthy"), @ApiResponse(code = 503, message = "Server is not healthy") }) public String checkHealth( @ApiParam(value = "health check type: liveness or readiness") @QueryParam("checkType") @Nullable String checkType) { if ("liveness".equalsIgnoreCase(checkType)) { return checkLiveness(); } else { return checkReadiness(); } } @GET @Path("/health/liveness") @Produces(MediaType.TEXT_PLAIN) @ApiOperation(value = "Checking server liveness status.") @ApiResponses(value = { @ApiResponse(code = 200, message = "Server is live"), @ApiResponse(code = 503, message = "Server is not live") }) public String checkLiveness() { // Returns OK since if we reached here, the admin application is running. return "OK"; } @GET @Path("/health/readiness") @Produces(MediaType.TEXT_PLAIN) @ApiOperation(value = "Checking server readiness status") @ApiResponses(value = { @ApiResponse(code = 200, message = "Server is ready to serve queries"), @ApiResponse(code = 503, message = "Server is not ready to serve queries") }) public String checkReadiness() { if (_shutDownInProgress.get()) { String errMessage = "Server is shutting down"; throw new WebApplicationException(errMessage, Response.status(Response.Status.SERVICE_UNAVAILABLE).entity(errMessage).build()); } Status status = ServiceStatus.getServiceStatus(_instanceId); if (status == Status.GOOD) { _serverMetrics.addMeteredGlobalValue(ServerMeter.READINESS_CHECK_OK_CALLS, 1); return "OK"; } _serverMetrics.addMeteredGlobalValue(ServerMeter.READINESS_CHECK_BAD_CALLS, 1); String errMessage = String.format("Pinot server status is %s", status); Response response = Response.status(Response.Status.SERVICE_UNAVAILABLE).entity(errMessage).build(); throw new WebApplicationException(errMessage, response); } }
4,150
0.732771
0.726988
117
34.470085
25.242947
102
false
false
0
0
0
0
0
0
0.487179
false
false
12
a3bf03929170135d2eebbaaa647b33ba0df368d4
18,442,589,571,151
9f17275662c7265a953d970f10805caf30b97e25
/src/main/java/com/vapasi/springstarter/model/Book.java
96ee50680261b4e816de422523f6b2a667100249
[]
no_license
ginettev/spring-starter
https://github.com/ginettev/spring-starter
913cf29f33e5c354d8eae0cfcfc386272dd99d09
c0e9dbe99e26344f6d106c89e40e6776839060e1
refs/heads/master
2020-07-01T14:25:09.967000
2019-08-13T10:53:37
2019-08-13T10:54:19
201,196,253
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.vapasi.springstarter.model; import lombok.Getter; import lombok.NoArgsConstructor; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "books") @Getter @NoArgsConstructor public class Book { @Id @Column private Integer id; }
UTF-8
Java
349
java
Book.java
Java
[]
null
[]
package com.vapasi.springstarter.model; import lombok.Getter; import lombok.NoArgsConstructor; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "books") @Getter @NoArgsConstructor public class Book { @Id @Column private Integer id; }
349
0.773639
0.773639
19
17.368422
12.595782
39
false
false
0
0
0
0
0
0
0.421053
false
false
12
38512da367a742fc2ecf2dc0d8a0500431206510
18,339,510,406,023
3216b56841afca4c7bdf0af1e0cdbb446efa0722
/src/main/java/com/github/andbed/cleanarch/eventtype/core/boundary/ImportReceiver.java
048052d3f46021d894115b5107893e1f538f2b77
[ "Apache-2.0" ]
permissive
mrcmatuszak/clean-architecture
https://github.com/mrcmatuszak/clean-architecture
c7abc91f5bb00816addc5b7d6594c04f75f996f3
776536927b9c5fe70334052bcf0a4125423b812c
refs/heads/master
2018-10-22T03:02:33.431000
2014-10-09T11:40:11
2014-10-09T11:40:11
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.github.andbed.cleanarch.eventtype.core.boundary; import com.github.andbed.cleanarch.common.MessageCode; public interface ImportReceiver { void sendMessage(MessageCode xmlNotValid); void sendResult(boolean result); }
UTF-8
Java
235
java
ImportReceiver.java
Java
[ { "context": "package com.github.andbed.cleanarch.eventtype.core.boundary;\n\nimport com.gi", "end": 25, "score": 0.7038787603378296, "start": 19, "tag": "USERNAME", "value": "andbed" }, { "context": "narch.eventtype.core.boundary;\n\nimport com.github.andbed.cleanarch.common.MessageCode;\n\npublic interface I", "end": 86, "score": 0.7285158634185791, "start": 80, "tag": "USERNAME", "value": "andbed" } ]
null
[]
package com.github.andbed.cleanarch.eventtype.core.boundary; import com.github.andbed.cleanarch.common.MessageCode; public interface ImportReceiver { void sendMessage(MessageCode xmlNotValid); void sendResult(boolean result); }
235
0.817021
0.817021
11
20.363636
23.320972
60
false
false
0
0
0
0
0
0
0.545455
false
false
12
2b52b5f8d055377731e8251509a990c49abf881c
30,855,045,071,036
96904ac7a53531312c85b2e2b25e65ea9b84a231
/ShooterGameFinal/blackbear.java
fb2b8b14a5d61b0167f3a76eca82cf3d84f6984c
[]
no_license
kenthehacker/resumeRepository
https://github.com/kenthehacker/resumeRepository
61a5e86f004e2cdc7d0e71bcbd03c960fc935c10
84a0bdef0a4fcfac7bae078a6e2ea8ffbe6f4c04
refs/heads/master
2022-07-25T18:22:29.251000
2020-05-18T08:03:07
2020-05-18T08:03:07
264,868,387
0
0
null
true
2020-05-18T07:55:58
2020-05-18T07:55:57
2020-03-20T11:03:15
2020-03-20T11:03:13
6,534
0
0
0
null
false
false
import java.awt.Graphics2D; import java.awt.Color; import java.awt.FlowLayout; import java.awt.Font; import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.util.Random; import javax.swing.ImageIcon; public class blackbear extends GameDriverV4{ SoundDriver blackbear; boolean isplay = true; int whichsong = 0; public blackbear() { String[] AP = new String[6]; AP[0] = "Troll_Song-gkTb9GP9lVI.wav"; AP[1] = "Punch_Sound_Effect-Tp7sDYEq5vI.wav"; AP[2] = "blackbear_-_Chateau-Ess0tB2obZo.wav"; AP[3] = "Logic_-_Fade_Away_Official_Audio-Uf7nGBJOR9I.wav"; AP[4] = "Machine_Gun_Sound_Effects_3-1yM_CqT-Nvk.wav"; AP[5] = "fortnite.wav"; blackbear = new SoundDriver(AP); if (isplay == true) { blackbear.loop(0); } } public void firstone() { //plays the punch soud for now //must replace with new sound blackbear.play(1); } public void reverse() { //pauses and stops the song if(isplay == true) { isplay = false; blackbear.stop(whichsong); } else { isplay = true; blackbear.loop(whichsong); } } public void soundfive() { blackbear.play(5); } public void soundfour() { blackbear.play(4); } public void soundthree() { blackbear.stop(whichsong); blackbear.loop(3); whichsong = 3; } public void soundtwo() { //stops the og sound and plays the new one blackbear.stop(whichsong); blackbear.loop(2); whichsong = 2; } public void soundone() { blackbear.stop(whichsong); //plays the og sound blackbear.loop(0); whichsong = 0; } @Override public void draw(Graphics2D win) { // TODO Auto-generated method stub } @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub } @Override public void mouseClicked(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mousePressed(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseReleased(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseEntered(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseExited(MouseEvent e) { // TODO Auto-generated method stub } }
UTF-8
Java
2,333
java
blackbear.java
Java
[]
null
[]
import java.awt.Graphics2D; import java.awt.Color; import java.awt.FlowLayout; import java.awt.Font; import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.util.Random; import javax.swing.ImageIcon; public class blackbear extends GameDriverV4{ SoundDriver blackbear; boolean isplay = true; int whichsong = 0; public blackbear() { String[] AP = new String[6]; AP[0] = "Troll_Song-gkTb9GP9lVI.wav"; AP[1] = "Punch_Sound_Effect-Tp7sDYEq5vI.wav"; AP[2] = "blackbear_-_Chateau-Ess0tB2obZo.wav"; AP[3] = "Logic_-_Fade_Away_Official_Audio-Uf7nGBJOR9I.wav"; AP[4] = "Machine_Gun_Sound_Effects_3-1yM_CqT-Nvk.wav"; AP[5] = "fortnite.wav"; blackbear = new SoundDriver(AP); if (isplay == true) { blackbear.loop(0); } } public void firstone() { //plays the punch soud for now //must replace with new sound blackbear.play(1); } public void reverse() { //pauses and stops the song if(isplay == true) { isplay = false; blackbear.stop(whichsong); } else { isplay = true; blackbear.loop(whichsong); } } public void soundfive() { blackbear.play(5); } public void soundfour() { blackbear.play(4); } public void soundthree() { blackbear.stop(whichsong); blackbear.loop(3); whichsong = 3; } public void soundtwo() { //stops the og sound and plays the new one blackbear.stop(whichsong); blackbear.loop(2); whichsong = 2; } public void soundone() { blackbear.stop(whichsong); //plays the og sound blackbear.loop(0); whichsong = 0; } @Override public void draw(Graphics2D win) { // TODO Auto-generated method stub } @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub } @Override public void mouseClicked(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mousePressed(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseReleased(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseEntered(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseExited(MouseEvent e) { // TODO Auto-generated method stub } }
2,333
0.682383
0.668667
107
20.803738
15.589021
61
false
false
0
0
0
0
0
0
2.084112
false
false
12
98f3afa3f473635c87950ee004ad191f93d61524
30,855,045,073,093
a0eac10ab513ad28f4c3329a905a4aa085953933
/bucketBrigade.java
a96818337a80704f29449578fe8b19b52a2a30ac
[ "MIT" ]
permissive
mw4132/USACOprobs
https://github.com/mw4132/USACOprobs
359cf8433249d2f1ebf81bb33168930da5469274
3040d2b33f953028b8fa89db192226a0cee07895
refs/heads/master
2020-05-17T20:42:42.807000
2020-04-19T00:12:01
2020-04-19T00:12:01
183,951,634
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.*; public class bucketBrigade { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new FileReader("buckets.in")); PrintWriter pw = new PrintWriter(new File("buckets.out")); String a = ""; Point B = new Point(); Point R = new Point(); Point L = new Point(); for (int i = 0; i < 10; i++){ a = br.readLine(); for (int j = 0; j < a.length(); j++){ if (a.charAt(j)=='B') B = new Point(i,j); if (a.charAt(j) == 'R') R = new Point(i, j); if (a.charAt(j) == 'L') L = new Point(i, j); } } if ((B.getX() == R.getX() && B.getX() == L.getX() )|| (B.getY() == R.getY() && B.getY() == L.getY())){ pw.println(getDistance(B, L) + 2); } else { pw.println(getDistance(B, L)); } br.close(); pw.close(); } public static int getDistance(Point x, Point y){ int sum1 = Math.abs(x.getX() - y.getX()); int sum2 = Math.abs(x.getY() - y.getY()); return sum1+sum2-1; } } class Point{ private int a; private int b; public Point (int a, int b){ this.a = a; this.b = b; } public Point(){ this.a = 0; this.b = 0; } public int getX(){ return a; } public int getY(){ return b; } }
UTF-8
Java
1,378
java
bucketBrigade.java
Java
[]
null
[]
import java.io.*; public class bucketBrigade { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new FileReader("buckets.in")); PrintWriter pw = new PrintWriter(new File("buckets.out")); String a = ""; Point B = new Point(); Point R = new Point(); Point L = new Point(); for (int i = 0; i < 10; i++){ a = br.readLine(); for (int j = 0; j < a.length(); j++){ if (a.charAt(j)=='B') B = new Point(i,j); if (a.charAt(j) == 'R') R = new Point(i, j); if (a.charAt(j) == 'L') L = new Point(i, j); } } if ((B.getX() == R.getX() && B.getX() == L.getX() )|| (B.getY() == R.getY() && B.getY() == L.getY())){ pw.println(getDistance(B, L) + 2); } else { pw.println(getDistance(B, L)); } br.close(); pw.close(); } public static int getDistance(Point x, Point y){ int sum1 = Math.abs(x.getX() - y.getX()); int sum2 = Math.abs(x.getY() - y.getY()); return sum1+sum2-1; } } class Point{ private int a; private int b; public Point (int a, int b){ this.a = a; this.b = b; } public Point(){ this.a = 0; this.b = 0; } public int getX(){ return a; } public int getY(){ return b; } }
1,378
0.485486
0.476778
61
20.622952
20.152016
108
false
false
0
0
0
0
0
0
0.639344
false
false
12
9424b9c19a7a256328fc831e57891091de6e5369
12,704,513,271,345
e820097c99fb212c1c819945e82bd0370b4f1cf7
/gwt-sh/src/main/java/com/skynet/spms/client/service/BaseCodeService.java
ce9624db14d4aed2721ccfc7ac49607d93a6ba5c
[]
no_license
jayanttupe/springas-train-example
https://github.com/jayanttupe/springas-train-example
7b173ca4298ceef543dc9cf8ae5f5ea365431453
adc2e0f60ddd85d287995f606b372c3d686c3be7
refs/heads/master
2021-01-10T10:37:28.615000
2011-12-20T07:47:31
2011-12-20T07:47:31
36,887,613
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.skynet.spms.client.service; import java.util.LinkedHashMap; import java.util.List; import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; import com.skynet.spms.client.vo.AddressInfoVO; import com.skynet.spms.client.vo.AddressVO; import com.skynet.spms.client.vo.BaseCode; import com.skynet.spms.client.vo.CarrierVO; import com.skynet.spms.client.vo.ContractState; import com.skynet.spms.client.vo.CustomerContact; import com.skynet.spms.client.vo.DiscountVO; import com.skynet.spms.client.vo.PartInfoVO; import com.skynet.spms.client.vo.RepairAgencyVO; import com.skynet.spms.client.vo.SupplierVO; @RemoteServiceRelativePath("baseCodeAction.form") public interface BaseCodeService extends RemoteService { public List<BaseCode> getListCode(String key); public CustomerContact getCustomerContact(String codeId); public SupplierVO getSupplierVO(String codeId); public CarrierVO getCarrierVO(String codeId); public RepairAgencyVO getRepairAgencyVO(String codeID); String[] getCertificateType(); String[] getModelofApplicabilityCode(); /** * 发货地址信息 * * @param enterpriseId */ LinkedHashMap<String, AddressVO> getShippingAddressByEnterId( String enterpriseId, String businessType); /** * 获得发票相关信息 * * @param enterpriseId */ LinkedHashMap<String, AddressVO> getInvocieAddressByEnterId( String enterpriseId, String businessType); /** * 获得收货相关地址 * * @param enterpriseId */ LinkedHashMap<String, AddressVO> getConsigneeAddressByEnterId( String enterpriseId, String businessType); public List<DiscountVO> getByCustomerIdandPartSaleReleaseId( String customerCodeId, String partNumber); /** * 获取送修合同状态 * * @param contractID * @return */ public ContractState getRepairContractState(String contractID); /*** * 通过供应商ids获得多个供应商数据 * * @param ids * @return */ public List<BaseCode> getSupplierCodeList(String ids); /** * 根据codeid获得code * * @param id * @return */ public String getCodeById(String id); /** * 更新供应商送修合同的总金额 * @param contractID * @param amount */ public void updateSupplierRepairContractAmount(String contractID,Float amount); /** * 更新客户送修合同总金额 * @param contractID * @param amount */ public void updateCustomerRepairContractAmount(String contractID,Float amount); /** * 根据销售订单明细id查询制造商信息 * @param id */ public BaseCode getmanufacturerCodeBySalesRequisitionSheetItemId(String id); /** * 件号获得备件信息 * @param partNumber * @return */ public PartInfoVO getPartInfoByPartNumber(String partNumber); /** * 根据业务编号获取地址信息 * @param uuid * @return */ public AddressInfoVO getAddressInfoByUUID(String uuid); /** * * 更改实体业务状态 * * @param className 类名 * @param id 主键 * @param state 新业务状态 * @return void * @throws */ public void updateBussinessState(String className,String id,String state); }
UTF-8
Java
3,344
java
BaseCodeService.java
Java
[]
null
[]
package com.skynet.spms.client.service; import java.util.LinkedHashMap; import java.util.List; import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; import com.skynet.spms.client.vo.AddressInfoVO; import com.skynet.spms.client.vo.AddressVO; import com.skynet.spms.client.vo.BaseCode; import com.skynet.spms.client.vo.CarrierVO; import com.skynet.spms.client.vo.ContractState; import com.skynet.spms.client.vo.CustomerContact; import com.skynet.spms.client.vo.DiscountVO; import com.skynet.spms.client.vo.PartInfoVO; import com.skynet.spms.client.vo.RepairAgencyVO; import com.skynet.spms.client.vo.SupplierVO; @RemoteServiceRelativePath("baseCodeAction.form") public interface BaseCodeService extends RemoteService { public List<BaseCode> getListCode(String key); public CustomerContact getCustomerContact(String codeId); public SupplierVO getSupplierVO(String codeId); public CarrierVO getCarrierVO(String codeId); public RepairAgencyVO getRepairAgencyVO(String codeID); String[] getCertificateType(); String[] getModelofApplicabilityCode(); /** * 发货地址信息 * * @param enterpriseId */ LinkedHashMap<String, AddressVO> getShippingAddressByEnterId( String enterpriseId, String businessType); /** * 获得发票相关信息 * * @param enterpriseId */ LinkedHashMap<String, AddressVO> getInvocieAddressByEnterId( String enterpriseId, String businessType); /** * 获得收货相关地址 * * @param enterpriseId */ LinkedHashMap<String, AddressVO> getConsigneeAddressByEnterId( String enterpriseId, String businessType); public List<DiscountVO> getByCustomerIdandPartSaleReleaseId( String customerCodeId, String partNumber); /** * 获取送修合同状态 * * @param contractID * @return */ public ContractState getRepairContractState(String contractID); /*** * 通过供应商ids获得多个供应商数据 * * @param ids * @return */ public List<BaseCode> getSupplierCodeList(String ids); /** * 根据codeid获得code * * @param id * @return */ public String getCodeById(String id); /** * 更新供应商送修合同的总金额 * @param contractID * @param amount */ public void updateSupplierRepairContractAmount(String contractID,Float amount); /** * 更新客户送修合同总金额 * @param contractID * @param amount */ public void updateCustomerRepairContractAmount(String contractID,Float amount); /** * 根据销售订单明细id查询制造商信息 * @param id */ public BaseCode getmanufacturerCodeBySalesRequisitionSheetItemId(String id); /** * 件号获得备件信息 * @param partNumber * @return */ public PartInfoVO getPartInfoByPartNumber(String partNumber); /** * 根据业务编号获取地址信息 * @param uuid * @return */ public AddressInfoVO getAddressInfoByUUID(String uuid); /** * * 更改实体业务状态 * * @param className 类名 * @param id 主键 * @param state 新业务状态 * @return void * @throws */ public void updateBussinessState(String className,String id,String state); }
3,344
0.705749
0.705749
136
20.764706
22.210966
80
false
false
0
0
0
0
0
0
1.132353
false
false
12
22be707b2c92da861e60b16cd6bdf2b8848f8eed
11,476,152,667,767
2f7b585bc87c88e46747c969f49b86706e05cfa6
/iefas-web/src/main/java/hk/oro/iefas/web/configuration/JsfConfig.java
ae3f3f0f7137aee16c30f84c85c7153ed57216ff
[]
no_license
peterso05168/oro
https://github.com/peterso05168/oro
3fd5ee3e86838215b02b73e8c5a536ba2bb7c525
6ca20e6dc77d4716df29873c110eb68abbacbdbd
refs/heads/master
2020-03-21T17:10:58.381000
2018-06-27T02:19:08
2018-06-27T02:19:08
138,818,244
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package hk.oro.iefas.web.configuration; import java.util.Collections; import javax.faces.application.ProjectStage; import javax.faces.webapp.FacesServlet; import javax.servlet.ServletContext; import javax.servlet.ServletException; import org.apache.commons.fileupload.servlet.FileCleanerCleanup; import org.primefaces.util.Constants; import org.primefaces.webapp.filter.FileUploadFilter; import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.config.CustomScopeConfigurer; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.boot.web.servlet.ServletContextInitializer; import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.context.request.RequestContextListener; import org.springframework.web.filter.CharacterEncodingFilter; import hk.oro.iefas.web.core.jsf.scope.view.FacesViewScope; /** * @version $Revision: 912 $ $Date: 2018-01-19 10:27:19 +0800 (週五, 19 一月 2018) $ * @author $Author: marvel.ma $ */ @Configuration public class JsfConfig { @Value(value = "${jsf.project-stage:Development}") private String projectStage; @Bean public ServletRegistrationBean servletRegistrationBean() { return new ServletRegistrationBean(new FacesServlet(), "*.xhtml"); } // @Bean // public ServletListenerRegistrationBean<ConfigureListener> // configureListener() // { // return new ServletListenerRegistrationBean<>(new ConfigureListener()); // } @Bean public ServletListenerRegistrationBean<RequestContextListener> requestContextListener() { return new ServletListenerRegistrationBean<>(new RequestContextListener()); } @Bean public ServletListenerRegistrationBean<FileCleanerCleanup> fileCleanerCleanup() { return new ServletListenerRegistrationBean<>(new FileCleanerCleanup()); } @Bean public FilterRegistrationBean characterEncodingFilter() { return new FilterRegistrationBean(new CharacterEncodingFilter(), servletRegistrationBean()); } @Bean public FilterRegistrationBean fileUploadFilter() { return new FilterRegistrationBean(new FileUploadFilter(), servletRegistrationBean()); } @Bean public ServletContextInitializer initializer() { return new ServletContextInitializer() { @Override public void onStartup(ServletContext servletContext) throws ServletException { servletContext.setInitParameter(ProjectStage.PROJECT_STAGE_PARAM_NAME, projectStage); servletContext.setInitParameter("com.sun.faces.numberOfViewsInSession", "5"); servletContext.setInitParameter("com.sun.faces.serializeServerState", "false"); servletContext.setInitParameter("javax.faces.STATE_SAVING_METHOD", "server"); servletContext.setInitParameter("javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE", "true"); servletContext.setInitParameter("javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL", "true"); servletContext.setInitParameter(Constants.ContextParams.THEME, "oro"); servletContext.setInitParameter(Constants.ContextParams.FONT_AWESOME, "true"); } }; } @Bean public static CustomScopeConfigurer customScopeConfigurer() { CustomScopeConfigurer configurer = new CustomScopeConfigurer(); configurer.setScopes(Collections.<String, Object>singletonMap(FacesViewScope.NAME, new FacesViewScope())); return configurer; } @Bean public static JsfErrorViewResolver jsfErrorViewResolver(ApplicationContext applicationContext) { return new JsfErrorViewResolver(applicationContext); } }
UTF-8
Java
4,080
java
JsfConfig.java
Java
[ { "context": "27:19 +0800 (週五, 19 一月 2018) $\n * @author $Author: marvel.ma $\n */\n@Configuration\npublic class JsfConfig {\n\n ", "end": 1284, "score": 0.9995014071464539, "start": 1275, "tag": "USERNAME", "value": "marvel.ma" } ]
null
[]
package hk.oro.iefas.web.configuration; import java.util.Collections; import javax.faces.application.ProjectStage; import javax.faces.webapp.FacesServlet; import javax.servlet.ServletContext; import javax.servlet.ServletException; import org.apache.commons.fileupload.servlet.FileCleanerCleanup; import org.primefaces.util.Constants; import org.primefaces.webapp.filter.FileUploadFilter; import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.config.CustomScopeConfigurer; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.boot.web.servlet.ServletContextInitializer; import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.context.request.RequestContextListener; import org.springframework.web.filter.CharacterEncodingFilter; import hk.oro.iefas.web.core.jsf.scope.view.FacesViewScope; /** * @version $Revision: 912 $ $Date: 2018-01-19 10:27:19 +0800 (週五, 19 一月 2018) $ * @author $Author: marvel.ma $ */ @Configuration public class JsfConfig { @Value(value = "${jsf.project-stage:Development}") private String projectStage; @Bean public ServletRegistrationBean servletRegistrationBean() { return new ServletRegistrationBean(new FacesServlet(), "*.xhtml"); } // @Bean // public ServletListenerRegistrationBean<ConfigureListener> // configureListener() // { // return new ServletListenerRegistrationBean<>(new ConfigureListener()); // } @Bean public ServletListenerRegistrationBean<RequestContextListener> requestContextListener() { return new ServletListenerRegistrationBean<>(new RequestContextListener()); } @Bean public ServletListenerRegistrationBean<FileCleanerCleanup> fileCleanerCleanup() { return new ServletListenerRegistrationBean<>(new FileCleanerCleanup()); } @Bean public FilterRegistrationBean characterEncodingFilter() { return new FilterRegistrationBean(new CharacterEncodingFilter(), servletRegistrationBean()); } @Bean public FilterRegistrationBean fileUploadFilter() { return new FilterRegistrationBean(new FileUploadFilter(), servletRegistrationBean()); } @Bean public ServletContextInitializer initializer() { return new ServletContextInitializer() { @Override public void onStartup(ServletContext servletContext) throws ServletException { servletContext.setInitParameter(ProjectStage.PROJECT_STAGE_PARAM_NAME, projectStage); servletContext.setInitParameter("com.sun.faces.numberOfViewsInSession", "5"); servletContext.setInitParameter("com.sun.faces.serializeServerState", "false"); servletContext.setInitParameter("javax.faces.STATE_SAVING_METHOD", "server"); servletContext.setInitParameter("javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE", "true"); servletContext.setInitParameter("javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL", "true"); servletContext.setInitParameter(Constants.ContextParams.THEME, "oro"); servletContext.setInitParameter(Constants.ContextParams.FONT_AWESOME, "true"); } }; } @Bean public static CustomScopeConfigurer customScopeConfigurer() { CustomScopeConfigurer configurer = new CustomScopeConfigurer(); configurer.setScopes(Collections.<String, Object>singletonMap(FacesViewScope.NAME, new FacesViewScope())); return configurer; } @Bean public static JsfErrorViewResolver jsfErrorViewResolver(ApplicationContext applicationContext) { return new JsfErrorViewResolver(applicationContext); } }
4,080
0.749754
0.742878
100
39.720001
35.706604
119
false
false
0
0
0
0
0
0
0.55
false
false
12
d08ea4d1f06b3828bb891009d43460e0fa04891a
5,600,637,360,140
210c498ea42b5e1248a094ae14d02d0ea816c5d5
/src/movimiento/MovimientoVerticalProyectilJugador.java
72b6b2c3f59f07a2ca100b174943b01f72605455
[]
no_license
VictoriaMartinSahagun/Proyecto_Harry
https://github.com/VictoriaMartinSahagun/Proyecto_Harry
975dfb7ae4d74c8cae6948082de3da348b2b9641
7811f8ed4e9b64c690d6a59e3f29b4eac094501c
refs/heads/master
2023-02-03T11:53:43.450000
2020-12-10T20:08:12
2020-12-10T20:08:12
307,735,596
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package movimiento; import javax.swing.JLabel; import entidad.proyectil.*; public class MovimientoVerticalProyectilJugador extends MovimientoVertical{ /** * Crea un nuevo MovimientoVerticalProyectilJugador partiendo de ciertos parametros * @param p Proyectil * @param dir int * @param vel int * @param lim_inf int * @param lim_sup int */ public MovimientoVerticalProyectilJugador( Proyectil p, int dir, int vel,int lim) { entidad = p; direccion = dir; velocidad = vel; lim_superior = lim; } @Override public void mover() { JLabel lbl = entidad.getEntidadGrafica().getEtiqueta(); int pos_y = lbl.getY() + direccion * velocidad; //si se pasa del rango desaparece if (pos_y <= this.lim_superior) { entidad.desactivar(); }else { lbl.setLocation(lbl.getX(), pos_y); } entidad.setPosY(pos_y); } }
UTF-8
Java
855
java
MovimientoVerticalProyectilJugador.java
Java
[]
null
[]
package movimiento; import javax.swing.JLabel; import entidad.proyectil.*; public class MovimientoVerticalProyectilJugador extends MovimientoVertical{ /** * Crea un nuevo MovimientoVerticalProyectilJugador partiendo de ciertos parametros * @param p Proyectil * @param dir int * @param vel int * @param lim_inf int * @param lim_sup int */ public MovimientoVerticalProyectilJugador( Proyectil p, int dir, int vel,int lim) { entidad = p; direccion = dir; velocidad = vel; lim_superior = lim; } @Override public void mover() { JLabel lbl = entidad.getEntidadGrafica().getEtiqueta(); int pos_y = lbl.getY() + direccion * velocidad; //si se pasa del rango desaparece if (pos_y <= this.lim_superior) { entidad.desactivar(); }else { lbl.setLocation(lbl.getX(), pos_y); } entidad.setPosY(pos_y); } }
855
0.693567
0.693567
39
20.923077
22.258833
84
false
false
0
0
0
0
0
0
1.641026
false
false
12
d89d85c8276fbbc118c865a2f47a0354cf1cc9b1
146,028,897,017
c15da00415e5ec191636f1d3742ed89c22ff6f1a
/20121/PLC/Project1/test/tests/Birch.java
18b42b537ffacf9e7395f62ad080392a5e709a4b
[]
no_license
chris-wood/RIT-Assignments
https://github.com/chris-wood/RIT-Assignments
6c23487469606670562209fb4e4573613b741073
f45d3bb18827b8c6d5aad64a6ceb0112780b04bc
refs/heads/master
2020-04-10T21:32:00.993000
2013-07-21T01:43:36
2013-07-21T01:43:36
2,921,248
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.*; import java.util.*; import java.math.BigInteger; /** * The interpreter program for the small and simple Birch programming language. * * @author Christopher Wood, caw4567@rit.edu */ public class Birch { // The main data stack. private List<BirchElement> stack; // The main executable command sequence. private List<BirchElement> commandSequence; // The string-to-command translation map. private Map<String, BirchCommand> commandMap = new HashMap<String, BirchCommand>(); // The supported commands by this Birch interpreter. public static enum BirchCommand { ADD, SUB, MUL, DIV, REM, EQ, GT, LT, IFZ, DUP, POP, SWAP, REV, PACK, EXEC, PUTC } /** * Default constructor for our Birch interpreter. */ public Birch() { // Initialize the data structures stack = new ArrayList<BirchElement>(); commandSequence = new ArrayList<BirchElement>(); // Initialize the command translation map commandMap.put("add", BirchCommand.ADD); commandMap.put("sub", BirchCommand.SUB); commandMap.put("mul", BirchCommand.MUL); commandMap.put("div", BirchCommand.DIV); commandMap.put("rem", BirchCommand.REM); commandMap.put("eq", BirchCommand.EQ); commandMap.put("gt", BirchCommand.GT); commandMap.put("lt", BirchCommand.LT); commandMap.put("ifz", BirchCommand.IFZ); commandMap.put("dup", BirchCommand.DUP); commandMap.put("pop", BirchCommand.POP); commandMap.put("swap", BirchCommand.SWAP); commandMap.put("rev", BirchCommand.REV); commandMap.put("pack", BirchCommand.PACK); commandMap.put("exec", BirchCommand.EXEC); commandMap.put("putc", BirchCommand.PUTC); } /** * Public method to initialize the interpretation of the Birch program * stored in the file specified. * * @param fileName * - the location of the Birch program to run. * @return the BigInteger result * * @throws FileNotFoundException * - invalid Birch program file * @throws Exception * - Any other runtime exceptions that are caused by Birch * syntax errors */ public BigInteger interpret(String fileName) throws FileNotFoundException, Exception { BigInteger result = null; // Process the input by reading from the file and building up the command sequence. // Syntax errors are detected here, before any interpretation is done. Scanner fileStream = new Scanner(new File(fileName)); while (fileStream.hasNext()) { // Try to handle the integers first if (fileStream.hasNextBigInteger()) { commandSequence.add(new BirchInteger(fileStream.next())); } else { String element = fileStream.next(); if (isValidCommand(element)) { commandSequence.add(new BirchCommandString(this, element, commandMap.get(element))); } else { throw new Exception("Syntax error in program file."); } } } // Interpret the command sequence to get the result of the Birch program. while (commandSequence.size() > 0) { BirchElement element = commandSequence.get(0); commandSequence.remove(0); handleElement(element); } // Fetch the result from the stack if ((stack.size() > 0) && (stack.get(0).getType() == BirchElement.BirchType.INTEGER)) { BirchInteger resultElement = (BirchInteger)stack.get(0); result = resultElement.evaluate(); } return result; } /** * Push a new command string sequence onto the main executing command sequence. * * @param sequenceString - the string to merge with the existing command sequeunce. */ public void sequencePush(String sequenceString) { String[] split = sequenceString.trim().split(" "); for (int i = 0; i < split.length; i++) { if (commandMap.containsKey(split[i])) { commandSequence.add(0, new BirchCommandString(this, split[i], commandMap.get(split[i]))); } else if (!split[i].isEmpty()){ commandSequence.add(0, new BirchInteger(split[i])); } } } /** * Pop the top element off the command sequence. * @return - the old top element in the sequence. */ public BirchElement sequencePop() { BirchElement topElement = commandSequence.get(0); commandSequence.remove(0); return topElement; } /** * Reverse the elements on the data stack. */ public void reverseStack() { Collections.reverse(stack); } /** * Retrieve the nth element from the top of the stack (handling negatives). * * @param n - the stack position from the top. * @return the nth element to retrieve from the top of the stack. */ public BirchElement stackGet(int n) { BirchElement nthElement = null; if (n < 0 && Math.abs(n) <= stack.size()) { n += stack.size(); nthElement = stack.get(n); } else if (n >= 0 && n < stack.size()) { nthElement = stack.get(n); } return nthElement; } /** * Push a new element onto the data stack. * * @param element - the element to push. */ public void stackPush(BirchElement element) { stack.add(0, element); } /** * Pop the top element off the data stack. * * @return - the old top element on the stack. */ public BirchElement stackPop() throws Exception { BirchElement topElement = null; if (!stack.isEmpty()) { topElement = stack.get(0); stack.remove(0); } else { throw new Exception("error"); } return topElement; } /** * Determine the size of the data stack. * * @return - the data stack size. */ public int stackSize() { return stack.size(); } /** * Determine the size of the command sequence. * * @return - length of the command sequence. */ public int sequenceSize() { return commandSequence.size(); } /** * Internal validation command. * * @param inputCommand * @return */ private boolean isValidCommand(String inputCommand) { boolean validCommand = false; for (String command : commandMap.keySet()) { if (command.equalsIgnoreCase(inputCommand)) { validCommand = true; break; } } return validCommand; } /** * Hand off the Birch element to the appropriate handler * * @param element * @throws Exception */ private void handleElement(BirchElement element) throws Exception { if (element.getType() == BirchElement.BirchType.INTEGER) { stackPush(element); } else { element.evaluate(); } } /** * The main method that runs the Birch interpreter. * * @param args * - command line arguments. */ public static void main(String args[]) { if (args.length != 1) { error("usage: java Birch progName.bir"); } else { try { Birch birch = new Birch(); BigInteger result = birch.interpret(args[0]); if (result == null) { error("error"); } else { System.out.println(result); } } catch (FileNotFoundException ex1) { error("No such file or directory"); } catch (Exception ex2) { error(ex2.getMessage()); } } } /** * Helper method that displays errors from Birch runtime exceptions. * * @param message * - message associated with the error. */ private static void error(String message) { System.err.println(message); } }
UTF-8
Java
7,071
java
Birch.java
Java
[ { "context": " simple Birch programming language.\n * \n * @author Christopher Wood, caw4567@rit.edu\n */\npublic class Birch {\n\t// The", "end": 183, "score": 0.9998525977134705, "start": 167, "tag": "NAME", "value": "Christopher Wood" }, { "context": "ramming language.\n * \n * @author Christopher Wood, caw4567@rit.edu\n */\npublic class Birch {\n\t// The main data stack.", "end": 200, "score": 0.9999260902404785, "start": 185, "tag": "EMAIL", "value": "caw4567@rit.edu" } ]
null
[]
import java.io.*; import java.util.*; import java.math.BigInteger; /** * The interpreter program for the small and simple Birch programming language. * * @author <NAME>, <EMAIL> */ public class Birch { // The main data stack. private List<BirchElement> stack; // The main executable command sequence. private List<BirchElement> commandSequence; // The string-to-command translation map. private Map<String, BirchCommand> commandMap = new HashMap<String, BirchCommand>(); // The supported commands by this Birch interpreter. public static enum BirchCommand { ADD, SUB, MUL, DIV, REM, EQ, GT, LT, IFZ, DUP, POP, SWAP, REV, PACK, EXEC, PUTC } /** * Default constructor for our Birch interpreter. */ public Birch() { // Initialize the data structures stack = new ArrayList<BirchElement>(); commandSequence = new ArrayList<BirchElement>(); // Initialize the command translation map commandMap.put("add", BirchCommand.ADD); commandMap.put("sub", BirchCommand.SUB); commandMap.put("mul", BirchCommand.MUL); commandMap.put("div", BirchCommand.DIV); commandMap.put("rem", BirchCommand.REM); commandMap.put("eq", BirchCommand.EQ); commandMap.put("gt", BirchCommand.GT); commandMap.put("lt", BirchCommand.LT); commandMap.put("ifz", BirchCommand.IFZ); commandMap.put("dup", BirchCommand.DUP); commandMap.put("pop", BirchCommand.POP); commandMap.put("swap", BirchCommand.SWAP); commandMap.put("rev", BirchCommand.REV); commandMap.put("pack", BirchCommand.PACK); commandMap.put("exec", BirchCommand.EXEC); commandMap.put("putc", BirchCommand.PUTC); } /** * Public method to initialize the interpretation of the Birch program * stored in the file specified. * * @param fileName * - the location of the Birch program to run. * @return the BigInteger result * * @throws FileNotFoundException * - invalid Birch program file * @throws Exception * - Any other runtime exceptions that are caused by Birch * syntax errors */ public BigInteger interpret(String fileName) throws FileNotFoundException, Exception { BigInteger result = null; // Process the input by reading from the file and building up the command sequence. // Syntax errors are detected here, before any interpretation is done. Scanner fileStream = new Scanner(new File(fileName)); while (fileStream.hasNext()) { // Try to handle the integers first if (fileStream.hasNextBigInteger()) { commandSequence.add(new BirchInteger(fileStream.next())); } else { String element = fileStream.next(); if (isValidCommand(element)) { commandSequence.add(new BirchCommandString(this, element, commandMap.get(element))); } else { throw new Exception("Syntax error in program file."); } } } // Interpret the command sequence to get the result of the Birch program. while (commandSequence.size() > 0) { BirchElement element = commandSequence.get(0); commandSequence.remove(0); handleElement(element); } // Fetch the result from the stack if ((stack.size() > 0) && (stack.get(0).getType() == BirchElement.BirchType.INTEGER)) { BirchInteger resultElement = (BirchInteger)stack.get(0); result = resultElement.evaluate(); } return result; } /** * Push a new command string sequence onto the main executing command sequence. * * @param sequenceString - the string to merge with the existing command sequeunce. */ public void sequencePush(String sequenceString) { String[] split = sequenceString.trim().split(" "); for (int i = 0; i < split.length; i++) { if (commandMap.containsKey(split[i])) { commandSequence.add(0, new BirchCommandString(this, split[i], commandMap.get(split[i]))); } else if (!split[i].isEmpty()){ commandSequence.add(0, new BirchInteger(split[i])); } } } /** * Pop the top element off the command sequence. * @return - the old top element in the sequence. */ public BirchElement sequencePop() { BirchElement topElement = commandSequence.get(0); commandSequence.remove(0); return topElement; } /** * Reverse the elements on the data stack. */ public void reverseStack() { Collections.reverse(stack); } /** * Retrieve the nth element from the top of the stack (handling negatives). * * @param n - the stack position from the top. * @return the nth element to retrieve from the top of the stack. */ public BirchElement stackGet(int n) { BirchElement nthElement = null; if (n < 0 && Math.abs(n) <= stack.size()) { n += stack.size(); nthElement = stack.get(n); } else if (n >= 0 && n < stack.size()) { nthElement = stack.get(n); } return nthElement; } /** * Push a new element onto the data stack. * * @param element - the element to push. */ public void stackPush(BirchElement element) { stack.add(0, element); } /** * Pop the top element off the data stack. * * @return - the old top element on the stack. */ public BirchElement stackPop() throws Exception { BirchElement topElement = null; if (!stack.isEmpty()) { topElement = stack.get(0); stack.remove(0); } else { throw new Exception("error"); } return topElement; } /** * Determine the size of the data stack. * * @return - the data stack size. */ public int stackSize() { return stack.size(); } /** * Determine the size of the command sequence. * * @return - length of the command sequence. */ public int sequenceSize() { return commandSequence.size(); } /** * Internal validation command. * * @param inputCommand * @return */ private boolean isValidCommand(String inputCommand) { boolean validCommand = false; for (String command : commandMap.keySet()) { if (command.equalsIgnoreCase(inputCommand)) { validCommand = true; break; } } return validCommand; } /** * Hand off the Birch element to the appropriate handler * * @param element * @throws Exception */ private void handleElement(BirchElement element) throws Exception { if (element.getType() == BirchElement.BirchType.INTEGER) { stackPush(element); } else { element.evaluate(); } } /** * The main method that runs the Birch interpreter. * * @param args * - command line arguments. */ public static void main(String args[]) { if (args.length != 1) { error("usage: java Birch progName.bir"); } else { try { Birch birch = new Birch(); BigInteger result = birch.interpret(args[0]); if (result == null) { error("error"); } else { System.out.println(result); } } catch (FileNotFoundException ex1) { error("No such file or directory"); } catch (Exception ex2) { error(ex2.getMessage()); } } } /** * Helper method that displays errors from Birch runtime exceptions. * * @param message * - message associated with the error. */ private static void error(String message) { System.err.println(message); } }
7,053
0.668929
0.665394
266
25.586466
23.049677
93
false
false
0
0
0
0
0
0
2.075188
false
false
12
2edec8d1be729a5d92e4598cdc533b16fed8ee9d
27,238,682,656,211
fa866ad6134108f7444efa545633cd57fa552425
/Project3/src/main/java/edu/berkeley/cs186/database/concurrency/DummyLockManager.java
fe1fc3bf32246232e295e881738f658eae872449
[]
no_license
sunilpimenta/MOOCbase
https://github.com/sunilpimenta/MOOCbase
b4fc0ff0c54593ba0e8ed9dc3a7cb4e857110632
ca4a896928f443da9324566eda2d75eca4018b12
refs/heads/main
2023-02-11T01:49:53.339000
2020-12-29T18:30:01
2020-12-29T18:30:01
331,160,257
2
2
null
true
2021-01-20T01:42:03
2021-01-20T01:42:03
2020-12-29T18:30:13
2020-12-29T18:30:08
50,479
0
0
0
null
false
false
package edu.berkeley.cs186.database.concurrency; import java.util.Collections; import java.util.List; import edu.berkeley.cs186.database.TransactionContext; import edu.berkeley.cs186.database.common.Pair; /** * Dummy lock manager that does no locking or error checking. * * Used for non-locking-related tests to disable locking. */ public class DummyLockManager extends LockManager { public DummyLockManager() { } @Override public LockContext context(String readable, long name) { return new DummyLockContext(new Pair<>(readable, name)); } @Override public LockContext databaseContext() { return new DummyLockContext(new Pair<>("database", 0L)); } @Override public void acquireAndRelease(TransactionContext transaction, ResourceName name, LockType lockType, List<ResourceName> releaseLocks) throws DuplicateLockRequestException, NoLockHeldException { } @Override public void acquire(TransactionContext transaction, ResourceName name, LockType lockType) throws DuplicateLockRequestException { } @Override public void release(TransactionContext transaction, ResourceName name) throws NoLockHeldException { } @Override public void promote(TransactionContext transaction, ResourceName name, LockType newLockType) throws DuplicateLockRequestException, NoLockHeldException, InvalidLockException { } @Override public LockType getLockType(TransactionContext transaction, ResourceName name) { return LockType.NL; } @Override public List<Lock> getLocks(ResourceName name) { return Collections.emptyList(); } @Override public List<Lock> getLocks(TransactionContext transaction) { return Collections.emptyList(); } }
UTF-8
Java
1,852
java
DummyLockManager.java
Java
[]
null
[]
package edu.berkeley.cs186.database.concurrency; import java.util.Collections; import java.util.List; import edu.berkeley.cs186.database.TransactionContext; import edu.berkeley.cs186.database.common.Pair; /** * Dummy lock manager that does no locking or error checking. * * Used for non-locking-related tests to disable locking. */ public class DummyLockManager extends LockManager { public DummyLockManager() { } @Override public LockContext context(String readable, long name) { return new DummyLockContext(new Pair<>(readable, name)); } @Override public LockContext databaseContext() { return new DummyLockContext(new Pair<>("database", 0L)); } @Override public void acquireAndRelease(TransactionContext transaction, ResourceName name, LockType lockType, List<ResourceName> releaseLocks) throws DuplicateLockRequestException, NoLockHeldException { } @Override public void acquire(TransactionContext transaction, ResourceName name, LockType lockType) throws DuplicateLockRequestException { } @Override public void release(TransactionContext transaction, ResourceName name) throws NoLockHeldException { } @Override public void promote(TransactionContext transaction, ResourceName name, LockType newLockType) throws DuplicateLockRequestException, NoLockHeldException, InvalidLockException { } @Override public LockType getLockType(TransactionContext transaction, ResourceName name) { return LockType.NL; } @Override public List<Lock> getLocks(ResourceName name) { return Collections.emptyList(); } @Override public List<Lock> getLocks(TransactionContext transaction) { return Collections.emptyList(); } }
1,852
0.713283
0.707883
59
30.372881
29.20059
87
false
false
0
0
0
0
0
0
0.423729
false
false
12