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
ae22aee794de76bee6245dac5885d5e2decb9326
15,032,385,587,194
3057141869f27cb4309c77b5b5f775ad0b818dca
/src/massive.java
9f265a7828e787a8d6d402a3b031cba6a6b2eddc
[]
no_license
MTU2018/ITMonopoly
https://github.com/MTU2018/ITMonopoly
6460338684398ac228a587cad62aea583c4195f7
3b202779b97b204769cf55c11a95034c23f86336
refs/heads/master
2021-08-08T17:43:13.887000
2018-06-13T19:01:57
2018-06-13T19:01:57
134,593,429
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Random; public class massive { public static void main(String[] args) { int[][] matrix = new int[8][5]; System.out.println(matrix.length); Random rnd = new Random(); for (int i = 0; i < 8; i++) { for (int J = 0; J < 5; J++) { matrix[i][J] = rnd.nextInt(10); } } for (int[] row : matrix) { System.out.println(); for (int item : row) { System.out.print(item + ","); } } } }
UTF-8
Java
550
java
massive.java
Java
[]
null
[]
import java.util.Random; public class massive { public static void main(String[] args) { int[][] matrix = new int[8][5]; System.out.println(matrix.length); Random rnd = new Random(); for (int i = 0; i < 8; i++) { for (int J = 0; J < 5; J++) { matrix[i][J] = rnd.nextInt(10); } } for (int[] row : matrix) { System.out.println(); for (int item : row) { System.out.print(item + ","); } } } }
550
0.427273
0.412727
24
21.916666
17.223812
47
false
false
0
0
0
0
0
0
0.5
false
false
14
4b884747a22b0217be62fade519b740f12f8b48f
15,032,385,585,451
a592d2c9c57cc88c6873d9a95bfc6b71cf6058f8
/Java入门/com/www/Keyword/New_Final.java
c36c610782cbd3054cfdbdd5aed5741d0399cbe6
[]
no_license
yewmeaner/yewer
https://github.com/yewmeaner/yewer
08de482a74f905a76300ba9fb12d6910a612561b
b8c4fc01a9e1c5cb9245b18f164c8ff9e02254d3
refs/heads/master
2020-03-30T00:43:51.903000
2018-09-27T07:35:12
2018-09-27T07:35:12
150,540,792
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.www.Keyword; //final特点: //1.修饰的类不能被继承; //2.修饰的方法不能重写,可以继承; //3.修饰常量不能修改,表示常量,而且必须赋值。 //4.不能修饰构造方法。 //final功能: //1.防止修改; //2.高效,编译器调final修饰的方法时,会转入内嵌机制,提高执行效率, public class New_Final { public final void m1() { System.out.println("Hello,world !"); } public static void main(String[] args) { New_Final a = new New_Final(); a.m1(); } } class Tom extends New_Final{ /*public void m1() { System.out.println("not final");//不能继承 }*/ }
UTF-8
Java
680
java
New_Final.java
Java
[]
null
[]
package com.www.Keyword; //final特点: //1.修饰的类不能被继承; //2.修饰的方法不能重写,可以继承; //3.修饰常量不能修改,表示常量,而且必须赋值。 //4.不能修饰构造方法。 //final功能: //1.防止修改; //2.高效,编译器调final修饰的方法时,会转入内嵌机制,提高执行效率, public class New_Final { public final void m1() { System.out.println("Hello,world !"); } public static void main(String[] args) { New_Final a = new New_Final(); a.m1(); } } class Tom extends New_Final{ /*public void m1() { System.out.println("not final");//不能继承 }*/ }
680
0.622407
0.603734
25
17.280001
13.373167
41
false
false
0
0
0
0
0
0
0.88
false
false
14
f4d0dfd7adf3544c368505615fe3959e0d4c5385
2,164,663,568,437
f1cf602ab51dc1664dc94d5cd54d26ff491113b5
/src/main/java/com/tripforbusiness/resolver/Mutation.java
7b7b11e452753b6a558776e64a869e1e10130972
[]
no_license
andrewpalkin/tripforbusiness
https://github.com/andrewpalkin/tripforbusiness
7520f4410183fdbaf7ec42c43fcdb84efaab4f6c
37a95c51e8da4f4eec04b0c127b6f54bbe27a5a3
refs/heads/master
2020-03-13T13:42:29.033000
2018-06-19T14:39:16
2018-06-19T14:39:16
131,144,372
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tripforbusiness.resolver; import com.coxautodev.graphql.tools.GraphQLMutationResolver; import com.tripforbusiness.model.City; import com.tripforbusiness.model.Country; import com.tripforbusiness.model.CustomerSite; import com.tripforbusiness.repository.CityRepository; import com.tripforbusiness.repository.CountryRepository; import com.tripforbusiness.repository.CustomerSiteRepository; import java.util.Date; public class Mutation implements GraphQLMutationResolver { private CustomerSiteRepository customerSiteRepository; private CountryRepository countryRepository; private CityRepository cityRepository; public Mutation(CustomerSiteRepository customerSiteRepository, CountryRepository countryRepository, CityRepository cityRepository) { this.customerSiteRepository = customerSiteRepository; this.countryRepository = countryRepository; this.cityRepository = cityRepository; } public CustomerSite newCustomerSite(String cityId, String countryId, String name, String address, String description) { CustomerSite customerSite = new CustomerSite(); customerSite.setCityId(cityId); customerSite.setCountryId(countryId); customerSite.setName(name); customerSite.setDescription(description); customerSite.setAddress(address); customerSite.setCreated_at(new Date()); customerSite.setUpdated_at(new Date()); return customerSiteRepository.insert(customerSite); } public Country newCountry(String name, String description) { Country country = new Country(); country.setName(name); country.setDescription(description); country.setCreated_at(new Date()); country.setUpdated_at(new Date()); return countryRepository.insert(country); } public City newCity(String name, String timeZone, String countryId, String description) { City city = new City(); city.setName(name); city.setTimeZone(timeZone); city.setCountryId(countryId); city.setDescription(description); city.setCreated_at(new Date()); city.setUpdated_at(new Date()); return cityRepository.insert(city); } }
UTF-8
Java
2,535
java
Mutation.java
Java
[]
null
[]
package com.tripforbusiness.resolver; import com.coxautodev.graphql.tools.GraphQLMutationResolver; import com.tripforbusiness.model.City; import com.tripforbusiness.model.Country; import com.tripforbusiness.model.CustomerSite; import com.tripforbusiness.repository.CityRepository; import com.tripforbusiness.repository.CountryRepository; import com.tripforbusiness.repository.CustomerSiteRepository; import java.util.Date; public class Mutation implements GraphQLMutationResolver { private CustomerSiteRepository customerSiteRepository; private CountryRepository countryRepository; private CityRepository cityRepository; public Mutation(CustomerSiteRepository customerSiteRepository, CountryRepository countryRepository, CityRepository cityRepository) { this.customerSiteRepository = customerSiteRepository; this.countryRepository = countryRepository; this.cityRepository = cityRepository; } public CustomerSite newCustomerSite(String cityId, String countryId, String name, String address, String description) { CustomerSite customerSite = new CustomerSite(); customerSite.setCityId(cityId); customerSite.setCountryId(countryId); customerSite.setName(name); customerSite.setDescription(description); customerSite.setAddress(address); customerSite.setCreated_at(new Date()); customerSite.setUpdated_at(new Date()); return customerSiteRepository.insert(customerSite); } public Country newCountry(String name, String description) { Country country = new Country(); country.setName(name); country.setDescription(description); country.setCreated_at(new Date()); country.setUpdated_at(new Date()); return countryRepository.insert(country); } public City newCity(String name, String timeZone, String countryId, String description) { City city = new City(); city.setName(name); city.setTimeZone(timeZone); city.setCountryId(countryId); city.setDescription(description); city.setCreated_at(new Date()); city.setUpdated_at(new Date()); return cityRepository.insert(city); } }
2,535
0.651282
0.651282
73
33.726028
21.691019
66
false
false
0
0
0
0
0
0
0.657534
false
false
14
ec9f8b0d8e57833ed7e2a4c853580d5943654bc5
27,358,941,736,137
b0e3f7215f58f1166fe3d4174bfbe8cab8d2fa71
/cuentasBancarias/src/main/java/com/mayab/calidad/tarea02/AlertListener.java
b38b39563bb6ef34e5536ba2a6aab774a9ab620c
[]
no_license
Aheal/TAREA02
https://github.com/Aheal/TAREA02
35ed49747b604c5401266b12edc3893e9ea437a7
5511e8d32ecd89fcf66c82b9b0ff6ed5ffe2d62f
refs/heads/master
2020-04-30T06:29:45.962000
2019-03-20T04:30:53
2019-03-20T04:30:53
176,653,543
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mayab.calidad.tarea02; public class AlertListener implements AlertListenerInterface { public void sendAlert(String msg){ } }
UTF-8
Java
151
java
AlertListener.java
Java
[]
null
[]
package com.mayab.calidad.tarea02; public class AlertListener implements AlertListenerInterface { public void sendAlert(String msg){ } }
151
0.748344
0.735099
8
18
22.062412
62
false
false
0
0
0
0
0
0
0.125
false
false
14
4e3aa2cb08af6f9d42a99a310ff573e0ea58c10f
31,645,319,037,423
64b696dfb51ae9eeb41609b6a6a10fe296b20aa2
/src/main/java/patterns/factory/concise/Product.java
5edbd019add20767779f01f1634e4e9411869613
[ "MIT" ]
permissive
bink81/java-experiments
https://github.com/bink81/java-experiments
d4e688e617ba4aa6e4fa843173984cff30dd3c40
6f1277d9f4856477d2b89adf1ae347e45e372e7c
refs/heads/master
2021-01-17T10:21:14.855000
2018-02-21T18:52:05
2018-02-21T18:52:05
52,715,901
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package patterns.factory.concise; public abstract class Product { private final String size; @FunctionalInterface public interface Factory { Product produce(String type); } protected Product(String size) { this.size = size; } public String getSize() { return size; } public abstract int getPrice(); @Override public String toString() { return "Product [size: " + size + ", price: " + getPrice() + "]"; } }
UTF-8
Java
460
java
Product.java
Java
[]
null
[]
package patterns.factory.concise; public abstract class Product { private final String size; @FunctionalInterface public interface Factory { Product produce(String type); } protected Product(String size) { this.size = size; } public String getSize() { return size; } public abstract int getPrice(); @Override public String toString() { return "Product [size: " + size + ", price: " + getPrice() + "]"; } }
460
0.643478
0.643478
26
15.769231
15.611405
60
false
false
0
0
0
0
0
0
1.230769
false
false
14
ec671ddadda7aa8bc2e1aa391254a5726816e279
31,645,319,040,244
aa23e9dd6dc8b671cc23f34f7ecd4bd60cfe9a0d
/library/src/main/java/com/small/tools/network/support/images/ConfigImages.java
0adc833e6efa39e61504cab01afae110f7ec32b8
[]
no_license
yztazjin/AndroidNetworks
https://github.com/yztazjin/AndroidNetworks
0fc579d992515adb0eb5a72a3c6d90f09ebc13db
4ae807e464642c874afa97f99644c8c1138f1265
refs/heads/master
2021-10-11T14:41:11.554000
2019-01-27T13:39:53
2019-01-27T13:39:53
83,212,762
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.small.tools.network.support.images; import android.graphics.drawable.Drawable; import com.small.tools.network.global.Configs; import com.small.tools.network.global.SmallLogs; import com.small.tools.network.internal.interfaces.ResourceDataParser; import com.small.tools.network.internal.interfaces.SmallConfig; import com.small.tools.network.internal.async.Scheduler; import com.small.tools.network.internal.cache.CacheAction; import com.small.tools.network.internal.cache.SmallCache; import com.small.tools.network.internal.interfaces.HTTPClient; /** * Author: hjq * Date : 2018/10/06 19:05 * Name : ConfigImages * Intro : Edit By hjq * Version : 1.0 */ public class ConfigImages implements SmallConfig { Scheduler mScheduler; int mBitmapMaxWidth; int mBitmapMaxHeight; CacheAction mCacheAction; SmallCache mCacheManager; HTTPClient mHTTPClient; ResourceDataParser mDataParser; public ConfigImages() { mScheduler = new SchedulerImages(); mBitmapMaxWidth = mBitmapMaxHeight = 512; mCacheAction = CacheAction.All; mCacheManager = Configs.getSingleton().getCacheManager(); mHTTPClient = Configs.getSingleton().getHTTPClient(); mDataParser = new ResourceParserBitmap(); } public ConfigImages setScheduler(Scheduler scheduler) { mScheduler = scheduler; return this; } @Override public Scheduler getScheduler() { return mScheduler; } @Override public SmallConfig setDataParser(ResourceDataParser parser) { if (parser == null) { throw new NullPointerException("parser shouldn't set null"); } if (!Drawable.class.isAssignableFrom(parser.getParseType())) { SmallLogs.w("data parse-type is not drawable!"); } mDataParser = parser; return this; } @Override public ResourceDataParser getDataParser() { return mDataParser.newInstance(); } public ConfigImages setBitmapMaxSize(int width, int height) { mBitmapMaxWidth = width; mBitmapMaxHeight = height; return this; } public int[] getBitmapMaxSize() { return new int[]{mBitmapMaxWidth, mBitmapMaxHeight}; } @Override public SmallConfig setHTTPClient(HTTPClient client) { if (client == null) { throw new NullPointerException("request client shouldn't null!"); } mHTTPClient = client; return this; } @Override public HTTPClient getHTTPClient() { return mHTTPClient; } @Override public ConfigImages setCacheManager(SmallCache cache) { mCacheManager = cache; return this; } @Override public SmallCache getCacheManager() { return mCacheManager; } public ConfigImages setCacheAction(CacheAction action) { mCacheAction = action; return this; } public CacheAction getCacheAction() { return mCacheAction; } }
UTF-8
Java
3,022
java
ConfigImages.java
Java
[ { "context": "rk.internal.interfaces.HTTPClient;\n\n/**\n * Author: hjq\n * Date : 2018/10/06 19:05\n * Name : ConfigImag", "end": 580, "score": 0.9995537996292114, "start": 577, "tag": "USERNAME", "value": "hjq" }, { "context": "6 19:05\n * Name : ConfigImages\n * Intro : Edit By hjq\n * Version : 1.0\n */\npublic class ConfigImages im", "end": 655, "score": 0.997326672077179, "start": 652, "tag": "USERNAME", "value": "hjq" } ]
null
[]
package com.small.tools.network.support.images; import android.graphics.drawable.Drawable; import com.small.tools.network.global.Configs; import com.small.tools.network.global.SmallLogs; import com.small.tools.network.internal.interfaces.ResourceDataParser; import com.small.tools.network.internal.interfaces.SmallConfig; import com.small.tools.network.internal.async.Scheduler; import com.small.tools.network.internal.cache.CacheAction; import com.small.tools.network.internal.cache.SmallCache; import com.small.tools.network.internal.interfaces.HTTPClient; /** * Author: hjq * Date : 2018/10/06 19:05 * Name : ConfigImages * Intro : Edit By hjq * Version : 1.0 */ public class ConfigImages implements SmallConfig { Scheduler mScheduler; int mBitmapMaxWidth; int mBitmapMaxHeight; CacheAction mCacheAction; SmallCache mCacheManager; HTTPClient mHTTPClient; ResourceDataParser mDataParser; public ConfigImages() { mScheduler = new SchedulerImages(); mBitmapMaxWidth = mBitmapMaxHeight = 512; mCacheAction = CacheAction.All; mCacheManager = Configs.getSingleton().getCacheManager(); mHTTPClient = Configs.getSingleton().getHTTPClient(); mDataParser = new ResourceParserBitmap(); } public ConfigImages setScheduler(Scheduler scheduler) { mScheduler = scheduler; return this; } @Override public Scheduler getScheduler() { return mScheduler; } @Override public SmallConfig setDataParser(ResourceDataParser parser) { if (parser == null) { throw new NullPointerException("parser shouldn't set null"); } if (!Drawable.class.isAssignableFrom(parser.getParseType())) { SmallLogs.w("data parse-type is not drawable!"); } mDataParser = parser; return this; } @Override public ResourceDataParser getDataParser() { return mDataParser.newInstance(); } public ConfigImages setBitmapMaxSize(int width, int height) { mBitmapMaxWidth = width; mBitmapMaxHeight = height; return this; } public int[] getBitmapMaxSize() { return new int[]{mBitmapMaxWidth, mBitmapMaxHeight}; } @Override public SmallConfig setHTTPClient(HTTPClient client) { if (client == null) { throw new NullPointerException("request client shouldn't null!"); } mHTTPClient = client; return this; } @Override public HTTPClient getHTTPClient() { return mHTTPClient; } @Override public ConfigImages setCacheManager(SmallCache cache) { mCacheManager = cache; return this; } @Override public SmallCache getCacheManager() { return mCacheManager; } public ConfigImages setCacheAction(CacheAction action) { mCacheAction = action; return this; } public CacheAction getCacheAction() { return mCacheAction; } }
3,022
0.67505
0.669424
114
25.508772
22.196983
77
false
false
0
0
0
0
0
0
0.412281
false
false
14
e3c25afe9420e8ad408eb265a84d67afc8624776
31,971,736,569,929
6832918e1b21bafdc9c9037cdfbcfe5838abddc4
/jdk_8_maven/cs/rest-gui/genome-nexus/service/src/main/java/org/cbioportal/genome_nexus/service/internal/InfoServiceImpl.java
4d2a579b8c8d2b1d5085d37772ade5ac8b46c34e
[ "MIT", "Apache-2.0", "GPL-1.0-or-later", "LGPL-2.0-or-later" ]
permissive
EMResearch/EMB
https://github.com/EMResearch/EMB
200c5693fb169d5f5462d9ebaf5b61c46d6f9ac9
092c92f7b44d6265f240bcf6b1c21b8a5cba0c7f
refs/heads/master
2023-09-04T01:46:13.465000
2023-04-12T12:09:44
2023-04-12T12:09:44
94,008,854
25
14
Apache-2.0
false
2023-09-13T11:23:37
2017-06-11T14:13:22
2023-08-20T08:44:30
2023-09-13T11:23:36
154,785
19
12
3
Java
false
false
package org.cbioportal.genome_nexus.service.internal; import org.cbioportal.genome_nexus.model.AggregateSourceInfo; import org.cbioportal.genome_nexus.model.GenomeNexusInfo; import org.cbioportal.genome_nexus.model.VEPInfo; import org.cbioportal.genome_nexus.persistence.internal.SourceInfoRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; @Configuration @PropertySource("classpath:/maven.properties") @Service public class InfoServiceImpl { @Autowired private SourceInfoRepository sourceInfoRepository; public AggregateSourceInfo getAggregateSourceInfo() { return sourceInfoRepository.getAggregateSourceInfo(); } }
UTF-8
Java
840
java
InfoServiceImpl.java
Java
[]
null
[]
package org.cbioportal.genome_nexus.service.internal; import org.cbioportal.genome_nexus.model.AggregateSourceInfo; import org.cbioportal.genome_nexus.model.GenomeNexusInfo; import org.cbioportal.genome_nexus.model.VEPInfo; import org.cbioportal.genome_nexus.persistence.internal.SourceInfoRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; @Configuration @PropertySource("classpath:/maven.properties") @Service public class InfoServiceImpl { @Autowired private SourceInfoRepository sourceInfoRepository; public AggregateSourceInfo getAggregateSourceInfo() { return sourceInfoRepository.getAggregateSourceInfo(); } }
840
0.834524
0.834524
24
34
26.638006
77
false
false
0
0
0
0
0
0
0.458333
false
false
14
104a901164e76d4dfbc27ab0b5c663f2e4aa689b
4,080,218,979,267
209f84e2a33c74fabd4589eb524dffa08d0209c0
/core.model/src/main/java/collabware/model/graph/Graph.java
c03489dc7670b6d86ce17e4f0963ddbe823914b4
[ "MIT" ]
permissive
HotblackDesiato/collabware
https://github.com/HotblackDesiato/collabware
39fcd4dadd68a485a2f4d815d6ac3d132c5401c8
3fc4d6d9214d63cb6a9273720124e1fa0379601f
refs/heads/master
2016-09-05T23:04:17.035000
2014-04-06T13:29:09
2014-04-06T13:29:09
17,085,825
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package collabware.model.graph; import java.util.Collection; public interface Graph { boolean contains(Node n); public Node getNode(String string); public abstract Collection<? extends Node> getNodes(); public abstract Node getRootNode(); }
UTF-8
Java
254
java
Graph.java
Java
[]
null
[]
package collabware.model.graph; import java.util.Collection; public interface Graph { boolean contains(Node n); public Node getNode(String string); public abstract Collection<? extends Node> getNodes(); public abstract Node getRootNode(); }
254
0.755906
0.755906
15
15.933333
17.905182
55
false
false
0
0
0
0
0
0
0.8
false
false
14
6d81fab24f9ec7554916542eaa04c21a38c67ee1
27,582,280,042,809
b68bbdb522341bbbb28f8446898c6414d484b212
/common/TheMinecraftGames/FissionStudios/client/TileEntityHurdleRendererF.java
737246344bed65bac9b302727c3f747f97dff413
[]
no_license
madcrazydrumma/TheMinecraftGames
https://github.com/madcrazydrumma/TheMinecraftGames
60e7d86fe7891196fd26c3439d31dddc0ac5a512
11b3d8cae675dfff46937d92fb772342fc006c8a
refs/heads/master
2020-05-26T21:59:47.655000
2012-08-22T15:28:14
2012-08-22T15:28:14
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.minecraft.src; import org.lwjgl.opengl.GL11; public class TileEntityHurdleRendererF extends TileEntitySpecialRenderer { private ModelHurdleFallen model; public TileEntityHurdleRendererF() { model = new ModelHurdleFallen(); } public void renderAModelAt(TileEntityHurdleFallen tile, double d, double d1, double d2, float f) { int i = tile.getBlockMetadata(); int j = 0; if (i == 0) { j = 0; } if (i == 1) { j = 90; } if (i == 2) { j = 180; } if (i == 3) { j = 270; } bindTextureByName("/olympics/hurdle.png"); GL11.glPushMatrix(); GL11.glTranslatef((float)d + 0.5F, (float)d1 + 1.5F, (float)d2 + 0.5F); //size GL11.glRotatef(j, 0.0F, 1.0F, 0.0F); //rotate based on metadata GL11.glScalef(1.0F, -1F, -1F); //if you read this comment out this line and you can see what happens model.renderModel(0.0625F); GL11.glPopMatrix(); } public void renderTileEntityAt(TileEntity te, double d, double d1, double d2, float f) { renderAModelAt((TileEntityHurdleFallen)te, d, d1, d2, f); } }
UTF-8
Java
1,212
java
TileEntityHurdleRendererF.java
Java
[]
null
[]
package net.minecraft.src; import org.lwjgl.opengl.GL11; public class TileEntityHurdleRendererF extends TileEntitySpecialRenderer { private ModelHurdleFallen model; public TileEntityHurdleRendererF() { model = new ModelHurdleFallen(); } public void renderAModelAt(TileEntityHurdleFallen tile, double d, double d1, double d2, float f) { int i = tile.getBlockMetadata(); int j = 0; if (i == 0) { j = 0; } if (i == 1) { j = 90; } if (i == 2) { j = 180; } if (i == 3) { j = 270; } bindTextureByName("/olympics/hurdle.png"); GL11.glPushMatrix(); GL11.glTranslatef((float)d + 0.5F, (float)d1 + 1.5F, (float)d2 + 0.5F); //size GL11.glRotatef(j, 0.0F, 1.0F, 0.0F); //rotate based on metadata GL11.glScalef(1.0F, -1F, -1F); //if you read this comment out this line and you can see what happens model.renderModel(0.0625F); GL11.glPopMatrix(); } public void renderTileEntityAt(TileEntity te, double d, double d1, double d2, float f) { renderAModelAt((TileEntityHurdleFallen)te, d, d1, d2, f); } }
1,212
0.579208
0.533828
51
22.784313
27.317533
108
false
false
0
0
0
0
0
0
1.235294
false
false
14
c6f735096029d1e7cb4e3fb928d7cdadf7418cfb
25,228,637,937,847
479d22ecd39b56fff3b82b2a9eee6edf730c4bbd
/Tree/InorderSuccessorInBST.java
21cb6bb933d27b1e26d856a97ef4131edadd7d41
[]
no_license
cqlzx/leetcode
https://github.com/cqlzx/leetcode
61457dddf7e26be6d8d45f42e29fd225a65a91b3
f61ad33abc99a06f8bd2901b899d3ac82825de40
refs/heads/master
2021-01-21T23:45:24.203000
2017-11-02T01:49:59
2017-11-02T01:49:59
68,783,896
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package tree; public class InorderSuccessorInBST { public static void main(String[] args) { } public TreeNode inorderSuccessor(TreeNode root, TreeNode p) { if (root == null) return null; TreeNode successor; if (root.val <= p.val) { successor = inorderSuccessor(root.right, p); } else { successor = inorderSuccessor(root.left, p); if (successor == null) successor = root; } return successor; } }
UTF-8
Java
496
java
InorderSuccessorInBST.java
Java
[]
null
[]
package tree; public class InorderSuccessorInBST { public static void main(String[] args) { } public TreeNode inorderSuccessor(TreeNode root, TreeNode p) { if (root == null) return null; TreeNode successor; if (root.val <= p.val) { successor = inorderSuccessor(root.right, p); } else { successor = inorderSuccessor(root.left, p); if (successor == null) successor = root; } return successor; } }
496
0.584677
0.584677
20
23.799999
21.332136
65
false
false
0
0
0
0
0
0
0.75
false
false
14
fc358854b2ecbec1301cc36d1eacb05e840414cb
21,835,613,785,029
9f086e9e6e78066ba366517d36dbcf4e857dbf5c
/domain/src/main/java/com/rene/snakebackend/models/SnakePlayer.java
603c3501b27d84cfd8e5ace60393fb623c103f0f
[]
no_license
BigIdeaS3/Backend
https://github.com/BigIdeaS3/Backend
e3f6f0c4f44767e38c1e67fb79453acdbdcee305
4f67182d1422d54ced2d67753317b9209dcd0ac9
refs/heads/master
2020-07-24T01:17:13.741000
2020-01-20T14:31:08
2020-01-20T14:31:08
207,758,420
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rene.snakebackend.models; import com.rene.snakebackend.interfaces.DTO; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.util.List; @Data @AllArgsConstructor @NoArgsConstructor public class SnakePlayer implements DTO { private Player player; private List<Location> snake; }
UTF-8
Java
362
java
SnakePlayer.java
Java
[]
null
[]
package com.rene.snakebackend.models; import com.rene.snakebackend.interfaces.DTO; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.util.List; @Data @AllArgsConstructor @NoArgsConstructor public class SnakePlayer implements DTO { private Player player; private List<Location> snake; }
362
0.773481
0.773481
16
20.625
15.028619
44
false
false
0
0
0
0
0
0
0.5
false
false
14
9ef630d446b233df81b01caac9db2d7c4b5a0af1
18,064,632,511,927
2d79286427c8403f8c1d6a77e020f85362700cd2
/FFSE1702005/JavaDesktop/src/test/QuanLySV.java
39a6f6af318845d3be3ae6edbbd56628c1802bdb
[]
no_license
FASTTRACKSE/FFSE1702A.JavaCore
https://github.com/FASTTRACKSE/FFSE1702A.JavaCore
65fde01c0e1a02190c335ddf2c14535c64674942
478dffd285f2a6db36c757e7b0d48f4511db1fd4
refs/heads/master
2021-05-09T05:58:17.385000
2021-03-05T04:57:12
2021-03-05T04:57:12
119,320,744
0
11
null
false
2018-01-29T03:33:33
2018-01-29T02:26:34
2018-01-29T02:26:34
2018-01-29T03:28:47
1
0
7
0
null
false
null
package test; import javax.swing.*; import javax.swing.table.DefaultTableModel; import javax.swing.JComboBox; import java.awt.event.ActionEvent; import java.awt.*; import java.awt.event.ActionListener; import java.util.ArrayList; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.*; public class QuanLySV extends JFrame { public QuanLySV(String tieude) { super(tieude); addControls(); addEvents(); } private JTextField ma; private JTextField ten; private JTextField tuoi; private JComboBox cb; private JButton luu; private JButton thoat; private JButton xoa; private JButton moi; private JButton tai; ArrayList<SinhVien> arrStd = new ArrayList<SinhVien>(); private DefaultTableModel bang; private JTable tbl; public void addControls() { Container con = getContentPane(); JPanel pnMain = new JPanel(); pnMain.setLayout(new BoxLayout(pnMain, BoxLayout.Y_AXIS)); JPanel pnFlow = new JPanel(); pnFlow.setLayout(new FlowLayout()); luu = new JButton("Lưu"); luu.setFont(new Font("Times New Roman", Font.BOLD, 15)); pnFlow.add(luu); moi = new JButton("Thêm"); moi.setFont(new Font("Times New Roman", Font.BOLD, 15)); pnFlow.add(moi); xoa = new JButton("Xóa"); xoa.setFont(new Font("Times New Roman", Font.BOLD, 15)); pnFlow.add(xoa); tai = new JButton("Tải"); tai.setFont(new Font("Times New Roman", Font.BOLD, 15)); pnFlow.add(tai); thoat = new JButton("Thoát"); thoat.setFont(new Font("Times New Roman", Font.BOLD, 15)); pnFlow.add(thoat); JPanel trong = new JPanel(); JLabel cach = new JLabel(" "); trong.add(cach); JPanel trong1 = new JPanel(); JLabel cach1 = new JLabel(" "); trong1.add(cach); JPanel trong2 = new JPanel(); JLabel cach2 = new JLabel(" "); trong2.add(cach); JPanel de = new JPanel(); JLabel pt = new JLabel("Chương trình quản lý sinh viên"); pt.setForeground(Color.BLUE); pt.setFont(new Font("Times New Roman", Font.BOLD, 33)); pt.setHorizontalAlignment(SwingConstants.CENTER); de.add(pt); JPanel lopSV = new JPanel(); JLabel lop1 = new JLabel("Lớp: "); lop1.setFont(new Font("Times New Roman", Font.PLAIN, 20)); String lop[] = {"FFSE1701", "FFSE1702", "FFSE1703", "FFSE1704", "FFSE1705"}; cb = new JComboBox(lop); lopSV.add(lop1); lopSV.add(cb); JPanel maSV = new JPanel(); JLabel nhap = new JLabel("Mã sinh viên: "); nhap.setFont(new Font("Times New Roman", Font.PLAIN, 20)); ma = new JTextField(25); ma.setPreferredSize(new Dimension(80, 30)); maSV.add(nhap); maSV.add(ma); JPanel tenSV = new JPanel(); JLabel nhap1 = new JLabel("Tên sinh viên: "); nhap1.setFont(new Font("Times New Roman", Font.PLAIN, 20)); ten = new JTextField(25); ten.setPreferredSize(new Dimension(80, 30)); tenSV.add(nhap1); tenSV.add(ten); JPanel age = new JPanel(); JLabel age1 = new JLabel("Tuổi: "); age1.setFont(new Font("Times New Roman", Font.PLAIN, 20)); tuoi = new JTextField(); tuoi.setPreferredSize(new Dimension(80, 30)); tuoi.setColumns(25); age.add(age1); age.add(tuoi); bang = new DefaultTableModel(); bang.addColumn("Mã"); bang.addColumn("Tên"); bang.addColumn("Tuổi"); bang.addColumn("Lớp"); tbl = new JTable(bang); // bang.addRow(new String[] { "112", "Ngô Văn Bắp", "21" }); // bang.addRow(new String[] { "113", "Nguyễn Thị Tý", "18" }); // bang.addRow(new String[] { "114", "Trần Văn Tèo", "22" }); tbl.setModel(bang); tbl.setRowHeight(30); JScrollPane sc = new JScrollPane(tbl); con.setLayout(new BorderLayout()); con.add(sc, BorderLayout.CENTER); pnMain.add(de); pnMain.add(trong); pnMain.add(lopSV); pnMain.add(maSV); pnMain.add(tenSV); pnMain.add(age); pnMain.add(trong1); pnMain.add(pnFlow); pnMain.add(trong2); pnMain.add(sc); con.add(pnMain); } MouseAdapter eventSelect = new MouseAdapter() { public void mouseClicked(MouseEvent e) { int i = tbl.getSelectedRow(); String[] row = new String[4]; for (int j = 0; j < 4; j++) { row[j] = (String) tbl.getValueAt(i, j); } ma.setText(row[0]); ten.setText(row[1]); tuoi.setText(row[2]); cb.setSelectedItem(row[3]); } }; public void addEvents() { tbl.addMouseListener(eventSelect); luu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { FileOutputStream fos = new FileOutputStream("test.txt"); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(arrStd); oos.close(); fos.close(); JOptionPane.showMessageDialog(null, "Đã lưu"); } catch (IOException ex) { JOptionPane.showMessageDialog(null, "Lỗi khi lưu"); } } }); moi.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String id = ma.getText(); String name = ten.getText(); String age = tuoi.getText(); String cls = (String) cb.getSelectedItem(); SinhVien st = new SinhVien(id, name, age, cls); if (id.equals("") && name.equals("") && age.equals("")) { JOptionPane.showMessageDialog(null, "Nhập đầy đủ ba cột mã SV, tên SV và tuổi SV"); } else { arrStd.add(st); String[] row = { id, name, age ,cls}; bang.addRow(row); ma.setText(""); ten.setText(""); tuoi.setText(""); cb.setSelectedItem(""); } } }); xoa.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (ma.getText().equals("") && ten.getText().equals("") && tuoi.getText().equals("")) { JOptionPane.showMessageDialog(null, "Chọn sinh viên để xóa"); } else { int i = tbl.getSelectedRow(); arrStd.remove(i); bang.removeRow(i); ma.setText(""); ten.setText(""); tuoi.setText(""); cb.setSelectedItem(""); } } }); tai.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { FileInputStream fis = new FileInputStream("test.txt"); ObjectInputStream ois = new ObjectInputStream(fis); arrStd = (ArrayList<SinhVien>) ois.readObject(); ois.close(); fis.close(); bang.setRowCount(0); for (SinhVien st : arrStd) { String[] row = { st.getId(), st.getName(), st.getAge() ,st.getLop()}; bang.addRow(row); } JOptionPane.showMessageDialog(null, "Đã tải dữ liệu"); } catch (Exception ex) { System.out.println(ex); JOptionPane.showMessageDialog(null, "Lỗi khi tải."); } } }); thoat.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { System.exit(0); } }); } // public static Connection getConnect(String strServer, String strDatabase, // String strUser, String strPwd) { // Connection conn = null; // String strConnect = "jdbc:mysql://" + strServer + "/" + strDatabase + // "?useUnicode=true&characterEncoding=utf-8"; // Properties pro = new Properties(); // pro.put("user", strUser); // pro.put("password", strPwd); // try { // Driver driver = new Driver(); // conn = (Connection) driver.connect(strConnect, pro); // } catch (SQLException ex) { // ex.printStackTrace(); // } // return conn; // } public void showWindow() { this.setSize(650, 500); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setLocationRelativeTo(null); this.setVisible(true); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { String title = "Chương Trình Quản Lý Sinh Viên"; QuanLySV myUI = new QuanLySV(title); myUI.showWindow(); } catch (Exception e) { e.printStackTrace(); } } }); } }
UTF-8
Java
7,777
java
QuanLySV.java
Java
[ { "context": "le(bang);\n\t\t// bang.addRow(new String[] { \"112\", \"Ngô Văn Bắp\", \"21\" });\n\t\t// bang.addRow(new String[] { \"113\",", "end": 3316, "score": 0.9343533515930176, "start": 3305, "tag": "NAME", "value": "Ngô Văn Bắp" }, { "context": " \"21\" });\n\t\t// bang.addRow(new String[] { \"113\", \"Nguyễn Thị Tý\", \"18\" });\n\t\t// bang.addRow(new String[] { \"114\",", "end": 3381, "score": 0.7341309785842896, "start": 3368, "tag": "NAME", "value": "Nguyễn Thị Tý" }, { "context": " \"18\" });\n\t\t// bang.addRow(new String[] { \"114\", \"Trần Văn Tèo\", \"22\" });\n\t\ttbl.setModel(bang);\n\t\ttbl.setRowHeig", "end": 3445, "score": 0.974011242389679, "start": 3433, "tag": "NAME", "value": "Trần Văn Tèo" }, { "context": ".put(\"user\", strUser);\n\t// pro.put(\"password\", strPwd);\n\t// try {\n\t// Driver driver = new Driver();\n\t//", "end": 7016, "score": 0.9343246221542358, "start": 7013, "tag": "PASSWORD", "value": "Pwd" }, { "context": "ublic void run() {\n\t\t\t\ttry {\n\t\t\t\t\tString title = \"Chương Trình Quản Lý Sinh Viên\";\n\t\t\t\t\tQuanLySV myUI = new QuanLySV(title);\n\t\t\t\t\t", "end": 7544, "score": 0.995229959487915, "start": 7514, "tag": "NAME", "value": "Chương Trình Quản Lý Sinh Viên" } ]
null
[]
package test; import javax.swing.*; import javax.swing.table.DefaultTableModel; import javax.swing.JComboBox; import java.awt.event.ActionEvent; import java.awt.*; import java.awt.event.ActionListener; import java.util.ArrayList; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.*; public class QuanLySV extends JFrame { public QuanLySV(String tieude) { super(tieude); addControls(); addEvents(); } private JTextField ma; private JTextField ten; private JTextField tuoi; private JComboBox cb; private JButton luu; private JButton thoat; private JButton xoa; private JButton moi; private JButton tai; ArrayList<SinhVien> arrStd = new ArrayList<SinhVien>(); private DefaultTableModel bang; private JTable tbl; public void addControls() { Container con = getContentPane(); JPanel pnMain = new JPanel(); pnMain.setLayout(new BoxLayout(pnMain, BoxLayout.Y_AXIS)); JPanel pnFlow = new JPanel(); pnFlow.setLayout(new FlowLayout()); luu = new JButton("Lưu"); luu.setFont(new Font("Times New Roman", Font.BOLD, 15)); pnFlow.add(luu); moi = new JButton("Thêm"); moi.setFont(new Font("Times New Roman", Font.BOLD, 15)); pnFlow.add(moi); xoa = new JButton("Xóa"); xoa.setFont(new Font("Times New Roman", Font.BOLD, 15)); pnFlow.add(xoa); tai = new JButton("Tải"); tai.setFont(new Font("Times New Roman", Font.BOLD, 15)); pnFlow.add(tai); thoat = new JButton("Thoát"); thoat.setFont(new Font("Times New Roman", Font.BOLD, 15)); pnFlow.add(thoat); JPanel trong = new JPanel(); JLabel cach = new JLabel(" "); trong.add(cach); JPanel trong1 = new JPanel(); JLabel cach1 = new JLabel(" "); trong1.add(cach); JPanel trong2 = new JPanel(); JLabel cach2 = new JLabel(" "); trong2.add(cach); JPanel de = new JPanel(); JLabel pt = new JLabel("Chương trình quản lý sinh viên"); pt.setForeground(Color.BLUE); pt.setFont(new Font("Times New Roman", Font.BOLD, 33)); pt.setHorizontalAlignment(SwingConstants.CENTER); de.add(pt); JPanel lopSV = new JPanel(); JLabel lop1 = new JLabel("Lớp: "); lop1.setFont(new Font("Times New Roman", Font.PLAIN, 20)); String lop[] = {"FFSE1701", "FFSE1702", "FFSE1703", "FFSE1704", "FFSE1705"}; cb = new JComboBox(lop); lopSV.add(lop1); lopSV.add(cb); JPanel maSV = new JPanel(); JLabel nhap = new JLabel("Mã sinh viên: "); nhap.setFont(new Font("Times New Roman", Font.PLAIN, 20)); ma = new JTextField(25); ma.setPreferredSize(new Dimension(80, 30)); maSV.add(nhap); maSV.add(ma); JPanel tenSV = new JPanel(); JLabel nhap1 = new JLabel("Tên sinh viên: "); nhap1.setFont(new Font("Times New Roman", Font.PLAIN, 20)); ten = new JTextField(25); ten.setPreferredSize(new Dimension(80, 30)); tenSV.add(nhap1); tenSV.add(ten); JPanel age = new JPanel(); JLabel age1 = new JLabel("Tuổi: "); age1.setFont(new Font("Times New Roman", Font.PLAIN, 20)); tuoi = new JTextField(); tuoi.setPreferredSize(new Dimension(80, 30)); tuoi.setColumns(25); age.add(age1); age.add(tuoi); bang = new DefaultTableModel(); bang.addColumn("Mã"); bang.addColumn("Tên"); bang.addColumn("Tuổi"); bang.addColumn("Lớp"); tbl = new JTable(bang); // bang.addRow(new String[] { "112", "<NAME>", "21" }); // bang.addRow(new String[] { "113", "<NAME>", "18" }); // bang.addRow(new String[] { "114", "<NAME>", "22" }); tbl.setModel(bang); tbl.setRowHeight(30); JScrollPane sc = new JScrollPane(tbl); con.setLayout(new BorderLayout()); con.add(sc, BorderLayout.CENTER); pnMain.add(de); pnMain.add(trong); pnMain.add(lopSV); pnMain.add(maSV); pnMain.add(tenSV); pnMain.add(age); pnMain.add(trong1); pnMain.add(pnFlow); pnMain.add(trong2); pnMain.add(sc); con.add(pnMain); } MouseAdapter eventSelect = new MouseAdapter() { public void mouseClicked(MouseEvent e) { int i = tbl.getSelectedRow(); String[] row = new String[4]; for (int j = 0; j < 4; j++) { row[j] = (String) tbl.getValueAt(i, j); } ma.setText(row[0]); ten.setText(row[1]); tuoi.setText(row[2]); cb.setSelectedItem(row[3]); } }; public void addEvents() { tbl.addMouseListener(eventSelect); luu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { FileOutputStream fos = new FileOutputStream("test.txt"); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(arrStd); oos.close(); fos.close(); JOptionPane.showMessageDialog(null, "Đã lưu"); } catch (IOException ex) { JOptionPane.showMessageDialog(null, "Lỗi khi lưu"); } } }); moi.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String id = ma.getText(); String name = ten.getText(); String age = tuoi.getText(); String cls = (String) cb.getSelectedItem(); SinhVien st = new SinhVien(id, name, age, cls); if (id.equals("") && name.equals("") && age.equals("")) { JOptionPane.showMessageDialog(null, "Nhập đầy đủ ba cột mã SV, tên SV và tuổi SV"); } else { arrStd.add(st); String[] row = { id, name, age ,cls}; bang.addRow(row); ma.setText(""); ten.setText(""); tuoi.setText(""); cb.setSelectedItem(""); } } }); xoa.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (ma.getText().equals("") && ten.getText().equals("") && tuoi.getText().equals("")) { JOptionPane.showMessageDialog(null, "Chọn sinh viên để xóa"); } else { int i = tbl.getSelectedRow(); arrStd.remove(i); bang.removeRow(i); ma.setText(""); ten.setText(""); tuoi.setText(""); cb.setSelectedItem(""); } } }); tai.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { FileInputStream fis = new FileInputStream("test.txt"); ObjectInputStream ois = new ObjectInputStream(fis); arrStd = (ArrayList<SinhVien>) ois.readObject(); ois.close(); fis.close(); bang.setRowCount(0); for (SinhVien st : arrStd) { String[] row = { st.getId(), st.getName(), st.getAge() ,st.getLop()}; bang.addRow(row); } JOptionPane.showMessageDialog(null, "Đã tải dữ liệu"); } catch (Exception ex) { System.out.println(ex); JOptionPane.showMessageDialog(null, "Lỗi khi tải."); } } }); thoat.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { System.exit(0); } }); } // public static Connection getConnect(String strServer, String strDatabase, // String strUser, String strPwd) { // Connection conn = null; // String strConnect = "jdbc:mysql://" + strServer + "/" + strDatabase + // "?useUnicode=true&characterEncoding=utf-8"; // Properties pro = new Properties(); // pro.put("user", strUser); // pro.put("password", strPwd); // try { // Driver driver = new Driver(); // conn = (Connection) driver.connect(strConnect, pro); // } catch (SQLException ex) { // ex.printStackTrace(); // } // return conn; // } public void showWindow() { this.setSize(650, 500); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setLocationRelativeTo(null); this.setVisible(true); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { String title = "<NAME>"; QuanLySV myUI = new QuanLySV(title); myUI.showWindow(); } catch (Exception e) { e.printStackTrace(); } } }); } }
7,715
0.648505
0.63446
290
25.517241
19.736403
91
false
false
0
0
0
0
0
0
2.965517
false
false
14
a9b513fda239e31484a406376314ba63f9bb4a27
5,317,169,544,396
c57314fbd4299e7c1033788acc48e785da955f4f
/smrs-app/src/main/java/com/haier/openplatform/console/jira/webapp/action/ManagermentAction.java
541c4bc8f42aa2b5d65252368c8027c9932ce069
[]
no_license
ronesp86/smrs
https://github.com/ronesp86/smrs
c8abcdadc376fdea08aaa554ad285f8fbbbd27e1
8cf33f6d8b70937cfe489354380159b89f7986fc
refs/heads/master
2017-04-28T17:22:01.556000
2013-06-28T14:52:49
2013-06-28T14:52:49
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.haier.openplatform.console.jira.webapp.action; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.haier.openplatform.console.issue.domain.AppLists; import com.haier.openplatform.console.jira.module.ManagermentModel; import com.haier.openplatform.console.jira.module.ManagermentSearchModel; import com.haier.openplatform.console.jira.module.ProSeleModel; import com.haier.openplatform.util.Pager; /** * @author Jira */ public class ManagermentAction extends BaseJiraAction { private static final long serialVersionUID = 2986568372732421489L; /** * service分页对象 */ private Pager<ManagermentModel> pager = new Pager<ManagermentModel>(); private List<ProSeleModel> proList = new ArrayList<ProSeleModel>(); /** * 应用系统列表 */ private List<AppLists> appLists = new ArrayList<AppLists>(); private String serviceName; public String getServiceName() { return serviceName; } public void setServiceName(String serviceName) { this.serviceName = serviceName; } public Pager<ManagermentModel> getPager() { return pager; } public void setPager(Pager<ManagermentModel> pager) { this.pager = pager; } public List<AppLists> getAppLists() { return appLists; } public void setAppLists(List<AppLists> appLists) { this.appLists = appLists; } public List<ProSeleModel> getProList() { return proList; } public void setProList(List<ProSeleModel> proList) { this.proList = proList; } @Override public String execute() throws Exception { // 获取应用系统列表 Map<String, Object> pram = new HashMap<String,Object>(); pram.put("pkey", "hmmsqy"); pram.put("start", "2011-10-01"); pram.put("end", "2012-12-31"); pram.put("effissuestatus", 10006); pram.put("effissuestatus_1", "5"); pram.put("effissuestatus_2", "6"); pram.put("Transformdays", 28800); pram.put("issuedoc", 10040); pram.put("tecdoc", 10061); pram.put("forstart", 10026); pram.put("bugtype", "1"); ManagermentSearchModel searchModel = new ManagermentSearchModel(); pager.setCurrentPage(getPage()); pager.setPageSize(getRows()); searchModel.setPager(pager); //pager = getLfSqlService().getManagerment(pram,searchModel); return SUCCESS; } }
UTF-8
Java
2,277
java
ManagermentAction.java
Java
[ { "context": "om.haier.openplatform.util.Pager;\n\n/**\n * @author Jira\n */\npublic class ManagermentAction extends BaseJi", "end": 490, "score": 0.9845965504646301, "start": 486, "tag": "NAME", "value": "Jira" } ]
null
[]
package com.haier.openplatform.console.jira.webapp.action; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.haier.openplatform.console.issue.domain.AppLists; import com.haier.openplatform.console.jira.module.ManagermentModel; import com.haier.openplatform.console.jira.module.ManagermentSearchModel; import com.haier.openplatform.console.jira.module.ProSeleModel; import com.haier.openplatform.util.Pager; /** * @author Jira */ public class ManagermentAction extends BaseJiraAction { private static final long serialVersionUID = 2986568372732421489L; /** * service分页对象 */ private Pager<ManagermentModel> pager = new Pager<ManagermentModel>(); private List<ProSeleModel> proList = new ArrayList<ProSeleModel>(); /** * 应用系统列表 */ private List<AppLists> appLists = new ArrayList<AppLists>(); private String serviceName; public String getServiceName() { return serviceName; } public void setServiceName(String serviceName) { this.serviceName = serviceName; } public Pager<ManagermentModel> getPager() { return pager; } public void setPager(Pager<ManagermentModel> pager) { this.pager = pager; } public List<AppLists> getAppLists() { return appLists; } public void setAppLists(List<AppLists> appLists) { this.appLists = appLists; } public List<ProSeleModel> getProList() { return proList; } public void setProList(List<ProSeleModel> proList) { this.proList = proList; } @Override public String execute() throws Exception { // 获取应用系统列表 Map<String, Object> pram = new HashMap<String,Object>(); pram.put("pkey", "hmmsqy"); pram.put("start", "2011-10-01"); pram.put("end", "2012-12-31"); pram.put("effissuestatus", 10006); pram.put("effissuestatus_1", "5"); pram.put("effissuestatus_2", "6"); pram.put("Transformdays", 28800); pram.put("issuedoc", 10040); pram.put("tecdoc", 10061); pram.put("forstart", 10026); pram.put("bugtype", "1"); ManagermentSearchModel searchModel = new ManagermentSearchModel(); pager.setCurrentPage(getPage()); pager.setPageSize(getRows()); searchModel.setPager(pager); //pager = getLfSqlService().getManagerment(pram,searchModel); return SUCCESS; } }
2,277
0.733601
0.704596
91
23.626373
22.524052
73
false
false
0
0
0
0
0
0
1.538462
false
false
14
4c77a14cec13195003c75a81650f06e186a3e7b1
19,533,511,282,146
247b44c8a29166c0e81882288d3f5a7708cdda33
/src/main/java/dev/emir/models/PlayerModel.java
5a88b69c4c185780c4fa9ecbcbad986f7ca8118d
[]
no_license
MrEmii/GamesHiddenCore
https://github.com/MrEmii/GamesHiddenCore
6383b9aa6b909bc07b86d7d914652602be78b8c6
e37834ad8d7047ce6723b7407bbc74558982651f
refs/heads/main
2023-01-05T05:08:54.185000
2020-10-13T12:28:32
2020-10-13T12:28:32
303,232,012
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dev.emir.models; import dev.emir.Main; import org.bson.Document; import org.bson.codecs.pojo.annotations.BsonIgnore; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import java.util.ArrayList; import java.util.UUID; public class PlayerModel { private ArrayList<ConditionalModel> friends = new ArrayList<>(); private ArrayList<String> trophy = new ArrayList<>(); private PartyModel party = new PartyModel(); private ClanModel clan = new ClanModel(); private String last_server = "lobby"; private double last_connection = 0; private String language = "es_mx"; private String rank = "default"; private double real_money = 0; private double loot_coins = 0; private String username = ""; private double level = 0; private double money = 0; private String uuid = ""; private double xp = 0; @BsonIgnore private transient Player playerTPA; @BsonIgnore private transient Player player; public PlayerModel set(String last_server, String rank, String username, String uuid) { this.last_server = last_server; this.rank = rank; this.username = username; this.uuid = uuid; this.player = Bukkit.getPlayer(uuid); return this; } public PlayerModel set(String last_server, String rank, Player player) { this.last_server = last_server; this.rank = rank; this.username = player.getName(); this.uuid = player.getUniqueId().toString(); this.player = player; return this; } public ArrayList<ConditionalModel> getFriends() { return friends; } public void setFriends(ArrayList<ConditionalModel> friends) { this.friends = friends; } public ArrayList<String> getTrophy() { return trophy; } public void setTrophy(ArrayList<String> trophy) { this.trophy = trophy; } public PartyModel getParty() { return party; } public void setParty(PartyModel party) { this.party = party; } public ClanModel getClan() { return clan; } public void setClan(ClanModel clan) { this.clan = clan; } public String getLast_server() { return last_server; } public void setLast_server(String last_server) { this.last_server = last_server; } public double getLast_connection() { return last_connection; } public void setLast_connection(double last_connection) { this.last_connection = last_connection; } public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } public String getRank() { return rank; } public void setRank(String rank) { this.rank = rank; } public double getReal_money() { return real_money; } public void setReal_money(double real_money) { this.real_money = real_money; } public double getLoot_coins() { return loot_coins; } public void setLoot_coins(double loot_coins) { this.loot_coins = loot_coins; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public double getLevel() { return level; } public void setLevel(double level) { this.level = level; } public double getMoney() { return money; } public void setMoney(double money) { this.money = money; } public String getUuid() { return uuid; } public PlayerModel setUuid(String uuid) { this.uuid = uuid; return this; } public double getXp() { return xp; } public void setXp(double xp) { this.xp = xp; } public Player getPlayer() { return player; } public PlayerModel setPlayer(Player player) { this.player = player; this.username = player.getName(); this.rank = Main.getInstance().getLuckPerms().getUserManager().getUser(UUID.fromString(uuid)).getPrimaryGroup(); return this; } public void save() { Main.getInstance().getMongodb().replace("globalusers", "uuid", this.uuid, Document.parse(Main.gson.toJson(this))); } public Player getPlayerTPA() { return playerTPA; } public void setPlayerTPA(Player playerTPA) { this.playerTPA = playerTPA; } }
UTF-8
Java
4,537
java
PlayerModel.java
Java
[ { "context": "\n this.rank = rank;\n this.username = username;\n this.uuid = uuid;\n this.player = ", "end": 1169, "score": 0.9995046854019165, "start": 1161, "tag": "USERNAME", "value": "username" } ]
null
[]
package dev.emir.models; import dev.emir.Main; import org.bson.Document; import org.bson.codecs.pojo.annotations.BsonIgnore; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import java.util.ArrayList; import java.util.UUID; public class PlayerModel { private ArrayList<ConditionalModel> friends = new ArrayList<>(); private ArrayList<String> trophy = new ArrayList<>(); private PartyModel party = new PartyModel(); private ClanModel clan = new ClanModel(); private String last_server = "lobby"; private double last_connection = 0; private String language = "es_mx"; private String rank = "default"; private double real_money = 0; private double loot_coins = 0; private String username = ""; private double level = 0; private double money = 0; private String uuid = ""; private double xp = 0; @BsonIgnore private transient Player playerTPA; @BsonIgnore private transient Player player; public PlayerModel set(String last_server, String rank, String username, String uuid) { this.last_server = last_server; this.rank = rank; this.username = username; this.uuid = uuid; this.player = Bukkit.getPlayer(uuid); return this; } public PlayerModel set(String last_server, String rank, Player player) { this.last_server = last_server; this.rank = rank; this.username = player.getName(); this.uuid = player.getUniqueId().toString(); this.player = player; return this; } public ArrayList<ConditionalModel> getFriends() { return friends; } public void setFriends(ArrayList<ConditionalModel> friends) { this.friends = friends; } public ArrayList<String> getTrophy() { return trophy; } public void setTrophy(ArrayList<String> trophy) { this.trophy = trophy; } public PartyModel getParty() { return party; } public void setParty(PartyModel party) { this.party = party; } public ClanModel getClan() { return clan; } public void setClan(ClanModel clan) { this.clan = clan; } public String getLast_server() { return last_server; } public void setLast_server(String last_server) { this.last_server = last_server; } public double getLast_connection() { return last_connection; } public void setLast_connection(double last_connection) { this.last_connection = last_connection; } public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } public String getRank() { return rank; } public void setRank(String rank) { this.rank = rank; } public double getReal_money() { return real_money; } public void setReal_money(double real_money) { this.real_money = real_money; } public double getLoot_coins() { return loot_coins; } public void setLoot_coins(double loot_coins) { this.loot_coins = loot_coins; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public double getLevel() { return level; } public void setLevel(double level) { this.level = level; } public double getMoney() { return money; } public void setMoney(double money) { this.money = money; } public String getUuid() { return uuid; } public PlayerModel setUuid(String uuid) { this.uuid = uuid; return this; } public double getXp() { return xp; } public void setXp(double xp) { this.xp = xp; } public Player getPlayer() { return player; } public PlayerModel setPlayer(Player player) { this.player = player; this.username = player.getName(); this.rank = Main.getInstance().getLuckPerms().getUserManager().getUser(UUID.fromString(uuid)).getPrimaryGroup(); return this; } public void save() { Main.getInstance().getMongodb().replace("globalusers", "uuid", this.uuid, Document.parse(Main.gson.toJson(this))); } public Player getPlayerTPA() { return playerTPA; } public void setPlayerTPA(Player playerTPA) { this.playerTPA = playerTPA; } }
4,537
0.61803
0.616707
198
21.914141
21.032627
122
false
false
0
0
0
0
0
0
0.424242
false
false
14
7131f93667e229d4712d158fc5c53fff655ddafa
15,942,918,617,359
8ef2cecd392f43cc670ae8c6f149be6d71d737ba
/src/com/telesoftas/deeper/animation/SceneView.java
9fe665bff0b434d1ab60bd43ba827f7a1933d6bd
[]
no_license
NBchitu/AngelEyes2
https://github.com/NBchitu/AngelEyes2
28e563380be6dcf5ba5398770d66ebeb924a033b
afea424b70597c7498e9c6da49bcc7b140a383f7
refs/heads/master
2021-01-16T18:30:51.913000
2015-02-15T07:30:00
2015-02-15T07:30:00
30,744,510
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.telesoftas.deeper.animation; import android.content.Context; import android.content.SharedPreferences; import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.RectF; import android.util.AttributeSet; import com.fridaylab.deeper.ui.ViewTools; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterators; import com.google.common.collect.UnmodifiableListIterator; import com.telesoftas.deeper.ui.views.Panel; import com.telesoftas.hardware.DeeperFishDataPacket; import com.telesoftas.hardware.DeeperRawDataPacket; import com.telesoftas.hardware.ImagingSignal; import com.telesoftas.services.DeeperDataManager; import com.telesoftas.services.Signal; import com.telesoftas.utilities.deeper.SettingsUtils; import java.util.ArrayDeque; import java.util.Iterator; import java.util.ListIterator; public class SceneView extends SceneViewAbstract { private ImmutableList<Signal> n; private ArrayDeque<DrawingRange> o; private float p = 2.0F; private ImagingSignal q = null; private Panel r; private boolean s = false; private int t = 0; private VerticalFlasher u = null; private DialFlasher v = null; public SceneView(Context paramContext) { super(paramContext); a(paramContext); } public SceneView(Context paramContext, AttributeSet paramAttributeSet) { super(paramContext, paramAttributeSet); a(paramContext); } public SceneView(Context paramContext, AttributeSet paramAttributeSet, int paramInt) { super(paramContext, paramAttributeSet, paramInt); a(paramContext); } private void a(Canvas paramCanvas, int paramInt, float paramFloat, DeeperRawDataPacket paramDeeperRawDataPacket) { byte[] arrayOfByte = paramDeeperRawDataPacket.b(); int i = paramInt + (this.j - this.u.a()); this.u.a(paramCanvas, i, this.a, paramFloat, arrayOfByte); } private void a(Canvas paramCanvas, boolean paramBoolean, DeeperRawDataPacket paramDeeperRawDataPacket) { int i = getResources().getDimensionPixelOffset(2131230778); if (paramBoolean) {} for (int j = this.u.a();; j = 0) { float f1 = 0.5F * (paramCanvas.getWidth() - j); float f2 = 0.5F * (paramCanvas.getHeight() - i); int k = ViewTools.a(0.8F * f2); if ((k >= 280) && (k <= 300)) { k = 288; } this.v.a(paramCanvas, paramDeeperRawDataPacket, ViewTools.a(f1), ViewTools.a(f2), k); return; } } private void d() { this.p = 2.0F; this.c = 0.85F; if (this.o == null) {} float f; do { return; f = a(this.n, this.o, 3600000000000L); } while (f < 0.0F); this.p = Math.max(f, 0.0965251F); this.c = (0.85F / this.p); } protected void a(int paramInt, float paramFloat, boolean paramBoolean) { this.l.b(paramInt); if (this.q != null) { this.l.a(-1, -1.0F, this.g.getInt(SettingsUtils.a, 0), -1L, paramFloat); } for (;;) { this.l.a(paramBoolean); return; this.l.a(-1, -1.0F, this.g.getInt(SettingsUtils.a, 0), -1L, -1.0F); } } protected void a(Canvas paramCanvas) { int i; boolean bool1; label38: float f1; label52: boolean bool2; if (this.g.getInt(SettingsUtils.s, 0) == 1) { i = 1; if (this.g.getInt(SettingsUtils.t, 1) != 1) { break label158; } bool1 = true; VerticalFlasher localVerticalFlasher = this.u; if (i == 0) { break label163; } f1 = 3.0F; localVerticalFlasher.a(f1); if ((!DeeperDataManager.a().c()) && (this.o != null) && (this.q != null)) { break label181; } if ((!bool1) || ((this.g.getInt(SettingsUtils.b, 1) != 0) && (i == 0))) { break label169; } bool2 = true; label109: if (!bool2) { break label175; } } label158: label163: label169: label175: for (int j = this.u.a();; j = 0) { a(j, 41.439999F, true); if (i != 0) { a(paramCanvas, bool2, null); } this.l.a(paramCanvas); return; i = 0; break; bool1 = false; break label38; f1 = 1.0F; break label52; bool2 = false; break label109; } label181: boolean bool3 = this.g.getBoolean(SettingsUtils.f, false); a(); int k; int m; label226: Object localObject1; label237: int i1; label251: float f2; float f3; float f14; float f4; if (this.q.c() == 1) { k = 1; if ((!bool1) || (k == 0)) { break label575; } m = 1; if (m == 0) { break label581; } localObject1 = this.q; if (m == 0) { break label587; } i1 = this.u.a(); f2 = 35.223999F / this.c; f3 = this.c; if (i == 0) { break label895; } f14 = 0.85F / Math.max(a(this.n, this.o, 5000000000L), 0.06399614F); f4 = 35.223999F / f14; } for (float f5 = f14;; f5 = f3) { Signal localSignal; label366: int i2; Object localObject2; if ((bool1) && (this.o.size() > 1)) { if (m == 0) { localSignal = (Signal)this.n.get(((DrawingRange)Iterators.a(this.o.iterator(), 1)).c()); if (localSignal.c() != 1) { localObject1 = null; } } else { long l = ((Signal)this.n.get(((DrawingRange)this.o.getFirst()).b())).k(); float f12 = (float)(System.nanoTime() - l); if ((localObject1 != null) && (f12 < 1.0E+009F)) { float f13 = f12 / 1.0E+009F; if (m == 0) { f13 = 1.0F - f13; } i2 = (int)(f13 * this.u.a()); localObject2 = localObject1; } } } for (;;) { label452: if ((i != 0) && (this.q != null) && (System.nanoTime() - this.q.k() > 1000000000L)) { localObject2 = null; this.q = null; } if (localObject2 != null) { a(paramCanvas, this.u.a() - i2, f5, (DeeperRawDataPacket)localObject2); } if ((i != 0) && (k != 0)) { a(paramCanvas, bool1, (DeeperRawDataPacket)this.q); label538: if ((m == 0) && (i != 0)) { break label860; } } label575: label581: label587: label860: for (boolean bool4 = true;; bool4 = false) { a(i2, f4, bool4); this.l.a(paramCanvas); return; k = 0; break; m = 0; break label226; localObject1 = null; break label237; i1 = 0; break label251; if (m != 0) { break label866; } i2 = i1; localObject2 = null; break label452; float f6 = i2; this.d.a(i2); Iterator localIterator = this.o.iterator(); float f11; for (float f7 = f6; localIterator.hasNext(); f7 = f11) { DrawingRange localDrawingRange = (DrawingRange)localIterator.next(); float f8 = ((Signal)this.n.get(localDrawingRange.b())).a(getContext()); float f9 = f8 * localDrawingRange.d(); float f10 = this.j - f7; f11 = f7 + f9; RectF localRectF = new RectF(f10 - f9, this.a, f10, this.k); ImmutableList localImmutableList = this.n.a(localDrawingRange.b(), 1 + localDrawingRange.c()); DataRenderer localDataRenderer = a(localDrawingRange.a()); if (localDataRenderer != null) { int i3 = (int)(this.t + i2 / f8); this.f.a(localDataRenderer, paramCanvas, localRectF, this.c, localImmutableList, i3); if ((bool3) && (localDrawingRange.a() == 1)) { this.f.a(this.d, paramCanvas, localRectF, this.c, localImmutableList, i3); } } } this.f.a(); break label538; } label866: i2 = i1; localObject2 = localObject1; continue; localObject1 = localSignal; break label366; i2 = i1; localObject2 = localObject1; } label895: f4 = f2; } } public void a(Renderable paramRenderable, DataRenderer<DeeperFishDataPacket> paramDataRenderer, DataRenderer<Signal> paramDataRenderer1) { this.d = new DetectedFishes(DetectedFishes.a(getResources()), this.h); super.a(paramRenderable, paramDataRenderer, paramDataRenderer1); } public void a(boolean paramBoolean1, boolean paramBoolean2) { Object localObject1 = null; this.s = paramBoolean2; this.q = null; ImmutableList localImmutableList = DeeperDataManager.a().a(getContext(), this.j); ArrayDeque localArrayDeque = new ArrayDeque(); UnmodifiableListIterator localUnmodifiableListIterator = localImmutableList.a(localImmutableList.size()); float f1 = 0.0F; int i = 2147483647; int j; Signal localSignal; int k; if (localUnmodifiableListIterator.hasPrevious()) { j = localUnmodifiableListIterator.previousIndex(); localSignal = (Signal)localUnmodifiableListIterator.previous(); k = localSignal.c(); if ((localObject1 != null) && (i == k)) { break label286; } DrawingRange localDrawingRange = new DrawingRange(k, j, j); localArrayDeque.addLast(localDrawingRange); localObject1 = localDrawingRange; } for (;;) { localObject1.a(j); if ((this.q == null) && ((localSignal instanceof ImagingSignal))) { this.q = ((ImagingSignal)localSignal); } float f2 = f1 + localSignal.a(getContext()); if (f2 >= this.j) { if (localObject1 != null) { break label222; } } for (;;) { try { this.o = null; return; } finally { label222: if (this.r.a()) { continue; } invalidate(); } f1 = f2; i = k; break; this.o = localArrayDeque; this.n = localImmutableList; if (paramBoolean1) { d(); this.t = (1 + this.t); } if (!this.r.a()) { invalidate(); return; } } label286: k = i; } } protected void onDraw(Canvas paramCanvas) { b(paramCanvas); a(paramCanvas); if ((this.l != null) && (this.s)) { this.l.a(this); } super.onDraw(paramCanvas); } protected void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4) { if (this.j == 0) {} for (int i = 1;; i = 0) { super.onLayout(paramBoolean, paramInt1, paramInt2, paramInt3, paramInt4); if ((i != 0) && (this.j > 0)) { this.u = new VerticalFlasher(this, getResources().getDimensionPixelOffset(2131230775), this.k - this.a); this.v = new DialFlasher(getContext()); } return; } } public void setHistoryPanel(Panel paramPanel) { this.r = paramPanel; } } /* Location: C:\DISKD\fishfinder\apktool-install-windows-r05-ibot\classes_dex2jar.jar * Qualified Name: com.telesoftas.deeper.animation.SceneView * JD-Core Version: 0.7.0.1 */
UTF-8
Java
11,937
java
SceneView.java
Java
[]
null
[]
package com.telesoftas.deeper.animation; import android.content.Context; import android.content.SharedPreferences; import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.RectF; import android.util.AttributeSet; import com.fridaylab.deeper.ui.ViewTools; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterators; import com.google.common.collect.UnmodifiableListIterator; import com.telesoftas.deeper.ui.views.Panel; import com.telesoftas.hardware.DeeperFishDataPacket; import com.telesoftas.hardware.DeeperRawDataPacket; import com.telesoftas.hardware.ImagingSignal; import com.telesoftas.services.DeeperDataManager; import com.telesoftas.services.Signal; import com.telesoftas.utilities.deeper.SettingsUtils; import java.util.ArrayDeque; import java.util.Iterator; import java.util.ListIterator; public class SceneView extends SceneViewAbstract { private ImmutableList<Signal> n; private ArrayDeque<DrawingRange> o; private float p = 2.0F; private ImagingSignal q = null; private Panel r; private boolean s = false; private int t = 0; private VerticalFlasher u = null; private DialFlasher v = null; public SceneView(Context paramContext) { super(paramContext); a(paramContext); } public SceneView(Context paramContext, AttributeSet paramAttributeSet) { super(paramContext, paramAttributeSet); a(paramContext); } public SceneView(Context paramContext, AttributeSet paramAttributeSet, int paramInt) { super(paramContext, paramAttributeSet, paramInt); a(paramContext); } private void a(Canvas paramCanvas, int paramInt, float paramFloat, DeeperRawDataPacket paramDeeperRawDataPacket) { byte[] arrayOfByte = paramDeeperRawDataPacket.b(); int i = paramInt + (this.j - this.u.a()); this.u.a(paramCanvas, i, this.a, paramFloat, arrayOfByte); } private void a(Canvas paramCanvas, boolean paramBoolean, DeeperRawDataPacket paramDeeperRawDataPacket) { int i = getResources().getDimensionPixelOffset(2131230778); if (paramBoolean) {} for (int j = this.u.a();; j = 0) { float f1 = 0.5F * (paramCanvas.getWidth() - j); float f2 = 0.5F * (paramCanvas.getHeight() - i); int k = ViewTools.a(0.8F * f2); if ((k >= 280) && (k <= 300)) { k = 288; } this.v.a(paramCanvas, paramDeeperRawDataPacket, ViewTools.a(f1), ViewTools.a(f2), k); return; } } private void d() { this.p = 2.0F; this.c = 0.85F; if (this.o == null) {} float f; do { return; f = a(this.n, this.o, 3600000000000L); } while (f < 0.0F); this.p = Math.max(f, 0.0965251F); this.c = (0.85F / this.p); } protected void a(int paramInt, float paramFloat, boolean paramBoolean) { this.l.b(paramInt); if (this.q != null) { this.l.a(-1, -1.0F, this.g.getInt(SettingsUtils.a, 0), -1L, paramFloat); } for (;;) { this.l.a(paramBoolean); return; this.l.a(-1, -1.0F, this.g.getInt(SettingsUtils.a, 0), -1L, -1.0F); } } protected void a(Canvas paramCanvas) { int i; boolean bool1; label38: float f1; label52: boolean bool2; if (this.g.getInt(SettingsUtils.s, 0) == 1) { i = 1; if (this.g.getInt(SettingsUtils.t, 1) != 1) { break label158; } bool1 = true; VerticalFlasher localVerticalFlasher = this.u; if (i == 0) { break label163; } f1 = 3.0F; localVerticalFlasher.a(f1); if ((!DeeperDataManager.a().c()) && (this.o != null) && (this.q != null)) { break label181; } if ((!bool1) || ((this.g.getInt(SettingsUtils.b, 1) != 0) && (i == 0))) { break label169; } bool2 = true; label109: if (!bool2) { break label175; } } label158: label163: label169: label175: for (int j = this.u.a();; j = 0) { a(j, 41.439999F, true); if (i != 0) { a(paramCanvas, bool2, null); } this.l.a(paramCanvas); return; i = 0; break; bool1 = false; break label38; f1 = 1.0F; break label52; bool2 = false; break label109; } label181: boolean bool3 = this.g.getBoolean(SettingsUtils.f, false); a(); int k; int m; label226: Object localObject1; label237: int i1; label251: float f2; float f3; float f14; float f4; if (this.q.c() == 1) { k = 1; if ((!bool1) || (k == 0)) { break label575; } m = 1; if (m == 0) { break label581; } localObject1 = this.q; if (m == 0) { break label587; } i1 = this.u.a(); f2 = 35.223999F / this.c; f3 = this.c; if (i == 0) { break label895; } f14 = 0.85F / Math.max(a(this.n, this.o, 5000000000L), 0.06399614F); f4 = 35.223999F / f14; } for (float f5 = f14;; f5 = f3) { Signal localSignal; label366: int i2; Object localObject2; if ((bool1) && (this.o.size() > 1)) { if (m == 0) { localSignal = (Signal)this.n.get(((DrawingRange)Iterators.a(this.o.iterator(), 1)).c()); if (localSignal.c() != 1) { localObject1 = null; } } else { long l = ((Signal)this.n.get(((DrawingRange)this.o.getFirst()).b())).k(); float f12 = (float)(System.nanoTime() - l); if ((localObject1 != null) && (f12 < 1.0E+009F)) { float f13 = f12 / 1.0E+009F; if (m == 0) { f13 = 1.0F - f13; } i2 = (int)(f13 * this.u.a()); localObject2 = localObject1; } } } for (;;) { label452: if ((i != 0) && (this.q != null) && (System.nanoTime() - this.q.k() > 1000000000L)) { localObject2 = null; this.q = null; } if (localObject2 != null) { a(paramCanvas, this.u.a() - i2, f5, (DeeperRawDataPacket)localObject2); } if ((i != 0) && (k != 0)) { a(paramCanvas, bool1, (DeeperRawDataPacket)this.q); label538: if ((m == 0) && (i != 0)) { break label860; } } label575: label581: label587: label860: for (boolean bool4 = true;; bool4 = false) { a(i2, f4, bool4); this.l.a(paramCanvas); return; k = 0; break; m = 0; break label226; localObject1 = null; break label237; i1 = 0; break label251; if (m != 0) { break label866; } i2 = i1; localObject2 = null; break label452; float f6 = i2; this.d.a(i2); Iterator localIterator = this.o.iterator(); float f11; for (float f7 = f6; localIterator.hasNext(); f7 = f11) { DrawingRange localDrawingRange = (DrawingRange)localIterator.next(); float f8 = ((Signal)this.n.get(localDrawingRange.b())).a(getContext()); float f9 = f8 * localDrawingRange.d(); float f10 = this.j - f7; f11 = f7 + f9; RectF localRectF = new RectF(f10 - f9, this.a, f10, this.k); ImmutableList localImmutableList = this.n.a(localDrawingRange.b(), 1 + localDrawingRange.c()); DataRenderer localDataRenderer = a(localDrawingRange.a()); if (localDataRenderer != null) { int i3 = (int)(this.t + i2 / f8); this.f.a(localDataRenderer, paramCanvas, localRectF, this.c, localImmutableList, i3); if ((bool3) && (localDrawingRange.a() == 1)) { this.f.a(this.d, paramCanvas, localRectF, this.c, localImmutableList, i3); } } } this.f.a(); break label538; } label866: i2 = i1; localObject2 = localObject1; continue; localObject1 = localSignal; break label366; i2 = i1; localObject2 = localObject1; } label895: f4 = f2; } } public void a(Renderable paramRenderable, DataRenderer<DeeperFishDataPacket> paramDataRenderer, DataRenderer<Signal> paramDataRenderer1) { this.d = new DetectedFishes(DetectedFishes.a(getResources()), this.h); super.a(paramRenderable, paramDataRenderer, paramDataRenderer1); } public void a(boolean paramBoolean1, boolean paramBoolean2) { Object localObject1 = null; this.s = paramBoolean2; this.q = null; ImmutableList localImmutableList = DeeperDataManager.a().a(getContext(), this.j); ArrayDeque localArrayDeque = new ArrayDeque(); UnmodifiableListIterator localUnmodifiableListIterator = localImmutableList.a(localImmutableList.size()); float f1 = 0.0F; int i = 2147483647; int j; Signal localSignal; int k; if (localUnmodifiableListIterator.hasPrevious()) { j = localUnmodifiableListIterator.previousIndex(); localSignal = (Signal)localUnmodifiableListIterator.previous(); k = localSignal.c(); if ((localObject1 != null) && (i == k)) { break label286; } DrawingRange localDrawingRange = new DrawingRange(k, j, j); localArrayDeque.addLast(localDrawingRange); localObject1 = localDrawingRange; } for (;;) { localObject1.a(j); if ((this.q == null) && ((localSignal instanceof ImagingSignal))) { this.q = ((ImagingSignal)localSignal); } float f2 = f1 + localSignal.a(getContext()); if (f2 >= this.j) { if (localObject1 != null) { break label222; } } for (;;) { try { this.o = null; return; } finally { label222: if (this.r.a()) { continue; } invalidate(); } f1 = f2; i = k; break; this.o = localArrayDeque; this.n = localImmutableList; if (paramBoolean1) { d(); this.t = (1 + this.t); } if (!this.r.a()) { invalidate(); return; } } label286: k = i; } } protected void onDraw(Canvas paramCanvas) { b(paramCanvas); a(paramCanvas); if ((this.l != null) && (this.s)) { this.l.a(this); } super.onDraw(paramCanvas); } protected void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4) { if (this.j == 0) {} for (int i = 1;; i = 0) { super.onLayout(paramBoolean, paramInt1, paramInt2, paramInt3, paramInt4); if ((i != 0) && (this.j > 0)) { this.u = new VerticalFlasher(this, getResources().getDimensionPixelOffset(2131230775), this.k - this.a); this.v = new DialFlasher(getContext()); } return; } } public void setHistoryPanel(Panel paramPanel) { this.r = paramPanel; } } /* Location: C:\DISKD\fishfinder\apktool-install-windows-r05-ibot\classes_dex2jar.jar * Qualified Name: com.telesoftas.deeper.animation.SceneView * JD-Core Version: 0.7.0.1 */
11,937
0.535478
0.494597
428
25.904205
23.55006
138
false
false
0
0
0
0
0
0
0.75
false
false
14
4e355601a47e523c3fc5ec656c91cbfb66449aa6
15,221,364,103,796
e46c2384c257a8c6ac8f2a6066b748db25fa340e
/trunk/workflow-manager/src/main/java/org/mitre/mpf/mvc/ControllerUncaughtExceptionHandler.java
750cd6c914a1590de0dd6865f33dc00f31e6e90f
[ "Apache-2.0", "BSD-3-Clause" ]
permissive
bolme/openmpf
https://github.com/bolme/openmpf
025332603a019fb69eb618b5af1e03dbe6fa9082
896dddba99707176fd7d94b19799f78341699c35
refs/heads/master
2022-12-11T04:42:14.821000
2020-08-26T05:49:13
2020-08-26T05:49:13
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/****************************************************************************** * NOTICE * * * * This software (or technical data) was produced for the U.S. Government * * under contract, and is subject to the Rights in Data-General Clause * * 52.227-14, Alt. IV (DEC 2007). * * * * Copyright 2020 The MITRE Corporation. All Rights Reserved. * ******************************************************************************/ /****************************************************************************** * Copyright 2020 The MITRE Corporation * * * * 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.mitre.mpf.mvc; import org.apache.commons.lang3.StringUtils; import org.mitre.mpf.rest.api.ResponseMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.util.InvalidMimeTypeException; import org.springframework.util.MimeType; import org.springframework.util.MimeTypeUtils; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import java.util.Collections; import java.util.List; import java.util.Optional; @ControllerAdvice public class ControllerUncaughtExceptionHandler { private static final Logger log = LoggerFactory.getLogger(ControllerUncaughtExceptionHandler.class); @ExceptionHandler(Exception.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) public Object handle(HttpServletRequest request, Exception exception){ log.error(String.format("Request for %s raised an uncaught exception", request.getRequestURL()), exception); var errorMessage = StringUtils.isBlank(exception.getMessage()) ? "An unknown error has occurred. Check the Workflow Manager log for details." : exception.getMessage(); boolean isExpectingHtml = !hasAjaxHeader(request) && !jsonIsFirstMatchingMimeType(request); return isExpectingHtml ? new ModelAndView("error", "exceptionMessage", errorMessage) : createErrorModel(errorMessage, getStatus(exception)); } private static HttpStatus getStatus(Exception exception) { if (exception instanceof HttpMessageNotReadableException) { return HttpStatus.BAD_REQUEST; } return HttpStatus.INTERNAL_SERVER_ERROR; } private static boolean hasAjaxHeader(HttpServletRequest request) { String requestedWithHeaderVal = request.getHeader("X-Requested-With"); return "XMLHttpRequest".equalsIgnoreCase(requestedWithHeaderVal); } private static boolean jsonIsFirstMatchingMimeType(HttpServletRequest request) { try { return getFirstMatchingMimeType(request) .map(MimeTypeUtils.APPLICATION_JSON::includes) .orElse(false); } catch (InvalidMimeTypeException ex) { log.error("Received an invalid MIME type in the accept header. Using HTML error page", ex); return false; } } private static Optional<MimeType> getFirstMatchingMimeType(HttpServletRequest request) { List<String> acceptHeaderVals = Collections.list(request.getHeaders("Accept")); return acceptHeaderVals.stream() .flatMap(s -> MimeTypeUtils.parseMimeTypes(s).stream()) .filter(mt -> MimeTypeUtils.APPLICATION_JSON.includes(mt) || MimeTypeUtils.TEXT_HTML.includes(mt)) .findFirst(); } private static ResponseMessage createErrorModel(String errorMessage, HttpStatus status) { return new ResponseMessage(errorMessage, status); } }
UTF-8
Java
5,237
java
ControllerUncaughtExceptionHandler.java
Java
[]
null
[]
/****************************************************************************** * NOTICE * * * * This software (or technical data) was produced for the U.S. Government * * under contract, and is subject to the Rights in Data-General Clause * * 52.227-14, Alt. IV (DEC 2007). * * * * Copyright 2020 The MITRE Corporation. All Rights Reserved. * ******************************************************************************/ /****************************************************************************** * Copyright 2020 The MITRE Corporation * * * * 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.mitre.mpf.mvc; import org.apache.commons.lang3.StringUtils; import org.mitre.mpf.rest.api.ResponseMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.util.InvalidMimeTypeException; import org.springframework.util.MimeType; import org.springframework.util.MimeTypeUtils; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import java.util.Collections; import java.util.List; import java.util.Optional; @ControllerAdvice public class ControllerUncaughtExceptionHandler { private static final Logger log = LoggerFactory.getLogger(ControllerUncaughtExceptionHandler.class); @ExceptionHandler(Exception.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) public Object handle(HttpServletRequest request, Exception exception){ log.error(String.format("Request for %s raised an uncaught exception", request.getRequestURL()), exception); var errorMessage = StringUtils.isBlank(exception.getMessage()) ? "An unknown error has occurred. Check the Workflow Manager log for details." : exception.getMessage(); boolean isExpectingHtml = !hasAjaxHeader(request) && !jsonIsFirstMatchingMimeType(request); return isExpectingHtml ? new ModelAndView("error", "exceptionMessage", errorMessage) : createErrorModel(errorMessage, getStatus(exception)); } private static HttpStatus getStatus(Exception exception) { if (exception instanceof HttpMessageNotReadableException) { return HttpStatus.BAD_REQUEST; } return HttpStatus.INTERNAL_SERVER_ERROR; } private static boolean hasAjaxHeader(HttpServletRequest request) { String requestedWithHeaderVal = request.getHeader("X-Requested-With"); return "XMLHttpRequest".equalsIgnoreCase(requestedWithHeaderVal); } private static boolean jsonIsFirstMatchingMimeType(HttpServletRequest request) { try { return getFirstMatchingMimeType(request) .map(MimeTypeUtils.APPLICATION_JSON::includes) .orElse(false); } catch (InvalidMimeTypeException ex) { log.error("Received an invalid MIME type in the accept header. Using HTML error page", ex); return false; } } private static Optional<MimeType> getFirstMatchingMimeType(HttpServletRequest request) { List<String> acceptHeaderVals = Collections.list(request.getHeaders("Accept")); return acceptHeaderVals.stream() .flatMap(s -> MimeTypeUtils.parseMimeTypes(s).stream()) .filter(mt -> MimeTypeUtils.APPLICATION_JSON.includes(mt) || MimeTypeUtils.TEXT_HTML.includes(mt)) .findFirst(); } private static ResponseMessage createErrorModel(String errorMessage, HttpStatus status) { return new ResponseMessage(errorMessage, status); } }
5,237
0.582967
0.578003
105
48.866665
33.641548
116
false
false
0
0
0
0
0
0
0.485714
false
false
14
8ed86e7deb14da9abda2d457c5400ad933d42e8b
12,549,894,498,630
aae30680e7abafb5735577019898ef3a8f3bdf0c
/src/com/cf/mycountry/Utility/RandomGuid.java
af6996776144845770e65bed4671191bb43444b6
[]
no_license
yoogesh2002/RestProject
https://github.com/yoogesh2002/RestProject
a6b4adf903efa91c4981692d7116440b67845b15
5964ebab16e62d89fca0f3bf2581e8953bec19dc
refs/heads/master
2021-01-10T00:57:14.763000
2016-01-27T00:00:40
2016-01-27T00:00:40
49,826,110
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cf.mycountry.Utility; import java.util.UUID; import org.apache.commons.lang3.StringUtils; public class RandomGuid { public String getRandomGuid() { UUID randomUUID = UUID.randomUUID(); StringBuffer stringBuffer = new StringBuffer(); String mostSignificantBits = Long.toHexString(randomUUID.getMostSignificantBits()); stringBuffer.append(StringUtils.leftPad(mostSignificantBits, 16, '0')); String leastSignificantBits = Long.toHexString(randomUUID.getLeastSignificantBits()); stringBuffer.append(StringUtils.leftPad(leastSignificantBits, 16, '0')); return stringBuffer.toString(); } }
UTF-8
Java
741
java
RandomGuid.java
Java
[]
null
[]
package com.cf.mycountry.Utility; import java.util.UUID; import org.apache.commons.lang3.StringUtils; public class RandomGuid { public String getRandomGuid() { UUID randomUUID = UUID.randomUUID(); StringBuffer stringBuffer = new StringBuffer(); String mostSignificantBits = Long.toHexString(randomUUID.getMostSignificantBits()); stringBuffer.append(StringUtils.leftPad(mostSignificantBits, 16, '0')); String leastSignificantBits = Long.toHexString(randomUUID.getLeastSignificantBits()); stringBuffer.append(StringUtils.leftPad(leastSignificantBits, 16, '0')); return stringBuffer.toString(); } }
741
0.65587
0.646424
28
25.464285
29.673801
95
false
false
0
0
0
0
0
0
1.785714
false
false
14
92fda709261d778025b9895a051a13f9293269a4
5,944,234,759,397
aa2a7c6992154e93272b99d91405ba77afab6862
/FirstCA/Magazine.java
40e92bf15027f8422db35ee5b27953ec098f918d
[]
no_license
hasskell/College_work
https://github.com/hasskell/College_work
37a6a015efeccea88bcfc99451afb5f15c92c92e
be759e445454697971dea9af6187ec0fb257fb96
refs/heads/master
2016-12-13T15:00:36.981000
2016-05-26T19:58:22
2016-05-26T19:58:22
45,972,815
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package FirstCA; /** * @author Dmitrijs Lobanovskis * C00187703 */ public class Magazine extends Publications { private final String ISSN; Magazine(int id, String name, String description, double price, double vat, String title, String genre, String ISSN){ super(id, name, description, price ,vat, title, genre); this.ISSN = ISSN; } //getters public String getISSN() { return ISSN; } @Override public double calculateVAT() { double vat = (this.price * this.vat) / 100; return this.price - vat; } @Override public String toString() { return super.toString() + "\nISSN: " + this.ISSN + "\nPrice excluding vat: " + calculateVAT(); } }
UTF-8
Java
739
java
Magazine.java
Java
[ { "context": "package FirstCA;\n\n/**\n * @author Dmitrijs Lobanovskis\n * C00187703\n */\npublic class Magazine extends Pu", "end": 53, "score": 0.9998679161071777, "start": 33, "tag": "NAME", "value": "Dmitrijs Lobanovskis" } ]
null
[]
package FirstCA; /** * @author <NAME> * C00187703 */ public class Magazine extends Publications { private final String ISSN; Magazine(int id, String name, String description, double price, double vat, String title, String genre, String ISSN){ super(id, name, description, price ,vat, title, genre); this.ISSN = ISSN; } //getters public String getISSN() { return ISSN; } @Override public double calculateVAT() { double vat = (this.price * this.vat) / 100; return this.price - vat; } @Override public String toString() { return super.toString() + "\nISSN: " + this.ISSN + "\nPrice excluding vat: " + calculateVAT(); } }
725
0.61705
0.602165
32
22.09375
28.487234
121
false
false
0
0
0
0
0
0
0.65625
false
false
14
a15b8bd3820341e702ed6706012dea5074a58a14
26,328,149,537,550
ad64ca793709cabae041805ab53ac5512cb7d61d
/src/in/onlydocs/exceptions/OrderNotFoundException.java
3f7b2c430714f58b19d5bf9a7c406f5c16446654
[ "Apache-2.0" ]
permissive
shrikantghuge/only-docs-spring
https://github.com/shrikantghuge/only-docs-spring
9233ae95644d40abdc19109a5a3f3227827b9ca1
5a5a4af08b39e5606737d634df56d3e873b24235
refs/heads/master
2022-11-18T19:03:58.664000
2020-07-01T17:54:58
2020-07-01T17:54:58
276,301,099
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package in.onlydocs.exceptions; public class OrderNotFoundException extends Exception { }
UTF-8
Java
97
java
OrderNotFoundException.java
Java
[]
null
[]
package in.onlydocs.exceptions; public class OrderNotFoundException extends Exception { }
97
0.783505
0.783505
5
17.4
22.240503
55
false
false
0
0
0
0
0
0
0.2
false
false
14
0b3996db9944c779469c6089235234cf31849d42
5,334,349,424,390
c829ab79ab4391eb4267e2de1215662187091b7f
/src/basura/MainClass.java
31988cef8793be15d40b548fe3c009375da8f078
[]
no_license
MaQuiNa1995/League_Of_Legends_Info
https://github.com/MaQuiNa1995/League_Of_Legends_Info
ee37f5e16da366799cd515e3320064cfc0be4f33
9bc43b5811ae8bc6c6ee5df248452eb58e17da64
refs/heads/master
2021-01-12T01:42:32.433000
2017-01-10T17:09:27
2017-01-10T17:09:27
78,010,224
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package basura; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; /** * * @author MaQuiNa */ public class MainClass { public static void main(String[] args) { String letra = "C:\\Users\\MaQuiNa\\InfoLol\\Imagenes\\Skins"; File Dir = new File(letra); File[] lista_Archivos = Dir.listFiles(); for (int i = 0; i < lista_Archivos.length; i++) { if (lista_Archivos[i].isDirectory() && !lista_Archivos[i].isHidden()) { String Pregunta = lista_Archivos[i].getName(); System.out.println("SetOutPath $INSTDIR\\Imagenes\\Skins\\"+Pregunta); System.out.println("File W.\\Imagenes\\Skins\\" + Pregunta + "\\W"); } } } static void Meter_String(String Pregunta) { try { FileWriter Escribir_Fichero = new FileWriter("C:\\Users\\MaQuiNa\\Desktop\\ARCHIVO.TXT", true); BufferedWriter bw = new BufferedWriter(Escribir_Fichero); // Metemos en el fichero lo que escribio el usuario acompaņado de un salto de linea Escribir_Fichero.write("File W.\\Imagenes\\Skins\\" + Pregunta + "\\W"); bw.newLine(); // Cerramos el flujo Escribir_Fichero.close(); bw.close(); // Capturamos excepciones } catch (IOException error) { System.out.println(error.getMessage()); } } static void Meter_String2(String Pregunta) { try { FileWriter Escribir_Fichero = new FileWriter("C:\\Users\\MaQuiNa\\Desktop\\ARCHIVO.TXT", true); BufferedWriter bw = new BufferedWriter(Escribir_Fichero); // Metemos en el fichero lo que escribio el usuario acompaņado de un salto de linea Escribir_Fichero.write("SetOutPath $INSTDIR\\Imagenes\\Skins\\"+Pregunta); bw.newLine(); // Cerramos el flujo Escribir_Fichero.close(); bw.close(); // Capturamos excepciones } catch (IOException error) { System.out.println(error.getMessage()); } } }
ISO-8859-10
Java
2,470
java
MainClass.java
Java
[ { "context": "import java.io.IOException;\r\n\r\n/**\r\n *\r\n * @author MaQuiNa\r\n */\r\npublic class MainClass {\r\n\r\n public stat", "end": 349, "score": 0.9925788044929504, "start": 342, "tag": "USERNAME", "value": "MaQuiNa" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package basura; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; /** * * @author MaQuiNa */ public class MainClass { public static void main(String[] args) { String letra = "C:\\Users\\MaQuiNa\\InfoLol\\Imagenes\\Skins"; File Dir = new File(letra); File[] lista_Archivos = Dir.listFiles(); for (int i = 0; i < lista_Archivos.length; i++) { if (lista_Archivos[i].isDirectory() && !lista_Archivos[i].isHidden()) { String Pregunta = lista_Archivos[i].getName(); System.out.println("SetOutPath $INSTDIR\\Imagenes\\Skins\\"+Pregunta); System.out.println("File W.\\Imagenes\\Skins\\" + Pregunta + "\\W"); } } } static void Meter_String(String Pregunta) { try { FileWriter Escribir_Fichero = new FileWriter("C:\\Users\\MaQuiNa\\Desktop\\ARCHIVO.TXT", true); BufferedWriter bw = new BufferedWriter(Escribir_Fichero); // Metemos en el fichero lo que escribio el usuario acompaņado de un salto de linea Escribir_Fichero.write("File W.\\Imagenes\\Skins\\" + Pregunta + "\\W"); bw.newLine(); // Cerramos el flujo Escribir_Fichero.close(); bw.close(); // Capturamos excepciones } catch (IOException error) { System.out.println(error.getMessage()); } } static void Meter_String2(String Pregunta) { try { FileWriter Escribir_Fichero = new FileWriter("C:\\Users\\MaQuiNa\\Desktop\\ARCHIVO.TXT", true); BufferedWriter bw = new BufferedWriter(Escribir_Fichero); // Metemos en el fichero lo que escribio el usuario acompaņado de un salto de linea Escribir_Fichero.write("SetOutPath $INSTDIR\\Imagenes\\Skins\\"+Pregunta); bw.newLine(); // Cerramos el flujo Escribir_Fichero.close(); bw.close(); // Capturamos excepciones } catch (IOException error) { System.out.println(error.getMessage()); } } }
2,470
0.568882
0.568071
74
31.351351
30.045206
107
false
false
0
0
0
0
0
0
0.432432
false
false
14
cc2c6636fbd0688326218ce4d2ecf0d82f5edbc7
13,520,557,048,276
13b2c94902efaf4083135f31a3d07899962d43ba
/src/main/java/com/grafmen9999/businesslogic/repository/UserRepository.java
dff2436c238e05f5bce17b2e2b71abe95c6783b9
[]
no_license
grafmen9999/SystemControlGameProcess
https://github.com/grafmen9999/SystemControlGameProcess
f9541a8b16a6fdac1b5ed73157e297b580c66893
2ab2fbc1063d8865678c71508fe006ab27857c13
refs/heads/master
2020-06-01T09:02:46.749000
2019-06-23T20:09:38
2019-06-23T20:09:38
190,724,505
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.grafmen9999.businesslogic.repository; import com.grafmen9999.user.AbstractUser; import org.springframework.data.jpa.repository.JpaRepository; public interface UserRepository extends JpaRepository<AbstractUser, Long> { // TODO: 11.06.2019 The magic code :D }
UTF-8
Java
276
java
UserRepository.java
Java
[ { "context": "men9999.businesslogic.repository;\n\nimport com.grafmen9999.user.AbstractUser;\nimport org.springframework.", "end": 70, "score": 0.5781514644622803, "start": 66, "tag": "USERNAME", "value": "men9" } ]
null
[]
package com.grafmen9999.businesslogic.repository; import com.grafmen9999.user.AbstractUser; import org.springframework.data.jpa.repository.JpaRepository; public interface UserRepository extends JpaRepository<AbstractUser, Long> { // TODO: 11.06.2019 The magic code :D }
276
0.811594
0.753623
8
33.5
27.685736
75
false
false
0
0
0
0
0
0
0.5
false
false
14
b4aec331559f94a624fbdca5c1ef175cbfcaec86
927,712,968,205
be49595905348c0c0c4aa05903c27268b8b16046
/chap02/src/List2_4.java
eb8a0ed5208aef3d2da555f99726f9d9f340ed65
[]
no_license
musagil/java7book-src
https://github.com/musagil/java7book-src
c8217c76acffce9b138ec62fb4db145245851457
a74adc84bc4717bb34b872074b91e8a824ff6faf
refs/heads/master
2021-05-29T15:19:47.649000
2011-07-14T00:28:31
2011-07-14T00:28:31
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class List2_4 { public static void main(String[] args) { int value = 40000; short value2 = (short) value; System.out.println("º¯È¯µÈ °ª = " + value2); } }
WINDOWS-1252
Java
183
java
List2_4.java
Java
[]
null
[]
public class List2_4 { public static void main(String[] args) { int value = 40000; short value2 = (short) value; System.out.println("º¯È¯µÈ °ª = " + value2); } }
183
0.617143
0.565714
7
23.285715
16.263142
46
false
false
0
0
0
0
0
0
1.571429
false
false
14
1a16bb8df326260c91053d30a420902de75e3a1f
10,668,698,825,952
6f672fb72caedccb841ee23f53e32aceeaf1895e
/Music-Audio/livemix_tapes_source/src/com/google/android/gms/drive/query/internal/FilterHolder.java
07cab5e27a1a6b435d77b6e1f8b3ea3a44775c5e
[]
no_license
cha63506/CompSecurity
https://github.com/cha63506/CompSecurity
5c69743f660b9899146ed3cf21eceabe3d5f4280
eee7e74f4088b9c02dd711c061fc04fb1e4e2654
refs/heads/master
2018-03-23T04:15:18.480000
2015-12-19T01:29:58
2015-12-19T01:29:58
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.google.android.gms.drive.query.internal; import android.os.Parcel; import com.google.android.gms.common.internal.safeparcel.SafeParcelable; import com.google.android.gms.common.internal.zzx; import com.google.android.gms.drive.query.Filter; // Referenced classes of package com.google.android.gms.drive.query.internal: // zzd, ComparisonFilter, FieldOnlyFilter, LogicalFilter, // NotFilter, InFilter, MatchAllFilter, HasFilter, // FullTextSearchFilter, OwnedByMeFilter public class FilterHolder implements SafeParcelable { public static final android.os.Parcelable.Creator CREATOR = new zzd(); final int mVersionCode; private final Filter zzagW; final FieldOnlyFilter zzalA; final LogicalFilter zzalB; final NotFilter zzalC; final InFilter zzalD; final MatchAllFilter zzalE; final HasFilter zzalF; final FullTextSearchFilter zzalG; final OwnedByMeFilter zzalH; final ComparisonFilter zzalz; FilterHolder(int i, ComparisonFilter comparisonfilter, FieldOnlyFilter fieldonlyfilter, LogicalFilter logicalfilter, NotFilter notfilter, InFilter infilter, MatchAllFilter matchallfilter, HasFilter hasfilter, FullTextSearchFilter fulltextsearchfilter, OwnedByMeFilter ownedbymefilter) { mVersionCode = i; zzalz = comparisonfilter; zzalA = fieldonlyfilter; zzalB = logicalfilter; zzalC = notfilter; zzalD = infilter; zzalE = matchallfilter; zzalF = hasfilter; zzalG = fulltextsearchfilter; zzalH = ownedbymefilter; if (zzalz != null) { zzagW = zzalz; return; } if (zzalA != null) { zzagW = zzalA; return; } if (zzalB != null) { zzagW = zzalB; return; } if (zzalC != null) { zzagW = zzalC; return; } if (zzalD != null) { zzagW = zzalD; return; } if (zzalE != null) { zzagW = zzalE; return; } if (zzalF != null) { zzagW = zzalF; return; } if (zzalG != null) { zzagW = zzalG; return; } if (zzalH != null) { zzagW = zzalH; return; } else { throw new IllegalArgumentException("At least one filter must be set."); } } public FilterHolder(Filter filter) { zzx.zzb(filter, "Null filter."); mVersionCode = 2; Object obj; if (filter instanceof ComparisonFilter) { obj = (ComparisonFilter)filter; } else { obj = null; } zzalz = ((ComparisonFilter) (obj)); if (filter instanceof FieldOnlyFilter) { obj = (FieldOnlyFilter)filter; } else { obj = null; } zzalA = ((FieldOnlyFilter) (obj)); if (filter instanceof LogicalFilter) { obj = (LogicalFilter)filter; } else { obj = null; } zzalB = ((LogicalFilter) (obj)); if (filter instanceof NotFilter) { obj = (NotFilter)filter; } else { obj = null; } zzalC = ((NotFilter) (obj)); if (filter instanceof InFilter) { obj = (InFilter)filter; } else { obj = null; } zzalD = ((InFilter) (obj)); if (filter instanceof MatchAllFilter) { obj = (MatchAllFilter)filter; } else { obj = null; } zzalE = ((MatchAllFilter) (obj)); if (filter instanceof HasFilter) { obj = (HasFilter)filter; } else { obj = null; } zzalF = ((HasFilter) (obj)); if (filter instanceof FullTextSearchFilter) { obj = (FullTextSearchFilter)filter; } else { obj = null; } zzalG = ((FullTextSearchFilter) (obj)); if (filter instanceof OwnedByMeFilter) { obj = (OwnedByMeFilter)filter; } else { obj = null; } zzalH = ((OwnedByMeFilter) (obj)); if (zzalz == null && zzalA == null && zzalB == null && zzalC == null && zzalD == null && zzalE == null && zzalF == null && zzalG == null && zzalH == null) { throw new IllegalArgumentException("Invalid filter type."); } else { zzagW = filter; return; } } public int describeContents() { return 0; } public Filter getFilter() { return zzagW; } public String toString() { return String.format("FilterHolder[%s]", new Object[] { zzagW }); } public void writeToParcel(Parcel parcel, int i) { zzd.zza(this, parcel, i); } }
UTF-8
Java
5,351
java
FilterHolder.java
Java
[ { "context": "// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.\n// Jad home page: http://www.geocities.com/kpdus", "end": 61, "score": 0.9996351599693298, "start": 45, "tag": "NAME", "value": "Pavel Kouznetsov" } ]
null
[]
// Decompiled by Jad v1.5.8e. Copyright 2001 <NAME>. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.google.android.gms.drive.query.internal; import android.os.Parcel; import com.google.android.gms.common.internal.safeparcel.SafeParcelable; import com.google.android.gms.common.internal.zzx; import com.google.android.gms.drive.query.Filter; // Referenced classes of package com.google.android.gms.drive.query.internal: // zzd, ComparisonFilter, FieldOnlyFilter, LogicalFilter, // NotFilter, InFilter, MatchAllFilter, HasFilter, // FullTextSearchFilter, OwnedByMeFilter public class FilterHolder implements SafeParcelable { public static final android.os.Parcelable.Creator CREATOR = new zzd(); final int mVersionCode; private final Filter zzagW; final FieldOnlyFilter zzalA; final LogicalFilter zzalB; final NotFilter zzalC; final InFilter zzalD; final MatchAllFilter zzalE; final HasFilter zzalF; final FullTextSearchFilter zzalG; final OwnedByMeFilter zzalH; final ComparisonFilter zzalz; FilterHolder(int i, ComparisonFilter comparisonfilter, FieldOnlyFilter fieldonlyfilter, LogicalFilter logicalfilter, NotFilter notfilter, InFilter infilter, MatchAllFilter matchallfilter, HasFilter hasfilter, FullTextSearchFilter fulltextsearchfilter, OwnedByMeFilter ownedbymefilter) { mVersionCode = i; zzalz = comparisonfilter; zzalA = fieldonlyfilter; zzalB = logicalfilter; zzalC = notfilter; zzalD = infilter; zzalE = matchallfilter; zzalF = hasfilter; zzalG = fulltextsearchfilter; zzalH = ownedbymefilter; if (zzalz != null) { zzagW = zzalz; return; } if (zzalA != null) { zzagW = zzalA; return; } if (zzalB != null) { zzagW = zzalB; return; } if (zzalC != null) { zzagW = zzalC; return; } if (zzalD != null) { zzagW = zzalD; return; } if (zzalE != null) { zzagW = zzalE; return; } if (zzalF != null) { zzagW = zzalF; return; } if (zzalG != null) { zzagW = zzalG; return; } if (zzalH != null) { zzagW = zzalH; return; } else { throw new IllegalArgumentException("At least one filter must be set."); } } public FilterHolder(Filter filter) { zzx.zzb(filter, "Null filter."); mVersionCode = 2; Object obj; if (filter instanceof ComparisonFilter) { obj = (ComparisonFilter)filter; } else { obj = null; } zzalz = ((ComparisonFilter) (obj)); if (filter instanceof FieldOnlyFilter) { obj = (FieldOnlyFilter)filter; } else { obj = null; } zzalA = ((FieldOnlyFilter) (obj)); if (filter instanceof LogicalFilter) { obj = (LogicalFilter)filter; } else { obj = null; } zzalB = ((LogicalFilter) (obj)); if (filter instanceof NotFilter) { obj = (NotFilter)filter; } else { obj = null; } zzalC = ((NotFilter) (obj)); if (filter instanceof InFilter) { obj = (InFilter)filter; } else { obj = null; } zzalD = ((InFilter) (obj)); if (filter instanceof MatchAllFilter) { obj = (MatchAllFilter)filter; } else { obj = null; } zzalE = ((MatchAllFilter) (obj)); if (filter instanceof HasFilter) { obj = (HasFilter)filter; } else { obj = null; } zzalF = ((HasFilter) (obj)); if (filter instanceof FullTextSearchFilter) { obj = (FullTextSearchFilter)filter; } else { obj = null; } zzalG = ((FullTextSearchFilter) (obj)); if (filter instanceof OwnedByMeFilter) { obj = (OwnedByMeFilter)filter; } else { obj = null; } zzalH = ((OwnedByMeFilter) (obj)); if (zzalz == null && zzalA == null && zzalB == null && zzalC == null && zzalD == null && zzalE == null && zzalF == null && zzalG == null && zzalH == null) { throw new IllegalArgumentException("Invalid filter type."); } else { zzagW = filter; return; } } public int describeContents() { return 0; } public Filter getFilter() { return zzagW; } public String toString() { return String.format("FilterHolder[%s]", new Object[] { zzagW }); } public void writeToParcel(Parcel parcel, int i) { zzd.zza(this, parcel, i); } }
5,341
0.523454
0.521772
206
24.975729
23.609163
192
false
false
0
0
0
0
0
0
0.514563
false
false
14
613dd6123f72521405433a54217fe5b7b810493b
3,049,426,793,357
ebcc531336c57b553cad930723fccd3a9f2c33c3
/chapter_002/src/main/java/ru/job4j/task3_2/profession/Student.java
c140743c451b28552e8f148d2571f42693bd2d13
[ "Apache-2.0" ]
permissive
Yurik16/yuchuksin
https://github.com/Yurik16/yuchuksin
aba916d307b161d891053ed00cd479f92c3df13e
8abf24555d149210070da53c1cbac4cbe1265fec
refs/heads/master
2021-04-29T03:53:34.642000
2017-09-30T17:39:23
2017-09-30T17:39:23
78,035,146
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ru.job4j.task3_2.profession; /** * Student class. * @author Yury Chuksin (chuksinyury.gmail.com) * @since 17.02.2017 */ public class Student extends Human { /** * course from 1 to 5. */ private byte course; /** * specialty some technical or another. */ private String specialty; /** * educMark list for each lesson sudent gets mark. */ private byte educMark; /** * knowlegwLevel form 1 to 100. */ private byte knowlegwLevel; /** * setEducMark set educMark for student. * @param mark form 1 to 10 * @return educMark */ public byte setEducMark(byte mark) { this.educMark = mark; return this.educMark; } /** * setRank set knowlegwLevel for student. * @param mark form 1 to 100 * @return knowlegwLevel */ public byte setRank(byte mark) { this.knowlegwLevel = mark; return this.knowlegwLevel; } /** * Student constructor. * @param name family * @param age from 1 to 150 * @param sex male is true, frmale is false * @param course from 1 to 5 * @param specialty some technical or another * @param educMark list of marks for each lesson * @param knowlegwLevel form 1 to 100 */ public Student(String name, short age, boolean sex, byte course, String specialty, byte educMark, byte knowlegwLevel) { super(name, age, sex); this.course = course; this.specialty = specialty; this.educMark = educMark; this.knowlegwLevel = knowlegwLevel; } /** * selfLearning. */ public void selfLearning() { } }
UTF-8
Java
1,464
java
Student.java
Java
[ { "context": "ask3_2.profession;\n\n/**\n* Student class.\n* @author Yury Chuksin (chuksinyury.gmail.com)\n* @since 17.02.2017\n*/\npu", "end": 81, "score": 0.9998243451118469, "start": 69, "tag": "NAME", "value": "Yury Chuksin" }, { "context": "on;\n\n/**\n* Student class.\n* @author Yury Chuksin (chuksinyury.gmail.com)\n* @since 17.02.2017\n*/\npublic class Student exte", "end": 104, "score": 0.9998897910118103, "start": 83, "tag": "EMAIL", "value": "chuksinyury.gmail.com" } ]
null
[]
package ru.job4j.task3_2.profession; /** * Student class. * @author <NAME> (<EMAIL>) * @since 17.02.2017 */ public class Student extends Human { /** * course from 1 to 5. */ private byte course; /** * specialty some technical or another. */ private String specialty; /** * educMark list for each lesson sudent gets mark. */ private byte educMark; /** * knowlegwLevel form 1 to 100. */ private byte knowlegwLevel; /** * setEducMark set educMark for student. * @param mark form 1 to 10 * @return educMark */ public byte setEducMark(byte mark) { this.educMark = mark; return this.educMark; } /** * setRank set knowlegwLevel for student. * @param mark form 1 to 100 * @return knowlegwLevel */ public byte setRank(byte mark) { this.knowlegwLevel = mark; return this.knowlegwLevel; } /** * Student constructor. * @param name family * @param age from 1 to 150 * @param sex male is true, frmale is false * @param course from 1 to 5 * @param specialty some technical or another * @param educMark list of marks for each lesson * @param knowlegwLevel form 1 to 100 */ public Student(String name, short age, boolean sex, byte course, String specialty, byte educMark, byte knowlegwLevel) { super(name, age, sex); this.course = course; this.specialty = specialty; this.educMark = educMark; this.knowlegwLevel = knowlegwLevel; } /** * selfLearning. */ public void selfLearning() { } }
1,444
0.690574
0.66735
74
18.797297
19.343956
120
false
false
0
0
0
0
0
0
1.189189
false
false
14
cc822666e3e81d35bd6c7f91f9f9d4bb3804da16
29,575,144,836,776
6d2bd51e16993317f8572ba2d65b8dd37b0deb2e
/src/main/java/com/ning/pojo/Role.java
228ddc495478ea93a15e763b3815269cbc42caeb
[]
no_license
ewsq/onlineCourseAdmin
https://github.com/ewsq/onlineCourseAdmin
be9f334a2dd2648d913771e2778964782cc4ecba
443090608efcd85b3ad332e6ae6fe38f96b53edc
refs/heads/master
2022-04-08T11:21:23.807000
2020-03-19T07:37:00
2020-03-19T07:37:00
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ning.pojo; import java.util.Date; import javax.persistence.*; public class Role { @Id @Column(name = "roleId") private String roleid; private String rolename; private String description; @Column(name = "crateTime") private Date cratetime; @Column(name = "updateTime") private Date updatetime; /** * @return roleId */ public String getRoleid() { return roleid; } /** * @param roleid */ public void setRoleid(String roleid) { this.roleid = roleid; } /** * @return rolename */ public String getRolename() { return rolename; } /** * @param rolename */ public void setRolename(String rolename) { this.rolename = rolename; } /** * @return description */ public String getDescription() { return description; } /** * @param description */ public void setDescription(String description) { this.description = description; } /** * @return crateTime */ public Date getCratetime() { return cratetime; } /** * @param cratetime */ public void setCratetime(Date cratetime) { this.cratetime = cratetime; } /** * @return updateTime */ public Date getUpdatetime() { return updatetime; } /** * @param updatetime */ public void setUpdatetime(Date updatetime) { this.updatetime = updatetime; } }
UTF-8
Java
1,537
java
Role.java
Java
[]
null
[]
package com.ning.pojo; import java.util.Date; import javax.persistence.*; public class Role { @Id @Column(name = "roleId") private String roleid; private String rolename; private String description; @Column(name = "crateTime") private Date cratetime; @Column(name = "updateTime") private Date updatetime; /** * @return roleId */ public String getRoleid() { return roleid; } /** * @param roleid */ public void setRoleid(String roleid) { this.roleid = roleid; } /** * @return rolename */ public String getRolename() { return rolename; } /** * @param rolename */ public void setRolename(String rolename) { this.rolename = rolename; } /** * @return description */ public String getDescription() { return description; } /** * @param description */ public void setDescription(String description) { this.description = description; } /** * @return crateTime */ public Date getCratetime() { return cratetime; } /** * @param cratetime */ public void setCratetime(Date cratetime) { this.cratetime = cratetime; } /** * @return updateTime */ public Date getUpdatetime() { return updatetime; } /** * @param updatetime */ public void setUpdatetime(Date updatetime) { this.updatetime = updatetime; } }
1,537
0.555628
0.555628
90
16.088888
14.064648
52
false
false
0
0
0
0
0
0
0.2
false
false
14
658fdccdcb0128c4a3a4ab820d42501835e8ac75
19,954,418,072,819
990e60a3d19efe92e23c3a53d32c96625002f273
/StatsUI.java
1a80e7d6a44aea2678b57b97f61dd58c79e69404
[]
no_license
MMukundi/JAM-CougStatistics
https://github.com/MMukundi/JAM-CougStatistics
0f50c3443fe4c92afbc5a743cfeeba3e32169fc2
7a8aa783797bbc0f25bdd1110e21d8a78ac5d440
refs/heads/main
2023-08-10T18:52:34.250000
2021-09-22T08:31:26
2021-09-22T08:31:26
409,124,720
0
0
null
true
2021-09-22T08:33:25
2021-09-22T08:33:24
2021-09-01T02:27:27
2021-09-01T02:27:25
0
0
0
0
null
false
false
import java.util.List; import java.util.Set; import java.util.function.Function; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.ScrollPaneConstants; import javax.swing.GroupLayout.ParallelGroup; import javax.swing.GroupLayout.SequentialGroup; import javax.swing.JLabel; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.GroupLayout; import javax.swing.JButton; import java.awt.event.ActionEvent; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.BorderLayout; class GroupedPanel extends JPanel { GroupLayout layout; ParallelGroup labelGroup; ParallelGroup textFieldGroup; SequentialGroup stackedGroup; GroupedPanel() { layout = new GroupLayout(this); setLayout(layout); labelGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING); textFieldGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING); stackedGroup = layout.createSequentialGroup(); layout.setHorizontalGroup(layout.createSequentialGroup().addGroup(labelGroup).addGroup(textFieldGroup)); layout.setVerticalGroup(stackedGroup); } void addPair(JLabel label, JTextField textField) { labelGroup.addComponent(label); textFieldGroup.addComponent(textField); stackedGroup.addGroup( layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(label).addComponent(textField)); } } class ErrorPane extends JPanel { static final String BaseText = "Errors:\n"; JTextArea textArea; ErrorPane() { super(new BorderLayout()); textArea = new JTextArea(BaseText); JScrollPane scroll = new JScrollPane(textArea); scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); add(scroll ,BorderLayout.CENTER); add(new JButton("Clear"){{ addActionListener(new AbstractAction(){ @Override public void actionPerformed(ActionEvent e ){ textArea.setText(BaseText); System.out.println("hi!"); } }); }},BorderLayout.SOUTH); textArea.setEditable(false); textArea.setLineWrap(true); } void log(String error) { System.out.println(error); textArea.append(error + "\n"); } } public class StatsUI { HashMap<String, Dataset> inputs = new HashMap<>(); HashMap<String, String> outpus = new HashMap<>(); HashMap<String, Set<Runnable>> inputDependents = new HashMap<>(); JFrame frame; GroupedPanel inputPanel; GroupedPanel outputPanel; ErrorPane errorPane; int width; int height; StatsUI() { this("Coug Stats",500,500); } StatsUI(int width, int height) { this("Coug Stats", width, height); } StatsUI(String title) { this(title, 500,500); } StatsUI(String title, int width, int height) { this.width = width; this.height = height; frame = new JFrame(title); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JSplitPane contentPanes = new JSplitPane(JSplitPane.VERTICAL_SPLIT); JSplitPane errorSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT); inputPanel = new GroupedPanel(); outputPanel = new GroupedPanel(); errorPane = new ErrorPane(); contentPanes.add(inputPanel); contentPanes.add(outputPanel); errorSplit.add(contentPanes); errorSplit.add(errorPane); contentPanes.setDividerLocation(0.5); errorSplit.setDividerLocation(0.8); frame.add(errorSplit); } void updateInputs(String input, String inputId) { updateInputs(input, inputId, null); } void updateInputs(String input, String inputId, Integer tupleSize) { try { if (input.trim().length() == 0) { inputs.remove(inputId); } else { Dataset data = tupleSize == null ? Dataset.parse(input) : Dataset.parse(input, tupleSize); inputs.put(inputId, data); Set<Runnable> dependents = inputDependents.get(inputId); if (dependents != null) { for (Runnable updateDependent : dependents) { updateDependent.run(); } } } } catch (Exception e) { errorPane.log(e.getMessage()); } } void addInput(String label, String inputId) { addInput(label, inputId, null); } void addInput(String label, String inputId, Integer tupleSize) { JTextField textField = new JTextField(20); Action setInputAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { updateInputs(textField.getText(), inputId, tupleSize); } }; FocusListener focusListener = new FocusListener() { @Override public void focusGained(FocusEvent e) { } @Override public void focusLost(FocusEvent e) { updateInputs(textField.getText(), inputId, tupleSize); } }; textField.addActionListener(setInputAction); textField.addFocusListener(focusListener); inputPanel.addPair(new JLabel(label), textField); inputPanel.validate(); frame.validate(); } void addOutput(String label, String[] dependencies, Function<Dataset[], String> getOutput) { JTextField textField = new JTextField(20); textField.setEditable(false); for (String inputId : dependencies) { Set<Runnable> otherDependents = inputDependents.containsKey(inputId) ? inputDependents.get(inputId) : new HashSet<>(); otherDependents.add(() -> { Dataset[] datasets = new Dataset[dependencies.length]; for (int i = 0; i < datasets.length; i++) { String dependency = dependencies[i]; datasets[i] = inputs.get(dependency); } System.out.printf("%s noticed the update!\n", label); try { textField.setText(getOutput.apply(datasets)); } catch (Exception e) { System.out.println("Throuble in paradise!"); textField.setText(e.getMessage()); } }); inputDependents.put(inputId, otherDependents); } outputPanel.addPair(new JLabel(label), textField); outputPanel.validate(); frame.validate(); } void run() { frame.pack(); frame.setVisible(true); } }
UTF-8
Java
7,067
java
StatsUI.java
Java
[]
null
[]
import java.util.List; import java.util.Set; import java.util.function.Function; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.ScrollPaneConstants; import javax.swing.GroupLayout.ParallelGroup; import javax.swing.GroupLayout.SequentialGroup; import javax.swing.JLabel; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.GroupLayout; import javax.swing.JButton; import java.awt.event.ActionEvent; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.BorderLayout; class GroupedPanel extends JPanel { GroupLayout layout; ParallelGroup labelGroup; ParallelGroup textFieldGroup; SequentialGroup stackedGroup; GroupedPanel() { layout = new GroupLayout(this); setLayout(layout); labelGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING); textFieldGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING); stackedGroup = layout.createSequentialGroup(); layout.setHorizontalGroup(layout.createSequentialGroup().addGroup(labelGroup).addGroup(textFieldGroup)); layout.setVerticalGroup(stackedGroup); } void addPair(JLabel label, JTextField textField) { labelGroup.addComponent(label); textFieldGroup.addComponent(textField); stackedGroup.addGroup( layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(label).addComponent(textField)); } } class ErrorPane extends JPanel { static final String BaseText = "Errors:\n"; JTextArea textArea; ErrorPane() { super(new BorderLayout()); textArea = new JTextArea(BaseText); JScrollPane scroll = new JScrollPane(textArea); scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); add(scroll ,BorderLayout.CENTER); add(new JButton("Clear"){{ addActionListener(new AbstractAction(){ @Override public void actionPerformed(ActionEvent e ){ textArea.setText(BaseText); System.out.println("hi!"); } }); }},BorderLayout.SOUTH); textArea.setEditable(false); textArea.setLineWrap(true); } void log(String error) { System.out.println(error); textArea.append(error + "\n"); } } public class StatsUI { HashMap<String, Dataset> inputs = new HashMap<>(); HashMap<String, String> outpus = new HashMap<>(); HashMap<String, Set<Runnable>> inputDependents = new HashMap<>(); JFrame frame; GroupedPanel inputPanel; GroupedPanel outputPanel; ErrorPane errorPane; int width; int height; StatsUI() { this("Coug Stats",500,500); } StatsUI(int width, int height) { this("Coug Stats", width, height); } StatsUI(String title) { this(title, 500,500); } StatsUI(String title, int width, int height) { this.width = width; this.height = height; frame = new JFrame(title); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JSplitPane contentPanes = new JSplitPane(JSplitPane.VERTICAL_SPLIT); JSplitPane errorSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT); inputPanel = new GroupedPanel(); outputPanel = new GroupedPanel(); errorPane = new ErrorPane(); contentPanes.add(inputPanel); contentPanes.add(outputPanel); errorSplit.add(contentPanes); errorSplit.add(errorPane); contentPanes.setDividerLocation(0.5); errorSplit.setDividerLocation(0.8); frame.add(errorSplit); } void updateInputs(String input, String inputId) { updateInputs(input, inputId, null); } void updateInputs(String input, String inputId, Integer tupleSize) { try { if (input.trim().length() == 0) { inputs.remove(inputId); } else { Dataset data = tupleSize == null ? Dataset.parse(input) : Dataset.parse(input, tupleSize); inputs.put(inputId, data); Set<Runnable> dependents = inputDependents.get(inputId); if (dependents != null) { for (Runnable updateDependent : dependents) { updateDependent.run(); } } } } catch (Exception e) { errorPane.log(e.getMessage()); } } void addInput(String label, String inputId) { addInput(label, inputId, null); } void addInput(String label, String inputId, Integer tupleSize) { JTextField textField = new JTextField(20); Action setInputAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { updateInputs(textField.getText(), inputId, tupleSize); } }; FocusListener focusListener = new FocusListener() { @Override public void focusGained(FocusEvent e) { } @Override public void focusLost(FocusEvent e) { updateInputs(textField.getText(), inputId, tupleSize); } }; textField.addActionListener(setInputAction); textField.addFocusListener(focusListener); inputPanel.addPair(new JLabel(label), textField); inputPanel.validate(); frame.validate(); } void addOutput(String label, String[] dependencies, Function<Dataset[], String> getOutput) { JTextField textField = new JTextField(20); textField.setEditable(false); for (String inputId : dependencies) { Set<Runnable> otherDependents = inputDependents.containsKey(inputId) ? inputDependents.get(inputId) : new HashSet<>(); otherDependents.add(() -> { Dataset[] datasets = new Dataset[dependencies.length]; for (int i = 0; i < datasets.length; i++) { String dependency = dependencies[i]; datasets[i] = inputs.get(dependency); } System.out.printf("%s noticed the update!\n", label); try { textField.setText(getOutput.apply(datasets)); } catch (Exception e) { System.out.println("Throuble in paradise!"); textField.setText(e.getMessage()); } }); inputDependents.put(inputId, otherDependents); } outputPanel.addPair(new JLabel(label), textField); outputPanel.validate(); frame.validate(); } void run() { frame.pack(); frame.setVisible(true); } }
7,067
0.618226
0.615112
222
30.833334
24.401377
120
false
false
0
0
0
0
0
0
0.702703
false
false
14
8601d99c93dea0f2ac883304ffaf35152e43184d
14,705,968,037,027
400b63c3f36322e0074ef9662f947fae908d76e3
/ftc_app-4.3/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Auto_4788_PhoneCamera.java
e31f380f974c1ab1993939cfd91e2cdaf59517de
[ "BSD-3-Clause" ]
permissive
CJBuchel/FTC_Vision_Auto_Example
https://github.com/CJBuchel/FTC_Vision_Auto_Example
025fb2730a16f492d4a0da8763add61d2b840abc
558475b423397900b41a7ac69699f3c17b338347
refs/heads/master
2020-04-09T23:25:12.701000
2018-12-10T07:19:12
2018-12-10T07:19:12
160,656,188
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.firstinspires.ftc.teamcode; import com.qualcomm.robotcore.eventloop.opmode.Autonomous; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.util.ElapsedTime; import com.qualcomm.robotcore.util.Range; import com.disnodeteam.dogecv.CameraViewDisplay; import com.disnodeteam.dogecv.DogeCV; import com.disnodeteam.dogecv.Dogeforia; import com.disnodeteam.dogecv.detectors.roverrukus.GoldAlignDetector; import com.disnodeteam.dogecv.detectors.roverrukus.SamplingOrderDetector; import com.disnodeteam.dogecv.filters.LeviColorFilter; import com.qualcomm.robotcore.eventloop.opmode.OpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.util.ElapsedTime; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.util.Range; import org.opencv.core.Size; import com.disnodeteam.dogecv.detectors.roverrukus.SilverDetector; import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName; import org.firstinspires.ftc.robotcore.external.matrices.OpenGLMatrix; import org.firstinspires.ftc.robotcore.external.matrices.VectorF; import org.firstinspires.ftc.robotcore.external.navigation.Orientation; import org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer; import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable; import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackableDefaultListener; import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackables; import java.util.ArrayList; import java.util.List; import static org.firstinspires.ftc.robotcore.external.navigation.AngleUnit.DEGREES; import static org.firstinspires.ftc.robotcore.external.navigation.AxesOrder.XYZ; import static org.firstinspires.ftc.robotcore.external.navigation.AxesOrder.YZX; import static org.firstinspires.ftc.robotcore.external.navigation.AxesReference.EXTRINSIC; import static org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer.CameraDirection.BACK; import static org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer.CameraDirection.FRONT; import com.disnodeteam.dogecv.CameraViewDisplay; import com.disnodeteam.dogecv.DogeCV; import com.disnodeteam.dogecv.detectors.roverrukus.GoldAlignDetector; import com.disnodeteam.dogecv.detectors.roverrukus.SamplingOrderDetector; import com.qualcomm.robotcore.eventloop.opmode.OpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; //Developed By GitHub User CJBuchel <https://github.com/CJBuchel> @Autonomous(name="Auto_Example_Phone_Camera") public class Auto_4788_PhoneCamera extends LinearOpMode { // Detector object private GoldAlignDetector detector; // Declare OpMode members. private ElapsedTime runtime = new ElapsedTime(); private DcMotor leftDrive = null; private DcMotor rightDrive = null; @Override public void runOpMode() { telemetry.addData("Status", "DogeCV 2018.0 - Gold Align Example"); // Set up detector detector = new GoldAlignDetector(); // Create detector detector.init(hardwareMap.appContext, CameraViewDisplay.getInstance()); // Initialize it with the app context and camera detector.useDefaults(); // Set detector to use default settings // Optional tuning detector.alignSize = 100; // How wide (in pixels) is the range in which the gold object will be aligned. (Represented by green bars in the preview) detector.alignPosOffset = 0; // How far from center frame to offset this alignment zone. detector.downscale = 0.4; // How much to downscale the input frames detector.areaScoringMethod = DogeCV.AreaScoringMethod.MAX_AREA; // Can also be PERFECT_AREA //detector.perfectAreaScorer.perfectArea = 10000; // if using PERFECT_AREA scoring detector.maxAreaScorer.weight = 0.005; // detector.ratioScorer.weight = 5; // detector.ratioScorer.perfectRatio = 1.0; // Ratio adjustment detector.enable(); // Start the detector! leftDrive = hardwareMap.get(DcMotor.class, "left"); rightDrive = hardwareMap.get(DcMotor.class, "right"); leftDrive.setDirection(DcMotor.Direction.FORWARD); rightDrive.setDirection(DcMotor.Direction.REVERSE); // Wait for the game to start (driver presses PLAY) waitForStart(); runtime.reset(); // run until the end of the match (driver presses STOP) while (opModeIsActive()) { telemetry.addData("IsAligned" , detector.getAligned()); // Is the bot aligned with the gold mineral? telemetry.addData("X Pos" , detector.getXPosition()); // Gold X position. //=================================================== //Gold Vision Tracking Start /Put Your Main Code here //=================================================== double goal = 300; double Rgoal = 350; double Lgoal = 250; double kP = -0.01; double output; double error; double visionRightPowerStraight = 1.0; double visionLeftPowerStraight = 1.0; if (detector.getXPosition() < 350 && detector.getXPosition() > 250) { // If object is directly in front of it leftDrive.setPower(-visionLeftPowerStraight); rightDrive.setPower(-visionRightPowerStraight); } if (detector.getXPosition() > Rgoal) { // If object is on the right error = goal - detector.getXPosition(); output = kP * error; leftDrive.setPower(output); rightDrive.setPower(-output); } if (detector.getXPosition() < Lgoal) { // If object is on the left error = goal - detector.getXPosition(); output = kP * error; leftDrive.setPower(-output); rightDrive.setPower(output); } // --------------------------------------------------------------------------------- // Show the elapsed game time and wheel power. telemetry.addData("Status", "Run Time: " + runtime.toString()); //telemetry.addData("Motors", "left (%.2f), right (%.2f)", leftPower, rightPower); telemetry.update(); } } }
UTF-8
Java
6,779
java
Auto_4788_PhoneCamera.java
Java
[ { "context": "entloop.opmode.TeleOp;\n\n//Developed By GitHub User CJBuchel <https://github.com/CJBuchel>\n\n@Autonomous(name=\"", "end": 2798, "score": 0.9997296333312988, "start": 2790, "tag": "USERNAME", "value": "CJBuchel" }, { "context": "loped By GitHub User CJBuchel <https://github.com/CJBuchel>\n\n@Autonomous(name=\"Auto_Example_Phone_Camera\")\n\n", "end": 2827, "score": 0.9996995329856873, "start": 2819, "tag": "USERNAME", "value": "CJBuchel" } ]
null
[]
package org.firstinspires.ftc.teamcode; import com.qualcomm.robotcore.eventloop.opmode.Autonomous; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.util.ElapsedTime; import com.qualcomm.robotcore.util.Range; import com.disnodeteam.dogecv.CameraViewDisplay; import com.disnodeteam.dogecv.DogeCV; import com.disnodeteam.dogecv.Dogeforia; import com.disnodeteam.dogecv.detectors.roverrukus.GoldAlignDetector; import com.disnodeteam.dogecv.detectors.roverrukus.SamplingOrderDetector; import com.disnodeteam.dogecv.filters.LeviColorFilter; import com.qualcomm.robotcore.eventloop.opmode.OpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.util.ElapsedTime; import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.util.Range; import org.opencv.core.Size; import com.disnodeteam.dogecv.detectors.roverrukus.SilverDetector; import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName; import org.firstinspires.ftc.robotcore.external.matrices.OpenGLMatrix; import org.firstinspires.ftc.robotcore.external.matrices.VectorF; import org.firstinspires.ftc.robotcore.external.navigation.Orientation; import org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer; import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackable; import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackableDefaultListener; import org.firstinspires.ftc.robotcore.external.navigation.VuforiaTrackables; import java.util.ArrayList; import java.util.List; import static org.firstinspires.ftc.robotcore.external.navigation.AngleUnit.DEGREES; import static org.firstinspires.ftc.robotcore.external.navigation.AxesOrder.XYZ; import static org.firstinspires.ftc.robotcore.external.navigation.AxesOrder.YZX; import static org.firstinspires.ftc.robotcore.external.navigation.AxesReference.EXTRINSIC; import static org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer.CameraDirection.BACK; import static org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer.CameraDirection.FRONT; import com.disnodeteam.dogecv.CameraViewDisplay; import com.disnodeteam.dogecv.DogeCV; import com.disnodeteam.dogecv.detectors.roverrukus.GoldAlignDetector; import com.disnodeteam.dogecv.detectors.roverrukus.SamplingOrderDetector; import com.qualcomm.robotcore.eventloop.opmode.OpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; //Developed By GitHub User CJBuchel <https://github.com/CJBuchel> @Autonomous(name="Auto_Example_Phone_Camera") public class Auto_4788_PhoneCamera extends LinearOpMode { // Detector object private GoldAlignDetector detector; // Declare OpMode members. private ElapsedTime runtime = new ElapsedTime(); private DcMotor leftDrive = null; private DcMotor rightDrive = null; @Override public void runOpMode() { telemetry.addData("Status", "DogeCV 2018.0 - Gold Align Example"); // Set up detector detector = new GoldAlignDetector(); // Create detector detector.init(hardwareMap.appContext, CameraViewDisplay.getInstance()); // Initialize it with the app context and camera detector.useDefaults(); // Set detector to use default settings // Optional tuning detector.alignSize = 100; // How wide (in pixels) is the range in which the gold object will be aligned. (Represented by green bars in the preview) detector.alignPosOffset = 0; // How far from center frame to offset this alignment zone. detector.downscale = 0.4; // How much to downscale the input frames detector.areaScoringMethod = DogeCV.AreaScoringMethod.MAX_AREA; // Can also be PERFECT_AREA //detector.perfectAreaScorer.perfectArea = 10000; // if using PERFECT_AREA scoring detector.maxAreaScorer.weight = 0.005; // detector.ratioScorer.weight = 5; // detector.ratioScorer.perfectRatio = 1.0; // Ratio adjustment detector.enable(); // Start the detector! leftDrive = hardwareMap.get(DcMotor.class, "left"); rightDrive = hardwareMap.get(DcMotor.class, "right"); leftDrive.setDirection(DcMotor.Direction.FORWARD); rightDrive.setDirection(DcMotor.Direction.REVERSE); // Wait for the game to start (driver presses PLAY) waitForStart(); runtime.reset(); // run until the end of the match (driver presses STOP) while (opModeIsActive()) { telemetry.addData("IsAligned" , detector.getAligned()); // Is the bot aligned with the gold mineral? telemetry.addData("X Pos" , detector.getXPosition()); // Gold X position. //=================================================== //Gold Vision Tracking Start /Put Your Main Code here //=================================================== double goal = 300; double Rgoal = 350; double Lgoal = 250; double kP = -0.01; double output; double error; double visionRightPowerStraight = 1.0; double visionLeftPowerStraight = 1.0; if (detector.getXPosition() < 350 && detector.getXPosition() > 250) { // If object is directly in front of it leftDrive.setPower(-visionLeftPowerStraight); rightDrive.setPower(-visionRightPowerStraight); } if (detector.getXPosition() > Rgoal) { // If object is on the right error = goal - detector.getXPosition(); output = kP * error; leftDrive.setPower(output); rightDrive.setPower(-output); } if (detector.getXPosition() < Lgoal) { // If object is on the left error = goal - detector.getXPosition(); output = kP * error; leftDrive.setPower(-output); rightDrive.setPower(output); } // --------------------------------------------------------------------------------- // Show the elapsed game time and wheel power. telemetry.addData("Status", "Run Time: " + runtime.toString()); //telemetry.addData("Motors", "left (%.2f), right (%.2f)", leftPower, rightPower); telemetry.update(); } } }
6,779
0.68786
0.680336
201
32.716419
33.691078
155
false
false
0
0
0
0
0
0
0.507463
false
false
14
126817f73deaa4b837525a7679e27fa072b0251e
19,920,058,327,880
e57ad65ac69d705dda0cff0633a1d3bd4834945e
/src/main/java/MainTest.java
0ee8286e63005ad3d031e6b1020c277b0fee087d
[]
no_license
Morgan-1/Spring-annotation
https://github.com/Morgan-1/Spring-annotation
172eb175942cebd45192b68aae8b1e8c8fee4e60
4a5013b84a825dc64011daabfc968bbb97853382
refs/heads/master
2022-06-27T07:16:43.806000
2019-06-24T13:23:02
2019-06-24T13:23:02
193,508,826
0
0
null
false
2022-06-21T01:20:30
2019-06-24T13:15:57
2019-06-24T13:23:38
2022-06-21T01:20:29
39
0
0
2
Java
false
false
import annotation.bean.Person; import annotation.config.MainConfig; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class MainTest { public static void main(String[] arges) { /* ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml"); Person person = (Person)context.getBean("person"); System.out.println(person);*/ ApplicationContext context = new AnnotationConfigApplicationContext(MainConfig.class); Person person = (Person) context.getBean(Person.class); System.out.println(person); String[] names =context.getBeanDefinitionNames(); for (String name : names) System.out.println(name); } }
UTF-8
Java
866
java
MainTest.java
Java
[]
null
[]
import annotation.bean.Person; import annotation.config.MainConfig; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class MainTest { public static void main(String[] arges) { /* ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml"); Person person = (Person)context.getBean("person"); System.out.println(person);*/ ApplicationContext context = new AnnotationConfigApplicationContext(MainConfig.class); Person person = (Person) context.getBean(Person.class); System.out.println(person); String[] names =context.getBeanDefinitionNames(); for (String name : names) System.out.println(name); } }
866
0.745958
0.745958
26
32.307693
29.932962
93
false
false
0
0
0
0
0
0
0.5
false
false
14
5386c0f825e39dd9e18023a07de077ef4e6127de
30,674,656,458,173
2429dfbe8a53e7af879ac13e0a23990865cd1681
/src/Main/Java/com/stackroute/practice_3/LastDateOfWeek.java
50dc1fda325d1134222d929801decd3f2a3d0b07
[]
no_license
saurabhsk/Java_Practice_3
https://github.com/saurabhsk/Java_Practice_3
51b7dfebaf8746bc663d108f1b9faa860578ac27
f20423d3c75b21406b96d08256eb255caf518ee7
refs/heads/master
2020-04-23T19:24:48.730000
2019-02-21T10:44:16
2019-02-21T10:44:16
171,402,542
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// Write a java program to calculate first and last date of a week. // Output: // First Date of Week: Mon 24/07/2017 // Last date of the week: Sun 30/07/2017 package com.stackroute.practice_3; import java.sql.Date; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; public class LastDateOfWeek { String fdate, ldate; //Instance variable. Calendar c = Calendar.getInstance(); // get current date and time DateFormat df = new SimpleDateFormat("EEE dd/MM/yyyy"); //Using DateFormate class // Returns the first day of week(Mon) public String firstWeekDay(String str) throws ParseException { SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy"); c.setTime(sdf.parse(str)); c.setFirstDayOfWeek(Calendar.MONDAY); c.set(Calendar.DAY_OF_WEEK,c.getFirstDayOfWeek()); fdate = df.format(c.getTime()); System.out.println(fdate); return fdate; } //Returns the last day of the week(Sun) public String lastWeekDay(String str) throws ParseException { SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy"); c.setTime(sdf.parse(str)); c.setFirstDayOfWeek(Calendar.MONDAY); c.set(Calendar.DAY_OF_WEEK,Calendar.SUNDAY); ldate = df.format(c.getTime()); System.out.println(ldate); return ldate; } }
UTF-8
Java
1,437
java
LastDateOfWeek.java
Java
[]
null
[]
// Write a java program to calculate first and last date of a week. // Output: // First Date of Week: Mon 24/07/2017 // Last date of the week: Sun 30/07/2017 package com.stackroute.practice_3; import java.sql.Date; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; public class LastDateOfWeek { String fdate, ldate; //Instance variable. Calendar c = Calendar.getInstance(); // get current date and time DateFormat df = new SimpleDateFormat("EEE dd/MM/yyyy"); //Using DateFormate class // Returns the first day of week(Mon) public String firstWeekDay(String str) throws ParseException { SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy"); c.setTime(sdf.parse(str)); c.setFirstDayOfWeek(Calendar.MONDAY); c.set(Calendar.DAY_OF_WEEK,c.getFirstDayOfWeek()); fdate = df.format(c.getTime()); System.out.println(fdate); return fdate; } //Returns the last day of the week(Sun) public String lastWeekDay(String str) throws ParseException { SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy"); c.setTime(sdf.parse(str)); c.setFirstDayOfWeek(Calendar.MONDAY); c.set(Calendar.DAY_OF_WEEK,Calendar.SUNDAY); ldate = df.format(c.getTime()); System.out.println(ldate); return ldate; } }
1,437
0.671538
0.659708
46
30.23913
23.887585
85
false
false
0
0
0
0
0
0
0.565217
false
false
14
d68097681398e07dd35a749c81eb1236b2a09fdb
12,077,448,055,161
4d9d3f42e3e2c3167647e7ef40d8240a4de19e58
/src/main/java/demo/health/ServiceHealthCheckController.java
33c059f998297b8b25e57792fe4862e4f96d55a2
[ "Apache-2.0" ]
permissive
thomasdarimont/spring-boot-dockerized-service-example
https://github.com/thomasdarimont/spring-boot-dockerized-service-example
dc892ca533fbbcdca05bf21f2ea5e1c1c8c91c3a
93864b31913d0f14ba35ef10d5520e162c1d8a42
refs/heads/master
2021-01-23T02:34:38.390000
2018-02-23T13:12:58
2018-02-23T13:12:58
86,006,303
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package demo.health; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/service-health") @RequiredArgsConstructor class ServiceHealthCheckController { private final ServiceHealthCheck serviceHealthCheck; @PostMapping public void heal(){ serviceHealthCheck.setHealthy(true); } @DeleteMapping public void hurt(){ serviceHealthCheck.setHealthy(false); } }
UTF-8
Java
672
java
ServiceHealthCheckController.java
Java
[]
null
[]
package demo.health; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/service-health") @RequiredArgsConstructor class ServiceHealthCheckController { private final ServiceHealthCheck serviceHealthCheck; @PostMapping public void heal(){ serviceHealthCheck.setHealthy(true); } @DeleteMapping public void hurt(){ serviceHealthCheck.setHealthy(false); } }
672
0.78869
0.78869
25
25.879999
21.935032
62
false
false
0
0
0
0
0
0
0.36
false
false
14
1804c2cee4ba63677fdfb6168f84a82c99944b63
541,165,943,538
3a9ef46b5c63fb131d62658190a3670ec4833de6
/BasicJava/src/ClassWork/p140717/inheritance/C.java
a52671abc2073c657a8d74cf90c268f5f8b45fcf
[]
no_license
XRater/EPAM-Java-Course-2017
https://github.com/XRater/EPAM-Java-Course-2017
3ad57d439be9991fc4b96d995f06ec36f24eb0ad
ca6d482a9f7e19aee08a98352b050f92214a6408
refs/heads/master
2020-12-02T22:53:33.802000
2017-08-10T00:15:13
2017-08-10T00:15:13
96,197,813
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ClassWork.p140717.inheritance; public class C extends B { public void m() { } }
UTF-8
Java
100
java
C.java
Java
[]
null
[]
package ClassWork.p140717.inheritance; public class C extends B { public void m() { } }
100
0.65
0.59
9
10.111111
13.609183
38
false
false
0
0
0
0
0
0
0.111111
false
false
14
a4b00da841438ef7fe13787ebc4f9ee5db033bce
32,143,535,270,784
53d677a55e4ece8883526738f1c9d00fa6560ff7
/com/tencent/mm/plugin/location/ui/impl/a$4.java
42d4f6f187ce0a6bb108ee42844cf8e99b3b8f81
[]
no_license
0jinxing/wechat-apk-source
https://github.com/0jinxing/wechat-apk-source
544c2d79bfc10261eb36389c1edfdf553d8f312a
f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d
refs/heads/master
2020-06-07T20:06:03.580000
2019-06-21T09:17:26
2019-06-21T09:17:26
193,069,132
9
4
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tencent.mm.plugin.location.ui.impl; import android.app.Activity; import android.view.View; import android.view.View.OnClickListener; import com.tencent.matrix.trace.core.AppMethodBeat; final class a$4 implements View.OnClickListener { a$4(a parama) { } public final void onClick(View paramView) { AppMethodBeat.i(113592); this.nOW.bKl(); this.nOW.aqX(); this.nOW.activity.finish(); AppMethodBeat.o(113592); } } /* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes8-dex2jar.jar * Qualified Name: com.tencent.mm.plugin.location.ui.impl.a.4 * JD-Core Version: 0.6.2 */
UTF-8
Java
699
java
a$4.java
Java
[]
null
[]
package com.tencent.mm.plugin.location.ui.impl; import android.app.Activity; import android.view.View; import android.view.View.OnClickListener; import com.tencent.matrix.trace.core.AppMethodBeat; final class a$4 implements View.OnClickListener { a$4(a parama) { } public final void onClick(View paramView) { AppMethodBeat.i(113592); this.nOW.bKl(); this.nOW.aqX(); this.nOW.activity.finish(); AppMethodBeat.o(113592); } } /* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes8-dex2jar.jar * Qualified Name: com.tencent.mm.plugin.location.ui.impl.a.4 * JD-Core Version: 0.6.2 */
699
0.676681
0.642346
28
23.035715
24.843054
112
false
false
0
0
0
0
0
0
0.357143
false
false
14
08a474c511ed92f0876fd811f652cab51212888d
17,446,157,161,043
492cc3eb9b4491083612fc9942a1669792570a2d
/src/main/java/com/duliday/persistence/services/UserProfileService.java
2dcddbc348a3601a59b2b8c13daee1102d695275
[]
no_license
lianhongliang/persistence
https://github.com/lianhongliang/persistence
9c56c34547e7d5e241c3e9b131babb61764f895e
89d15171cf638aefa1fa26722be424d2404673e1
refs/heads/master
2020-03-23T23:43:25.882000
2018-07-25T05:29:47
2018-07-25T05:29:47
142,251,553
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.duliday.persistence.services; import com.duliday.persistence.dtos.JobIntentionRequestDTO; import com.duliday.persistence.dtos.UserProfileFlexibleResponseDTO; import com.duliday.persistence.dtos.UserProfileRequestDTO; import com.duliday.persistence.dtos.UserProfileResponseDTO; import com.duliday.persistence.dtos.UserProfileRigidResponseDTO; public interface UserProfileService { UserProfileResponseDTO queryByResumeId(Long resumeId, String userPorfileType); UserProfileRigidResponseDTO queryUserProfileRigidByResumeId(Long resumeId); UserProfileFlexibleResponseDTO queryUserProfileFlexibleByResumeId(Long resumeId); Long updateUserProfile(UserProfileRequestDTO userProfile); Long saveOrUpdateUserProfile(UserProfileRequestDTO userProfile, Long resumeId); boolean updateUserJobIntention(JobIntentionRequestDTO jobIntention, Long resumeId); boolean checkIsMvp(Long resumeId); void setDefaultAddress(Long resumeId, Long addressId); }
UTF-8
Java
970
java
UserProfileService.java
Java
[]
null
[]
package com.duliday.persistence.services; import com.duliday.persistence.dtos.JobIntentionRequestDTO; import com.duliday.persistence.dtos.UserProfileFlexibleResponseDTO; import com.duliday.persistence.dtos.UserProfileRequestDTO; import com.duliday.persistence.dtos.UserProfileResponseDTO; import com.duliday.persistence.dtos.UserProfileRigidResponseDTO; public interface UserProfileService { UserProfileResponseDTO queryByResumeId(Long resumeId, String userPorfileType); UserProfileRigidResponseDTO queryUserProfileRigidByResumeId(Long resumeId); UserProfileFlexibleResponseDTO queryUserProfileFlexibleByResumeId(Long resumeId); Long updateUserProfile(UserProfileRequestDTO userProfile); Long saveOrUpdateUserProfile(UserProfileRequestDTO userProfile, Long resumeId); boolean updateUserJobIntention(JobIntentionRequestDTO jobIntention, Long resumeId); boolean checkIsMvp(Long resumeId); void setDefaultAddress(Long resumeId, Long addressId); }
970
0.861856
0.861856
27
34.925926
32.751507
84
false
false
0
0
0
0
0
0
1.222222
false
false
14
e079a904182037277c874f5503b987448ce741c1
29,901,562,319,516
bf37576ef74315f532c9949cf36a42fb5c2f66b5
/cc.creativecomputing/src/cc/creativecomputing/graphics/font/CCBitFont.java
4e1df9d7d00e9382af161e88949f64a813afd312
[]
no_license
nickvido/creativecomputing
https://github.com/nickvido/creativecomputing
bd95d060e9b0e86e531c0dd017e2a034e7277252
109148ffd342e5f6ab241b858c89a1c2778d900f
refs/heads/master
2020-04-09T17:24:35.926000
2012-01-23T10:31:50
2012-01-23T10:31:50
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (c) 2011 Christian Riekoff <info@texone.org> * * This file is free software: you may copy, redistribute and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 2 of the License, or (at your * option) any later version. * * This file 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/>. * * This file incorporates work covered by the following copyright and * permission notice: */ package cc.creativecomputing.graphics.font; import java.awt.Font; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.font.FontRenderContext; import java.awt.font.GlyphVector; import java.awt.image.BufferedImage; import cc.creativecomputing.graphics.CCColor; import cc.creativecomputing.graphics.texture.CCTexture2D; import cc.creativecomputing.graphics.texture.CCTextureData; import cc.creativecomputing.graphics.texture.CCTextureIO; import cc.creativecomputing.graphics.texture.CCTexture.CCTextureFilter; import cc.creativecomputing.math.CCMath; import cc.creativecomputing.math.CCVector2f; /** * @author christianriekoff * */ public class CCBitFont extends CCTextureMapFont{ private CCTextureData _myData; public CCBitFont(CCTextureData theData, int theDescent) { super(null); _myData = theData; _myCharCount = 255; _myChars = createCharArray(_myCharCount); _myCharCodes = new int[_myCharCount]; _myHeight = _mySize = theData.height(); _myNormalizedHeight = 1; _myAscent = _myHeight - theDescent; _myDescent = theDescent; // _myNormalizedAscent = (float)_myAscent / _mySize; _myNormalizedDescent = (float)_myDescent / _mySize; _myLeading = _myHeight + 2; createChars(); } /* (non-Javadoc) * @see cc.creativecomputing.graphics.font.CCFont#index(char) */ @Override public int index(char theChar) { int c = (int) theChar; return c - 32; } protected void createChars() { _mySize = _myData.height(); int index = 0; int myX = 0; int myY = 0; // array passed to createGylphVector char textArray[] = new char[1]; int myLastX = 0; for (int x = 0; x < _myData.width(); x++) { myX++; boolean myApplyCut = !_myData.getPixel(x, _myData.height() - 1).equals(CCColor.RED); for(int y = 0; y < _myData.height(); y++) { if(_myData.getPixel(x, y).equals(CCColor.BLACK)) { _myData.setPixel(x, y, CCColor.WHITE); }else { _myData.setPixel(x, y, CCColor.TRANSPARENT); } } if (myApplyCut) { continue; } float myCharWidth = myX - myLastX; if(index == 0) { _mySpaceWidth = myCharWidth / _mySize; } char c = (char)(index + 32); _myCharCodes[index] = c; System.out.println(c + ":" + myCharWidth); _myChars[index] = new CCTextureMapChar(c, -1, myCharWidth / _mySize, height(), new CCVector2f( myLastX / (float)_myData.width(), 1f ), new CCVector2f( myX / (float)_myData.width(), 0 ) ); myLastX = myX; index++; } _myCharCount = index; // _myAscent = _myFontMetrics.getAscent(); // _myDescent = _myFontMetrics.getDescent(); // // _myLeading = _myFontMetrics.getLeading(); // _mySpacing = _myFontMetrics.getHeight(); // // _myNormalizedAscent = (float)_myFontMetrics.getAscent() / _mySize; // _myNormalizedDescent = (float)_myDescent / _mySize; _myFontTexture = new CCTexture2D(_myData); _myFontTexture.textureFilter(CCTextureFilter.NEAREST); } }
UTF-8
Java
4,033
java
CCBitFont.java
Java
[ { "context": "/* \n * Copyright (c) 2011 Christian Riekoff <info@texone.org> \n * \n * This file is free so", "end": 44, "score": 0.9998422861099243, "start": 27, "tag": "NAME", "value": "Christian Riekoff" }, { "context": "/* \n * Copyright (c) 2011 Christian Riekoff <info@texone.org> \n * \n * This file is free software: you may c", "end": 61, "score": 0.9999306797981262, "start": 46, "tag": "EMAIL", "value": "info@texone.org" }, { "context": "creativecomputing.math.CCVector2f;\n\n/**\n * @author christianriekoff\n *\n */\npublic class CCBitFont extends CCTextureMa", "end": 1503, "score": 0.9979209899902344, "start": 1487, "tag": "USERNAME", "value": "christianriekoff" } ]
null
[]
/* * Copyright (c) 2011 <NAME> <<EMAIL>> * * This file is free software: you may copy, redistribute and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 2 of the License, or (at your * option) any later version. * * This file 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/>. * * This file incorporates work covered by the following copyright and * permission notice: */ package cc.creativecomputing.graphics.font; import java.awt.Font; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.font.FontRenderContext; import java.awt.font.GlyphVector; import java.awt.image.BufferedImage; import cc.creativecomputing.graphics.CCColor; import cc.creativecomputing.graphics.texture.CCTexture2D; import cc.creativecomputing.graphics.texture.CCTextureData; import cc.creativecomputing.graphics.texture.CCTextureIO; import cc.creativecomputing.graphics.texture.CCTexture.CCTextureFilter; import cc.creativecomputing.math.CCMath; import cc.creativecomputing.math.CCVector2f; /** * @author christianriekoff * */ public class CCBitFont extends CCTextureMapFont{ private CCTextureData _myData; public CCBitFont(CCTextureData theData, int theDescent) { super(null); _myData = theData; _myCharCount = 255; _myChars = createCharArray(_myCharCount); _myCharCodes = new int[_myCharCount]; _myHeight = _mySize = theData.height(); _myNormalizedHeight = 1; _myAscent = _myHeight - theDescent; _myDescent = theDescent; // _myNormalizedAscent = (float)_myAscent / _mySize; _myNormalizedDescent = (float)_myDescent / _mySize; _myLeading = _myHeight + 2; createChars(); } /* (non-Javadoc) * @see cc.creativecomputing.graphics.font.CCFont#index(char) */ @Override public int index(char theChar) { int c = (int) theChar; return c - 32; } protected void createChars() { _mySize = _myData.height(); int index = 0; int myX = 0; int myY = 0; // array passed to createGylphVector char textArray[] = new char[1]; int myLastX = 0; for (int x = 0; x < _myData.width(); x++) { myX++; boolean myApplyCut = !_myData.getPixel(x, _myData.height() - 1).equals(CCColor.RED); for(int y = 0; y < _myData.height(); y++) { if(_myData.getPixel(x, y).equals(CCColor.BLACK)) { _myData.setPixel(x, y, CCColor.WHITE); }else { _myData.setPixel(x, y, CCColor.TRANSPARENT); } } if (myApplyCut) { continue; } float myCharWidth = myX - myLastX; if(index == 0) { _mySpaceWidth = myCharWidth / _mySize; } char c = (char)(index + 32); _myCharCodes[index] = c; System.out.println(c + ":" + myCharWidth); _myChars[index] = new CCTextureMapChar(c, -1, myCharWidth / _mySize, height(), new CCVector2f( myLastX / (float)_myData.width(), 1f ), new CCVector2f( myX / (float)_myData.width(), 0 ) ); myLastX = myX; index++; } _myCharCount = index; // _myAscent = _myFontMetrics.getAscent(); // _myDescent = _myFontMetrics.getDescent(); // // _myLeading = _myFontMetrics.getLeading(); // _mySpacing = _myFontMetrics.getHeight(); // // _myNormalizedAscent = (float)_myFontMetrics.getAscent() / _mySize; // _myNormalizedDescent = (float)_myDescent / _mySize; _myFontTexture = new CCTexture2D(_myData); _myFontTexture.textureFilter(CCTextureFilter.NEAREST); } }
4,014
0.647161
0.639226
152
25.532894
23.447567
93
false
false
0
0
0
0
0
0
1.921053
false
false
14
7f375df1b71c9467857feea3759dfb2ae21579e9
25,855,703,144,307
73b008102b747beb80d1975b09305b26af228286
/src/test/java/ShopTest.java
813d9d21086f1da409cfb60da3b2e6a8e737f613
[]
no_license
robwilson195/MusicShop_w12_d5_hw
https://github.com/robwilson195/MusicShop_w12_d5_hw
dd818f706458c501edc622a63030ecd8bc64035d
4d157e4ded5f51e3368668971e74eef09d2a0a1d
refs/heads/master
2020-04-17T08:40:26.605000
2019-01-19T15:18:40
2019-01-19T15:18:40
166,419,352
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import Entities.Shop; import Instruments.FamilyType; import Instruments.Guitar; import Instruments.MaterialType; import StockItems.SheetMusic; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertEquals; public class ShopTest { private Guitar guitar; private SheetMusic music; private Shop shop; @Before public void setUp() { guitar = new Guitar("Zenhouser", "X300", MaterialType.PLASTIC, FamilyType.STRING, "Red", 230.00, 345.00, 110, 6); music = new SheetMusic("Beethoven's Symphony Number 4", 9.00, 12.00, 32, "Ludwig von Beethoven"); shop = new Shop("Ray's Records", 300.00); } @Test public void hasName() { assertEquals("Ray's Records", shop.getName()); } @Test public void hasCash() { assertEquals(300.00, shop.getCash(), 0.001); } @Test public void hasStock() { assertEquals(0, shop.getStock().size()); } @Test public void canBuyStock() { shop.buyStock(guitar); shop.buyStock(music); assertEquals(2, shop.getStock().size()); assertEquals(61.00, shop.getCash(), 0.001); } @Test public void wontBuyUnaffordableStock() { shop.buyStock(guitar); shop.buyStock(guitar); assertEquals(1, shop.getStock().size()); } @Test public void canDetermineTotalProfitExpected() { shop.buyStock(guitar); shop.buyStock(music); assertEquals(118.00, shop.totalProfit(), 0.001); } }
UTF-8
Java
1,533
java
ShopTest.java
Java
[ { "context": "ublic void setUp() {\n guitar = new Guitar(\"Zenhouser\", \"X300\", MaterialType.PLASTIC, FamilyType.STRING", "end": 421, "score": 0.9990611672401428, "start": 412, "tag": "NAME", "value": "Zenhouser" }, { "context": "Beethoven's Symphony Number 4\", 9.00, 12.00, 32, \"Ludwig von Beethoven\");\n shop = new Shop(\"Ray's Records\", 300.0", "end": 607, "score": 0.9995313882827759, "start": 587, "tag": "NAME", "value": "Ludwig von Beethoven" } ]
null
[]
import Entities.Shop; import Instruments.FamilyType; import Instruments.Guitar; import Instruments.MaterialType; import StockItems.SheetMusic; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertEquals; public class ShopTest { private Guitar guitar; private SheetMusic music; private Shop shop; @Before public void setUp() { guitar = new Guitar("Zenhouser", "X300", MaterialType.PLASTIC, FamilyType.STRING, "Red", 230.00, 345.00, 110, 6); music = new SheetMusic("Beethoven's Symphony Number 4", 9.00, 12.00, 32, "<NAME>"); shop = new Shop("Ray's Records", 300.00); } @Test public void hasName() { assertEquals("Ray's Records", shop.getName()); } @Test public void hasCash() { assertEquals(300.00, shop.getCash(), 0.001); } @Test public void hasStock() { assertEquals(0, shop.getStock().size()); } @Test public void canBuyStock() { shop.buyStock(guitar); shop.buyStock(music); assertEquals(2, shop.getStock().size()); assertEquals(61.00, shop.getCash(), 0.001); } @Test public void wontBuyUnaffordableStock() { shop.buyStock(guitar); shop.buyStock(guitar); assertEquals(1, shop.getStock().size()); } @Test public void canDetermineTotalProfitExpected() { shop.buyStock(guitar); shop.buyStock(music); assertEquals(118.00, shop.totalProfit(), 0.001); } }
1,519
0.632746
0.592955
61
24.131147
23.834454
121
false
false
0
0
0
0
0
0
0.819672
false
false
14
f39ae6c8020f37da942bcadcaba3246362c6cc95
25,855,703,146,488
5a088135a99a386e473f94f971c571864373865c
/A2016001-云南省第一人民医院自助机项目/02.Engineering/03.代码/01.server/tags/ssm_0.1/src/main/java/com/lenovohit/ssm/treat/manager/impl/HisOutpatientManagerImpl.java
259a1489f03ea56af0f1760ce02fc1f5f83ec472
[]
no_license
jacky-cyber/work
https://github.com/jacky-cyber/work
a7bebd2cc910da1e9e227181def880a78cc1de07
e58558221b2a8f410b087fa2ce88017cea12efa4
refs/heads/master
2022-02-25T09:48:53.940000
2018-05-01T10:04:53
2018-05-01T10:04:53
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lenovohit.ssm.treat.manager.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import com.lenovohit.ssm.treat.dao.FrontendRestDao; import com.lenovohit.ssm.treat.manager.HisOutpatientManager; import com.lenovohit.ssm.treat.model.MedicalRecord; import com.lenovohit.ssm.treat.model.Patient; public class HisOutpatientManagerImpl implements HisOutpatientManager{ @Autowired private FrontendRestDao frontendRestDao; @Override public List<MedicalRecord> getMedicalRecordPage(Patient patient) { List<MedicalRecord> medicalRecord = frontendRestDao.getForList("outpatient/medicalRecord/page", MedicalRecord.class); return medicalRecord; } @Override public List<MedicalRecord> getMedicalRecord(String id) { List<MedicalRecord> medicalDetail = frontendRestDao.getForList("outpatient/medicalRecord/"+id, MedicalRecord.class); return medicalDetail; } @Override public MedicalRecord medicalRecordPrint(MedicalRecord record) { return null; } }
UTF-8
Java
1,025
java
HisOutpatientManagerImpl.java
Java
[]
null
[]
package com.lenovohit.ssm.treat.manager.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import com.lenovohit.ssm.treat.dao.FrontendRestDao; import com.lenovohit.ssm.treat.manager.HisOutpatientManager; import com.lenovohit.ssm.treat.model.MedicalRecord; import com.lenovohit.ssm.treat.model.Patient; public class HisOutpatientManagerImpl implements HisOutpatientManager{ @Autowired private FrontendRestDao frontendRestDao; @Override public List<MedicalRecord> getMedicalRecordPage(Patient patient) { List<MedicalRecord> medicalRecord = frontendRestDao.getForList("outpatient/medicalRecord/page", MedicalRecord.class); return medicalRecord; } @Override public List<MedicalRecord> getMedicalRecord(String id) { List<MedicalRecord> medicalDetail = frontendRestDao.getForList("outpatient/medicalRecord/"+id, MedicalRecord.class); return medicalDetail; } @Override public MedicalRecord medicalRecordPrint(MedicalRecord record) { return null; } }
1,025
0.810732
0.810732
37
26.702703
32.466087
119
false
false
0
0
0
0
0
0
1.189189
false
false
14
c18493d187996bd67e1f9ec4439acadb901539fa
506,806,197,971
27a5642c8e0ddf3c89c12d0734dd2e2fdb68999f
/multisource/src/main/java/com/fm/multisource/web/DataSourceRouterFilter.java
87e5dae521b5845a970059cf29f9c3dc2877128d
[]
no_license
beku8/multisource
https://github.com/beku8/multisource
8dd8f11d85c9089c85dee61cc9e0da7962f53cbf
fbdab4b5f18c9d47a812fffd4fe86197f12c3320
refs/heads/master
2016-09-05T13:17:14.075000
2012-12-15T16:15:53
2012-12-15T16:15:53
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.fm.multisource.web; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.core.context.SecurityContextHolder; import com.fm.multisource.datasource.CustomerContextHolder; /** * Servlet Filter implementation class DataSourceRouterFilter */ public class DataSourceRouterFilter implements Filter { private Logger logger = LoggerFactory.getLogger(getClass()); public void destroy() { logger.debug("destroying DataSourceRouterFilter filter"); } /** * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain) */ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { logger.debug("entered filter"); if(SecurityContextHolder.getContext().getAuthentication() != null){ String name = SecurityContextHolder.getContext().getAuthentication().getName(); logger.debug("current user: {}", name); if(name.equals("admin")){ CustomerContextHolder.setCustomerType(2); logger.debug("setting source to {}", 2); } else if(name.equals("koala")){ CustomerContextHolder.setCustomerType(3); logger.debug("setting source to {}", 3); } } chain.doFilter(request, response); } /** * @see Filter#init(FilterConfig) */ public void init(FilterConfig fConfig) throws ServletException { logger.debug("initializing DataSourceRouterFilter filter"); } }
UTF-8
Java
1,672
java
DataSourceRouterFilter.java
Java
[]
null
[]
package com.fm.multisource.web; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.core.context.SecurityContextHolder; import com.fm.multisource.datasource.CustomerContextHolder; /** * Servlet Filter implementation class DataSourceRouterFilter */ public class DataSourceRouterFilter implements Filter { private Logger logger = LoggerFactory.getLogger(getClass()); public void destroy() { logger.debug("destroying DataSourceRouterFilter filter"); } /** * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain) */ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { logger.debug("entered filter"); if(SecurityContextHolder.getContext().getAuthentication() != null){ String name = SecurityContextHolder.getContext().getAuthentication().getName(); logger.debug("current user: {}", name); if(name.equals("admin")){ CustomerContextHolder.setCustomerType(2); logger.debug("setting source to {}", 2); } else if(name.equals("koala")){ CustomerContextHolder.setCustomerType(3); logger.debug("setting source to {}", 3); } } chain.doFilter(request, response); } /** * @see Filter#init(FilterConfig) */ public void init(FilterConfig fConfig) throws ServletException { logger.debug("initializing DataSourceRouterFilter filter"); } }
1,672
0.76256
0.758971
57
28.333334
27.744026
129
false
false
0
0
0
0
0
0
1.719298
false
false
14
9bd858b463d86785c67a1aa6ee1ede73300a5dbb
33,440,615,387,210
6a9ff07e6d8713abba72c39f740729375ea4f317
/src/main/java/part1/service/DataImporter.java
f170e75c9f89eda61f2674bc3aa096d96c758e7a
[]
no_license
jakubszybisty/codekata04
https://github.com/jakubszybisty/codekata04
2ac14b084b79de2d4726639401d0152f2cc35b21
47dbb72709bdb00fa65dfde3d48eb77061b8dec6
refs/heads/master
2021-01-11T10:22:09.575000
2017-02-16T08:49:11
2017-02-16T08:49:11
78,473,470
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package part1.service; import part1.model.Weather; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; import java.util.stream.Collectors; /** * Created by Jakub on 1/9/2017. */ public class DataImporter { public List<Weather> importData(Path weatherData) { try { return Files.readAllLines(weatherData).stream() .map(line -> line.trim().split("(\\s)+")) .filter(row -> row[0].matches("\\d+")) .map(this::parseWeather) .collect(Collectors.toList()); } catch (IOException e) { throw new RuntimeException(e); } } private Weather parseWeather(String[] row) { Weather weather = new Weather(); weather.setDayNumber(cleanValue(row[0])); weather.setMinTemperature(cleanValue(row[2])); weather.setMaxTemperature(cleanValue(row[1])); return weather; } private int cleanValue(String s) { return Integer.parseInt(s.replaceAll("[*]", "")); } }
UTF-8
Java
1,094
java
DataImporter.java
Java
[ { "context": "rt java.util.stream.Collectors;\n\n/**\n * Created by Jakub on 1/9/2017.\n */\npublic class DataImporter {\n\n ", "end": 220, "score": 0.9952405095100403, "start": 215, "tag": "NAME", "value": "Jakub" } ]
null
[]
package part1.service; import part1.model.Weather; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; import java.util.stream.Collectors; /** * Created by Jakub on 1/9/2017. */ public class DataImporter { public List<Weather> importData(Path weatherData) { try { return Files.readAllLines(weatherData).stream() .map(line -> line.trim().split("(\\s)+")) .filter(row -> row[0].matches("\\d+")) .map(this::parseWeather) .collect(Collectors.toList()); } catch (IOException e) { throw new RuntimeException(e); } } private Weather parseWeather(String[] row) { Weather weather = new Weather(); weather.setDayNumber(cleanValue(row[0])); weather.setMinTemperature(cleanValue(row[2])); weather.setMaxTemperature(cleanValue(row[1])); return weather; } private int cleanValue(String s) { return Integer.parseInt(s.replaceAll("[*]", "")); } }
1,094
0.595978
0.585009
40
26.35
20.987556
61
false
false
0
0
0
0
0
0
0.4
false
false
14
7edc9ce7845aaa49931ce21ada145463e0567197
18,442,589,598,536
e93011a399041fd8da5aff51476d6a6b890a7927
/service/src/main/java/com/epam/department/service/DepartmentServiceImpl.java
a529a61435e6301360b58e4bc47b5aa173c44971
[]
no_license
IharPashkevich/department-app
https://github.com/IharPashkevich/department-app
614dc2cfeca75b43b383d1aa645bfcd8058dcf43
76e9b6acd24d7c4e2be72b5ed637a3026298c283
refs/heads/master
2016-09-17T06:35:12.265000
2016-09-06T14:03:01
2016-09-06T14:03:01
61,991,983
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.epam.department.service; import com.epam.department.dao.DepartmentDAO; import com.epam.department.dao.EmployeeDAO; import com.epam.department.model.Department; import com.epam.department.model.Employee; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import java.util.HashMap; import java.util.List; import java.util.Map; @Component @Transactional public class DepartmentServiceImpl implements DepartmentService{ @Autowired DepartmentDAO departmentDAO; @Autowired EmployeeDAO employeeDAO; public Map<Department, Double> getDepartmentsWithAverageSalary() { List<Department> allDepartments = departmentDAO.getAllDepartments(); Map<Department, Double> departmentsWithAverageSalary = new HashMap<Department, Double>(); for (Department department: allDepartments) { List<Employee> employeesInDepartment = employeeDAO.getEmployeesInDepartment(department.getId()); if (employeesInDepartment.size() != 0) { int i = 0; double sum = 0; for (Employee employee : employeesInDepartment) { sum += employee.getSalary(); i++; } departmentsWithAverageSalary.put(department, sum / i); } else departmentsWithAverageSalary.put(department, 0D); } return departmentsWithAverageSalary; } @Override public List<Department> getDepartments() { return departmentDAO.getAllDepartments(); } @Override public void addDepartment(Department department) { departmentDAO.addDepartment(department); } @Override public void deleteDepartment(long id) { Department department = departmentDAO.getDepartmentById(id); departmentDAO.deleteDepartment(department); } @Override public void updateDepartment(Department department) { departmentDAO.updateDepartment(department); } @Override public Department getDepartmentByName(String name) { return departmentDAO.getDepartmentByName(name); } @Override public Department getDepartmentById(long id) { return departmentDAO.getDepartmentById(id); } }
UTF-8
Java
2,373
java
DepartmentServiceImpl.java
Java
[]
null
[]
package com.epam.department.service; import com.epam.department.dao.DepartmentDAO; import com.epam.department.dao.EmployeeDAO; import com.epam.department.model.Department; import com.epam.department.model.Employee; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import java.util.HashMap; import java.util.List; import java.util.Map; @Component @Transactional public class DepartmentServiceImpl implements DepartmentService{ @Autowired DepartmentDAO departmentDAO; @Autowired EmployeeDAO employeeDAO; public Map<Department, Double> getDepartmentsWithAverageSalary() { List<Department> allDepartments = departmentDAO.getAllDepartments(); Map<Department, Double> departmentsWithAverageSalary = new HashMap<Department, Double>(); for (Department department: allDepartments) { List<Employee> employeesInDepartment = employeeDAO.getEmployeesInDepartment(department.getId()); if (employeesInDepartment.size() != 0) { int i = 0; double sum = 0; for (Employee employee : employeesInDepartment) { sum += employee.getSalary(); i++; } departmentsWithAverageSalary.put(department, sum / i); } else departmentsWithAverageSalary.put(department, 0D); } return departmentsWithAverageSalary; } @Override public List<Department> getDepartments() { return departmentDAO.getAllDepartments(); } @Override public void addDepartment(Department department) { departmentDAO.addDepartment(department); } @Override public void deleteDepartment(long id) { Department department = departmentDAO.getDepartmentById(id); departmentDAO.deleteDepartment(department); } @Override public void updateDepartment(Department department) { departmentDAO.updateDepartment(department); } @Override public Department getDepartmentByName(String name) { return departmentDAO.getDepartmentByName(name); } @Override public Department getDepartmentById(long id) { return departmentDAO.getDepartmentById(id); } }
2,373
0.693637
0.691951
83
27.590361
26.644033
108
false
false
0
0
0
0
0
0
0.421687
false
false
14
e05f33b7a5376f8fc1cfc01f3a5f399c3793e451
7,739,531,071,018
8eb64210c43c0396fc865614deb72507f78b3ad2
/src/com/worxforus/net/NetAuthentication.java
6cf16c364c6484726d72d95c9a9e4c38a2ba3814
[]
no_license
satish123/WorxForUs_Library
https://github.com/satish123/WorxForUs_Library
7e35b46a759830bf738aeaaa16a751864da26aa2
7134f6f2e6d8ec0614dcad2987456647f1dc66ff
refs/heads/master
2021-01-18T06:02:56.312000
2014-06-02T12:34:39
2014-06-02T12:34:39
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.worxforus.net; import com.worxforus.Utils; import com.worxforus.net.NetResult; /** * This class is used to contain the login credentials in memory and to handle actual responses to the network login attempts. * * Usage requires NetAuthentication.NetAuthenticationHelper to be subclassed * @author sbossen * */ public class NetAuthentication { private String username=""; private String password=""; private String accessToken=""; //accessToken can be used instead of a password private String uuid=""; //when combined with accessToken it can be used instead of a password private volatile boolean isLoggedIn = false; //store if we have been authenticated private long lastLoginTime = 0; //stores last time we authenticated private int usernum=-1; protected volatile int loginStatus = NOT_SET; //starts as false to indicate we haven't attempted the connection yet public static final int NO_ERRORS = 0; public static final int NOT_SET = -1; //login information has not been checked public static final int LOGIN_FAILURE = 1; //login supplied but not valid public static final int NETWORK_ERROR = 2; //could not communicate to server public static final int SERVER_ERROR = 3; //server response could not be parsed public static final int NOT_LOGGED_IN = 4; //server indicates user is not logged in - should only happen in context other than trying to log in. public static long LOGIN_REFRESH_TIME_SECONDS = 28800; //retries login after 8 hours if requested // Private constructor prevents instantiation from other classes private NetAuthentication() { } /** * SingletonHolder is loaded on the first execution of Singleton.getInstance() * or the first access to SingletonHolder.INSTANCE, not before. */ private static class AuthenticationHolder { public static final NetAuthentication INSTANCE = new NetAuthentication(); } public static NetAuthentication getInstance() { return AuthenticationHolder.INSTANCE; } public static void loadUsernamePassword(String user, String pass) { NetAuthentication.getInstance().username = user; NetAuthentication.getInstance().password = pass; reset(); } public static String getLoginStatusMessage(String appName) { String message = ""; if (NetAuthentication.getInstance().loginStatus == NO_ERRORS) { message ="Logged in to "+appName; } else if(NetAuthentication.getInstance().loginStatus == LOGIN_FAILURE) { message ="Could not login. Check your login credential settings."; } else if(NetAuthentication.getInstance().loginStatus == NETWORK_ERROR) { message ="Could not connect to the network. Connect to the Internet to login."; } else if(NetAuthentication.getInstance().loginStatus == SERVER_ERROR) { message =appName+" did not respond to the login. Please try again later."; } return message; } /** * Returns the results of whether the login was successful. * @return */ public static int getLoginStatus() { return NetAuthentication.getInstance().loginStatus; } /** * Returns the last authenticated user - does not reset on invalidate (ie. failed authentication) * @return */ public static int getUsernum() { return NetAuthentication.getInstance().usernum; } public static void loadAccessToken(String token, String uuid) { NetAuthentication.getInstance().accessToken = token; NetAuthentication.getInstance().uuid = uuid; reset(); } /** * Use this function after calling loadUsername and loadPassword * Run inside a separate thread using Runnable or ASyncTask since the network calls may block for a while * * The NetHelper interface is used to attempt access multiple retries if needed. * Use NetAuthentication.getLoginStatus() to verify success or failure information * * If successful, this function calls the NetAuthenticationHelper to persist the returned user number * @return NetResult - NetResult.success tells if the login worked or not */ public static NetResult authenticate(String host, NetAuthenticationHelper authHelper) { synchronized(NetAuthentication.getInstance()) { //so we can only try to authenticate one at a time //check if current authentication is valid NetResult result = new NetResult(); result.net_success = true; Utils.LogD(NetAuthentication.class.getName(), "Checking user authentication..."); if (NetAuthentication.isCurrentAuthenticationValid()) { authHelper.markAsLoginSuccessFromCache(result); Utils.LogD(NetAuthentication.class.getName(), "User authentication found in cache"); return result; //don't sent to network - expect to be able to use the cookie. } //if username/password available use that if (NetAuthentication.getInstance().username.length() > 0 && NetAuthentication.getInstance().password.length() > 0) { result = authHelper.handleUsernameLogin(host, NetAuthentication.getInstance().username, NetAuthentication.getInstance().password); } else if (NetAuthentication.getInstance().accessToken.length() > 0 && NetAuthentication.getInstance().uuid.length() > 0) { result = authHelper.handleUsernameLogin(host, NetAuthentication.getInstance().accessToken, NetAuthentication.getInstance().uuid); } else { //error - no login credentials specified. result.success = false; result.net_success = true; //since this is not a network problem //set result to read as login failure authHelper.markAsLoginFailure(result); } //check for login error - read response as a json object //this function below should be called in NetAUthenticationHelper.handleXXXLogin(...); //NetHandler.handleGenericJsonResponseHelper(result, NetAuthentication.class.getName()); int status = authHelper.validateLoginResponse(result); NetAuthentication.getInstance().loginStatus = status; if (status == NO_ERRORS) { NetAuthentication.getInstance().lastLoginTime = System.nanoTime(); NetAuthentication.getInstance().isLoggedIn = true; NetAuthentication.getInstance().usernum = authHelper.getUsernum(result); if (NetAuthentication.getInstance().usernum > 0) authHelper.persistUsernum(NetAuthentication.getInstance().usernum); } else { NetAuthentication.invalidate(); result.success = false; } Utils.LogD(NetAuthentication.class.getName(), "User authentication was "+NetAuthentication.getInstance().getLoginStatusMessage("Server")); return result; } } /** * Returns true if the cache value looks ok and we think we are still logged in. * Returns false if not. * @return */ public static boolean isCurrentAuthenticationValid() { if (NetAuthentication.getInstance().isLoggedIn) { long time_diff_nano = System.nanoTime() - NetAuthentication.getInstance().lastLoginTime; long time_diff_sec = time_diff_nano/1000000000; //convert nanoseconds to seconds: nano/micro/milli if (time_diff_sec < NetAuthentication.LOGIN_REFRESH_TIME_SECONDS) return true; else { reset(); return false; } } return false; } /** * Call this function whenever the login information changes or login can be re-queried. * This clears the login cache. You should also consider clearing the credential cache * with AuthNetHandler.reset(); */ public static void reset() { NetAuthentication.getInstance().loginStatus = NOT_SET; NetAuthentication.invalidate(); } /** * Mark logged in cache as invalid - so it will be rechecked next time authenticate is called */ public static void invalidate() { NetAuthentication.getInstance().isLoggedIn = false; } /** * This function returns true if there is a username or accessToken (or other token) present that allows for the system * to attempt a login. * @return */ public static boolean isReadyForLogin() { if ((NetAuthentication.getInstance().username != null && NetAuthentication.getInstance().username.length() > 0) || (NetAuthentication.getInstance().accessToken != null && NetAuthentication.getInstance().accessToken.length() > 0 && NetAuthentication.getInstance().uuid.length() > 0 )) { return true; } else { return false; } } /** * NetAuthenticationHelper defines the necessary functions needed for login handling. * @author sbossen * */ public interface NetAuthenticationHelper { /** * @return url of where to send login request */ public String getLoginURL(String host); /** * Use this function to save a usernumber into the application. Store in the preferences for example. * This is called on a successful call to NetAuthentication.authenticate(...) * @param result * @return */ public void persistUsernum(int usernum); /** * Use this function to read a given response from a website and return the user number * @param result * @return */ public int getUsernum(NetResult result); /** * Use this function to force the result to appear as a login failure * This simulates a login failure so it can be reported back to the calling class * @param result */ public void markAsLoginFailure(NetResult result); /** * Use this function to force the result to appear as a login success due to cache hit * This simulates a login success so it can be reported back to the calling class * @param result */ public void markAsLoginSuccessFromCache(NetResult result); /** * With this function, AuthNetHandler can use it to send an error message back up to the application * @return */ public String getLoginErrorMessage(); /** * This function is called after a request for the login page to see if a login error was created * * @param netResult - most useful for netResult.object to be a json object * @return int containing loginStatus based on given netResult */ public int validateLoginResponse(NetResult netResult); /** * This function is to be used by external classes that check to see if a login error was created. * Run after using a network command to any page other than the login interface page. * This does not check for all login failures, but only: * NO_ERRORS * NOT_LOGGED_IN * * If this returns the error with the NOT_LOGGED_IN string, then NetAuthentication.invalidate() should be called * * @param netResult - most useful for netResult.object to be a json object * @return int containing loginStatus based on given netResult - either NO_ERRORS or NOT_LOGGED_IN */ public int peekForNotLoggedInError(NetResult netResult); /** * Login to the getLoginURL() with the given username and password. Expect a json success response or failure * makes no determination of success or failure of login, just network connection * run checkForLoginError(...) to determine type of login failure * @param username * @param password * @return */ public NetResult handleUsernameLogin(String host, String username, String password); public NetResult handleTokenLogin(String host, String accessToken, String uuid); } }
UTF-8
Java
11,444
java
NetAuthentication.java
Java
[ { "context": "etAuthenticationHelper to be subclassed\n * @author sbossen\n *\n */\npublic class NetAuthentication {\n\t\n\tprivat", "end": 323, "score": 0.999644935131073, "start": 316, "tag": "USERNAME", "value": "sbossen" }, { "context": " \n\t NetAuthentication.getInstance().password = pass; \n\t reset();\n }\n\n public static String ge", "end": 2189, "score": 0.9913631081581116, "start": 2185, "tag": "PASSWORD", "value": "pass" }, { "context": "functions needed for login handling.\n * @author sbossen\n *\n */\n public interface NetAuthenticatio", "end": 8532, "score": 0.9996400475502014, "start": 8525, "tag": "USERNAME", "value": "sbossen" } ]
null
[]
package com.worxforus.net; import com.worxforus.Utils; import com.worxforus.net.NetResult; /** * This class is used to contain the login credentials in memory and to handle actual responses to the network login attempts. * * Usage requires NetAuthentication.NetAuthenticationHelper to be subclassed * @author sbossen * */ public class NetAuthentication { private String username=""; private String password=""; private String accessToken=""; //accessToken can be used instead of a password private String uuid=""; //when combined with accessToken it can be used instead of a password private volatile boolean isLoggedIn = false; //store if we have been authenticated private long lastLoginTime = 0; //stores last time we authenticated private int usernum=-1; protected volatile int loginStatus = NOT_SET; //starts as false to indicate we haven't attempted the connection yet public static final int NO_ERRORS = 0; public static final int NOT_SET = -1; //login information has not been checked public static final int LOGIN_FAILURE = 1; //login supplied but not valid public static final int NETWORK_ERROR = 2; //could not communicate to server public static final int SERVER_ERROR = 3; //server response could not be parsed public static final int NOT_LOGGED_IN = 4; //server indicates user is not logged in - should only happen in context other than trying to log in. public static long LOGIN_REFRESH_TIME_SECONDS = 28800; //retries login after 8 hours if requested // Private constructor prevents instantiation from other classes private NetAuthentication() { } /** * SingletonHolder is loaded on the first execution of Singleton.getInstance() * or the first access to SingletonHolder.INSTANCE, not before. */ private static class AuthenticationHolder { public static final NetAuthentication INSTANCE = new NetAuthentication(); } public static NetAuthentication getInstance() { return AuthenticationHolder.INSTANCE; } public static void loadUsernamePassword(String user, String pass) { NetAuthentication.getInstance().username = user; NetAuthentication.getInstance().password = <PASSWORD>; reset(); } public static String getLoginStatusMessage(String appName) { String message = ""; if (NetAuthentication.getInstance().loginStatus == NO_ERRORS) { message ="Logged in to "+appName; } else if(NetAuthentication.getInstance().loginStatus == LOGIN_FAILURE) { message ="Could not login. Check your login credential settings."; } else if(NetAuthentication.getInstance().loginStatus == NETWORK_ERROR) { message ="Could not connect to the network. Connect to the Internet to login."; } else if(NetAuthentication.getInstance().loginStatus == SERVER_ERROR) { message =appName+" did not respond to the login. Please try again later."; } return message; } /** * Returns the results of whether the login was successful. * @return */ public static int getLoginStatus() { return NetAuthentication.getInstance().loginStatus; } /** * Returns the last authenticated user - does not reset on invalidate (ie. failed authentication) * @return */ public static int getUsernum() { return NetAuthentication.getInstance().usernum; } public static void loadAccessToken(String token, String uuid) { NetAuthentication.getInstance().accessToken = token; NetAuthentication.getInstance().uuid = uuid; reset(); } /** * Use this function after calling loadUsername and loadPassword * Run inside a separate thread using Runnable or ASyncTask since the network calls may block for a while * * The NetHelper interface is used to attempt access multiple retries if needed. * Use NetAuthentication.getLoginStatus() to verify success or failure information * * If successful, this function calls the NetAuthenticationHelper to persist the returned user number * @return NetResult - NetResult.success tells if the login worked or not */ public static NetResult authenticate(String host, NetAuthenticationHelper authHelper) { synchronized(NetAuthentication.getInstance()) { //so we can only try to authenticate one at a time //check if current authentication is valid NetResult result = new NetResult(); result.net_success = true; Utils.LogD(NetAuthentication.class.getName(), "Checking user authentication..."); if (NetAuthentication.isCurrentAuthenticationValid()) { authHelper.markAsLoginSuccessFromCache(result); Utils.LogD(NetAuthentication.class.getName(), "User authentication found in cache"); return result; //don't sent to network - expect to be able to use the cookie. } //if username/password available use that if (NetAuthentication.getInstance().username.length() > 0 && NetAuthentication.getInstance().password.length() > 0) { result = authHelper.handleUsernameLogin(host, NetAuthentication.getInstance().username, NetAuthentication.getInstance().password); } else if (NetAuthentication.getInstance().accessToken.length() > 0 && NetAuthentication.getInstance().uuid.length() > 0) { result = authHelper.handleUsernameLogin(host, NetAuthentication.getInstance().accessToken, NetAuthentication.getInstance().uuid); } else { //error - no login credentials specified. result.success = false; result.net_success = true; //since this is not a network problem //set result to read as login failure authHelper.markAsLoginFailure(result); } //check for login error - read response as a json object //this function below should be called in NetAUthenticationHelper.handleXXXLogin(...); //NetHandler.handleGenericJsonResponseHelper(result, NetAuthentication.class.getName()); int status = authHelper.validateLoginResponse(result); NetAuthentication.getInstance().loginStatus = status; if (status == NO_ERRORS) { NetAuthentication.getInstance().lastLoginTime = System.nanoTime(); NetAuthentication.getInstance().isLoggedIn = true; NetAuthentication.getInstance().usernum = authHelper.getUsernum(result); if (NetAuthentication.getInstance().usernum > 0) authHelper.persistUsernum(NetAuthentication.getInstance().usernum); } else { NetAuthentication.invalidate(); result.success = false; } Utils.LogD(NetAuthentication.class.getName(), "User authentication was "+NetAuthentication.getInstance().getLoginStatusMessage("Server")); return result; } } /** * Returns true if the cache value looks ok and we think we are still logged in. * Returns false if not. * @return */ public static boolean isCurrentAuthenticationValid() { if (NetAuthentication.getInstance().isLoggedIn) { long time_diff_nano = System.nanoTime() - NetAuthentication.getInstance().lastLoginTime; long time_diff_sec = time_diff_nano/1000000000; //convert nanoseconds to seconds: nano/micro/milli if (time_diff_sec < NetAuthentication.LOGIN_REFRESH_TIME_SECONDS) return true; else { reset(); return false; } } return false; } /** * Call this function whenever the login information changes or login can be re-queried. * This clears the login cache. You should also consider clearing the credential cache * with AuthNetHandler.reset(); */ public static void reset() { NetAuthentication.getInstance().loginStatus = NOT_SET; NetAuthentication.invalidate(); } /** * Mark logged in cache as invalid - so it will be rechecked next time authenticate is called */ public static void invalidate() { NetAuthentication.getInstance().isLoggedIn = false; } /** * This function returns true if there is a username or accessToken (or other token) present that allows for the system * to attempt a login. * @return */ public static boolean isReadyForLogin() { if ((NetAuthentication.getInstance().username != null && NetAuthentication.getInstance().username.length() > 0) || (NetAuthentication.getInstance().accessToken != null && NetAuthentication.getInstance().accessToken.length() > 0 && NetAuthentication.getInstance().uuid.length() > 0 )) { return true; } else { return false; } } /** * NetAuthenticationHelper defines the necessary functions needed for login handling. * @author sbossen * */ public interface NetAuthenticationHelper { /** * @return url of where to send login request */ public String getLoginURL(String host); /** * Use this function to save a usernumber into the application. Store in the preferences for example. * This is called on a successful call to NetAuthentication.authenticate(...) * @param result * @return */ public void persistUsernum(int usernum); /** * Use this function to read a given response from a website and return the user number * @param result * @return */ public int getUsernum(NetResult result); /** * Use this function to force the result to appear as a login failure * This simulates a login failure so it can be reported back to the calling class * @param result */ public void markAsLoginFailure(NetResult result); /** * Use this function to force the result to appear as a login success due to cache hit * This simulates a login success so it can be reported back to the calling class * @param result */ public void markAsLoginSuccessFromCache(NetResult result); /** * With this function, AuthNetHandler can use it to send an error message back up to the application * @return */ public String getLoginErrorMessage(); /** * This function is called after a request for the login page to see if a login error was created * * @param netResult - most useful for netResult.object to be a json object * @return int containing loginStatus based on given netResult */ public int validateLoginResponse(NetResult netResult); /** * This function is to be used by external classes that check to see if a login error was created. * Run after using a network command to any page other than the login interface page. * This does not check for all login failures, but only: * NO_ERRORS * NOT_LOGGED_IN * * If this returns the error with the NOT_LOGGED_IN string, then NetAuthentication.invalidate() should be called * * @param netResult - most useful for netResult.object to be a json object * @return int containing loginStatus based on given netResult - either NO_ERRORS or NOT_LOGGED_IN */ public int peekForNotLoggedInError(NetResult netResult); /** * Login to the getLoginURL() with the given username and password. Expect a json success response or failure * makes no determination of success or failure of login, just network connection * run checkForLoginError(...) to determine type of login failure * @param username * @param password * @return */ public NetResult handleUsernameLogin(String host, String username, String password); public NetResult handleTokenLogin(String host, String accessToken, String uuid); } }
11,450
0.707095
0.704299
279
40.017921
38.264263
179
false
false
0
0
0
0
0
0
1.326165
false
false
14
37c60f9418b128b6b34dd05bd834fa480148f905
7,739,531,067,942
637b248e7afdfa69dddfab26e7147ca0736e03d6
/src/sample/Mecz.java
eae5a51072330e454c37197d265af36246e3ed64
[]
no_license
marbolba/ESportManager
https://github.com/marbolba/ESportManager
5662871a49ee9bd888b2b3bc529aaa9d4c802bf8
dcbba27b37cc3662fa3d979d116b66d740977f63
refs/heads/master
2021-04-09T13:11:13.709000
2018-03-28T09:03:01
2018-03-28T09:03:01
125,652,322
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package sample; import java.util.Random; public class Mecz { int id_mecz; public Druzyna A; public Druzyna B; String druzyna1; int id_druzyna1; int rating1; String druzyna2; int id_druzyna2; int id_gracz_1; int id_gracz_2; int rating2; int nagroda; int runda; int score1; int score2; int przesuniecie; int[] alive1tab; int[] alive2tab; int pamiec1; int pamiec2; String endScore; public String getEndScore() { return endScore; } Mecz(int id_m, int id_d1, String name_1, int r1, int id_d2, String name_2, int r2,String wynik) { id_mecz=id_m; id_druzyna1=id_d1; id_druzyna2=id_d2; druzyna1=name_1; druzyna2=name_2; rating1=r1; rating2=r2; runda=0; score1=0; score2=0; alive1tab=new int[5]; alive2tab=new int[5]; przesuniecie=0; pamiec1 = 0; pamiec2 = 0; if(wynik!=null) endScore=wynik; else endScore="nie rozegrano"; } public void rozegrajRunde() { Random luck = new Random(); float l1; float l2; //ozywiam wszystkich zawodnikow runda++; for (int i = 0; i < 5; i++) { A.zawodnicy[i].alive = true; B.zawodnicy[i].alive = true; } //potrzebne zmienne int x = 0; //pierwsze pojedynki setAliveTab(); /*for (int i = 0; i < alive1tab.length; i++) System.out.println(alive1tab[i] + " vs " + alive2tab[i]);*/ //lecimy while (x < 30) { //setting luck values do { l1 = luck.nextFloat() / 2;//0-1 l2 = luck.nextFloat() / 2; }while(l1<0.3 || l2<0.3); System.out.println("l1:"+l1+" l2:"+l2); x++; //System.out.println("\n\nkolejny pojedynek "+runda); for (int i = pamiec1; i < pamiec1 + 5; i++) { /*for (int j = 0; j < 5; j++) System.out.println(j+": " + alive1tab[j] + " vs " + alive2tab[j]);*/ if (alive1tab[i % 5] == 1) { //jesli jest zywy pamiec1 = i % 5; //System.out.println("Znaleziono1 " + i % 5); break; } } for (int i = pamiec2; i < pamiec2 + 5; i++) { if (alive2tab[i % 5] == 1) { //jesli jest zywy pamiec2 = i % 5; //System.out.println("Znaleziono2 " + i % 5); break; } } System.out.println("POJEDYNEK: "+pamiec1+" vs "+pamiec2); System.out.println(A.zawodnicy[pamiec1].ocena+" ["+l1+"]"+" vs "+B.zawodnicy[pamiec2].ocena+" ["+l2+"]"); System.out.println(A.zawodnicy[pamiec1].ocena*l1 +"v"+ B.zawodnicy[pamiec2].ocena*l2); //setting modificators if (A.zawodnicy[pamiec1].ocena*l1 >= B.zawodnicy[pamiec2].ocena*l2) { System.out.println("wygral " + A.zawodnicy[pamiec1].nazwa); A.zawodnicy[pamiec1].k++; B.zawodnicy[pamiec2].alive = false; B.zawodnicy[pamiec2].d++; alive2tab[pamiec2] = 0; pamiec1++; } else { System.out.println("wygral " + B.zawodnicy[pamiec2].nazwa); B.zawodnicy[pamiec2].k++; A.zawodnicy[pamiec1].alive = false; A.zawodnicy[pamiec1].d++; alive1tab[pamiec1] = 0; pamiec2++; } System.out.println(sum(alive1tab) + "-" + sum(alive2tab)); if (sum(alive1tab) == 0) { System.out.println("wygrywa2"); score2++; break; } if (sum(alive2tab) == 0) { System.out.println("wygrywa1"); score1++; break; } } System.out.println("r:"+runda+"---WYNIK "+score1+":"+score2); } void setAliveTab() { String alive1=A.getAliveList(); String alive2=B.getAliveList(); String [] t1; String [] t2; t1=alive1.split(","); t2=alive2.split(","); for(int i=0;i<t1.length;i++) { alive1tab[i]=Integer.parseInt(t1[i]); alive2tab[i]=Integer.parseInt(t2[i]); System.out.println(","+i+": "+alive1tab[i]+" vs "+alive2tab[i]); } } int sum(int[] d) { int suma=0; for(int i=0;i<d.length;i++) suma+=d[i]; return suma; } void setIdGraczy(int id_g1,int id_g2) { id_gracz_1=id_g1; id_gracz_2=id_g2; } public int getId_mecz() { return id_mecz; } public void setId_mecz(int id_mecz) { this.id_mecz = id_mecz; } public Druzyna getA() { return A; } public void setA(Druzyna a) { A = a; } public Druzyna getB() { return B; } public void setB(Druzyna b) { B = b; } public String getDruzyna1() { return druzyna1; } public void setDruzyna1(String druzyna1) { this.druzyna1 = druzyna1; } public int getId_druzyna1() { return id_druzyna1; } public void setId_druzyna1(int id_druzyna1) { this.id_druzyna1 = id_druzyna1; } public String getDruzyna2() { return druzyna2; } public void setDruzyna2(String druzyna2) { this.druzyna2 = druzyna2; } public int getId_druzyna2() { return id_druzyna2; } public void setId_druzyna2(int id_druzyna2) { this.id_druzyna2 = id_druzyna2; } public int getNagroda() { return nagroda; } public void setNagroda(int nagroda) { this.nagroda = nagroda; } }
UTF-8
Java
6,375
java
Mecz.java
Java
[]
null
[]
package sample; import java.util.Random; public class Mecz { int id_mecz; public Druzyna A; public Druzyna B; String druzyna1; int id_druzyna1; int rating1; String druzyna2; int id_druzyna2; int id_gracz_1; int id_gracz_2; int rating2; int nagroda; int runda; int score1; int score2; int przesuniecie; int[] alive1tab; int[] alive2tab; int pamiec1; int pamiec2; String endScore; public String getEndScore() { return endScore; } Mecz(int id_m, int id_d1, String name_1, int r1, int id_d2, String name_2, int r2,String wynik) { id_mecz=id_m; id_druzyna1=id_d1; id_druzyna2=id_d2; druzyna1=name_1; druzyna2=name_2; rating1=r1; rating2=r2; runda=0; score1=0; score2=0; alive1tab=new int[5]; alive2tab=new int[5]; przesuniecie=0; pamiec1 = 0; pamiec2 = 0; if(wynik!=null) endScore=wynik; else endScore="nie rozegrano"; } public void rozegrajRunde() { Random luck = new Random(); float l1; float l2; //ozywiam wszystkich zawodnikow runda++; for (int i = 0; i < 5; i++) { A.zawodnicy[i].alive = true; B.zawodnicy[i].alive = true; } //potrzebne zmienne int x = 0; //pierwsze pojedynki setAliveTab(); /*for (int i = 0; i < alive1tab.length; i++) System.out.println(alive1tab[i] + " vs " + alive2tab[i]);*/ //lecimy while (x < 30) { //setting luck values do { l1 = luck.nextFloat() / 2;//0-1 l2 = luck.nextFloat() / 2; }while(l1<0.3 || l2<0.3); System.out.println("l1:"+l1+" l2:"+l2); x++; //System.out.println("\n\nkolejny pojedynek "+runda); for (int i = pamiec1; i < pamiec1 + 5; i++) { /*for (int j = 0; j < 5; j++) System.out.println(j+": " + alive1tab[j] + " vs " + alive2tab[j]);*/ if (alive1tab[i % 5] == 1) { //jesli jest zywy pamiec1 = i % 5; //System.out.println("Znaleziono1 " + i % 5); break; } } for (int i = pamiec2; i < pamiec2 + 5; i++) { if (alive2tab[i % 5] == 1) { //jesli jest zywy pamiec2 = i % 5; //System.out.println("Znaleziono2 " + i % 5); break; } } System.out.println("POJEDYNEK: "+pamiec1+" vs "+pamiec2); System.out.println(A.zawodnicy[pamiec1].ocena+" ["+l1+"]"+" vs "+B.zawodnicy[pamiec2].ocena+" ["+l2+"]"); System.out.println(A.zawodnicy[pamiec1].ocena*l1 +"v"+ B.zawodnicy[pamiec2].ocena*l2); //setting modificators if (A.zawodnicy[pamiec1].ocena*l1 >= B.zawodnicy[pamiec2].ocena*l2) { System.out.println("wygral " + A.zawodnicy[pamiec1].nazwa); A.zawodnicy[pamiec1].k++; B.zawodnicy[pamiec2].alive = false; B.zawodnicy[pamiec2].d++; alive2tab[pamiec2] = 0; pamiec1++; } else { System.out.println("wygral " + B.zawodnicy[pamiec2].nazwa); B.zawodnicy[pamiec2].k++; A.zawodnicy[pamiec1].alive = false; A.zawodnicy[pamiec1].d++; alive1tab[pamiec1] = 0; pamiec2++; } System.out.println(sum(alive1tab) + "-" + sum(alive2tab)); if (sum(alive1tab) == 0) { System.out.println("wygrywa2"); score2++; break; } if (sum(alive2tab) == 0) { System.out.println("wygrywa1"); score1++; break; } } System.out.println("r:"+runda+"---WYNIK "+score1+":"+score2); } void setAliveTab() { String alive1=A.getAliveList(); String alive2=B.getAliveList(); String [] t1; String [] t2; t1=alive1.split(","); t2=alive2.split(","); for(int i=0;i<t1.length;i++) { alive1tab[i]=Integer.parseInt(t1[i]); alive2tab[i]=Integer.parseInt(t2[i]); System.out.println(","+i+": "+alive1tab[i]+" vs "+alive2tab[i]); } } int sum(int[] d) { int suma=0; for(int i=0;i<d.length;i++) suma+=d[i]; return suma; } void setIdGraczy(int id_g1,int id_g2) { id_gracz_1=id_g1; id_gracz_2=id_g2; } public int getId_mecz() { return id_mecz; } public void setId_mecz(int id_mecz) { this.id_mecz = id_mecz; } public Druzyna getA() { return A; } public void setA(Druzyna a) { A = a; } public Druzyna getB() { return B; } public void setB(Druzyna b) { B = b; } public String getDruzyna1() { return druzyna1; } public void setDruzyna1(String druzyna1) { this.druzyna1 = druzyna1; } public int getId_druzyna1() { return id_druzyna1; } public void setId_druzyna1(int id_druzyna1) { this.id_druzyna1 = id_druzyna1; } public String getDruzyna2() { return druzyna2; } public void setDruzyna2(String druzyna2) { this.druzyna2 = druzyna2; } public int getId_druzyna2() { return id_druzyna2; } public void setId_druzyna2(int id_druzyna2) { this.id_druzyna2 = id_druzyna2; } public int getNagroda() { return nagroda; } public void setNagroda(int nagroda) { this.nagroda = nagroda; } }
6,375
0.451294
0.421961
246
24.914635
21.419846
121
false
false
0
0
0
0
0
0
0.581301
false
false
14
9631e76e5f450ccc9b339486b93f08d2a36aefa6
12,841,952,215,355
7f6933fc4f984849ac979ca809ea83b6729f05ad
/src/main/java/ec/santiagogarcia/picoyplaca/plate/LastDigitPlateEnum.java
905111c8e57e32906e33a9351f1c30963a82928a
[ "Apache-2.0" ]
permissive
sgarciab/picoyplaca
https://github.com/sgarciab/picoyplaca
1fe4e40fb9907779d4170611f3711f5807b4fbb5
523f8e74c0b2a93265033808e12ac30897129664
refs/heads/master
2020-04-07T19:29:37.108000
2018-11-23T05:57:50
2018-11-23T05:57:50
158,651,015
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package main.java.ec.santiagogarcia.picoyplaca.plate; public enum LastDigitPlateEnum { ZERO("0"), ONE("1"), TWO("2"), THREE("3"), FOUR("4"), FIVE("5"), SIX("6"), SEVEN("7"), EIGHT("8"), NINE("9"); public String digit; public String getDay() { return this.digit; } LastDigitPlateEnum(String digit) { this.digit = digit; } }
UTF-8
Java
383
java
LastDigitPlateEnum.java
Java
[]
null
[]
package main.java.ec.santiagogarcia.picoyplaca.plate; public enum LastDigitPlateEnum { ZERO("0"), ONE("1"), TWO("2"), THREE("3"), FOUR("4"), FIVE("5"), SIX("6"), SEVEN("7"), EIGHT("8"), NINE("9"); public String digit; public String getDay() { return this.digit; } LastDigitPlateEnum(String digit) { this.digit = digit; } }
383
0.56658
0.54047
21
17.238094
18.368982
53
false
false
0
0
0
0
0
0
1.142857
false
false
14
581c32392972ab2801905bb0ac6b28df0ab3d7d7
24,137,716,222,121
b751931b07030e809317190dacbf3e9e0aa619cf
/src/CandidateComparator.java
71df432cf233089a0bd400c30db8297df4342399
[]
no_license
rakshithvasudev/Instant-Run-off-Election
https://github.com/rakshithvasudev/Instant-Run-off-Election
95a90e065cf3d8b4f42e80cdaadfcbff540c4eea
2ebbe3d3d61d648ce2d99a9dc346d86a3819e5ef
refs/heads/master
2021-03-24T10:40:23.780000
2018-10-18T19:58:59
2018-10-18T19:58:59
87,501,074
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Comparator; import java.util.Map; /** * Created by Rakshith on 4/10/2017. * Compares 2 candidates based on their votes first. * Then on their names if their votes are the same. * This class breaks the tie in the event that the candidates have * same number of votes. */ public class CandidateComparator implements Comparator<Map.Entry<Candidate,Integer>> { /** * Compares 2 candidates by their votes. * If their votes are equal, then the compares by their * lexicographically text names. * @param o1 candidate 1. * @param o2 candidate 2. * @return >0 or ==0 <0 */ @Override public int compare(Map.Entry<Candidate, Integer> o1, Map.Entry<Candidate, Integer> o2) { if (o1.getValue()!=(int)o2.getValue()) return o2.getValue()-o1.getValue(); return o2.getKey().compareTo(o1.getKey()); } }
UTF-8
Java
888
java
CandidateComparator.java
Java
[ { "context": "mparator;\nimport java.util.Map;\n\n/**\n * Created by Rakshith on 4/10/2017.\n * Compares 2 candidates based on t", "end": 78, "score": 0.9991050362586975, "start": 70, "tag": "NAME", "value": "Rakshith" } ]
null
[]
import java.util.Comparator; import java.util.Map; /** * Created by Rakshith on 4/10/2017. * Compares 2 candidates based on their votes first. * Then on their names if their votes are the same. * This class breaks the tie in the event that the candidates have * same number of votes. */ public class CandidateComparator implements Comparator<Map.Entry<Candidate,Integer>> { /** * Compares 2 candidates by their votes. * If their votes are equal, then the compares by their * lexicographically text names. * @param o1 candidate 1. * @param o2 candidate 2. * @return >0 or ==0 <0 */ @Override public int compare(Map.Entry<Candidate, Integer> o1, Map.Entry<Candidate, Integer> o2) { if (o1.getValue()!=(int)o2.getValue()) return o2.getValue()-o1.getValue(); return o2.getKey().compareTo(o1.getKey()); } }
888
0.665541
0.638514
26
33.153847
25.03796
92
false
false
0
0
0
0
0
0
0.346154
false
false
14
6e6ffcbe8cb3466d2dee161055cd229262b516b1
2,783,138,861,531
9eb787b3f9c161abea0c6e8080afe3563abbdd72
/ChecaGarciaJesusIP2014/src/org/ip/extras/Triangulo.java
5c20af0a9436fc769066d52d55431c2877af3517
[]
no_license
Fromau5/IP2014UAL
https://github.com/Fromau5/IP2014UAL
e0a3c337a5bd018d60153b5aedd9be00ed83ca32
8c12913ffa08b40f2c4d8ed15cad5815a1dbd5cf
refs/heads/master
2020-06-01T06:43:38.195000
2015-04-29T22:12:19
2015-04-29T22:12:19
34,820,334
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.ip.extras; import org.ip.entradainteractiva.*; public class Triangulo { public static void main(String[]args){ //Declaración e inicialización de una variable int base=0; //Descripción del programa e introducción del valor de la base System.out.println("Este programa generará un triangulo con la base que introduzca. El valor de la base ha de ser impar, " + "es la única restricción"); do{ System.out.print("\nIntroduzca un valor par si desea salir del programa >> "); base=EntradaInteractiva.leerEntero(); if(base%2==0) break; //Se muestra por pantalla el triángulo System.out.println("Realizando triángulo... en unos segundos estará listo."); System.out.println("\n"+crearTriangulo(base)); System.out.println("Triangulo realizado, puede continuar y realizar tantos cuadrados como desee."); }while(base%2!=0); System.out.println("\n\n\t\tFIN DEL PROGRAMA"); } //Método que genera el triángulo de base n private static String crearTriangulo(int base){ //Declaración e inicialización de una variable local String triangulo=""; //Creación del triángulo de base n for(int i=0;i<((base+1)/2);i++){ for(int j=0;j<(((base+1)/2)-i);j++){ triangulo+=" "; } for(int k=0;k<=(2*i);k++){ triangulo+="*"; } triangulo+="\n"; } return triangulo; } }
ISO-8859-1
Java
1,447
java
Triangulo.java
Java
[]
null
[]
package org.ip.extras; import org.ip.entradainteractiva.*; public class Triangulo { public static void main(String[]args){ //Declaración e inicialización de una variable int base=0; //Descripción del programa e introducción del valor de la base System.out.println("Este programa generará un triangulo con la base que introduzca. El valor de la base ha de ser impar, " + "es la única restricción"); do{ System.out.print("\nIntroduzca un valor par si desea salir del programa >> "); base=EntradaInteractiva.leerEntero(); if(base%2==0) break; //Se muestra por pantalla el triángulo System.out.println("Realizando triángulo... en unos segundos estará listo."); System.out.println("\n"+crearTriangulo(base)); System.out.println("Triangulo realizado, puede continuar y realizar tantos cuadrados como desee."); }while(base%2!=0); System.out.println("\n\n\t\tFIN DEL PROGRAMA"); } //Método que genera el triángulo de base n private static String crearTriangulo(int base){ //Declaración e inicialización de una variable local String triangulo=""; //Creación del triángulo de base n for(int i=0;i<((base+1)/2);i++){ for(int j=0;j<(((base+1)/2)-i);j++){ triangulo+=" "; } for(int k=0;k<=(2*i);k++){ triangulo+="*"; } triangulo+="\n"; } return triangulo; } }
1,447
0.639413
0.630328
53
25
27.71077
124
false
false
0
0
0
0
0
0
2.64151
false
false
14
f8f5c6061c8e021b2aeebb2ed4c8ac68898caa6f
2,783,138,864,051
93834cf07199d9018c4dba996d6d34b3ef4773c5
/src/ifexample/SwitchCase1.java
b60ad0943bf8e2e1fdd57904543b9568464169a8
[]
no_license
leehojin-93/FirstBook_BeginningJavaProgramming
https://github.com/leehojin-93/FirstBook_BeginningJavaProgramming
9e4926787f700daeaba0a6ad5068120771641042
83ab115ef35087783a68b4d0c0137345823edeca
refs/heads/master
2023-06-11T00:19:40.404000
2021-06-25T14:32:57
2021-06-25T14:32:57
370,580,778
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ifexample; import java.util.Scanner; public class SwitchCase1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("순위: "); int ranking = sc.nextInt(); char medalColor; switch(ranking) { case 1: medalColor = 'G'; break; case 2: medalColor = 'S'; break; case 3: medalColor = 'B'; break; default: medalColor = 'A'; } System.out.println(ranking + "등 메달 색상은 " + medalColor + " 입니다."); System.out.println("======================================================"); System.out.print("몇월의 일 수 를 알고 싶습니까: "); int month = sc.nextInt(); int day; switch(month) { case 4: case 6: case 9: case 11: day = 30; break; case 2: day = 28; break; default: day = 31; } System.out.println(month + "월은 "+ day +"일까지 있습니다."); sc.close(); } }
UTF-8
Java
974
java
SwitchCase1.java
Java
[]
null
[]
package ifexample; import java.util.Scanner; public class SwitchCase1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("순위: "); int ranking = sc.nextInt(); char medalColor; switch(ranking) { case 1: medalColor = 'G'; break; case 2: medalColor = 'S'; break; case 3: medalColor = 'B'; break; default: medalColor = 'A'; } System.out.println(ranking + "등 메달 색상은 " + medalColor + " 입니다."); System.out.println("======================================================"); System.out.print("몇월의 일 수 를 알고 싶습니까: "); int month = sc.nextInt(); int day; switch(month) { case 4: case 6: case 9: case 11: day = 30; break; case 2: day = 28; break; default: day = 31; } System.out.println(month + "월은 "+ day +"일까지 있습니다."); sc.close(); } }
974
0.521978
0.504396
54
14.851851
17.707926
79
false
false
0
0
0
0
0
0
1.740741
false
false
14
d3d5b242ceeac825366f3ca43a86a65458e33e3d
22,943,715,347,393
f9b0615fd76701e7ab3a947d8a06676ad70a3bf5
/src/main/java/com/luxh/server/Main.java
b12d82e70d2825cd9f2b601b8a40ac3d30e72b79
[]
no_license
mrluxh/netty-httpserver
https://github.com/mrluxh/netty-httpserver
f99b18809d027793cc640afdca3bbeec4f29f937
522e1f4dc7f11361592f8b3d913f31e24a23f31e
refs/heads/master
2022-06-12T03:20:20.518000
2019-06-05T14:56:46
2019-06-05T14:56:46
190,413,821
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.luxh.server; /** * @Description 程序启动类 * @Author luxiaohua * @Date 2019/6/5 */ public class Main { public static void main(String[] args) { int port = 8080; new NettyHttpServer(port).run(); } }
UTF-8
Java
244
java
Main.java
Java
[ { "context": "luxh.server;\n\n/**\n * @Description 程序启动类\n * @Author luxiaohua\n * @Date 2019/6/5\n */\npublic class Main {\n pub", "end": 72, "score": 0.9986165165901184, "start": 63, "tag": "USERNAME", "value": "luxiaohua" } ]
null
[]
package com.luxh.server; /** * @Description 程序启动类 * @Author luxiaohua * @Date 2019/6/5 */ public class Main { public static void main(String[] args) { int port = 8080; new NettyHttpServer(port).run(); } }
244
0.606838
0.564103
13
17
13.772883
44
false
false
0
0
0
0
0
0
0.230769
false
false
14
0544338500cd54c5b7d7cbfbf39899f958fcaeef
30,932,354,512,991
a3dd0c200158d33b3cd46084591e9128a62afe68
/src/com/yt/worlddatetime/ListCountries.java
80c2c086c7ba823e4bba4fc2509307f9607e0748
[]
no_license
verylove/worlddatetime
https://github.com/verylove/worlddatetime
aab11363b8ce789e04ee853ad3f705af141a99f6
8a79aca131b785c57e368013641423b1ac3897cc
refs/heads/master
2016-09-06T14:02:33.650000
2015-03-19T15:08:31
2015-03-19T15:08:31
32,513,520
0
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yt.worlddatetime; import android.app.ListActivity; public class ListCountries extends ListActivity { }
UTF-8
Java
118
java
ListCountries.java
Java
[]
null
[]
package com.yt.worlddatetime; import android.app.ListActivity; public class ListCountries extends ListActivity { }
118
0.813559
0.813559
7
15.857142
18.924124
49
false
false
0
0
0
0
0
0
0.285714
false
false
14
798c55e253780d31e9485d26fe365409af2b0b9c
25,855,703,153,481
30c2d5902075f64087db8c7cb36b2d1f9b5f3d8e
/src/transactions/ChangeHourlyTransaction.java
ec87fb914944e99fb001636a89954cd9296376c0
[]
no_license
HaidiChen/Payroll
https://github.com/HaidiChen/Payroll
fd96da7be664372675217b5215bb4afa8af3f064
7a090d54ac7b94b21da4f98a94d66edc6bc937b8
refs/heads/master
2020-12-20T20:25:54.135000
2020-05-10T22:17:46
2020-05-10T22:17:46
236,201,385
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package transactions; import intfs.PaymentClassification; import intfs.PaymentSchedule; import classifications.HourlyClassification; import schedules.WeeklySchedule; public class ChangeHourlyTransaction extends ChangeClassificationTransaction { private double rate; public ChangeHourlyTransaction(int empId, double rate) { this.rate = rate; this.empId = empId; } protected PaymentClassification getClassification() { return new HourlyClassification(rate); } protected PaymentSchedule getSchedule() { return new WeeklySchedule(); } }
UTF-8
Java
599
java
ChangeHourlyTransaction.java
Java
[]
null
[]
package transactions; import intfs.PaymentClassification; import intfs.PaymentSchedule; import classifications.HourlyClassification; import schedules.WeeklySchedule; public class ChangeHourlyTransaction extends ChangeClassificationTransaction { private double rate; public ChangeHourlyTransaction(int empId, double rate) { this.rate = rate; this.empId = empId; } protected PaymentClassification getClassification() { return new HourlyClassification(rate); } protected PaymentSchedule getSchedule() { return new WeeklySchedule(); } }
599
0.746244
0.746244
24
23.958334
22.422977
78
false
false
0
0
0
0
0
0
0.458333
false
false
14
f2e48a7e90684c610616b4ff7d28a32478ae8862
11,733,850,661,822
0854d2db6c73e8c3be865d1eebe5a4efd3c54083
/src/main/java/com/UniversAfrica/controllers/MetierController.java
990792461b2c5d008a3c4941a400dc64e67c524e
[]
no_license
azizmakri/backendFullProjet
https://github.com/azizmakri/backendFullProjet
22133705c74878d3285e445d95e9214780904f2b
2a74b58971f97650ece41c71914c5b2d6651767b
refs/heads/master
2023-05-14T08:46:45.092000
2021-06-13T02:26:33
2021-06-13T02:26:33
376,419,471
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.UniversAfrica.controllers; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; import com.UniversAfrica.dto.GetMetiersRequest; import com.UniversAfrica.models.Metier; import com.UniversAfrica.repository.MetierRepository; import com.UniversAfrica.security.exception.ResourceNotFoundException; @CrossOrigin(origins = "http://localhost:3000") @RestController @RequestMapping("/api/v1/") public class MetierController { @Autowired private MetierRepository metierRepository; // get all metiers @PostMapping("/metiers") public List<Metier> getAllMetiers(@RequestBody GetMetiersRequest request){ String input = ""; if (request.getName() == null || request.getName().equals("")) { input = "%"; }else { input = request.getName(); } return metierRepository.getAllMetiers(input); } // create metier rest api @PostMapping("/createMetiers") public Metier createMetier(@RequestBody Metier metier) { return metierRepository.save(metier); } // get metier by id rest api @GetMapping("/metiers/{id}") public ResponseEntity<Metier> getMetierById(@PathVariable Long id) { Metier metier = metierRepository.findById(id) .orElseThrow(() -> new ResourceNotFoundException("Metier not exist with id :" + id)); return ResponseEntity.ok(metier); } // update metier rest api @PutMapping("/metiers/{id}") public ResponseEntity<Metier> updateMetier(@PathVariable Long id, @RequestBody Metier metierDetails){ Metier metier = metierRepository.findById(id) .orElseThrow(() -> new ResourceNotFoundException("Metier not exist with id :" + id)); metier.setNom(metierDetails.getNom()); metier.setDescription(metierDetails.getDescription()); Metier updatedMetier = metierRepository.save(metier); return ResponseEntity.ok(updatedMetier); } // delete metier rest api @DeleteMapping("/metiers/{id}") public ResponseEntity<Map<String, Boolean>> deleteMetier(@PathVariable Long id){ Metier metier = metierRepository.findById(id) .orElseThrow(() -> new ResourceNotFoundException("Metier not exist with id :" + id)); metierRepository.delete(metier); Map<String, Boolean> response = new HashMap<>(); response.put("deleted", Boolean.TRUE); return ResponseEntity.ok(response); } @GetMapping("/Search") public ResponseEntity<Metier> getMetierByNom(@PathVariable String nom) { Metier metier = metierRepository.findByNom(nom) .orElseThrow(() -> new ResourceNotFoundException("Metier not exist with id :" + nom)); return ResponseEntity.ok(metier); } }
UTF-8
Java
3,522
java
MetierController.java
Java
[]
null
[]
package com.UniversAfrica.controllers; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; import com.UniversAfrica.dto.GetMetiersRequest; import com.UniversAfrica.models.Metier; import com.UniversAfrica.repository.MetierRepository; import com.UniversAfrica.security.exception.ResourceNotFoundException; @CrossOrigin(origins = "http://localhost:3000") @RestController @RequestMapping("/api/v1/") public class MetierController { @Autowired private MetierRepository metierRepository; // get all metiers @PostMapping("/metiers") public List<Metier> getAllMetiers(@RequestBody GetMetiersRequest request){ String input = ""; if (request.getName() == null || request.getName().equals("")) { input = "%"; }else { input = request.getName(); } return metierRepository.getAllMetiers(input); } // create metier rest api @PostMapping("/createMetiers") public Metier createMetier(@RequestBody Metier metier) { return metierRepository.save(metier); } // get metier by id rest api @GetMapping("/metiers/{id}") public ResponseEntity<Metier> getMetierById(@PathVariable Long id) { Metier metier = metierRepository.findById(id) .orElseThrow(() -> new ResourceNotFoundException("Metier not exist with id :" + id)); return ResponseEntity.ok(metier); } // update metier rest api @PutMapping("/metiers/{id}") public ResponseEntity<Metier> updateMetier(@PathVariable Long id, @RequestBody Metier metierDetails){ Metier metier = metierRepository.findById(id) .orElseThrow(() -> new ResourceNotFoundException("Metier not exist with id :" + id)); metier.setNom(metierDetails.getNom()); metier.setDescription(metierDetails.getDescription()); Metier updatedMetier = metierRepository.save(metier); return ResponseEntity.ok(updatedMetier); } // delete metier rest api @DeleteMapping("/metiers/{id}") public ResponseEntity<Map<String, Boolean>> deleteMetier(@PathVariable Long id){ Metier metier = metierRepository.findById(id) .orElseThrow(() -> new ResourceNotFoundException("Metier not exist with id :" + id)); metierRepository.delete(metier); Map<String, Boolean> response = new HashMap<>(); response.put("deleted", Boolean.TRUE); return ResponseEntity.ok(response); } @GetMapping("/Search") public ResponseEntity<Metier> getMetierByNom(@PathVariable String nom) { Metier metier = metierRepository.findByNom(nom) .orElseThrow(() -> new ResourceNotFoundException("Metier not exist with id :" + nom)); return ResponseEntity.ok(metier); } }
3,522
0.773708
0.772289
106
32.235847
27.07312
102
false
false
0
0
0
0
0
0
1.537736
false
false
14
446a1e824a07d94360ddb630aa700991e2f96315
30,124,900,620,228
733a19f2d6a7fe182bcf8f757e0ff75713132d64
/app/src/main/java/com/linsh/lshapp/common/LshConstants.java
80d6bbd3c28f42c2e8850ba8f5ffdbc4840a1c3e
[]
no_license
gejiushishuai/LshApp
https://github.com/gejiushishuai/LshApp
5f111cdbf8dbd1ba554420abcdb291249aef7c39
43c0578fba8fa0c23dd85e756553b10935051ca1
refs/heads/master
2021-05-05T23:31:22.792000
2018-01-05T15:07:55
2018-01-05T15:07:55
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.linsh.lshapp.common; /** * Created by Senh Linsh on 17/5/2. */ public class LshConstants { public static final String NAME_REALM_FILE = "shiyi.realm"; }
UTF-8
Java
174
java
LshConstants.java
Java
[ { "context": "ackage com.linsh.lshapp.common;\n\n/**\n * Created by Senh Linsh on 17/5/2.\n */\n\npublic class LshConstants {\n\n ", "end": 62, "score": 0.9998169541358948, "start": 52, "tag": "NAME", "value": "Senh Linsh" } ]
null
[]
package com.linsh.lshapp.common; /** * Created by <NAME> on 17/5/2. */ public class LshConstants { public static final String NAME_REALM_FILE = "shiyi.realm"; }
170
0.689655
0.666667
10
16.4
20.679459
63
false
false
0
0
0
0
0
0
0.2
false
false
14
cd3fcc76712a02c1a21d6420c0ccfd1382d6da46
7,808,250,557,287
e567328ef19333f2902b1d578ee196ee0b6def8a
/practices/P2/TrackingPackages/src/trackingpackages/Tracking.java
bd88b6ca5008a5b141a955091518be26f9aee331
[]
no_license
ixjosemi/FR-UGR
https://github.com/ixjosemi/FR-UGR
8df8b74b60ef48c114ffee10484f3c70cc256692
c83372850f358062c45ca415f15c7d17a7852cf4
refs/heads/master
2021-04-06T14:57:34.571000
2018-03-14T16:18:52
2018-03-14T16:18:52
125,239,867
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Jose Miguel Hernandez Garcia * Miguel Jimenez Cazorla * Fundamentos de Redes * 3 º B */ package trackingpackages; import java.io.*; import java.net.*; public class Tracking { // Llamamos a la clase BDTracking BDTracking track = new BDTracking(); // Abrimos un socket private Socket socketServicio; // Flujo de lectura private InputStream inputStream; // Flujo de salida private OutputStream outputStream; // Constructor que tiene como parámetro una referencia al socket abierto en por otra clase public Tracking(Socket socketServicio) { this.socketServicio=socketServicio; } void procesa(){ byte []bufferEnvio; byte []bufferLectura = new byte[1024]; int bytesRecibidos = 0; // Obtenemos flujos de salida y entrada try { // Obtiene los flujos de escritura/lectura inputStream=socketServicio.getInputStream(); outputStream=socketServicio.getOutputStream(); // Leemos la frase de que queremos conectarnos bytesRecibidos = inputStream.read(bufferLectura); // Convertimos la frase a string String peticion = ""; for(int i = 0; i < bytesRecibidos; i++) peticion += (char)bufferLectura[i]; if(peticion.equals("Quiero conectarme")){ // Pintamos el mensaje de bienvenida en el servidor y en el cliente System.out.println(Bienvenida()); // Enviamos el mensaje de bienvenida al cliente para pintarlo String mensajeBienvenida = Bienvenida()+"\nConectado. Introduce tus datos"; bufferEnvio = mensajeBienvenida.getBytes(); outputStream.write(bufferEnvio, 0, bufferEnvio.length); outputStream.flush(); // Leemos la cadena de usuario y contraseña y comprobamos que es correcto bytesRecibidos = inputStream.read(bufferLectura); // Si la conexion es exitosa, pedimos el numero de seguimiento if(login(bufferLectura, bytesRecibidos)){ // Mostramos mensaje de exito al conectarse bufferEnvio = "OK".getBytes(); outputStream.write(bufferEnvio, 0, bufferEnvio.length); outputStream.flush(); // Esperamos la lectura del tracking number bytesRecibidos = inputStream.read(bufferLectura); if(seguimiento(bufferLectura, bytesRecibidos)){ // Pintamos la ciudad en la que se encuentra el paquete // y el dia en que lo recibiremos String ubicacion = "\nEl paquete esta en " + track.getCiudad() + "\n" + "Y sera entregado el proximo " + track.getDiaEntrega(); bufferEnvio = ubicacion.getBytes(); outputStream.write(bufferEnvio, 0, bufferEnvio.length); outputStream.flush(); } else{ // Mostramos mensaje de error al buscar el numero de seguimiento bufferEnvio = "El tracking number es incorrecto".getBytes(); outputStream.write(bufferEnvio, 0, bufferEnvio.length); outputStream.flush(); } } else{ // Mostramos mensaje de error bufferEnvio = "ERROR al conectar".getBytes(); outputStream.write(bufferEnvio, 0, bufferEnvio.length); outputStream.flush(); } } else System.err.println("ERROR de peticion de conexion"); } catch (IOException e) { System.err.println("Error al obtener los flujos de entrada/salida."); } } boolean login(byte []conexion, int tam){ boolean conectado = false; String recibido = ""; for(int i = 0; i < tam; i++) recibido += (char)conexion[i]; if(track.UsuarioCon(recibido)) conectado = true; return conectado; } boolean seguimiento(byte []seguimiento, int tam){ boolean encontrado = false; String recibido = ""; for(int i = 0; i < tam; i++) recibido += (char)seguimiento[i]; if(track.TrackingN(recibido)) encontrado = true; return encontrado; } String Bienvenida(){ String bienvenida = ""; bienvenida = "*********************************************\n" + "* PROGRAMA DE SEGUIMIENTO DE PAQUETERIA *\n" + "* Fundamentos de Redes *\n" + "* Jose Miguel Hernandez Garcia *\n" + "* Miguel Jimenez Cazorla *\n" + "*********************************************\n"; return bienvenida; } }
UTF-8
Java
5,532
java
Tracking.java
Java
[ { "context": "/*\n * Jose Miguel Hernandez Garcia\n * Miguel Jimenez Cazorla\n * Fundamentos de Redes", "end": 34, "score": 0.99985671043396, "start": 6, "tag": "NAME", "value": "Jose Miguel Hernandez Garcia" }, { "context": "/*\n * Jose Miguel Hernandez Garcia\n * Miguel Jimenez Cazorla\n * Fundamentos de Redes\n * 3 º B\n */\npackage trac", "end": 60, "score": 0.9998592734336853, "start": 38, "tag": "NAME", "value": "Miguel Jimenez Cazorla" }, { "context": " *\\n\" +\n \"* Jose Miguel Hernandez Garcia *\\n\" +\n \"* Migue", "end": 5320, "score": 0.9998713135719299, "start": 5292, "tag": "NAME", "value": "Jose Miguel Hernandez Garcia" }, { "context": "Garcia *\\n\" +\n \"* Miguel Jimenez Cazorla *\\n\" +\n \"**", "end": 5387, "score": 0.999877393245697, "start": 5365, "tag": "NAME", "value": "Miguel Jimenez Cazorla" } ]
null
[]
/* * <NAME> * <NAME> * Fundamentos de Redes * 3 º B */ package trackingpackages; import java.io.*; import java.net.*; public class Tracking { // Llamamos a la clase BDTracking BDTracking track = new BDTracking(); // Abrimos un socket private Socket socketServicio; // Flujo de lectura private InputStream inputStream; // Flujo de salida private OutputStream outputStream; // Constructor que tiene como parámetro una referencia al socket abierto en por otra clase public Tracking(Socket socketServicio) { this.socketServicio=socketServicio; } void procesa(){ byte []bufferEnvio; byte []bufferLectura = new byte[1024]; int bytesRecibidos = 0; // Obtenemos flujos de salida y entrada try { // Obtiene los flujos de escritura/lectura inputStream=socketServicio.getInputStream(); outputStream=socketServicio.getOutputStream(); // Leemos la frase de que queremos conectarnos bytesRecibidos = inputStream.read(bufferLectura); // Convertimos la frase a string String peticion = ""; for(int i = 0; i < bytesRecibidos; i++) peticion += (char)bufferLectura[i]; if(peticion.equals("Quiero conectarme")){ // Pintamos el mensaje de bienvenida en el servidor y en el cliente System.out.println(Bienvenida()); // Enviamos el mensaje de bienvenida al cliente para pintarlo String mensajeBienvenida = Bienvenida()+"\nConectado. Introduce tus datos"; bufferEnvio = mensajeBienvenida.getBytes(); outputStream.write(bufferEnvio, 0, bufferEnvio.length); outputStream.flush(); // Leemos la cadena de usuario y contraseña y comprobamos que es correcto bytesRecibidos = inputStream.read(bufferLectura); // Si la conexion es exitosa, pedimos el numero de seguimiento if(login(bufferLectura, bytesRecibidos)){ // Mostramos mensaje de exito al conectarse bufferEnvio = "OK".getBytes(); outputStream.write(bufferEnvio, 0, bufferEnvio.length); outputStream.flush(); // Esperamos la lectura del tracking number bytesRecibidos = inputStream.read(bufferLectura); if(seguimiento(bufferLectura, bytesRecibidos)){ // Pintamos la ciudad en la que se encuentra el paquete // y el dia en que lo recibiremos String ubicacion = "\nEl paquete esta en " + track.getCiudad() + "\n" + "Y sera entregado el proximo " + track.getDiaEntrega(); bufferEnvio = ubicacion.getBytes(); outputStream.write(bufferEnvio, 0, bufferEnvio.length); outputStream.flush(); } else{ // Mostramos mensaje de error al buscar el numero de seguimiento bufferEnvio = "El tracking number es incorrecto".getBytes(); outputStream.write(bufferEnvio, 0, bufferEnvio.length); outputStream.flush(); } } else{ // Mostramos mensaje de error bufferEnvio = "ERROR al conectar".getBytes(); outputStream.write(bufferEnvio, 0, bufferEnvio.length); outputStream.flush(); } } else System.err.println("ERROR de peticion de conexion"); } catch (IOException e) { System.err.println("Error al obtener los flujos de entrada/salida."); } } boolean login(byte []conexion, int tam){ boolean conectado = false; String recibido = ""; for(int i = 0; i < tam; i++) recibido += (char)conexion[i]; if(track.UsuarioCon(recibido)) conectado = true; return conectado; } boolean seguimiento(byte []seguimiento, int tam){ boolean encontrado = false; String recibido = ""; for(int i = 0; i < tam; i++) recibido += (char)seguimiento[i]; if(track.TrackingN(recibido)) encontrado = true; return encontrado; } String Bienvenida(){ String bienvenida = ""; bienvenida = "*********************************************\n" + "* PROGRAMA DE SEGUIMIENTO DE PAQUETERIA *\n" + "* Fundamentos de Redes *\n" + "* <NAME> *\n" + "* <NAME> *\n" + "*********************************************\n"; return bienvenida; } }
5,456
0.490685
0.488153
157
34.21656
25.539608
94
false
false
0
0
0
0
0
0
0.585987
false
false
14
69a164061bef78547e2051039aa623ed77cf1485
18,966,575,590,564
6f982db25dae13a8b05f620b34444b666502b126
/app/src/main/java/com/menemi/dbfactory/SQLiteEngine.java
24e2ca6c867d8e0aab154fe8d8b4b9ab0530cb1c
[]
no_license
suxenori/imenem
https://github.com/suxenori/imenem
cd4a9c9c39470ac8ffb72913ba7b1b49fe2bd2ee
4321a42da95346ea36ffba1de5966337b33a222a
refs/heads/master
2021-05-04T04:55:59.581000
2016-11-30T17:08:54
2016-11-30T17:08:54
70,903,527
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.menemi.dbfactory; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.MatrixCursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.provider.BaseColumns; import android.util.Log; import java.util.ArrayList; /** * Created by irondev on 07.06.16. */ public class SQLiteEngine extends SQLiteOpenHelper implements BaseColumns { public static final String DATABASE_NAME = "menime1.db"; public static final String TABLE_OWNER = "profiles"; public static final String TABLE_LAST_ID = "last_id"; public static final String TABLE_INTEREST = "personInterests"; public static final String TABLE_SOCIAL = "social"; public static final String TABLE_SOCIAL_OK = "social_ok"; public static final String TABLE_SOCIAL_FB = "social_fb"; public static final String TABLE_SOCIAL_VK = "social_vk"; public static final String TABLE_SOCIAL_INSTA = "social_insta"; public static final String TABLE_AWARDS = "personAwards"; public static final String TABLE_FIRE_BASE = "fire_base"; public static final String TABLE_GIFTS_BASE = "gifts_base"; public static final String TABLE_NOTIFICATIONS = "notifications"; public static final String TABLE_TEMPLATES_BASE = "templates_base"; public static final String TABLE_PHOTOS = "photos"; public static final String TABLE_AVATARS = "avatars"; public static final String TABLE_DIALOGS = "dialogs_base"; public static final String TABLE_MESSAGES = "messages"; public static final String TABLE_FILTER = "filter"; public static final String TABLE_CONFIGURATIONS = "configurations"; public static final String TABLE_LANGUAGES = "languages"; private static final int DATABASE_VERSION = 2; // In case of any changes in database structure this variable should be incremented private static final String DATABASE_LAST_USER_CREATE_SCRIPT = "CREATE TABLE IF NOT EXISTS " + TABLE_LAST_ID + " (" + Fields.ID + " integer)"; private static final String DATABASE_FIREBASE_TOKEN_CREATE_SCRIPT = "CREATE TABLE IF NOT EXISTS " + TABLE_FIRE_BASE + " (" + Fields.FIRE_BASE_TOKEN + " text)"; private static final String DATABASE_CREATE_SCRIPT = "CREATE TABLE IF NOT EXISTS " + TABLE_OWNER + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.ID + " integer, " + Fields.NAME + " text not null, " + Fields.AGE + " integer, " + Fields.WORK + " text, " + Fields.EDUCATION + " text, " + Fields.VIP + " integer, " + Fields.CURRENT_LOCATION + " text, " + Fields.SCORE + " integer, " + Fields.ABOUT + " text, " + Fields.HERE_TO + " text, " + Fields.IS_MALE + " integer, " + Fields.RELATIONSHIP + " text, " + Fields.KIDS + " integer, " + Fields.CREDITS + " integer, " + Fields.POPULARITY + " integer, " + Fields.SUPERPOWER + " integer, " + Fields.DRINKING + " text, " + Fields.SMOKING + " text, " + Fields.SEXUALITY + " integer," + Fields.BIRTH_DAY + " int8, " + Fields.BODY_TYPE + " integer, " + Fields.EYE_COLOR + " integer, " + Fields.HAIR_COLOR + " integer, " + Fields.LIVING_CITY + " text, " + Fields.LIVING_WITH + " integer, " + Fields.SEARCH_AGE_MAX + " integer, " + Fields.SEARCH_AGE_MIN + " integer," + Fields.FRIENDS + " text, " + Fields.AWARDS + " text, " + /* Fields.LINKEDIN_ACCOUNT + " text, " + Fields.Gplus_ACCOUNT + " text, " + Fields.FACEBOOK_ACCOUNT + " text, " + Fields.VKONTAKTE_ACCOUNT + " text, " + Fields.TWITTER_ACCOUNT + " text, " + Fields.ODNOCLASSNIKI_ACCOUNT + " text, " + Fields.INSTAGRAM_ACCOUNT + " text, " +*/ Fields.GROWTH + " integer, " + Fields.WEIGHT + " integer, " + Fields.INTEREST_GENDER + " integer, " + Fields.ORIENTATION + " integer, " + Fields.EMAIL + " email, " + Fields.PASSWORD + " text)"; private static final String CREATE_TABLE_INTEREST = "CREATE TABLE IF NOT EXISTS " + TABLE_INTEREST + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.ID + " integer, " + Fields.CATEGORY + " integer, " + Fields.INTERESTS + " text)"; private static final String CREATE_TABLE_GIFTS = "CREATE TABLE IF NOT EXISTS " + TABLE_GIFTS_BASE + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.PHOTO + " text, " + Fields.ID + " integer, " + Fields.NAME + " text, " + Fields.PRICE + " integer)"; private static final String CREATE_TABLE_TEMPLATES = "CREATE TABLE IF NOT EXISTS " + TABLE_TEMPLATES_BASE + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.PHOTO + " text, " + Fields.ID + " integer)"; private static final String CREATE_TABLE_AVATARS = "CREATE TABLE IF NOT EXISTS " + TABLE_AVATARS + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.URLS + " text, " + Fields.ID + " integer)"; private static final String CREATE_FILTER_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_AVATARS + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.SEARCH_AGE_MIN + " integer, " + Fields.SEARCH_AGE_MAX + " integer, " + Fields.HERE_TO + " integer, " + Fields.STATUS + " integer, " + Fields.INTEREST_GENDER + " integer)"; private static final String CREATE_TABLE_MESSAGES = "CREATE TABLE IF NOT EXISTS " + TABLE_MESSAGES + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.MESSAGES + " text, " + Fields.SEARCH_AGE_MAX + " integer, " + Fields.HERE_TO + " integer, " + Fields.STATUS + " integer, " + Fields.INTEREST_GENDER + " integer)"; private static final String CREATE_TABLE_DIALOGS = "CREATE TABLE IF NOT EXISTS " + TABLE_DIALOGS + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.DIALOG_ID + " integer, " + Fields.PROFILE_ID_2 + " integer, " + Fields.LAST_MESSAGE + " text, " + Fields.LAST_MESSAGE_AT + " text, " + Fields.UNREAD_COUNT + " integer, " + Fields.NAME + " text)"; private static final String CREATE_TABLE_NOTIFICATIONS = "CREATE TABLE IF NOT EXISTS " + TABLE_NOTIFICATIONS + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.ID + " integer, " + Fields.MESSAGES + " text, " + Fields.MUT_LIKES + " text, " + Fields.THEIR_LIKES + " text, " + Fields.NEARBY + " text, " + Fields.VISITORS + " text, " + Fields.FAVORITES + " text, " + Fields.GIFTS + " text, " + Fields.OTHER + " text)"; private static final String CREATE_TABLE_CONFIGURATIONS = "CREATE TABLE IF NOT EXISTS " + TABLE_CONFIGURATIONS + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.ID + " integer, " + Fields.SHOW_DISTANCE + " integer, " + Fields.HIDE_ONLINE_STATUS + " integer, " + Fields.PUBLIC_SEARCH + " integer, " + Fields.LIMIT_PROFILE + " integer, " + Fields.SHARE_PROFILE + " integer, " + Fields.FIND_BY_EMAIL + " integer, " + Fields.HALF_INVISIBLE + " integer, " + Fields.INVISBLE_HEAT + " integer, " + Fields.HIDE_VIP_STATUS + " integer, " + Fields.LIMIT_MESSAGES + " integer, " + Fields.SHOW_NEARBY + " integer, " + Fields.HIDE_MY_VERIFICATIONS + " integer, " + Fields.HIDE_PROFILE_AS_DELETED + " integer)"; private static final String CREATE_TABLE_SOCIAL_FB = "CREATE TABLE IF NOT EXISTS " + TABLE_SOCIAL_FB + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.SOCIAL_ID + " text, " + Fields.SOCIAL_PROFILE_IMAGE + " text, " + Fields.SOCIAL_PROFILE_FIRST_NAME + " text, " + Fields.SOCIAL_PROFILE_MIDDLE_NAME + " text, " + Fields.SOCIAL_PROFILE_LAST_NAME + " text, " + Fields.ID + " text)"; private static final String CREATE_TABLE_SOCIAL = "CREATE TABLE IF NOT EXISTS " + TABLE_SOCIAL + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.SOCIAL_ID + " text, " + Fields.SOCIAL_PROFILE_IMAGE + " text, " + Fields.SOCIAL_NETWORK + " text, " + Fields.SOCIAL_PROFILE_FIRST_NAME + " text, " + Fields.SOCIAL_PROFILE_MIDDLE_NAME+ " text, " + Fields.SOCIAL_PROFILE_LAST_NAME + " text)"; private static final String CREATE_TABLE_SOCIAL_VK = "CREATE TABLE IF NOT EXISTS " + TABLE_SOCIAL_VK + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.SOCIAL_ID + " text, " + Fields.SOCIAL_PROFILE_IMAGE + " text, " + Fields.SOCIAL_PROFILE_FIRST_NAME + " text, " + Fields.SOCIAL_PROFILE_MIDDLE_NAME + " text, " + Fields.SOCIAL_PROFILE_LAST_NAME + " text, " + Fields.ID + " text)"; private static final String CREATE_TABLE_SOCIAL_OK = "CREATE TABLE IF NOT EXISTS " + TABLE_SOCIAL_OK + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.SOCIAL_ID + " text, " + Fields.SOCIAL_PROFILE_IMAGE + " text, " + Fields.SOCIAL_PROFILE_FIRST_NAME + " text, " + Fields.SOCIAL_PROFILE_MIDDLE_NAME + " text, " + Fields.SOCIAL_PROFILE_LAST_NAME + " text, " + Fields.ID + " text)"; private static final String CREATE_TABLE_SOCIAL_INSTA = "CREATE TABLE IF NOT EXISTS " + TABLE_SOCIAL_INSTA + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.SOCIAL_ID + " text, " + Fields.SOCIAL_PROFILE_IMAGE + " text, " + Fields.SOCIAL_PROFILE_FIRST_NAME + " text, " + Fields.SOCIAL_PROFILE_MIDDLE_NAME + " text, " + Fields.SOCIAL_PROFILE_LAST_NAME + " text, " + Fields.ID + " text)"; /*private static final String CREATE_TABLE_SOCIAL_USER = "CREATE TABLE IF NOT EXISTS " + TABLE_SOCIAL + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.SOCIAL_ID + " text, " + Fields.SOCIAL_PROFILE_IMAGE + " text, " + Fields.SOCIAL_PROFILE_FIRST_NAME + " text, " + Fields.SOCIAL_PROFILE_MIDDLE_NAME + " text, " + Fields.SOCIAL_PROFILE_LAST_NAME + " text, " + Fields.ID + " text)";*/ private static final String CREATE_TABLE_AWARDS = "CREATE TABLE IF NOT EXISTS " + TABLE_AWARDS + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.ID + " integer, " + Fields.AWARDS + " text)"; private static final String CREATE_TABLE_PHOTOS = "CREATE TABLE IF NOT EXISTS " + TABLE_PHOTOS + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.PROFILE_ID_2 + " integer, " + Fields.PHOTO + " text, " + Fields.QUALITY + " text, " + Fields.URLS + " text, " + Fields.IS_PRIVATE + " integer, " + Fields.ID + " integer, " + Fields.IS_AUTO_PRICE + " integer, " + Fields.PRICE + " integer, " + Fields.TOTAL_PROFIT + " integer, " + Fields.TOTAL_VIEWS + " integer, " + Fields.IS_UNLOCKED + " integer, " + Fields.TEMPLATE_IDS + " text)"; private static final String CREATE_TABLE_LANGUAGES = "CREATE TABLE IF NOT EXISTS " + TABLE_LANGUAGES + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.ID + " integer, " + Fields.NAME + " text)"; public SQLiteEngine(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { Log.v("SQLite", "onCreate"); try { db.execSQL(DATABASE_CREATE_SCRIPT); db.execSQL(DATABASE_LAST_USER_CREATE_SCRIPT); db.execSQL(CREATE_TABLE_SOCIAL_OK); db.execSQL(CREATE_TABLE_SOCIAL_VK); db.execSQL(CREATE_TABLE_SOCIAL_FB); db.execSQL(CREATE_TABLE_SOCIAL_INSTA); db.execSQL(DATABASE_FIREBASE_TOKEN_CREATE_SCRIPT); db.execSQL(CREATE_TABLE_GIFTS); db.execSQL(CREATE_TABLE_TEMPLATES); db.execSQL(CREATE_TABLE_PHOTOS); db.execSQL(CREATE_TABLE_AVATARS); db.execSQL(CREATE_TABLE_DIALOGS); db.execSQL(CREATE_FILTER_TABLE); db.execSQL(CREATE_TABLE_LANGUAGES); db.execSQL(CREATE_TABLE_SOCIAL); db.execSQL(CREATE_TABLE_CONFIGURATIONS); db.execSQL(CREATE_TABLE_NOTIFICATIONS); db.execSQL(CREATE_TABLE_MESSAGES); this.addDefaultId(db); } catch (SQLException sqle) { sqle.printStackTrace(); } } public void addDefaultId(SQLiteDatabase db) { ContentValues values = new ContentValues(); values.put(Fields.ID, -1); db.insert(TABLE_LAST_ID, null, values); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Log.w("SQLite", "Update from version " + oldVersion + " to version " + newVersion); if(oldVersion == 1 && newVersion == 2){ db.execSQL(CREATE_TABLE_CONFIGURATIONS); } /*if(newVersion > oldVersion){ db.execSQL("DROP TABLE IF EXISTS " + DATABASE_CREATE_SCRIPT); db.execSQL("DROP TABLE IF EXISTS " + DATABASE_LAST_USER_CREATE_SCRIPT); db.execSQL("DROP TABLE IF EXISTS " + CREATE_TABLE_SOCIAL_OK); db.execSQL("DROP TABLE IF EXISTS " + CREATE_TABLE_SOCIAL_VK); db.execSQL("DROP TABLE IF EXISTS " + CREATE_TABLE_SOCIAL_FB); db.execSQL("DROP TABLE IF EXISTS " + CREATE_TABLE_SOCIAL_INSTA); //db.execSQL("DROP TABLE IF EXISTS " + DATABASE_FIREBASE_TOKEN_CREATE_SCRIPT); }*/ // //TODO: Copy data to new table code onCreate(db); } public ArrayList<Cursor> getData(String Query) { //get writable database SQLiteDatabase sqlDB = this.getWritableDatabase(); String[] columns = new String[]{"mesage"}; //an array list of cursor to save two cursors one has results from the query //other cursor stores error message if any errors are triggered ArrayList<Cursor> alc = new ArrayList<Cursor>(2); MatrixCursor Cursor2 = new MatrixCursor(columns); alc.add(null); alc.add(null); try { String maxQuery = Query; //execute the query results will be save in Cursor c Cursor c = sqlDB.rawQuery(maxQuery, null); //add value to cursor2 Cursor2.addRow(new Object[]{"Success"}); alc.set(1, Cursor2); if (null != c && c.getCount() > 0) { alc.set(0, c); c.moveToFirst(); return alc; } return alc; } catch (SQLException sqlEx) { Log.d("printing exception", sqlEx.getMessage()); //if any exceptions are triggered save the error message to cursor an return the arraylist Cursor2.addRow(new Object[]{"" + sqlEx.getMessage()}); alc.set(1, Cursor2); return alc; } catch (Exception ex) { Log.d("printing exception", ex.getMessage()); //if any exceptions are triggered save the error message to cursor an return the arraylist Cursor2.addRow(new Object[]{"" + ex.getMessage()}); alc.set(1, Cursor2); return alc; } } }
UTF-8
Java
16,724
java
SQLiteEngine.java
Java
[ { "context": "g;\n\nimport java.util.ArrayList;\n\n/**\n * Created by irondev on 07.06.16.\n */\npublic class SQLiteEngine extend", "end": 422, "score": 0.9996204972267151, "start": 415, "tag": "USERNAME", "value": "irondev" } ]
null
[]
package com.menemi.dbfactory; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.MatrixCursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.provider.BaseColumns; import android.util.Log; import java.util.ArrayList; /** * Created by irondev on 07.06.16. */ public class SQLiteEngine extends SQLiteOpenHelper implements BaseColumns { public static final String DATABASE_NAME = "menime1.db"; public static final String TABLE_OWNER = "profiles"; public static final String TABLE_LAST_ID = "last_id"; public static final String TABLE_INTEREST = "personInterests"; public static final String TABLE_SOCIAL = "social"; public static final String TABLE_SOCIAL_OK = "social_ok"; public static final String TABLE_SOCIAL_FB = "social_fb"; public static final String TABLE_SOCIAL_VK = "social_vk"; public static final String TABLE_SOCIAL_INSTA = "social_insta"; public static final String TABLE_AWARDS = "personAwards"; public static final String TABLE_FIRE_BASE = "fire_base"; public static final String TABLE_GIFTS_BASE = "gifts_base"; public static final String TABLE_NOTIFICATIONS = "notifications"; public static final String TABLE_TEMPLATES_BASE = "templates_base"; public static final String TABLE_PHOTOS = "photos"; public static final String TABLE_AVATARS = "avatars"; public static final String TABLE_DIALOGS = "dialogs_base"; public static final String TABLE_MESSAGES = "messages"; public static final String TABLE_FILTER = "filter"; public static final String TABLE_CONFIGURATIONS = "configurations"; public static final String TABLE_LANGUAGES = "languages"; private static final int DATABASE_VERSION = 2; // In case of any changes in database structure this variable should be incremented private static final String DATABASE_LAST_USER_CREATE_SCRIPT = "CREATE TABLE IF NOT EXISTS " + TABLE_LAST_ID + " (" + Fields.ID + " integer)"; private static final String DATABASE_FIREBASE_TOKEN_CREATE_SCRIPT = "CREATE TABLE IF NOT EXISTS " + TABLE_FIRE_BASE + " (" + Fields.FIRE_BASE_TOKEN + " text)"; private static final String DATABASE_CREATE_SCRIPT = "CREATE TABLE IF NOT EXISTS " + TABLE_OWNER + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.ID + " integer, " + Fields.NAME + " text not null, " + Fields.AGE + " integer, " + Fields.WORK + " text, " + Fields.EDUCATION + " text, " + Fields.VIP + " integer, " + Fields.CURRENT_LOCATION + " text, " + Fields.SCORE + " integer, " + Fields.ABOUT + " text, " + Fields.HERE_TO + " text, " + Fields.IS_MALE + " integer, " + Fields.RELATIONSHIP + " text, " + Fields.KIDS + " integer, " + Fields.CREDITS + " integer, " + Fields.POPULARITY + " integer, " + Fields.SUPERPOWER + " integer, " + Fields.DRINKING + " text, " + Fields.SMOKING + " text, " + Fields.SEXUALITY + " integer," + Fields.BIRTH_DAY + " int8, " + Fields.BODY_TYPE + " integer, " + Fields.EYE_COLOR + " integer, " + Fields.HAIR_COLOR + " integer, " + Fields.LIVING_CITY + " text, " + Fields.LIVING_WITH + " integer, " + Fields.SEARCH_AGE_MAX + " integer, " + Fields.SEARCH_AGE_MIN + " integer," + Fields.FRIENDS + " text, " + Fields.AWARDS + " text, " + /* Fields.LINKEDIN_ACCOUNT + " text, " + Fields.Gplus_ACCOUNT + " text, " + Fields.FACEBOOK_ACCOUNT + " text, " + Fields.VKONTAKTE_ACCOUNT + " text, " + Fields.TWITTER_ACCOUNT + " text, " + Fields.ODNOCLASSNIKI_ACCOUNT + " text, " + Fields.INSTAGRAM_ACCOUNT + " text, " +*/ Fields.GROWTH + " integer, " + Fields.WEIGHT + " integer, " + Fields.INTEREST_GENDER + " integer, " + Fields.ORIENTATION + " integer, " + Fields.EMAIL + " email, " + Fields.PASSWORD + " text)"; private static final String CREATE_TABLE_INTEREST = "CREATE TABLE IF NOT EXISTS " + TABLE_INTEREST + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.ID + " integer, " + Fields.CATEGORY + " integer, " + Fields.INTERESTS + " text)"; private static final String CREATE_TABLE_GIFTS = "CREATE TABLE IF NOT EXISTS " + TABLE_GIFTS_BASE + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.PHOTO + " text, " + Fields.ID + " integer, " + Fields.NAME + " text, " + Fields.PRICE + " integer)"; private static final String CREATE_TABLE_TEMPLATES = "CREATE TABLE IF NOT EXISTS " + TABLE_TEMPLATES_BASE + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.PHOTO + " text, " + Fields.ID + " integer)"; private static final String CREATE_TABLE_AVATARS = "CREATE TABLE IF NOT EXISTS " + TABLE_AVATARS + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.URLS + " text, " + Fields.ID + " integer)"; private static final String CREATE_FILTER_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_AVATARS + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.SEARCH_AGE_MIN + " integer, " + Fields.SEARCH_AGE_MAX + " integer, " + Fields.HERE_TO + " integer, " + Fields.STATUS + " integer, " + Fields.INTEREST_GENDER + " integer)"; private static final String CREATE_TABLE_MESSAGES = "CREATE TABLE IF NOT EXISTS " + TABLE_MESSAGES + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.MESSAGES + " text, " + Fields.SEARCH_AGE_MAX + " integer, " + Fields.HERE_TO + " integer, " + Fields.STATUS + " integer, " + Fields.INTEREST_GENDER + " integer)"; private static final String CREATE_TABLE_DIALOGS = "CREATE TABLE IF NOT EXISTS " + TABLE_DIALOGS + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.DIALOG_ID + " integer, " + Fields.PROFILE_ID_2 + " integer, " + Fields.LAST_MESSAGE + " text, " + Fields.LAST_MESSAGE_AT + " text, " + Fields.UNREAD_COUNT + " integer, " + Fields.NAME + " text)"; private static final String CREATE_TABLE_NOTIFICATIONS = "CREATE TABLE IF NOT EXISTS " + TABLE_NOTIFICATIONS + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.ID + " integer, " + Fields.MESSAGES + " text, " + Fields.MUT_LIKES + " text, " + Fields.THEIR_LIKES + " text, " + Fields.NEARBY + " text, " + Fields.VISITORS + " text, " + Fields.FAVORITES + " text, " + Fields.GIFTS + " text, " + Fields.OTHER + " text)"; private static final String CREATE_TABLE_CONFIGURATIONS = "CREATE TABLE IF NOT EXISTS " + TABLE_CONFIGURATIONS + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.ID + " integer, " + Fields.SHOW_DISTANCE + " integer, " + Fields.HIDE_ONLINE_STATUS + " integer, " + Fields.PUBLIC_SEARCH + " integer, " + Fields.LIMIT_PROFILE + " integer, " + Fields.SHARE_PROFILE + " integer, " + Fields.FIND_BY_EMAIL + " integer, " + Fields.HALF_INVISIBLE + " integer, " + Fields.INVISBLE_HEAT + " integer, " + Fields.HIDE_VIP_STATUS + " integer, " + Fields.LIMIT_MESSAGES + " integer, " + Fields.SHOW_NEARBY + " integer, " + Fields.HIDE_MY_VERIFICATIONS + " integer, " + Fields.HIDE_PROFILE_AS_DELETED + " integer)"; private static final String CREATE_TABLE_SOCIAL_FB = "CREATE TABLE IF NOT EXISTS " + TABLE_SOCIAL_FB + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.SOCIAL_ID + " text, " + Fields.SOCIAL_PROFILE_IMAGE + " text, " + Fields.SOCIAL_PROFILE_FIRST_NAME + " text, " + Fields.SOCIAL_PROFILE_MIDDLE_NAME + " text, " + Fields.SOCIAL_PROFILE_LAST_NAME + " text, " + Fields.ID + " text)"; private static final String CREATE_TABLE_SOCIAL = "CREATE TABLE IF NOT EXISTS " + TABLE_SOCIAL + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.SOCIAL_ID + " text, " + Fields.SOCIAL_PROFILE_IMAGE + " text, " + Fields.SOCIAL_NETWORK + " text, " + Fields.SOCIAL_PROFILE_FIRST_NAME + " text, " + Fields.SOCIAL_PROFILE_MIDDLE_NAME+ " text, " + Fields.SOCIAL_PROFILE_LAST_NAME + " text)"; private static final String CREATE_TABLE_SOCIAL_VK = "CREATE TABLE IF NOT EXISTS " + TABLE_SOCIAL_VK + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.SOCIAL_ID + " text, " + Fields.SOCIAL_PROFILE_IMAGE + " text, " + Fields.SOCIAL_PROFILE_FIRST_NAME + " text, " + Fields.SOCIAL_PROFILE_MIDDLE_NAME + " text, " + Fields.SOCIAL_PROFILE_LAST_NAME + " text, " + Fields.ID + " text)"; private static final String CREATE_TABLE_SOCIAL_OK = "CREATE TABLE IF NOT EXISTS " + TABLE_SOCIAL_OK + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.SOCIAL_ID + " text, " + Fields.SOCIAL_PROFILE_IMAGE + " text, " + Fields.SOCIAL_PROFILE_FIRST_NAME + " text, " + Fields.SOCIAL_PROFILE_MIDDLE_NAME + " text, " + Fields.SOCIAL_PROFILE_LAST_NAME + " text, " + Fields.ID + " text)"; private static final String CREATE_TABLE_SOCIAL_INSTA = "CREATE TABLE IF NOT EXISTS " + TABLE_SOCIAL_INSTA + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.SOCIAL_ID + " text, " + Fields.SOCIAL_PROFILE_IMAGE + " text, " + Fields.SOCIAL_PROFILE_FIRST_NAME + " text, " + Fields.SOCIAL_PROFILE_MIDDLE_NAME + " text, " + Fields.SOCIAL_PROFILE_LAST_NAME + " text, " + Fields.ID + " text)"; /*private static final String CREATE_TABLE_SOCIAL_USER = "CREATE TABLE IF NOT EXISTS " + TABLE_SOCIAL + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.SOCIAL_ID + " text, " + Fields.SOCIAL_PROFILE_IMAGE + " text, " + Fields.SOCIAL_PROFILE_FIRST_NAME + " text, " + Fields.SOCIAL_PROFILE_MIDDLE_NAME + " text, " + Fields.SOCIAL_PROFILE_LAST_NAME + " text, " + Fields.ID + " text)";*/ private static final String CREATE_TABLE_AWARDS = "CREATE TABLE IF NOT EXISTS " + TABLE_AWARDS + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.ID + " integer, " + Fields.AWARDS + " text)"; private static final String CREATE_TABLE_PHOTOS = "CREATE TABLE IF NOT EXISTS " + TABLE_PHOTOS + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.PROFILE_ID_2 + " integer, " + Fields.PHOTO + " text, " + Fields.QUALITY + " text, " + Fields.URLS + " text, " + Fields.IS_PRIVATE + " integer, " + Fields.ID + " integer, " + Fields.IS_AUTO_PRICE + " integer, " + Fields.PRICE + " integer, " + Fields.TOTAL_PROFIT + " integer, " + Fields.TOTAL_VIEWS + " integer, " + Fields.IS_UNLOCKED + " integer, " + Fields.TEMPLATE_IDS + " text)"; private static final String CREATE_TABLE_LANGUAGES = "CREATE TABLE IF NOT EXISTS " + TABLE_LANGUAGES + " (" + BaseColumns._ID + " integer primary key autoincrement, " + Fields.ID + " integer, " + Fields.NAME + " text)"; public SQLiteEngine(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { Log.v("SQLite", "onCreate"); try { db.execSQL(DATABASE_CREATE_SCRIPT); db.execSQL(DATABASE_LAST_USER_CREATE_SCRIPT); db.execSQL(CREATE_TABLE_SOCIAL_OK); db.execSQL(CREATE_TABLE_SOCIAL_VK); db.execSQL(CREATE_TABLE_SOCIAL_FB); db.execSQL(CREATE_TABLE_SOCIAL_INSTA); db.execSQL(DATABASE_FIREBASE_TOKEN_CREATE_SCRIPT); db.execSQL(CREATE_TABLE_GIFTS); db.execSQL(CREATE_TABLE_TEMPLATES); db.execSQL(CREATE_TABLE_PHOTOS); db.execSQL(CREATE_TABLE_AVATARS); db.execSQL(CREATE_TABLE_DIALOGS); db.execSQL(CREATE_FILTER_TABLE); db.execSQL(CREATE_TABLE_LANGUAGES); db.execSQL(CREATE_TABLE_SOCIAL); db.execSQL(CREATE_TABLE_CONFIGURATIONS); db.execSQL(CREATE_TABLE_NOTIFICATIONS); db.execSQL(CREATE_TABLE_MESSAGES); this.addDefaultId(db); } catch (SQLException sqle) { sqle.printStackTrace(); } } public void addDefaultId(SQLiteDatabase db) { ContentValues values = new ContentValues(); values.put(Fields.ID, -1); db.insert(TABLE_LAST_ID, null, values); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Log.w("SQLite", "Update from version " + oldVersion + " to version " + newVersion); if(oldVersion == 1 && newVersion == 2){ db.execSQL(CREATE_TABLE_CONFIGURATIONS); } /*if(newVersion > oldVersion){ db.execSQL("DROP TABLE IF EXISTS " + DATABASE_CREATE_SCRIPT); db.execSQL("DROP TABLE IF EXISTS " + DATABASE_LAST_USER_CREATE_SCRIPT); db.execSQL("DROP TABLE IF EXISTS " + CREATE_TABLE_SOCIAL_OK); db.execSQL("DROP TABLE IF EXISTS " + CREATE_TABLE_SOCIAL_VK); db.execSQL("DROP TABLE IF EXISTS " + CREATE_TABLE_SOCIAL_FB); db.execSQL("DROP TABLE IF EXISTS " + CREATE_TABLE_SOCIAL_INSTA); //db.execSQL("DROP TABLE IF EXISTS " + DATABASE_FIREBASE_TOKEN_CREATE_SCRIPT); }*/ // //TODO: Copy data to new table code onCreate(db); } public ArrayList<Cursor> getData(String Query) { //get writable database SQLiteDatabase sqlDB = this.getWritableDatabase(); String[] columns = new String[]{"mesage"}; //an array list of cursor to save two cursors one has results from the query //other cursor stores error message if any errors are triggered ArrayList<Cursor> alc = new ArrayList<Cursor>(2); MatrixCursor Cursor2 = new MatrixCursor(columns); alc.add(null); alc.add(null); try { String maxQuery = Query; //execute the query results will be save in Cursor c Cursor c = sqlDB.rawQuery(maxQuery, null); //add value to cursor2 Cursor2.addRow(new Object[]{"Success"}); alc.set(1, Cursor2); if (null != c && c.getCount() > 0) { alc.set(0, c); c.moveToFirst(); return alc; } return alc; } catch (SQLException sqlEx) { Log.d("printing exception", sqlEx.getMessage()); //if any exceptions are triggered save the error message to cursor an return the arraylist Cursor2.addRow(new Object[]{"" + sqlEx.getMessage()}); alc.set(1, Cursor2); return alc; } catch (Exception ex) { Log.d("printing exception", ex.getMessage()); //if any exceptions are triggered save the error message to cursor an return the arraylist Cursor2.addRow(new Object[]{"" + ex.getMessage()}); alc.set(1, Cursor2); return alc; } } }
16,724
0.568345
0.566671
383
42.665798
23.777868
134
false
false
0
0
0
0
0
0
0.710183
false
false
14
b13d25c5cea713437ec51926a3d8c72679945f2f
22,385,369,559,479
00a1f2a2ce0a76cba47e022c3975ed0eda89e5ef
/app/src/main/java/com/example/qqweq/mvpdemo/mvpview/NewHomeView.java
e973ef2b21fe6bd0f9354315685c687d1135da76
[]
no_license
AdomChenyuSong/MVPDemo
https://github.com/AdomChenyuSong/MVPDemo
a2ba7dd7dd7c766c7157471d1ec722edd03586e3
9df3378696ed4d2774514aa3c4d1518e80d5e844
refs/heads/master
2020-03-22T23:28:07.045000
2018-10-17T09:32:17
2018-10-17T09:32:17
140,812,148
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.qqweq.mvpdemo.mvpview; import com.example.qqweq.mvpdemo.bean.ObjectModel; import com.example.qqweq.mvpdemo.mvp.BaseView; import java.util.List; /** * Created by qqweq on 2018/9/29. */ public interface NewHomeView extends BaseView { void getObject(List<ObjectModel> objectModel); }
UTF-8
Java
310
java
NewHomeView.java
Java
[ { "context": "seView;\n\nimport java.util.List;\n\n/**\n * Created by qqweq on 2018/9/29.\n */\n\npublic interface NewHomeView e", "end": 190, "score": 0.9996970295906067, "start": 185, "tag": "USERNAME", "value": "qqweq" } ]
null
[]
package com.example.qqweq.mvpdemo.mvpview; import com.example.qqweq.mvpdemo.bean.ObjectModel; import com.example.qqweq.mvpdemo.mvp.BaseView; import java.util.List; /** * Created by qqweq on 2018/9/29. */ public interface NewHomeView extends BaseView { void getObject(List<ObjectModel> objectModel); }
310
0.770968
0.748387
14
21.142857
21.253092
50
false
false
0
0
0
0
0
0
0.357143
false
false
14
af62140d757f3594315bf6b744f6cc6cbcb25240
2,276,332,684,443
84e9bb41380231853948a8e6c7f62baa5bfa817a
/crawler1.0/src/main/java/crawlerApp/NaukriBot.java
443b11c3c580f1738b21ba463a7eeefd9fb847cc
[]
no_license
Ansh90/CrawlerTest
https://github.com/Ansh90/CrawlerTest
d72882ff8b4dedc018f34a91b01d8bcd4bbfcd95
1057830c8066760d1f130f5986c9e6ff2c609ad9
refs/heads/master
2020-07-03T22:10:55.166000
2016-11-20T08:17:44
2016-11-20T08:17:44
74,227,999
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package crawlerApp; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; public class NaukriBot { @SuppressWarnings("static-access") public static void run(WebDriver driver) { //login driver.get("https://login.naukri.com/nLogin/Login.php"); driver.findElement(By.tagName("input").id("emailTxt")).sendKeys("anshulmohil@hotmail.com");; WebElement pass = driver.findElement(By.tagName("input").id("pwd1")); pass.sendKeys("ankeyveera13"); pass.submit(); // updating profile driver.findElement(By.className("leftNavBullet")).findElement(By.tagName("a")).click(); driver.findElement(By.tagName("button")).click(); } }
UTF-8
Java
715
java
NaukriBot.java
Java
[ { "context": "ent(By.tagName(\"input\").id(\"emailTxt\")).sendKeys(\"anshulmohil@hotmail.com\");;\n\t\t\tWebElement pass = driver.findElement(By.ta", "end": 404, "score": 0.9998957514762878, "start": 381, "tag": "EMAIL", "value": "anshulmohil@hotmail.com" }, { "context": "gName(\"input\").id(\"pwd1\"));\n\t\t\t\n\t\t\tpass.sendKeys(\"ankeyveera13\");\n\t\t\tpass.submit();\n\t\t\t\n\t\t\t// updating profile\n\t", "end": 516, "score": 0.9880403876304626, "start": 504, "tag": "PASSWORD", "value": "ankeyveera13" } ]
null
[]
package crawlerApp; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; public class NaukriBot { @SuppressWarnings("static-access") public static void run(WebDriver driver) { //login driver.get("https://login.naukri.com/nLogin/Login.php"); driver.findElement(By.tagName("input").id("emailTxt")).sendKeys("<EMAIL>");; WebElement pass = driver.findElement(By.tagName("input").id("pwd1")); pass.sendKeys("<PASSWORD>"); pass.submit(); // updating profile driver.findElement(By.className("leftNavBullet")).findElement(By.tagName("a")).click(); driver.findElement(By.tagName("button")).click(); } }
697
0.713287
0.709091
27
25.481482
27.675863
95
false
false
0
0
0
0
0
0
1.888889
false
false
14
1330017a99b77f519fec8f5ff3381a386e31193d
16,973,710,754,161
c3b743226b27e5ed58268ddc4ac73ab25303a38d
/Assignments/FinishedProjects/GuessingGame.java
376a0d521143244d7afed00a81ecf96cf517a8e8
[]
no_license
Nanakul/nanas-work
https://github.com/Nanakul/nanas-work
b417244909e65e18544b88fb6c25553b70b8b3aa
f7f6cd365a4584dd9f620e80440b8d6b2dac8428
refs/heads/master
2020-12-23T20:37:10.976000
2020-03-07T01:32:31
2020-03-07T01:32:31
237,267,622
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; public class GuessingGame { public static void main(String[] args) { userPrompt(); playGame(); tryAgain(); } //This method prompts the user to think of a number. public static void userPrompt() { //Prompt the user to think of a number System.out.println("I'm thinking of a number between 1 and 100. Can you guess it in less than 5 tries?"); } //This method starts the game. public static void playGame() { //Import the scanner Scanner console = new Scanner(System.in); //Set Parameters int attemptsNum = 0; final int maxAttempts = 5; int random = 1 + (int) (Math.random() * 99); int guess = 0; //Write a while statement that says "while guess DOES NOT = the random parameter AND //the number of attempts parameter is less than the max attempts parameter. while(guess != random && attemptsNum < maxAttempts) { guess = console.nextInt(); attemptsNum++; //Write an IF statement for the following scenarios: //1.)If guess is greater than random, print guess lower. //2.)If guess is less than random, print guess higher. //3.)Else You won in X amount of tries! if(guess > random) { System.out.println("Gotta think lower!"); } else if (guess < random) { System.out.println("Gotta think higher!"); } else { System.out.println("Congratulations, you win! It took you " + attemptsNum + " attempt(s)"); } } //Write an IF statement that says if their number of attempts is //equal to the max number of tries, they lose automatically and the //random number is printed. if (attemptsNum == maxAttempts) System.out.println("You lose! The number was: " + random); } //This method allows the user to try again public static void tryAgain() { //Set parameters Scanner console = new Scanner(System.in); String playAgain; boolean yn; System.out.println("Would you like to play again? Y/N?"); //Write a while statement that allows the user to choose whether or //not they want to play again. while(true) { playAgain = console.nextLine().trim().toLowerCase(); //trim gets rid of excess whitespace. and using toLowerCase will always convert their answer to one that isn't case sensitive. if(playAgain.equals("y")) { yn = true; break; //Using break to jump out of loop if it meets a requirement. } else if(playAgain.equals("n")) { yn = false; break; //Using break to jump out of loop if it meets a requirement. } else { System.out.println("Sorry, I didn't catch that. Please answer y/n"); } } //Write an IF statement that says if boolean variable yn is true, restart all methods. //IF false, then byebye xD if(yn) { userPrompt(); playGame(); tryAgain(); } else { System.out.println("Thanks for playing!"); } } }
UTF-8
Java
2,969
java
GuessingGame.java
Java
[]
null
[]
import java.util.Scanner; public class GuessingGame { public static void main(String[] args) { userPrompt(); playGame(); tryAgain(); } //This method prompts the user to think of a number. public static void userPrompt() { //Prompt the user to think of a number System.out.println("I'm thinking of a number between 1 and 100. Can you guess it in less than 5 tries?"); } //This method starts the game. public static void playGame() { //Import the scanner Scanner console = new Scanner(System.in); //Set Parameters int attemptsNum = 0; final int maxAttempts = 5; int random = 1 + (int) (Math.random() * 99); int guess = 0; //Write a while statement that says "while guess DOES NOT = the random parameter AND //the number of attempts parameter is less than the max attempts parameter. while(guess != random && attemptsNum < maxAttempts) { guess = console.nextInt(); attemptsNum++; //Write an IF statement for the following scenarios: //1.)If guess is greater than random, print guess lower. //2.)If guess is less than random, print guess higher. //3.)Else You won in X amount of tries! if(guess > random) { System.out.println("Gotta think lower!"); } else if (guess < random) { System.out.println("Gotta think higher!"); } else { System.out.println("Congratulations, you win! It took you " + attemptsNum + " attempt(s)"); } } //Write an IF statement that says if their number of attempts is //equal to the max number of tries, they lose automatically and the //random number is printed. if (attemptsNum == maxAttempts) System.out.println("You lose! The number was: " + random); } //This method allows the user to try again public static void tryAgain() { //Set parameters Scanner console = new Scanner(System.in); String playAgain; boolean yn; System.out.println("Would you like to play again? Y/N?"); //Write a while statement that allows the user to choose whether or //not they want to play again. while(true) { playAgain = console.nextLine().trim().toLowerCase(); //trim gets rid of excess whitespace. and using toLowerCase will always convert their answer to one that isn't case sensitive. if(playAgain.equals("y")) { yn = true; break; //Using break to jump out of loop if it meets a requirement. } else if(playAgain.equals("n")) { yn = false; break; //Using break to jump out of loop if it meets a requirement. } else { System.out.println("Sorry, I didn't catch that. Please answer y/n"); } } //Write an IF statement that says if boolean variable yn is true, restart all methods. //IF false, then byebye xD if(yn) { userPrompt(); playGame(); tryAgain(); } else { System.out.println("Thanks for playing!"); } } }
2,969
0.640957
0.636241
91
31.626373
30.881073
185
false
false
0
0
0
0
0
0
0.406593
false
false
14
dd38db9ad04525c4e56f928d31fa8af96c4e9cc7
9,294,309,246,778
6aae2e4d13b49185c27b7fed83bf7baa9f3119de
/mapmaker/MapmakerInterface.java
e34e10de0a4403d71d3329d461fca652d624232c
[]
no_license
ffleader1/Doge-Java
https://github.com/ffleader1/Doge-Java
6d0c72d83cdc02854cc1d8b1d109f3bf568829ce
ae97e91e5fa03b8eedd189325560f12af9d545bb
refs/heads/master
2021-01-20T13:37:26.816000
2017-05-07T03:55:50
2017-05-07T03:55:50
90,507,278
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.thecherno.flappy.mapmaker; import com.thecherno.flappy.graphics.Shader; import com.thecherno.flappy.graphics.Texture; import com.thecherno.flappy.graphics.VertexArray; import com.thecherno.flappy.math.Matrix4f; import com.thecherno.flappy.math.Vector3f; /** * package com.thecherno.flappy.ingame; * <p> * import com.thecherno.flappy.graphics.Shader; * import com.thecherno.flappy.graphics.Texture; * import com.thecherno.flappy.graphics.VertexArray; * import com.thecherno.flappy.input.Input; * import com.thecherno.flappy.math.Matrix4f; * import com.thecherno.flappy.math.Vector3f; * import static com.thecherno.flappy.Main.*; * import java.util.Random; * <p> * import static com.thecherno.flappy.clicklocation.Checkoptionpos.checksquarepos; * import static com.thecherno.flappy.Customvar.*; * import static com.thecherno.flappy.utils.readfile.readcustomdata; * import static org.lwjgl.glfw.GLFW.GLFW_KEY_END; * import static org.lwjgl.glfw.GLFW.GLFW_KEY_ENTER; * import static org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE; * <p> * /** * Created by fflea_000 on 2/25/2017. */ public class MapmakerInterface { private VertexArray mesh; private Texture texture; private float SIZE = 10.0f; private Vector3f position = new Vector3f(0, .0f, 0); public MapmakerInterface() { float[] vertices = new float[]{ -SIZE, -SIZE * 9 / 16f, 0.4f, -SIZE, SIZE * 9 / 16f, 0.4f, SIZE, SIZE * 9 / 16f, 0.4f, SIZE, -SIZE * 9 / 16f, 0.4f }; byte[] indices = new byte[]{ 0, 1, 2, 2, 3, 0 }; float[] tcs = new float[]{ 0, 1, 0, 0, 1, 0, 1, 1 }; mesh = new VertexArray(vertices, indices, tcs); texture = new Texture("res/RPG/Makefield/MakefieldBG.png"); } public void update() { } public void render() { Shader.BIRD.enable(); Shader.BIRD.setUniformMat4f("ml_matrix", Matrix4f.translate(position)); texture.bind(); mesh.render(); Shader.BIRD.disable(); } }
UTF-8
Java
2,262
java
MapmakerInterface.java
Java
[ { "context": "FW.GLFW_KEY_ESCAPE;\r\n * <p>\r\n * /**\r\n * Created by fflea_000 on 2/25/2017.\r\n */\r\npublic class MapmakerInterfac", "end": 1112, "score": 0.9995395541191101, "start": 1103, "tag": "USERNAME", "value": "fflea_000" } ]
null
[]
package com.thecherno.flappy.mapmaker; import com.thecherno.flappy.graphics.Shader; import com.thecherno.flappy.graphics.Texture; import com.thecherno.flappy.graphics.VertexArray; import com.thecherno.flappy.math.Matrix4f; import com.thecherno.flappy.math.Vector3f; /** * package com.thecherno.flappy.ingame; * <p> * import com.thecherno.flappy.graphics.Shader; * import com.thecherno.flappy.graphics.Texture; * import com.thecherno.flappy.graphics.VertexArray; * import com.thecherno.flappy.input.Input; * import com.thecherno.flappy.math.Matrix4f; * import com.thecherno.flappy.math.Vector3f; * import static com.thecherno.flappy.Main.*; * import java.util.Random; * <p> * import static com.thecherno.flappy.clicklocation.Checkoptionpos.checksquarepos; * import static com.thecherno.flappy.Customvar.*; * import static com.thecherno.flappy.utils.readfile.readcustomdata; * import static org.lwjgl.glfw.GLFW.GLFW_KEY_END; * import static org.lwjgl.glfw.GLFW.GLFW_KEY_ENTER; * import static org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE; * <p> * /** * Created by fflea_000 on 2/25/2017. */ public class MapmakerInterface { private VertexArray mesh; private Texture texture; private float SIZE = 10.0f; private Vector3f position = new Vector3f(0, .0f, 0); public MapmakerInterface() { float[] vertices = new float[]{ -SIZE, -SIZE * 9 / 16f, 0.4f, -SIZE, SIZE * 9 / 16f, 0.4f, SIZE, SIZE * 9 / 16f, 0.4f, SIZE, -SIZE * 9 / 16f, 0.4f }; byte[] indices = new byte[]{ 0, 1, 2, 2, 3, 0 }; float[] tcs = new float[]{ 0, 1, 0, 0, 1, 0, 1, 1 }; mesh = new VertexArray(vertices, indices, tcs); texture = new Texture("res/RPG/Makefield/MakefieldBG.png"); } public void update() { } public void render() { Shader.BIRD.enable(); Shader.BIRD.setUniformMat4f("ml_matrix", Matrix4f.translate(position)); texture.bind(); mesh.render(); Shader.BIRD.disable(); } }
2,262
0.600354
0.574713
82
25.585365
21.782154
82
false
false
0
0
0
0
0
0
0.768293
false
false
14
ecaee0c3e477977312a6818ca324634bb80911f3
19,550,691,149,908
5b22f970db7275b7b3285f67004fd23d126331c8
/base-component/cache/src/main/java/com/topweshare/cache/util/SpringCacheConstans.java
9d4119f0211eadc1ad8796b5fe43a183c48c9530
[ "Apache-2.0" ]
permissive
mongoding/spring-cloud-side
https://github.com/mongoding/spring-cloud-side
312b32937e334d85e9d2f096110e37ea4077a1c6
43563470febc5386fe097cecab605171777abd7b
refs/heads/master
2020-03-14T07:25:26.315000
2018-10-14T08:08:29
2018-10-14T08:08:29
131,504,626
3
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * */ package com.topweshare.cache.util; /** * @comment * * @author marke * * @time 2016年10月28日 下午5:50:02 * */ public class SpringCacheConstans { /** * spring cache的缓存类型,时间单位是秒 */ public static final String CACHE10 = "cache10"; public static final String CACHE30 = "cache30"; public static final String CACHE60 = "cache60"; public static final String CACHE180 = "cache180"; public static final String CACHE300 = "cache300"; public static final String CACHE600 = "cache600"; public static final String CACHE1800 = "cache1800"; }
UTF-8
Java
588
java
SpringCacheConstans.java
Java
[ { "context": "weshare.cache.util;\n\n/**\n * @comment\n *\n * @author marke\n *\n * @time 2016年10月28日 下午5:50:02\n *\n */\npublic c", "end": 83, "score": 0.9584853649139404, "start": 78, "tag": "USERNAME", "value": "marke" } ]
null
[]
/** * */ package com.topweshare.cache.util; /** * @comment * * @author marke * * @time 2016年10月28日 下午5:50:02 * */ public class SpringCacheConstans { /** * spring cache的缓存类型,时间单位是秒 */ public static final String CACHE10 = "cache10"; public static final String CACHE30 = "cache30"; public static final String CACHE60 = "cache60"; public static final String CACHE180 = "cache180"; public static final String CACHE300 = "cache300"; public static final String CACHE600 = "cache600"; public static final String CACHE1800 = "cache1800"; }
588
0.703971
0.611913
25
21.16
20.381718
52
true
false
0
0
0
0
0
0
0.72
false
false
14
f9811cf5ec2972b63c4ed21cb6a864251e59cfea
19,550,691,150,121
dbd52da2b23d58532bc7273ce4de47b7c0e7a823
/charter.system.portal/src/main/java/com/learnlogic/system/rental/model/SellerInfo.java
a3283653c917edffbff050cc8803642e6bcf716b
[]
no_license
jugalsshah/charter
https://github.com/jugalsshah/charter
506baf565ab3d5800b403ee8fd577a96bdd90ba8
e0e37e47a988b0f23d8bb7fe041fa72bfcae2f48
refs/heads/master
2020-05-20T01:59:26.714000
2015-07-18T07:55:08
2015-07-18T07:55:08
39,290,899
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.learnlogic.system.rental.model; // Generated Jul 11, 2015 5:51:02 PM by Hibernate Tools 4.0.0 import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; /** * SellerInfo generated by hbm2java */ @Entity @Table(name = "seller_info", catalog = "charter") public class SellerInfo implements java.io.Serializable { private long sellerId; private String sellerType; private String sellerEmail; private String sellerPhone; private String sellerReview; private String sellerFeedback; private Long sellerProductId; private String sellerLocation; private String sellerAddress; public SellerInfo() { } public SellerInfo(long sellerId) { this.sellerId = sellerId; } public SellerInfo(long sellerId, String sellerType, String sellerEmail, String sellerPhone, String sellerReview, String sellerFeedback, Long sellerProductId, String sellerLocation, String sellerAddress) { this.sellerId = sellerId; this.sellerType = sellerType; this.sellerEmail = sellerEmail; this.sellerPhone = sellerPhone; this.sellerReview = sellerReview; this.sellerFeedback = sellerFeedback; this.sellerProductId = sellerProductId; this.sellerLocation = sellerLocation; this.sellerAddress = sellerAddress; } @Id @Column(name = "seller_id", unique = true, nullable = false) public long getSellerId() { return this.sellerId; } public void setSellerId(long sellerId) { this.sellerId = sellerId; } @Column(name = "seller_type", length = 45) public String getSellerType() { return this.sellerType; } public void setSellerType(String sellerType) { this.sellerType = sellerType; } @Column(name = "seller_email", length = 45) public String getSellerEmail() { return this.sellerEmail; } public void setSellerEmail(String sellerEmail) { this.sellerEmail = sellerEmail; } @Column(name = "seller_phone", length = 45) public String getSellerPhone() { return this.sellerPhone; } public void setSellerPhone(String sellerPhone) { this.sellerPhone = sellerPhone; } @Column(name = "seller_review", length = 250) public String getSellerReview() { return this.sellerReview; } public void setSellerReview(String sellerReview) { this.sellerReview = sellerReview; } @Column(name = "seller_feedback", length = 250) public String getSellerFeedback() { return this.sellerFeedback; } public void setSellerFeedback(String sellerFeedback) { this.sellerFeedback = sellerFeedback; } @Column(name = "seller_product_id") public Long getSellerProductId() { return this.sellerProductId; } public void setSellerProductId(Long sellerProductId) { this.sellerProductId = sellerProductId; } @Column(name = "seller_location", length = 45) public String getSellerLocation() { return this.sellerLocation; } public void setSellerLocation(String sellerLocation) { this.sellerLocation = sellerLocation; } @Column(name = "seller_address", length = 45) public String getSellerAddress() { return this.sellerAddress; } public void setSellerAddress(String sellerAddress) { this.sellerAddress = sellerAddress; } }
UTF-8
Java
3,283
java
SellerInfo.java
Java
[]
null
[]
package com.learnlogic.system.rental.model; // Generated Jul 11, 2015 5:51:02 PM by Hibernate Tools 4.0.0 import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; /** * SellerInfo generated by hbm2java */ @Entity @Table(name = "seller_info", catalog = "charter") public class SellerInfo implements java.io.Serializable { private long sellerId; private String sellerType; private String sellerEmail; private String sellerPhone; private String sellerReview; private String sellerFeedback; private Long sellerProductId; private String sellerLocation; private String sellerAddress; public SellerInfo() { } public SellerInfo(long sellerId) { this.sellerId = sellerId; } public SellerInfo(long sellerId, String sellerType, String sellerEmail, String sellerPhone, String sellerReview, String sellerFeedback, Long sellerProductId, String sellerLocation, String sellerAddress) { this.sellerId = sellerId; this.sellerType = sellerType; this.sellerEmail = sellerEmail; this.sellerPhone = sellerPhone; this.sellerReview = sellerReview; this.sellerFeedback = sellerFeedback; this.sellerProductId = sellerProductId; this.sellerLocation = sellerLocation; this.sellerAddress = sellerAddress; } @Id @Column(name = "seller_id", unique = true, nullable = false) public long getSellerId() { return this.sellerId; } public void setSellerId(long sellerId) { this.sellerId = sellerId; } @Column(name = "seller_type", length = 45) public String getSellerType() { return this.sellerType; } public void setSellerType(String sellerType) { this.sellerType = sellerType; } @Column(name = "seller_email", length = 45) public String getSellerEmail() { return this.sellerEmail; } public void setSellerEmail(String sellerEmail) { this.sellerEmail = sellerEmail; } @Column(name = "seller_phone", length = 45) public String getSellerPhone() { return this.sellerPhone; } public void setSellerPhone(String sellerPhone) { this.sellerPhone = sellerPhone; } @Column(name = "seller_review", length = 250) public String getSellerReview() { return this.sellerReview; } public void setSellerReview(String sellerReview) { this.sellerReview = sellerReview; } @Column(name = "seller_feedback", length = 250) public String getSellerFeedback() { return this.sellerFeedback; } public void setSellerFeedback(String sellerFeedback) { this.sellerFeedback = sellerFeedback; } @Column(name = "seller_product_id") public Long getSellerProductId() { return this.sellerProductId; } public void setSellerProductId(Long sellerProductId) { this.sellerProductId = sellerProductId; } @Column(name = "seller_location", length = 45) public String getSellerLocation() { return this.sellerLocation; } public void setSellerLocation(String sellerLocation) { this.sellerLocation = sellerLocation; } @Column(name = "seller_address", length = 45) public String getSellerAddress() { return this.sellerAddress; } public void setSellerAddress(String sellerAddress) { this.sellerAddress = sellerAddress; } }
3,283
0.721596
0.712153
130
23.253845
20.063864
72
false
false
0
0
0
0
0
0
1.415385
false
false
14
f307b9e81bfdb3bec3caf90d1d8dc1e8e6b6d593
16,844,861,753,464
eba56c687f3126aa08e0cc3c5957c74eb9edd9c6
/bootique/src/test/java/io/bootique/jackson/PeriodDeserializerIT.java
b9d4cc81b345a1c9e2f6adc753e49abc593e9f4f
[ "Apache-2.0" ]
permissive
KEVINYZY/bootique
https://github.com/KEVINYZY/bootique
ae59757277d6e1adea8262b7746754025c321577
555f43a04a610bbf993288e2a3d650aa623ed5ec
refs/heads/master
2022-03-05T15:55:48.093000
2019-11-15T06:08:27
2019-11-15T06:08:27
112,723,092
0
0
null
true
2017-12-01T09:47:14
2017-12-01T09:47:13
2017-11-30T07:08:40
2017-11-28T13:43:57
3,074
0
0
0
null
false
null
package io.bootique.jackson; import org.junit.Test; import java.io.IOException; import java.time.Period; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; public class PeriodDeserializerIT extends DeserializerIT { @Test public void testDeserialization01() throws Exception { Period period = Period.of(5, 2, 3); Period value = this.mapper.readValue("\"" + period.toString() + "\"", Period.class); assertNotNull("The value should not be null.", value); assertEquals("The value is not correct.", period, value); } @Test public void testDeserialization02() throws Exception { Period period = Period.of(5, 8, 3); Period value = this.mapper.readValue("\"P5Y8M3D\"", Period.class); assertNotNull("The value should not be null.", value); assertEquals("The value is not correct.", period, value); } @Test public void testDeserialization03() throws IOException { Bean1 bean1 = readValue(Bean1.class, mapper, "a: \"x\"\n" + "c:\n" + " period: P5Y8M3D"); assertEquals(Period.of(5, 8, 3), bean1.c.period); } }
UTF-8
Java
1,197
java
PeriodDeserializerIT.java
Java
[]
null
[]
package io.bootique.jackson; import org.junit.Test; import java.io.IOException; import java.time.Period; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; public class PeriodDeserializerIT extends DeserializerIT { @Test public void testDeserialization01() throws Exception { Period period = Period.of(5, 2, 3); Period value = this.mapper.readValue("\"" + period.toString() + "\"", Period.class); assertNotNull("The value should not be null.", value); assertEquals("The value is not correct.", period, value); } @Test public void testDeserialization02() throws Exception { Period period = Period.of(5, 8, 3); Period value = this.mapper.readValue("\"P5Y8M3D\"", Period.class); assertNotNull("The value should not be null.", value); assertEquals("The value is not correct.", period, value); } @Test public void testDeserialization03() throws IOException { Bean1 bean1 = readValue(Bean1.class, mapper, "a: \"x\"\n" + "c:\n" + " period: P5Y8M3D"); assertEquals(Period.of(5, 8, 3), bean1.c.period); } }
1,197
0.64411
0.623225
39
29.692308
27.558939
92
false
false
0
0
0
0
0
0
0.846154
false
false
14
72d141939ea8c9ec45ce98ae64a886db0a484c74
4,449,586,144,396
c3dbbe01077bf60039c0795b69712576d09f603f
/HeadFirstDesignPatterns/src/myexamples/ch1/fpsgame/strategy/impl/FireWithShotgun.java
8b4fc45847d74479a33c0b422829f0063715cfa4
[]
no_license
burakdd/books
https://github.com/burakdd/books
f078543360244b6a0a2f370e9c39fc49748bd70a
865b34789ca5da7c7c95c693a549b8d04b8fab37
refs/heads/master
2016-06-17T05:55:50.999000
2016-04-12T07:10:52
2016-04-12T07:10:52
28,843,437
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package myexamples.ch1.fpsgame.strategy.impl; import myexamples.ch1.fpsgame.strategy.FireStrategy; /** * Created by burakdede on 7.02.15. */ public class FireWithShotgun implements FireStrategy { @Override public void fire() { System.out.println("I am firing with shotgun"); } }
UTF-8
Java
303
java
FireWithShotgun.java
Java
[ { "context": ".fpsgame.strategy.FireStrategy;\n\n/**\n * Created by burakdede on 7.02.15.\n */\npublic class FireWithShotgun impl", "end": 128, "score": 0.9996762275695801, "start": 119, "tag": "USERNAME", "value": "burakdede" } ]
null
[]
package myexamples.ch1.fpsgame.strategy.impl; import myexamples.ch1.fpsgame.strategy.FireStrategy; /** * Created by burakdede on 7.02.15. */ public class FireWithShotgun implements FireStrategy { @Override public void fire() { System.out.println("I am firing with shotgun"); } }
303
0.712871
0.689769
13
22.307692
21.864565
55
false
false
0
0
0
0
0
0
0.230769
false
false
14
2f914be5d8a313af45baeb47bd3370e964a01a6c
10,024,453,688,494
091744127eab15373340a5fae7b4ab7b8ab9d76f
/jfqui02/src/main/java/com/jfq/xlstef/jfqui/OrderFragment/Util/ToolDataBase/DetailDao.java
8d39ca0f43a54eb19d05721ab2c0bb1c5e8e9164
[]
no_license
HuXiaoli123/jfq_first
https://github.com/HuXiaoli123/jfq_first
7cf747f53c9c49e6f8f1dd7479450502740e900a
048a9277723b7cf8fd95ecf0eb022ad68d59a02b
refs/heads/master
2020-06-23T06:46:53.370000
2019-04-12T02:59:12
2019-04-12T02:59:12
198,546,796
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jfq.xlstef.jfqui.OrderFragment.Util.ToolDataBase; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import com.jfq.xlstef.jfqui.OrderFragment.Goods.CommissionDetailOrder; import java.util.ArrayList; import java.util.List; /* 佣金明细辅助查询类 */ public class DetailDao implements DAO<CommissionDetailOrder> { private Context context; private DBHelper dbHelper; public DetailDao(Context context) { this.context = context; this.dbHelper = new DBHelper(this.context); } @Override public List<CommissionDetailOrder> queryAll() { return queryAction(null,null); } @Override public List<CommissionDetailOrder> queryAction(String selection, String[] selectionArgs) { SQLiteDatabase sqLiteDatabase = null; Cursor cursor = null; List<CommissionDetailOrder> list = null; try { sqLiteDatabase = this.dbHelper.getReadableDatabase(); cursor = sqLiteDatabase.query(Data.DETAILS_OF_COMMISSION, null, selection, selectionArgs, null, null, Data.ORDER_BY); list = new ArrayList<>(); if (cursor != null && cursor.moveToFirst()) { do { list.add(ValuesTransform.transformMessage(cursor)); } while (cursor.moveToNext()); } } catch (Exception e) { e.printStackTrace(); } finally { if (cursor != null) { cursor.close(); } if (sqLiteDatabase != null) { sqLiteDatabase.close(); } } return list; } @Override public void delite() { } /** * 插入数据到佣金明细表中 * @param commissionDetailOrder */ @Override public void insert(CommissionDetailOrder commissionDetailOrder) { SQLiteDatabase sqLiteDatabase = null; try { sqLiteDatabase = this.dbHelper.getWritableDatabase(); sqLiteDatabase.insert(Data.DETAILS_OF_COMMISSION,null,ValuesTransform.transformContentValues(commissionDetailOrder)); } catch (Exception e) { e.printStackTrace(); } finally { if (sqLiteDatabase != null) { sqLiteDatabase.close(); } } } @Override public void update(CommissionDetailOrder commissionDetailOrder) { } }
UTF-8
Java
2,474
java
DetailDao.java
Java
[]
null
[]
package com.jfq.xlstef.jfqui.OrderFragment.Util.ToolDataBase; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import com.jfq.xlstef.jfqui.OrderFragment.Goods.CommissionDetailOrder; import java.util.ArrayList; import java.util.List; /* 佣金明细辅助查询类 */ public class DetailDao implements DAO<CommissionDetailOrder> { private Context context; private DBHelper dbHelper; public DetailDao(Context context) { this.context = context; this.dbHelper = new DBHelper(this.context); } @Override public List<CommissionDetailOrder> queryAll() { return queryAction(null,null); } @Override public List<CommissionDetailOrder> queryAction(String selection, String[] selectionArgs) { SQLiteDatabase sqLiteDatabase = null; Cursor cursor = null; List<CommissionDetailOrder> list = null; try { sqLiteDatabase = this.dbHelper.getReadableDatabase(); cursor = sqLiteDatabase.query(Data.DETAILS_OF_COMMISSION, null, selection, selectionArgs, null, null, Data.ORDER_BY); list = new ArrayList<>(); if (cursor != null && cursor.moveToFirst()) { do { list.add(ValuesTransform.transformMessage(cursor)); } while (cursor.moveToNext()); } } catch (Exception e) { e.printStackTrace(); } finally { if (cursor != null) { cursor.close(); } if (sqLiteDatabase != null) { sqLiteDatabase.close(); } } return list; } @Override public void delite() { } /** * 插入数据到佣金明细表中 * @param commissionDetailOrder */ @Override public void insert(CommissionDetailOrder commissionDetailOrder) { SQLiteDatabase sqLiteDatabase = null; try { sqLiteDatabase = this.dbHelper.getWritableDatabase(); sqLiteDatabase.insert(Data.DETAILS_OF_COMMISSION,null,ValuesTransform.transformContentValues(commissionDetailOrder)); } catch (Exception e) { e.printStackTrace(); } finally { if (sqLiteDatabase != null) { sqLiteDatabase.close(); } } } @Override public void update(CommissionDetailOrder commissionDetailOrder) { } }
2,474
0.613804
0.613804
90
26.044445
26.915468
129
false
false
0
0
0
0
0
0
0.433333
false
false
14
dadcc6de15bafe8b74e8e6842a50bfb84f819775
31,336,081,414,483
51e3d263da1dd472e0b1a386608d56aeb41a7d8f
/src/main/java/com/test/demo/design/adapter/KeyboardControl.java
6999de5919264f4661c5e8431cf13451c000dcef
[]
no_license
caimingxue51/workdemo
https://github.com/caimingxue51/workdemo
7f963e22e56baf1c323494e4b0f8bdad0ebd3038
a9e65d02135e2d08a0146833edbf15a443908021
refs/heads/master
2022-07-08T13:03:16.964000
2021-04-07T10:26:40
2021-04-07T10:26:40
174,253,721
1
0
null
false
2022-06-21T00:58:13
2019-03-07T02:06:18
2021-04-07T10:26:53
2022-06-21T00:58:10
94
1
0
2
Java
false
false
package com.test.demo.design.adapter; public interface KeyboardControl { void ctrlsButton(); void ctrlxButton(); void ctrlnButton(); void ctrlpButton(); }
UTF-8
Java
180
java
KeyboardControl.java
Java
[]
null
[]
package com.test.demo.design.adapter; public interface KeyboardControl { void ctrlsButton(); void ctrlxButton(); void ctrlnButton(); void ctrlpButton(); }
180
0.672222
0.672222
12
14
13.826303
37
false
false
0
0
0
0
0
0
0.416667
false
false
14
e45a644d460a75a82a9291a522e6e93f1a492f6f
26,663,156,996,708
8e441f8fed5b28939d0e13eeaf1b425113d8cc11
/mb-backend-master/src/main/java/com/backend/bank/dto/request/CustomerFESettingRequestDto.java
0265226d02276366896b33cb0e287e240431c905
[]
no_license
quoc1998/mb
https://github.com/quoc1998/mb
45b88794a18ee59cf9ef4fec76d89973550b3fa1
7ee53f0f131bece2cb74a7a3c2bde3a99ab78e8d
refs/heads/master
2021-05-24T07:38:01.406000
2020-04-06T09:45:01
2020-04-06T09:45:01
253,454,100
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.backend.bank.dto.request; import lombok.Data; import java.io.Serializable; @Data public class CustomerFESettingRequestDto implements Serializable { private static final long serialVersionUID = 7156526077883281623L; private String customerHeaderAssets; private String customerFoodterAssets; }
UTF-8
Java
319
java
CustomerFESettingRequestDto.java
Java
[]
null
[]
package com.backend.bank.dto.request; import lombok.Data; import java.io.Serializable; @Data public class CustomerFESettingRequestDto implements Serializable { private static final long serialVersionUID = 7156526077883281623L; private String customerHeaderAssets; private String customerFoodterAssets; }
319
0.815047
0.755486
12
25.583334
24.533848
70
false
false
0
0
0
0
0
0
0.5
false
false
14
6df653dffa8373b799ec6d54854bfda6b451ca83
20,358,144,985,111
15dba2fed50027ab624166bebe84e9ea9107b0eb
/app/src/main/java/com/rimuzakki/myrbx/UpdateMember.java
1a1d5e210787a8fb086c9d74f13cd47073558499
[]
no_license
rimuzakki/MyRBX
https://github.com/rimuzakki/MyRBX
e2e9f4aa6540d50db09286f6a96e5322e7382658
6f6c814461f6ecc416959e24b906f9385a2c9f24
refs/heads/master
2020-06-15T18:14:42.882000
2019-07-05T07:34:13
2019-07-05T07:34:13
195,361,175
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rimuzakki.myrbx; import androidx.appcompat.app.AppCompatActivity; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class UpdateMember extends AppCompatActivity { protected Cursor cursor; DataHelper dbHelper; Button btn_Update, btn_Back; EditText et_NamaLengkap, et_Alamat, et_Notelp, et_TempatLahir, et_TanggalLahir; TextView et_IdMember; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_update_member); dbHelper = new DataHelper(this); et_IdMember = (TextView) findViewById(R.id.etIdMember); et_NamaLengkap = (EditText)findViewById(R.id.etNamaLengkap); et_Alamat = (EditText)findViewById(R.id.etAlamat); et_Notelp = (EditText)findViewById(R.id.etNoTelp); et_TempatLahir = (EditText)findViewById(R.id.etTempatLahir); et_TanggalLahir = (EditText)findViewById(R.id.etTanggalLahir); btn_Update = (Button)findViewById(R.id.btnUpdateMember); btn_Back = (Button)findViewById(R.id.btnBackMember); SQLiteDatabase db = dbHelper.getReadableDatabase(); cursor = db.rawQuery("SELECT * FROM member WHERE id_member = '" + getIntent().getStringExtra("detail_member") + "'", null); cursor.moveToFirst(); if (cursor.getCount() > 0) { cursor.moveToPosition(0); et_IdMember.setText(cursor.getString(0).toString()); et_NamaLengkap.setText(cursor.getString(1).toString()); et_Alamat.setText(cursor.getString(2).toString()); et_Notelp.setText(cursor.getString(3).toString()); et_TempatLahir.setText(cursor.getString(4).toString()); et_TanggalLahir.setText(cursor.getString(5).toString()); } btn_Update = (Button)findViewById(R.id.btnUpdateMember); btn_Back = (Button)findViewById(R.id.btnBackMember); btn_Update.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { SQLiteDatabase db = dbHelper.getWritableDatabase(); db.execSQL("UPDATE member SET nama_lengkap='" + et_NamaLengkap.getText().toString() + "', alamat='" + et_Alamat.getText().toString() + "', no_telp='" + et_Notelp.getText().toString() + "', tempat_lahir='" + et_TempatLahir.getText().toString() + "', tanggal_lahir='" + et_TanggalLahir.getText().toString() + "' WHERE id_member='" + et_IdMember.getText().toString() +"'"); Toast.makeText(getApplicationContext(), "Berhasil memperbarui data", Toast.LENGTH_LONG).show(); ListMember.ma.RefreshList(); finish(); } }); btn_Back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); } }); } }
UTF-8
Java
3,301
java
UpdateMember.java
Java
[ { "context": "package com.rimuzakki.myrbx;\n\nimport androidx.appcompat.app.AppCompatAc", "end": 21, "score": 0.8957082629203796, "start": 12, "tag": "USERNAME", "value": "rimuzakki" } ]
null
[]
package com.rimuzakki.myrbx; import androidx.appcompat.app.AppCompatActivity; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class UpdateMember extends AppCompatActivity { protected Cursor cursor; DataHelper dbHelper; Button btn_Update, btn_Back; EditText et_NamaLengkap, et_Alamat, et_Notelp, et_TempatLahir, et_TanggalLahir; TextView et_IdMember; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_update_member); dbHelper = new DataHelper(this); et_IdMember = (TextView) findViewById(R.id.etIdMember); et_NamaLengkap = (EditText)findViewById(R.id.etNamaLengkap); et_Alamat = (EditText)findViewById(R.id.etAlamat); et_Notelp = (EditText)findViewById(R.id.etNoTelp); et_TempatLahir = (EditText)findViewById(R.id.etTempatLahir); et_TanggalLahir = (EditText)findViewById(R.id.etTanggalLahir); btn_Update = (Button)findViewById(R.id.btnUpdateMember); btn_Back = (Button)findViewById(R.id.btnBackMember); SQLiteDatabase db = dbHelper.getReadableDatabase(); cursor = db.rawQuery("SELECT * FROM member WHERE id_member = '" + getIntent().getStringExtra("detail_member") + "'", null); cursor.moveToFirst(); if (cursor.getCount() > 0) { cursor.moveToPosition(0); et_IdMember.setText(cursor.getString(0).toString()); et_NamaLengkap.setText(cursor.getString(1).toString()); et_Alamat.setText(cursor.getString(2).toString()); et_Notelp.setText(cursor.getString(3).toString()); et_TempatLahir.setText(cursor.getString(4).toString()); et_TanggalLahir.setText(cursor.getString(5).toString()); } btn_Update = (Button)findViewById(R.id.btnUpdateMember); btn_Back = (Button)findViewById(R.id.btnBackMember); btn_Update.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { SQLiteDatabase db = dbHelper.getWritableDatabase(); db.execSQL("UPDATE member SET nama_lengkap='" + et_NamaLengkap.getText().toString() + "', alamat='" + et_Alamat.getText().toString() + "', no_telp='" + et_Notelp.getText().toString() + "', tempat_lahir='" + et_TempatLahir.getText().toString() + "', tanggal_lahir='" + et_TanggalLahir.getText().toString() + "' WHERE id_member='" + et_IdMember.getText().toString() +"'"); Toast.makeText(getApplicationContext(), "Berhasil memperbarui data", Toast.LENGTH_LONG).show(); ListMember.ma.RefreshList(); finish(); } }); btn_Back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); } }); } }
3,301
0.621327
0.618903
77
41.870129
26.837341
111
false
false
0
0
0
0
0
0
0.753247
false
false
14
8c8e28311c70ac5922c3508c7ccd1a005b485d43
13,254,269,101,506
cdb5755d988ef6ce3177bc805ef47eb1d0aa1e19
/src/com/courseplanner/ds/HashTable.java
d6b1a582752b11f3ceee0977826e80dff1029184
[ "MIT" ]
permissive
du00d/EasySchedule
https://github.com/du00d/EasySchedule
117c8d7e4a651f239de59efe19a56e89b4f1e70e
71ae8393916d2e33bba877918c33b3c850725be6
refs/heads/master
2020-12-02T11:02:44.788000
2020-02-21T01:43:46
2020-02-21T01:43:46
230,991,810
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.courseplanner.ds; /* * * HashTable.java * * Computer Science 112, Boston University */ public interface HashTable { /* * insert - insert the specified (key, value) pair in the hash table. * Returns true if the pair can be added and false if there is overflow. */ public boolean insert(Object key, Object value); /* * search - search for the specified key and return the * associated collection of values, or null if the key * is not in the table */ public Queue<Object> search(Object key); /* * remove - remove from the table the entry for the specified key * and return the associated collection of values, or null if the key * is not in the table */ public Queue<Object> remove(Object key); }
UTF-8
Java
833
java
HashTable.java
Java
[]
null
[]
package com.courseplanner.ds; /* * * HashTable.java * * Computer Science 112, Boston University */ public interface HashTable { /* * insert - insert the specified (key, value) pair in the hash table. * Returns true if the pair can be added and false if there is overflow. */ public boolean insert(Object key, Object value); /* * search - search for the specified key and return the * associated collection of values, or null if the key * is not in the table */ public Queue<Object> search(Object key); /* * remove - remove from the table the entry for the specified key * and return the associated collection of values, or null if the key * is not in the table */ public Queue<Object> remove(Object key); }
833
0.626651
0.623049
29
26.793104
25.876869
76
false
false
0
0
0
0
0
0
0.310345
false
false
14
c0dfa18becceb33bf611227afaaaf4f385a64807
17,231,408,818,920
6a6d48e7c29c7f40ec862e56efac611fe5a35d70
/pilot-project/src/main/java/com/training/security/CustomAuthenticationProvider.java
b64768bac698666d4ed41cb867e36b93369c6cb0
[]
no_license
nstrung163/My_Project
https://github.com/nstrung163/My_Project
cd310a668e1e2e234e0b9d37fb8fd50769e083b5
65f2e40f8474db72e4940ec54a4f8d79018430e3
refs/heads/master
2023-04-19T15:33:59.311000
2021-01-28T15:58:18
2021-01-28T15:58:18
271,735,314
0
0
null
false
2021-04-26T20:43:58
2020-06-12T07:21:26
2021-01-28T16:00:20
2021-04-26T20:43:58
170,779
0
0
1
JavaScript
false
false
package com.training.security; import java.util.ArrayList; import java.util.List; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.AuthenticationProvider; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.stereotype.Component; import com.training.common.util.FileHelper; import com.training.entity.UserEntity; import com.training.service.IUserService; @Component public class CustomAuthenticationProvider implements AuthenticationProvider { @Autowired IUserService userService; @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { String username = authentication.getName(); String password = authentication.getCredentials().toString(); String encryptPassword = FileHelper.enrcyptMD5(password); UsernamePasswordAuthenticationToken usernamePassAuthToken = null; UserEntity loginUser = userService.login(username, encryptPassword); if (loginUser != null ) { List<GrantedAuthority> grantedAuths = new ArrayList<GrantedAuthority>(); grantedAuths.add(new SimpleGrantedAuthority(loginUser.getRole())); usernamePassAuthToken = new UsernamePasswordAuthenticationToken(username, StringUtils.EMPTY, grantedAuths); } return usernamePassAuthToken; } @Override public boolean supports(Class<?> authentication) { return authentication.equals(UsernamePasswordAuthenticationToken.class); } }
UTF-8
Java
1,811
java
CustomAuthenticationProvider.java
Java
[]
null
[]
package com.training.security; import java.util.ArrayList; import java.util.List; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.AuthenticationProvider; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.stereotype.Component; import com.training.common.util.FileHelper; import com.training.entity.UserEntity; import com.training.service.IUserService; @Component public class CustomAuthenticationProvider implements AuthenticationProvider { @Autowired IUserService userService; @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { String username = authentication.getName(); String password = authentication.getCredentials().toString(); String encryptPassword = FileHelper.enrcyptMD5(password); UsernamePasswordAuthenticationToken usernamePassAuthToken = null; UserEntity loginUser = userService.login(username, encryptPassword); if (loginUser != null ) { List<GrantedAuthority> grantedAuths = new ArrayList<GrantedAuthority>(); grantedAuths.add(new SimpleGrantedAuthority(loginUser.getRole())); usernamePassAuthToken = new UsernamePasswordAuthenticationToken(username, StringUtils.EMPTY, grantedAuths); } return usernamePassAuthToken; } @Override public boolean supports(Class<?> authentication) { return authentication.equals(UsernamePasswordAuthenticationToken.class); } }
1,811
0.836002
0.834898
47
37.553192
31.319771
110
false
false
0
0
0
0
0
0
1.446808
false
false
14
089a57b235f74651b23636c1357b234fcb84b723
3,590,592,688,114
8a503de7ca5e416fa6892a121163b469fe70973f
/de.xwic.appkit.webbase/src/de/xwic/appkit/webbase/editors/GenericEditorInput.java
27fcf82690c102b98a0abea619a2c4437283f6ff
[]
no_license
ApipA/appkit
https://github.com/ApipA/appkit
27f3fbe252ce625d075902b37aeeb735df4e07d2
9a33cbde2b96d62069582bf197e432d84bd73776
refs/heads/master
2021-01-15T17:02:12.790000
2015-07-05T09:13:13
2015-07-05T09:13:13
38,563,046
0
0
null
true
2015-07-05T09:17:38
2015-07-05T09:04:25
2015-07-05T09:04:28
2015-07-05T09:17:38
37,148
0
0
1
Java
null
null
/* * (c) Copyright 2005, 2006 by pol GmbH * * de.xwic.appkit.webbase.editor.GenericEditorInput * Created on May 14, 2007 by Aron Cotrau * */ package de.xwic.appkit.webbase.editors; import de.xwic.appkit.core.config.editor.EditorConfiguration; import de.xwic.appkit.core.dao.DAO; import de.xwic.appkit.core.dao.DAOSystem; import de.xwic.appkit.core.dao.IEntity; /** * Generic editor input that holds the Entity and the EditorConfiguration. * * @author Florian Lippisch */ public class GenericEditorInput { private EditorConfiguration config; private IEntity entity; /** * Constructor. * @param entity * @param config */ public GenericEditorInput(IEntity entity, EditorConfiguration config) { this.entity = entity; this.config = config; } /** * @return a string representation of the entity */ public String getName() { return createName(); } /** * @return the DAO string representation of the entity */ private String createName() { DAO entityDao = DAOSystem.findDAOforEntity(config.getEntityType().getClassname()); if (null == entityDao) { return entity.toString(); } return entityDao.buildTitle(entity); } /** * @return the config */ public EditorConfiguration getConfig() { return config; } /** * @param config the config to set */ public void setConfig(EditorConfiguration config) { this.config = config; } /** * @return the entity */ public IEntity getEntity() { return entity; } /** * @param entity the entity to set */ public void setEntity(IEntity entity) { this.entity = entity; } /* (non-Javadoc) * @see java.lang.Object#hashCode() */ public int hashCode() { final int PRIME = 31; int result = 1; result = PRIME * result + ((entity == null) ? 0 : entity.hashCode()); return result; } /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final GenericEditorInput other = (GenericEditorInput) obj; if (entity == null) { if (other.entity != null) return false; } else if (entity.getId() != other.entity.getId()) { return false; } else if (! entity.type().getName().equals(other.entity.type().getName())) { return false; } return true; } }
UTF-8
Java
2,383
java
GenericEditorInput.java
Java
[ { "context": "r.GenericEditorInput\n * Created on May 14, 2007 by Aron Cotrau\n *\n */\npackage de.xwic.appkit.webbase.editors;\n\ni", "end": 141, "score": 0.9998777508735657, "start": 130, "tag": "NAME", "value": "Aron Cotrau" }, { "context": "Entity and the EditorConfiguration.\n * \n * @author Florian Lippisch\n */\npublic class GenericEditorInput {\n\t\n\tprivate ", "end": 481, "score": 0.99981689453125, "start": 465, "tag": "NAME", "value": "Florian Lippisch" } ]
null
[]
/* * (c) Copyright 2005, 2006 by pol GmbH * * de.xwic.appkit.webbase.editor.GenericEditorInput * Created on May 14, 2007 by <NAME> * */ package de.xwic.appkit.webbase.editors; import de.xwic.appkit.core.config.editor.EditorConfiguration; import de.xwic.appkit.core.dao.DAO; import de.xwic.appkit.core.dao.DAOSystem; import de.xwic.appkit.core.dao.IEntity; /** * Generic editor input that holds the Entity and the EditorConfiguration. * * @author <NAME> */ public class GenericEditorInput { private EditorConfiguration config; private IEntity entity; /** * Constructor. * @param entity * @param config */ public GenericEditorInput(IEntity entity, EditorConfiguration config) { this.entity = entity; this.config = config; } /** * @return a string representation of the entity */ public String getName() { return createName(); } /** * @return the DAO string representation of the entity */ private String createName() { DAO entityDao = DAOSystem.findDAOforEntity(config.getEntityType().getClassname()); if (null == entityDao) { return entity.toString(); } return entityDao.buildTitle(entity); } /** * @return the config */ public EditorConfiguration getConfig() { return config; } /** * @param config the config to set */ public void setConfig(EditorConfiguration config) { this.config = config; } /** * @return the entity */ public IEntity getEntity() { return entity; } /** * @param entity the entity to set */ public void setEntity(IEntity entity) { this.entity = entity; } /* (non-Javadoc) * @see java.lang.Object#hashCode() */ public int hashCode() { final int PRIME = 31; int result = 1; result = PRIME * result + ((entity == null) ? 0 : entity.hashCode()); return result; } /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final GenericEditorInput other = (GenericEditorInput) obj; if (entity == null) { if (other.entity != null) return false; } else if (entity.getId() != other.entity.getId()) { return false; } else if (! entity.type().getName().equals(other.entity.type().getName())) { return false; } return true; } }
2,368
0.668485
0.660932
114
19.903509
20.155521
84
false
false
0
0
0
0
0
0
1.412281
false
false
14
55721777f90ddff57bd106a997daab5562fe907c
14,783,277,434,403
ef4dc0b348265a2aeca8a7f686882990465f8b80
/jmetal4.3/jmetal/operators/localSearch/TabuLocalSearch.java
bcd5c186e65ba139cff8973457217bf1aef10e92
[]
no_license
VolmirF/Flowshop_JMetal
https://github.com/VolmirF/Flowshop_JMetal
65e970979158c3a5722858490ffac64b5a74dcea
825e6d8031debe95a485d4dc8f1509584158496e
refs/heads/master
2022-11-07T06:28:14.486000
2020-06-12T04:57:02
2020-06-12T04:57:02
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// MutationLocalSearch.java // // Author: // Antonio J. Nebro <antonio@lcc.uma.es> // Juan J. Durillo <durillo@lcc.uma.es> // // Copyright (c) 2011 Antonio J. Nebro, Juan J. Durillo // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 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 Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. package jmetal.operators.localSearch; import jmetal.core.*; import jmetal.encodings.variable.Permutation; import jmetal.operators.mutation.Mutation; import jmetal.util.JMException; import jmetal.util.PseudoRandom; import jmetal.util.Ranking; import jmetal.util.comparators.DominanceComparator; import jmetal.util.comparators.OverallConstraintViolationComparator; import java.util.Comparator; import java.util.HashMap; /** * Implementation of Tabu Local Search */ public class TabuLocalSearch extends LocalSearch { /** * Stores the problem to solve */ private Problem problem_; /** * Stores a reference to the archive in which the non-dominated solutions are * inserted */ private SolutionSet archive_; private int improvementRounds_; /** * Stores comparators for dealing with constraints and dominance checking, * respectively. */ private Comparator constraintComparator_; private Comparator dominanceComparator_; /** * Stores the number of evaluations_ carried out */ private int evaluations_; private int[][] tabuList_; private int numberOfNeighbors; private int tabuLenghtTime; private int prohibitionRule; public TabuLocalSearch(HashMap<String, Object> parameters) { super(parameters); if (parameters.get("problem") != null) problem_ = (Problem) parameters.get("problem"); if (parameters.get("improvementRounds") != null) improvementRounds_ = (Integer) parameters.get("improvementRounds"); if (parameters.get("numberOfNeighbors") != null) numberOfNeighbors = (Integer) parameters.get("numberOfNeighbors"); if (parameters.get("tabuLenghtTime") != null) tabuLenghtTime = (Integer) parameters.get("tabuLenghtTime"); if (parameters.get("prohibitionRule") != null) prohibitionRule = (Integer) parameters.get("prohibitionRule"); evaluations_ = 0; archive_ = null; dominanceComparator_ = new DominanceComparator(); constraintComparator_ = new OverallConstraintViolationComparator(); } //Mutation improvement //Generate the moves to find neighbors in permutation problems private int[][] generateNeighborsSwaps(int permutationLength/*Solution solution*/) { //int permutationLength; // permutationLength = ((Permutation)solution.getDecisionVariables()[0]).getLength() ; int[][] moves = new int[numberOfNeighbors][2]; //Matrix that controls the neighbors already generated int[][] alreadyGenerated = new int[permutationLength][permutationLength]; int i = 0; int pos1; int pos2; int aux; while (true) { pos1 = PseudoRandom.randInt(0, permutationLength - 1); pos2 = PseudoRandom.randInt(0, permutationLength - 1); if (pos1 > pos2) { aux = pos1; pos1 = pos2; pos2 = aux; } if (pos1 == pos2 || alreadyGenerated[pos1][pos2] != 0) { continue; } else { alreadyGenerated[pos1][pos2] = 1; moves[i][0] = pos1; moves[i][1] = pos2; i++; } if (i == numberOfNeighbors) break; } return moves; } // -------------------------------------------// // n = number of neighbors, object is the initial solution private SolutionSet generateXNeighbors(Object object) throws JMException { Solution solution = (Solution) object; SolutionSet neighbors = new SolutionSet(numberOfNeighbors); //A set of neighbors int permutationLength; permutationLength = ((Permutation) solution.getDecisionVariables()[0]).getLength(); tabuList_ = new int[permutationLength][permutationLength]; int[][] moves = generateNeighborsSwaps(permutationLength); //This will generate the neighbors using the moves and add on the solutionSet neighbors for (int i = 0; i < numberOfNeighbors; i++) { Solution currentNeighbor; currentNeighbor = new Solution(solution); int[] swapPermutation = ((Permutation)solution.getDecisionVariables()[0]).vector_; int variableAux; variableAux = swapPermutation[moves[i][0]]; swapPermutation[moves[i][0]] = swapPermutation[moves[i][1]]; swapPermutation[moves[i][1]] = variableAux; //currentNeighbor.setDecisionVariables(swapPermutation); int[] movement = new int[2]; movement[0] = moves[i][0]; movement[1] = moves[i][1]; currentNeighbor.setSwapMovement(movement); problem_.evaluateConstraints(currentNeighbor); problem_.evaluate(currentNeighbor); evaluations_++; neighbors.add(currentNeighbor); } //Ranking ranking = new Ranking(neighbors); //SolutionSet front = ranking.getSubfront(0); return neighbors; } private int validateTabuConstraint(Solution solution, Solution currentSolution, int currentRound){ int best = dominanceComparator_.compare(currentSolution, solution); int[] swaps = currentSolution.getSwapMovement(); int[] currentSolutionPermutation = ((Permutation)currentSolution.getDecisionVariables()[0]).vector_; if(prohibitionRule == 2){ if (best == -1){ tabuList_[swaps[0]][currentSolutionPermutation[swaps[1]]] = currentRound + tabuLenghtTime; tabuList_[swaps[1]][currentSolutionPermutation[swaps[0]]] = currentRound + tabuLenghtTime; return 2; } if(tabuList_[swaps[0]][currentSolutionPermutation[swaps[1]]] > currentRound || tabuList_[swaps[1]][currentSolutionPermutation[swaps[0]]] > currentRound) return 1; else { //Não é tabu. Tornar o movimento Tabu tabuList_[swaps[0]][currentSolutionPermutation[swaps[1]]] = currentRound + tabuLenghtTime; tabuList_[swaps[1]][currentSolutionPermutation[swaps[0]]] = currentRound + tabuLenghtTime; return 0; } } else if(prohibitionRule == 7){ //Satisfazer um critério de aspiração. Atualizar o Tabu Time dos moves. if (best == -1){ tabuList_[swaps[0]][0] = currentRound + tabuLenghtTime; tabuList_[swaps[1]][0] = currentRound + tabuLenghtTime; return 2; } //Se for tabu if(tabuList_[swaps[0]][0] > currentRound || tabuList_[swaps[1]][0] > currentRound) return 1; else { //Não é tabu. Tornar o movimento Tabu tabuList_[swaps[0]][0] = currentRound + tabuLenghtTime; tabuList_[swaps[1]][0] = currentRound + tabuLenghtTime; return 0; } } return 1; } public Object execute(Object object) throws JMException { int best = 0; evaluations_ = 0; Solution solution = (Solution) object; int rounds = improvementRounds_; archive_ = (SolutionSet) getParameter("archive"); if (rounds <= 0) return new Solution(solution); for(int i=0; i < rounds; i++){ Solution mutatedSolution = new Solution(solution); int flagFindNonTabu = 0; //SolutionSet neighbors = generateXNeighbors(object); SolutionSet neighbors = generateXNeighbors(mutatedSolution); Ranking ranking = new Ranking(neighbors); //Tá. Aqui eu vou ter que pegar as soluções das subsets conforme for sendo necessário? for (int j = 0; j < ranking.getNumberOfSubfronts(); j++) { SolutionSet front = ranking.getSubfront(0); for (int k = 0; k < front.size(); k++) { Solution currentSolution = front.get(k); int isTabu = validateTabuConstraint(solution, currentSolution, i); if (isTabu == 1) { //é Tabu continue; } else { //Não é Tabu ou Satisfaz algum critério de aspiração. flagFindNonTabu = 1; mutatedSolution = currentSolution; if(isTabu == 2){ solution = currentSolution; } break; } } if (flagFindNonTabu == 1) break; } } return new Solution(solution); } // execute /** * Returns the number of evaluations made */ public int getEvaluations() { return evaluations_; } // evaluations } // MutationLocalSearch
UTF-8
Java
9,938
java
TabuLocalSearch.java
Java
[ { "context": " MutationLocalSearch.java\n//\n// Author:\n// Antonio J. Nebro <antonio@lcc.uma.es>\n// Juan J. Durillo <du", "end": 69, "score": 0.9998778700828552, "start": 53, "tag": "NAME", "value": "Antonio J. Nebro" }, { "context": "ch.java\n//\n// Author:\n// Antonio J. Nebro <antonio@lcc.uma.es>\n// Juan J. Durillo <durillo@lcc.uma.es>\n//", "end": 89, "score": 0.9999299645423889, "start": 71, "tag": "EMAIL", "value": "antonio@lcc.uma.es" }, { "context": " Antonio J. Nebro <antonio@lcc.uma.es>\n// Juan J. Durillo <durillo@lcc.uma.es>\n//\n// Copyright (c) 2011 An", "end": 115, "score": 0.9998665452003479, "start": 100, "tag": "NAME", "value": "Juan J. Durillo" }, { "context": "ro <antonio@lcc.uma.es>\n// Juan J. Durillo <durillo@lcc.uma.es>\n//\n// Copyright (c) 2011 Antonio J. Nebro, Juan", "end": 135, "score": 0.9999302625656128, "start": 117, "tag": "EMAIL", "value": "durillo@lcc.uma.es" }, { "context": "llo <durillo@lcc.uma.es>\n//\n// Copyright (c) 2011 Antonio J. Nebro, Juan J. Durillo\n//\n// This program is free soft", "end": 179, "score": 0.9998728036880493, "start": 163, "tag": "NAME", "value": "Antonio J. Nebro" }, { "context": "ma.es>\n//\n// Copyright (c) 2011 Antonio J. Nebro, Juan J. Durillo\n//\n// This program is free software: you can red", "end": 196, "score": 0.9998626708984375, "start": 181, "tag": "NAME", "value": "Juan J. Durillo" } ]
null
[]
// MutationLocalSearch.java // // Author: // <NAME> <<EMAIL>> // <NAME> <<EMAIL>> // // Copyright (c) 2011 <NAME>, <NAME> // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 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 Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. package jmetal.operators.localSearch; import jmetal.core.*; import jmetal.encodings.variable.Permutation; import jmetal.operators.mutation.Mutation; import jmetal.util.JMException; import jmetal.util.PseudoRandom; import jmetal.util.Ranking; import jmetal.util.comparators.DominanceComparator; import jmetal.util.comparators.OverallConstraintViolationComparator; import java.util.Comparator; import java.util.HashMap; /** * Implementation of Tabu Local Search */ public class TabuLocalSearch extends LocalSearch { /** * Stores the problem to solve */ private Problem problem_; /** * Stores a reference to the archive in which the non-dominated solutions are * inserted */ private SolutionSet archive_; private int improvementRounds_; /** * Stores comparators for dealing with constraints and dominance checking, * respectively. */ private Comparator constraintComparator_; private Comparator dominanceComparator_; /** * Stores the number of evaluations_ carried out */ private int evaluations_; private int[][] tabuList_; private int numberOfNeighbors; private int tabuLenghtTime; private int prohibitionRule; public TabuLocalSearch(HashMap<String, Object> parameters) { super(parameters); if (parameters.get("problem") != null) problem_ = (Problem) parameters.get("problem"); if (parameters.get("improvementRounds") != null) improvementRounds_ = (Integer) parameters.get("improvementRounds"); if (parameters.get("numberOfNeighbors") != null) numberOfNeighbors = (Integer) parameters.get("numberOfNeighbors"); if (parameters.get("tabuLenghtTime") != null) tabuLenghtTime = (Integer) parameters.get("tabuLenghtTime"); if (parameters.get("prohibitionRule") != null) prohibitionRule = (Integer) parameters.get("prohibitionRule"); evaluations_ = 0; archive_ = null; dominanceComparator_ = new DominanceComparator(); constraintComparator_ = new OverallConstraintViolationComparator(); } //Mutation improvement //Generate the moves to find neighbors in permutation problems private int[][] generateNeighborsSwaps(int permutationLength/*Solution solution*/) { //int permutationLength; // permutationLength = ((Permutation)solution.getDecisionVariables()[0]).getLength() ; int[][] moves = new int[numberOfNeighbors][2]; //Matrix that controls the neighbors already generated int[][] alreadyGenerated = new int[permutationLength][permutationLength]; int i = 0; int pos1; int pos2; int aux; while (true) { pos1 = PseudoRandom.randInt(0, permutationLength - 1); pos2 = PseudoRandom.randInt(0, permutationLength - 1); if (pos1 > pos2) { aux = pos1; pos1 = pos2; pos2 = aux; } if (pos1 == pos2 || alreadyGenerated[pos1][pos2] != 0) { continue; } else { alreadyGenerated[pos1][pos2] = 1; moves[i][0] = pos1; moves[i][1] = pos2; i++; } if (i == numberOfNeighbors) break; } return moves; } // -------------------------------------------// // n = number of neighbors, object is the initial solution private SolutionSet generateXNeighbors(Object object) throws JMException { Solution solution = (Solution) object; SolutionSet neighbors = new SolutionSet(numberOfNeighbors); //A set of neighbors int permutationLength; permutationLength = ((Permutation) solution.getDecisionVariables()[0]).getLength(); tabuList_ = new int[permutationLength][permutationLength]; int[][] moves = generateNeighborsSwaps(permutationLength); //This will generate the neighbors using the moves and add on the solutionSet neighbors for (int i = 0; i < numberOfNeighbors; i++) { Solution currentNeighbor; currentNeighbor = new Solution(solution); int[] swapPermutation = ((Permutation)solution.getDecisionVariables()[0]).vector_; int variableAux; variableAux = swapPermutation[moves[i][0]]; swapPermutation[moves[i][0]] = swapPermutation[moves[i][1]]; swapPermutation[moves[i][1]] = variableAux; //currentNeighbor.setDecisionVariables(swapPermutation); int[] movement = new int[2]; movement[0] = moves[i][0]; movement[1] = moves[i][1]; currentNeighbor.setSwapMovement(movement); problem_.evaluateConstraints(currentNeighbor); problem_.evaluate(currentNeighbor); evaluations_++; neighbors.add(currentNeighbor); } //Ranking ranking = new Ranking(neighbors); //SolutionSet front = ranking.getSubfront(0); return neighbors; } private int validateTabuConstraint(Solution solution, Solution currentSolution, int currentRound){ int best = dominanceComparator_.compare(currentSolution, solution); int[] swaps = currentSolution.getSwapMovement(); int[] currentSolutionPermutation = ((Permutation)currentSolution.getDecisionVariables()[0]).vector_; if(prohibitionRule == 2){ if (best == -1){ tabuList_[swaps[0]][currentSolutionPermutation[swaps[1]]] = currentRound + tabuLenghtTime; tabuList_[swaps[1]][currentSolutionPermutation[swaps[0]]] = currentRound + tabuLenghtTime; return 2; } if(tabuList_[swaps[0]][currentSolutionPermutation[swaps[1]]] > currentRound || tabuList_[swaps[1]][currentSolutionPermutation[swaps[0]]] > currentRound) return 1; else { //Não é tabu. Tornar o movimento Tabu tabuList_[swaps[0]][currentSolutionPermutation[swaps[1]]] = currentRound + tabuLenghtTime; tabuList_[swaps[1]][currentSolutionPermutation[swaps[0]]] = currentRound + tabuLenghtTime; return 0; } } else if(prohibitionRule == 7){ //Satisfazer um critério de aspiração. Atualizar o Tabu Time dos moves. if (best == -1){ tabuList_[swaps[0]][0] = currentRound + tabuLenghtTime; tabuList_[swaps[1]][0] = currentRound + tabuLenghtTime; return 2; } //Se for tabu if(tabuList_[swaps[0]][0] > currentRound || tabuList_[swaps[1]][0] > currentRound) return 1; else { //Não é tabu. Tornar o movimento Tabu tabuList_[swaps[0]][0] = currentRound + tabuLenghtTime; tabuList_[swaps[1]][0] = currentRound + tabuLenghtTime; return 0; } } return 1; } public Object execute(Object object) throws JMException { int best = 0; evaluations_ = 0; Solution solution = (Solution) object; int rounds = improvementRounds_; archive_ = (SolutionSet) getParameter("archive"); if (rounds <= 0) return new Solution(solution); for(int i=0; i < rounds; i++){ Solution mutatedSolution = new Solution(solution); int flagFindNonTabu = 0; //SolutionSet neighbors = generateXNeighbors(object); SolutionSet neighbors = generateXNeighbors(mutatedSolution); Ranking ranking = new Ranking(neighbors); //Tá. Aqui eu vou ter que pegar as soluções das subsets conforme for sendo necessário? for (int j = 0; j < ranking.getNumberOfSubfronts(); j++) { SolutionSet front = ranking.getSubfront(0); for (int k = 0; k < front.size(); k++) { Solution currentSolution = front.get(k); int isTabu = validateTabuConstraint(solution, currentSolution, i); if (isTabu == 1) { //é Tabu continue; } else { //Não é Tabu ou Satisfaz algum critério de aspiração. flagFindNonTabu = 1; mutatedSolution = currentSolution; if(isTabu == 2){ solution = currentSolution; } break; } } if (flagFindNonTabu == 1) break; } } return new Solution(solution); } // execute /** * Returns the number of evaluations made */ public int getEvaluations() { return evaluations_; } // evaluations } // MutationLocalSearch
9,878
0.594698
0.585022
286
33.688812
29.089884
108
false
false
0
0
0
0
0
0
0.51049
false
false
14
f7778b794400ef9afd3b62c3bbfa293e604b90d7
30,124,900,647,005
e9d41ef7e3e3eb28a2cbb83d22ed1bf0be3ac665
/demo/src/main/java/com/example/Culc.java
3ce643096485b03e9e580dc8a6bf31fbe3efcdd2
[]
no_license
sugimomoto/MarvenSample
https://github.com/sugimomoto/MarvenSample
66ac07371d25349ca9e477a81a492969d7c5c2cb
f73a8dce25108dc6e97612b8734a42b209f048a2
refs/heads/master
2023-05-19T19:07:45.090000
2021-06-10T14:48:09
2021-06-10T14:48:09
375,732,242
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example; public class Culc { public Culc(){ } public Integer Plus(Integer x, Integer y){ return x + y; } }
UTF-8
Java
152
java
Culc.java
Java
[]
null
[]
package com.example; public class Culc { public Culc(){ } public Integer Plus(Integer x, Integer y){ return x + y; } }
152
0.546053
0.546053
13
10.692307
13.076018
46
false
false
0
0
0
0
0
0
0.230769
false
false
14
ceb21b06e8d74e2ef66f1089f5b826404ae39da0
1,254,130,477,893
f32e0067fdd3875683a59f344a51ede69ee6f89a
/src/main/java/com/work4j/space/controller/fore/IndexController.java
92923594c1ef92a7ea0037d82271b61428596311
[]
no_license
work4j/work4j
https://github.com/work4j/work4j
9d4cd54a98d812c43ba6341c840627bd4417b5b7
687fdea89ea7cb8b6bdc624b48db23f551cdb2e0
refs/heads/master
2021-01-15T13:36:33.398000
2017-08-15T14:57:38
2017-08-15T14:57:38
99,680,733
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.work4j.space.controller.fore; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import lombok.Data; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import com.work4j.space.common.SystemHelper; import com.work4j.space.pojo.User; import com.work4j.space.pojo.form.UserForm; import com.work4j.space.pojo.query.UserQuery; import com.work4j.space.service.ArticleService; import com.work4j.space.service.UserService; import java.util.List; import java.util.Random; @Controller public class IndexController { @Value("${file.headpath}") private String headpath; @Resource private UserService userService; @Resource private ArticleService articleService; @RequestMapping("/index") public String toIndex() { return "redirect:/fore/article/list"; } @RequestMapping("/login") public String toLogin() { System.out.println(headpath); return "login/login"; } @RequestMapping("/register") public String toRegister() { return "login/register"; } @RequestMapping(value = "/register", method = RequestMethod.POST) public ModelAndView register(UserForm form) { ModelAndView mav = new ModelAndView("login/login"); form.setHead(headpath + new Random().nextInt(12) + ".jpg"); userService.add(form); mav.addObject("msg", "注册成功"); return mav; } @RequestMapping(value = "/checkUserName", method = RequestMethod.POST) @ResponseBody public boolean checkUsername(String username) { UserQuery query = new UserQuery(); query.setUserName(username); return userService.find(query).size() > 0; } @RequestMapping("/logout") public String toLogout() { SystemHelper.getSession().removeAttribute("currentUser"); return "redirect:/fore/article/list"; } @RequestMapping("/404") public String error() { return "error_404"; } @RequestMapping("/noPermission") public String noPermission() { return "noPermission"; } @RequestMapping(value = "/login", method = RequestMethod.POST) public ModelAndView login(HttpServletRequest request, final UserQuery query) { ModelAndView mav = new ModelAndView("login/login"); List<User> user = userService.find(query); if (user.size() > 0) { SystemHelper.setCurrentUser(user.get(0)); String referer = request.getHeader("referer"); if (referer.contains("redirect")) { String url = referer.substring(referer.indexOf("redirect") + 9, referer.length()); if (url != null && !url.equals("")) { mav.setViewName("redirect:" + request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + url); } } else { mav.setViewName("redirect:index"); } } else { query.setPassword(""); if (userService.find(query).size() == 0) { mav.addObject("msg", "没有此用户名"); } else { mav.addObject("msg", "密码错误"); } } return mav; } }
UTF-8
Java
3,536
java
IndexController.java
Java
[]
null
[]
package com.work4j.space.controller.fore; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import lombok.Data; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import com.work4j.space.common.SystemHelper; import com.work4j.space.pojo.User; import com.work4j.space.pojo.form.UserForm; import com.work4j.space.pojo.query.UserQuery; import com.work4j.space.service.ArticleService; import com.work4j.space.service.UserService; import java.util.List; import java.util.Random; @Controller public class IndexController { @Value("${file.headpath}") private String headpath; @Resource private UserService userService; @Resource private ArticleService articleService; @RequestMapping("/index") public String toIndex() { return "redirect:/fore/article/list"; } @RequestMapping("/login") public String toLogin() { System.out.println(headpath); return "login/login"; } @RequestMapping("/register") public String toRegister() { return "login/register"; } @RequestMapping(value = "/register", method = RequestMethod.POST) public ModelAndView register(UserForm form) { ModelAndView mav = new ModelAndView("login/login"); form.setHead(headpath + new Random().nextInt(12) + ".jpg"); userService.add(form); mav.addObject("msg", "注册成功"); return mav; } @RequestMapping(value = "/checkUserName", method = RequestMethod.POST) @ResponseBody public boolean checkUsername(String username) { UserQuery query = new UserQuery(); query.setUserName(username); return userService.find(query).size() > 0; } @RequestMapping("/logout") public String toLogout() { SystemHelper.getSession().removeAttribute("currentUser"); return "redirect:/fore/article/list"; } @RequestMapping("/404") public String error() { return "error_404"; } @RequestMapping("/noPermission") public String noPermission() { return "noPermission"; } @RequestMapping(value = "/login", method = RequestMethod.POST) public ModelAndView login(HttpServletRequest request, final UserQuery query) { ModelAndView mav = new ModelAndView("login/login"); List<User> user = userService.find(query); if (user.size() > 0) { SystemHelper.setCurrentUser(user.get(0)); String referer = request.getHeader("referer"); if (referer.contains("redirect")) { String url = referer.substring(referer.indexOf("redirect") + 9, referer.length()); if (url != null && !url.equals("")) { mav.setViewName("redirect:" + request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + url); } } else { mav.setViewName("redirect:index"); } } else { query.setPassword(""); if (userService.find(query).size() == 0) { mav.addObject("msg", "没有此用户名"); } else { mav.addObject("msg", "密码错误"); } } return mav; } }
3,536
0.644242
0.638541
106
32.094341
24.221668
143
false
false
0
0
0
0
0
0
0.528302
false
false
14
3c1735eb6ab4f125456544bc27e233278874b4d0
27,212,912,821,418
3da4654a2fe22b29524bbdc5fd58cdb4cf59be12
/DailyExpenses/app/src/main/java/com/example/vivekdalsaniya/dailyexpenses/View1.java
8a6b829368ab9755bb494bcd5d6d6b097ae2de08
[]
no_license
DalsaniyaVivek/aaa
https://github.com/DalsaniyaVivek/aaa
13f3e78efec56a87252d7301e858751e95c05e56
5fe9d9aa11921d7069882361452df46cdd8597d1
refs/heads/master
2021-01-10T18:01:15.781000
2016-02-18T15:38:12
2016-02-18T15:38:12
52,017,702
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.vivekdalsaniya.dailyexpenses; import android.app.DatePickerDialog; import android.app.Dialog; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.DatePicker; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import java.util.Calendar; /** * Created by Vivek Dalsaniya on 1/14/2016. */ public class View1 extends AppCompatActivity { private DatePicker datePicker; private Calendar calendar; private int year, month, day; private EditText e1; Spinner spinnerDropDown,spinnerDropDown1; String[] months = { "January", "February", "March", "April", "May", "June", "July", "August", "September","October","November","December"}; String[] years = { "2015","2016","2017","2018","2019","2020","2021","2022","2023" }; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setContentView(R.layout.view); android.support.v7.app.ActionBar actionBar = getSupportActionBar(); actionBar.setTitle("View1"); calendar = Calendar.getInstance(); year = calendar.get(Calendar.YEAR); month = calendar.get(Calendar.MONTH); day = calendar.get(Calendar.DAY_OF_MONTH); e1 = (EditText) findViewById(R.id.ve1); TextView t1 = (TextView) findViewById(R.id.vt2); spinnerDropDown=(Spinner)findViewById(R.id.vs1); spinnerDropDown1=(Spinner)findViewById(R.id.vs2); TextView t2=(TextView)findViewById(R.id.vt5); TextView t3=(TextView)findViewById(R.id.vt7); showDate(year, month + 1, day); ArrayAdapter<String> adapter= new ArrayAdapter<String>(this,android.R.layout.simple_spinner_dropdown_item ,months); ArrayAdapter<String> adapter1=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_dropdown_item,years); spinnerDropDown.setAdapter(adapter); spinnerDropDown1.setAdapter(adapter1); Button b1=(Button)findViewById(R.id.vb1); Button b2=(Button)findViewById(R.id.vb2); t3.setOnClickListener(new android.view.View.OnClickListener() { @Override public void onClick(android.view.View v) { dataview d3=new dataview(); d3.viewFull1(); Intent i1=new Intent(View1.this,dataview.class); startActivity(i1); } }); b1.setOnClickListener(new android.view.View.OnClickListener() { @Override public void onClick(android.view.View v) { dataview d4=new dataview(); d4.specDate(); Intent i2=new Intent(View1.this,dataview.class); i2.putExtra("a",e1.getText().toString()); startActivity(i2); } }); b2.setOnClickListener(new android.view.View.OnClickListener() { @Override public void onClick(android.view.View v) { String x=spinnerDropDown.getSelectedItem().toString(); String y=spinnerDropDown1.getSelectedItem().toString(); if(x.equals("January")){ x="1"; }else if(x.equals("February")){ x="2"; }else if(x.equals("March")){ x="3"; }else if(x.equals("April")){ x="4"; }else if(x.equals("May")){ x="5"; }else if(x.equals("June")){ x="6"; }else if(x.equals("July")){ x="7"; }else if(x.equals("August")){ x="8"; }else if(x.equals("September")){ x="9"; }else if(x.equals("October")){ x="10"; }else if(x.equals("November")){ x="11"; }else{ x="12"; } dataview d5=new dataview(); d5.setMonth(); Intent i3=new Intent(View1.this,dataview.class); i3.putExtra("b",x); i3.putExtra("c",y); startActivity(i3); } }); } public void onItemSelected(AdapterView<?> parent, View1 view1, int position, long id) { // Get select item Toast.makeText(parent.getContext(), "OnItemSelectedListener : " + parent.getItemAtPosition(position).toString(), Toast.LENGTH_SHORT).show(); } public void setDate(android.view.View view) { showDialog(990); Toast.makeText(getApplicationContext(), "ca", Toast.LENGTH_SHORT) .show(); } protected Dialog onCreateDialog(int id) { // TODO Auto-generated method stub if (id == 990) { return new DatePickerDialog(this, myDateListener, year, month, day); } return null; } private DatePickerDialog.OnDateSetListener myDateListener = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker arg0, int arg1, int arg2, int arg3) { // TODO Auto-generated method stub // arg1 = year // arg2 = month // arg3 = day showDate(arg1, arg2 + 1, arg3); } }; private void showDate(int year, int month, int day) { e1.setText(new StringBuilder().append(day).append("/") .append(month).append("/").append(year)); } }
UTF-8
Java
6,285
java
View1.java
Java
[ { "context": "st;\n\nimport java.util.Calendar;\n\n/**\n * Created by Vivek Dalsaniya on 1/14/2016.\n */\npublic class View1 extends AppC", "end": 542, "score": 0.9998860359191895, "start": 527, "tag": "NAME", "value": "Vivek Dalsaniya" } ]
null
[]
package com.example.vivekdalsaniya.dailyexpenses; import android.app.DatePickerDialog; import android.app.Dialog; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.DatePicker; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import java.util.Calendar; /** * Created by <NAME> on 1/14/2016. */ public class View1 extends AppCompatActivity { private DatePicker datePicker; private Calendar calendar; private int year, month, day; private EditText e1; Spinner spinnerDropDown,spinnerDropDown1; String[] months = { "January", "February", "March", "April", "May", "June", "July", "August", "September","October","November","December"}; String[] years = { "2015","2016","2017","2018","2019","2020","2021","2022","2023" }; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setContentView(R.layout.view); android.support.v7.app.ActionBar actionBar = getSupportActionBar(); actionBar.setTitle("View1"); calendar = Calendar.getInstance(); year = calendar.get(Calendar.YEAR); month = calendar.get(Calendar.MONTH); day = calendar.get(Calendar.DAY_OF_MONTH); e1 = (EditText) findViewById(R.id.ve1); TextView t1 = (TextView) findViewById(R.id.vt2); spinnerDropDown=(Spinner)findViewById(R.id.vs1); spinnerDropDown1=(Spinner)findViewById(R.id.vs2); TextView t2=(TextView)findViewById(R.id.vt5); TextView t3=(TextView)findViewById(R.id.vt7); showDate(year, month + 1, day); ArrayAdapter<String> adapter= new ArrayAdapter<String>(this,android.R.layout.simple_spinner_dropdown_item ,months); ArrayAdapter<String> adapter1=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_dropdown_item,years); spinnerDropDown.setAdapter(adapter); spinnerDropDown1.setAdapter(adapter1); Button b1=(Button)findViewById(R.id.vb1); Button b2=(Button)findViewById(R.id.vb2); t3.setOnClickListener(new android.view.View.OnClickListener() { @Override public void onClick(android.view.View v) { dataview d3=new dataview(); d3.viewFull1(); Intent i1=new Intent(View1.this,dataview.class); startActivity(i1); } }); b1.setOnClickListener(new android.view.View.OnClickListener() { @Override public void onClick(android.view.View v) { dataview d4=new dataview(); d4.specDate(); Intent i2=new Intent(View1.this,dataview.class); i2.putExtra("a",e1.getText().toString()); startActivity(i2); } }); b2.setOnClickListener(new android.view.View.OnClickListener() { @Override public void onClick(android.view.View v) { String x=spinnerDropDown.getSelectedItem().toString(); String y=spinnerDropDown1.getSelectedItem().toString(); if(x.equals("January")){ x="1"; }else if(x.equals("February")){ x="2"; }else if(x.equals("March")){ x="3"; }else if(x.equals("April")){ x="4"; }else if(x.equals("May")){ x="5"; }else if(x.equals("June")){ x="6"; }else if(x.equals("July")){ x="7"; }else if(x.equals("August")){ x="8"; }else if(x.equals("September")){ x="9"; }else if(x.equals("October")){ x="10"; }else if(x.equals("November")){ x="11"; }else{ x="12"; } dataview d5=new dataview(); d5.setMonth(); Intent i3=new Intent(View1.this,dataview.class); i3.putExtra("b",x); i3.putExtra("c",y); startActivity(i3); } }); } public void onItemSelected(AdapterView<?> parent, View1 view1, int position, long id) { // Get select item Toast.makeText(parent.getContext(), "OnItemSelectedListener : " + parent.getItemAtPosition(position).toString(), Toast.LENGTH_SHORT).show(); } public void setDate(android.view.View view) { showDialog(990); Toast.makeText(getApplicationContext(), "ca", Toast.LENGTH_SHORT) .show(); } protected Dialog onCreateDialog(int id) { // TODO Auto-generated method stub if (id == 990) { return new DatePickerDialog(this, myDateListener, year, month, day); } return null; } private DatePickerDialog.OnDateSetListener myDateListener = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker arg0, int arg1, int arg2, int arg3) { // TODO Auto-generated method stub // arg1 = year // arg2 = month // arg3 = day showDate(arg1, arg2 + 1, arg3); } }; private void showDate(int year, int month, int day) { e1.setText(new StringBuilder().append(day).append("/") .append(month).append("/").append(year)); } }
6,276
0.52856
0.508353
170
35.970589
24.218229
127
false
false
0
0
0
0
0
0
0.8
false
false
14
8b30d7bf97dea12dd0b7bffefc1bc52de3b200ea
3,719,441,709,248
420f996957467c0d5e59b909f889cc47d43975d4
/src/main/java/com/randomuselessfact/challenge/model/FactsStatus.java
38cfff0e52874d33cb20f1d0f32169553947f3e0
[]
no_license
pstefaniak7/randomfact
https://github.com/pstefaniak7/randomfact
e659730a1d5dec36d7f7280be6b76c1123811be7
13b241f38449e8f63afb17b8b21a6915003c0bd8
refs/heads/master
2020-07-30T08:50:14.523000
2019-09-22T18:18:37
2019-09-22T18:18:37
210,162,004
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.randomuselessfact.challenge.model; /** * Status of the facts service. */ public class FactsStatus { public static class Facts { private long total; private long unique; public Facts() { } public Facts(long unique, long total) { this.total = total; this.unique = unique; } public long getTotal() { return total; } public void setTotal(long total) { this.total = total; } public long getUnique() { return unique; } public void setUnique(long unique) { this.unique = unique; } } private Status status = Status.PENDING; private Facts facts = new Facts(); public Status getStatus() { return status; } public void setStatus(Status status) { this.status = status; } public Facts getFacts() { return facts; } public void setFacts(Facts facts) { this.facts = facts; } }
UTF-8
Java
1,053
java
FactsStatus.java
Java
[]
null
[]
package com.randomuselessfact.challenge.model; /** * Status of the facts service. */ public class FactsStatus { public static class Facts { private long total; private long unique; public Facts() { } public Facts(long unique, long total) { this.total = total; this.unique = unique; } public long getTotal() { return total; } public void setTotal(long total) { this.total = total; } public long getUnique() { return unique; } public void setUnique(long unique) { this.unique = unique; } } private Status status = Status.PENDING; private Facts facts = new Facts(); public Status getStatus() { return status; } public void setStatus(Status status) { this.status = status; } public Facts getFacts() { return facts; } public void setFacts(Facts facts) { this.facts = facts; } }
1,053
0.538462
0.538462
56
17.803572
15.800565
47
false
false
0
0
0
0
0
0
0.285714
false
false
14
bf33beb50d13fa431d8d047116f12b4c90195646
21,646,635,194,171
d320d75efd65907abec928db621fdff93cfb11d1
/blog-impl/src/main/java/com/spr/blog/impl/BlogEntity.java
772d61f4d449dd959a0e761d94816dc61f692ad7
[ "Apache-2.0" ]
permissive
jvz/lagom-example
https://github.com/jvz/lagom-example
2a07c5867e8dfd612af1c87d36ec8ca2db9be14e
965f6a8dec248b638dcf1287d7ecb588a7e186b4
refs/heads/master
2020-12-24T10:58:56.108000
2016-11-23T20:37:46
2016-11-23T20:37:46
73,206,003
22
8
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.spr.blog.impl; import com.lightbend.lagom.javadsl.persistence.PersistentEntity; import java.util.Optional; import akka.Done; /** * Entity and behaviors for blog posts. * * @author Matt Sicker */ @SuppressWarnings("unchecked") public class BlogEntity extends PersistentEntity<BlogCommand, BlogEvent, BlogState> { @Override public Behavior initialBehavior(final Optional<BlogState> snapshotState) { final BehaviorBuilder b = newBehaviorBuilder(snapshotState.orElse(BlogState.EMPTY)); addBehaviorForGetPost(b); addBehaviorForAddPost(b); addBehaviorForUpdatePost(b); return b.build(); } private void addBehaviorForGetPost(final BehaviorBuilder b) { b.setReadOnlyCommandHandler(BlogCommand.GetPost.class, (cmd, ctx) -> ctx.reply(state().getContent())); } private void addBehaviorForAddPost(final BehaviorBuilder b) { b.setCommandHandler(BlogCommand.AddPost.class, (cmd, ctx) -> ctx.thenPersist( new BlogEvent.PostAdded(entityId(), cmd.getContent()), evt -> ctx.reply(entityId()) ) ); b.setEventHandler(BlogEvent.PostAdded.class, evt -> new BlogState(Optional.of(evt.getContent()))); } private void addBehaviorForUpdatePost(final BehaviorBuilder b) { b.setCommandHandler(BlogCommand.UpdatePost.class, (cmd, ctx) -> ctx.thenPersist( new BlogEvent.PostUpdated(entityId(), cmd.getContent()), evt -> ctx.reply(Done.getInstance()) ) ); b.setEventHandler(BlogEvent.PostUpdated.class, evt -> new BlogState(Optional.of(evt.getContent()))); } }
UTF-8
Java
1,762
java
BlogEntity.java
Java
[ { "context": "Entity and behaviors for blog posts.\n *\n * @author Matt Sicker\n */\n@SuppressWarnings(\"unchecked\")\npublic class B", "end": 210, "score": 0.9998551607131958, "start": 199, "tag": "NAME", "value": "Matt Sicker" } ]
null
[]
package com.spr.blog.impl; import com.lightbend.lagom.javadsl.persistence.PersistentEntity; import java.util.Optional; import akka.Done; /** * Entity and behaviors for blog posts. * * @author <NAME> */ @SuppressWarnings("unchecked") public class BlogEntity extends PersistentEntity<BlogCommand, BlogEvent, BlogState> { @Override public Behavior initialBehavior(final Optional<BlogState> snapshotState) { final BehaviorBuilder b = newBehaviorBuilder(snapshotState.orElse(BlogState.EMPTY)); addBehaviorForGetPost(b); addBehaviorForAddPost(b); addBehaviorForUpdatePost(b); return b.build(); } private void addBehaviorForGetPost(final BehaviorBuilder b) { b.setReadOnlyCommandHandler(BlogCommand.GetPost.class, (cmd, ctx) -> ctx.reply(state().getContent())); } private void addBehaviorForAddPost(final BehaviorBuilder b) { b.setCommandHandler(BlogCommand.AddPost.class, (cmd, ctx) -> ctx.thenPersist( new BlogEvent.PostAdded(entityId(), cmd.getContent()), evt -> ctx.reply(entityId()) ) ); b.setEventHandler(BlogEvent.PostAdded.class, evt -> new BlogState(Optional.of(evt.getContent()))); } private void addBehaviorForUpdatePost(final BehaviorBuilder b) { b.setCommandHandler(BlogCommand.UpdatePost.class, (cmd, ctx) -> ctx.thenPersist( new BlogEvent.PostUpdated(entityId(), cmd.getContent()), evt -> ctx.reply(Done.getInstance()) ) ); b.setEventHandler(BlogEvent.PostUpdated.class, evt -> new BlogState(Optional.of(evt.getContent()))); } }
1,757
0.644154
0.644154
50
34.240002
31.602886
108
false
false
0
0
0
0
0
0
0.56
false
false
14
da09cd74207162c01af4f1314f53f5e957de8de8
2,336,462,260,671
fdfd1c55795854a0f9203fcbe1d0eaf6fc33883f
/src/day32/pagetestcases/RegistrationPOM.java
9a2ab233f7bfbbca70901b635d98937ba92b0583
[]
no_license
krazyahmed/CodeBase
https://github.com/krazyahmed/CodeBase
e9ca1467aa4d002c4cf1cdd6cdf1f57fe8381fd3
ccd8644d52191e44ad705eab796417bf79ad57d1
refs/heads/master
2020-04-23T21:49:25.495000
2018-03-14T05:13:49
2018-03-14T05:13:49
171,481,908
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package day32.pagetestcases; import java.util.concurrent.TimeUnit; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.PageFactory; import org.testng.annotations.Test; import day32.pageclasses.Menu; import day32.pageclasses.RegisterMercuryTours; import day32.pageclasses.WelcomeMercuryTours; public class RegistrationPOM { @Test public void registration() { FirefoxDriver driver=new FirefoxDriver(); driver.get("http://newtours.demoaut.com"); driver.manage().timeouts().implicitlyWait(25,TimeUnit.SECONDS); WelcomeMercuryTours wmPage=PageFactory.initElements(driver,WelcomeMercuryTours.class); Menu menuPage=PageFactory.initElements(driver,Menu.class); RegisterMercuryTours rmPage=PageFactory.initElements(driver,RegisterMercuryTours.class); wmPage.register(); rmPage.contactInformation(); menuPage.home(); wmPage.findAFlight("tutorial","tutorial"); } }
UTF-8
Java
931
java
RegistrationPOM.java
Java
[]
null
[]
package day32.pagetestcases; import java.util.concurrent.TimeUnit; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.PageFactory; import org.testng.annotations.Test; import day32.pageclasses.Menu; import day32.pageclasses.RegisterMercuryTours; import day32.pageclasses.WelcomeMercuryTours; public class RegistrationPOM { @Test public void registration() { FirefoxDriver driver=new FirefoxDriver(); driver.get("http://newtours.demoaut.com"); driver.manage().timeouts().implicitlyWait(25,TimeUnit.SECONDS); WelcomeMercuryTours wmPage=PageFactory.initElements(driver,WelcomeMercuryTours.class); Menu menuPage=PageFactory.initElements(driver,Menu.class); RegisterMercuryTours rmPage=PageFactory.initElements(driver,RegisterMercuryTours.class); wmPage.register(); rmPage.contactInformation(); menuPage.home(); wmPage.findAFlight("tutorial","tutorial"); } }
931
0.794844
0.784103
34
26.382353
25.478958
90
false
false
0
0
0
0
0
0
1.676471
false
false
14
7f58629f39d8769c2a99a68d9a1e38644d877e0d
2,336,462,259,003
1c05c93632c4bb98bd7775c872c68ca1a6332484
/bookshopping/src/main/java/cn/ssm/controller/IndexController.java
998afbf364ce08e058468648ffe8851c8b159932
[]
no_license
wangxiuqiang/MyProject
https://github.com/wangxiuqiang/MyProject
926758e1f8048dfb7e25044c8221c5dc3c2949d5
67c08fabb3e30ed68e20541035260e02c99a69ef
refs/heads/master
2021-06-28T11:16:16.614000
2019-04-04T09:49:54
2019-04-04T09:49:54
113,673,292
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.ssm.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import cn.ssm.model.PageBean; import cn.ssm.model.Products; import cn.ssm.service.ProductService; @Controller public class IndexController { @Autowired private ProductService productService; @RequestMapping("showIndex") public String showIndex(Model model,Integer page,String type) { // //查询商品 // // List<Products> productsList = productService.findProductList(); // //将查询到的商品在首页面中展示 // // model.addAttribute("productsList", productsList); // return "index"; return showIndex1(model,page,type); } @RequestMapping("/") public String showIndex1(Model model,Integer page,String type) { //查询商品 //获取商品的总记录数 Integer count = productService.findCount(); //创建pageBean的对象 PageBean pageBean = new PageBean(8,page,count); model.addAttribute("pageBean", pageBean); //调用具有分页功能的页面 List<Products> productsList = productService.findProductListPage(pageBean); //将查询到的商品在首页面中展示 model.addAttribute("productsList", productsList); return "index"; } //打开后台管理页面 @RequestMapping("showAdminIndex") public String showAdminIndex() { return "admin/index"; } }
UTF-8
Java
1,653
java
IndexController.java
Java
[]
null
[]
package cn.ssm.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import cn.ssm.model.PageBean; import cn.ssm.model.Products; import cn.ssm.service.ProductService; @Controller public class IndexController { @Autowired private ProductService productService; @RequestMapping("showIndex") public String showIndex(Model model,Integer page,String type) { // //查询商品 // // List<Products> productsList = productService.findProductList(); // //将查询到的商品在首页面中展示 // // model.addAttribute("productsList", productsList); // return "index"; return showIndex1(model,page,type); } @RequestMapping("/") public String showIndex1(Model model,Integer page,String type) { //查询商品 //获取商品的总记录数 Integer count = productService.findCount(); //创建pageBean的对象 PageBean pageBean = new PageBean(8,page,count); model.addAttribute("pageBean", pageBean); //调用具有分页功能的页面 List<Products> productsList = productService.findProductListPage(pageBean); //将查询到的商品在首页面中展示 model.addAttribute("productsList", productsList); return "index"; } //打开后台管理页面 @RequestMapping("showAdminIndex") public String showAdminIndex() { return "admin/index"; } }
1,653
0.679868
0.677888
81
16.703703
20.486938
77
false
false
0
0
0
0
0
0
1.728395
false
false
14
e69cf04c2ec0ad946dc519b0ac2602d115215af4
2,336,462,260,912
edb606bb39cde2d94730bbb22e46b4dcde6f5b06
/src/test/java/com/TestCache12306.java
79f4cb4ae3f1586a51fb69f279143239444dc3f8
[]
no_license
P79N6A/java-core-learn
https://github.com/P79N6A/java-core-learn
ce6a6e7cf2af9264f0e19af7bc05fd5c4caddf8b
e70afadb9b7ddf0871d4649a149d4479b29714e6
refs/heads/master
2020-04-07T07:12:28.723000
2018-11-19T05:39:51
2018-11-19T05:39:51
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com; import com.cache12306.TicketService; import lombok.extern.slf4j.Slf4j; 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.SpringJUnit4ClassRunner; /** * @author: XiaoMingxuan * @email: mingxuan.xmx@alibaba-inc.com * @create: 2018-11-19 11:49 **/ @SpringBootTest(classes = Application.class) @RunWith(SpringJUnit4ClassRunner.class) @Slf4j public class TestCache12306 { @Autowired TicketService ticketService; @Test public void test01() { ticketService.queryTicketStock("G104"); } }
UTF-8
Java
706
java
TestCache12306.java
Java
[ { "context": "t.junit4.SpringJUnit4ClassRunner;\n\n/**\n * @author: XiaoMingxuan\n * @email: mingxuan.xmx@alibaba-inc.com\n * @creat", "end": 366, "score": 0.9997432827949524, "start": 354, "tag": "NAME", "value": "XiaoMingxuan" }, { "context": "ssRunner;\n\n/**\n * @author: XiaoMingxuan\n * @email: mingxuan.xmx@alibaba-inc.com\n * @create: 2018-11-19 11:49\n **/\n@SpringBootTest", "end": 406, "score": 0.9999362230300903, "start": 378, "tag": "EMAIL", "value": "mingxuan.xmx@alibaba-inc.com" } ]
null
[]
package com; import com.cache12306.TicketService; import lombok.extern.slf4j.Slf4j; 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.SpringJUnit4ClassRunner; /** * @author: XiaoMingxuan * @email: <EMAIL> * @create: 2018-11-19 11:49 **/ @SpringBootTest(classes = Application.class) @RunWith(SpringJUnit4ClassRunner.class) @Slf4j public class TestCache12306 { @Autowired TicketService ticketService; @Test public void test01() { ticketService.queryTicketStock("G104"); } }
685
0.767705
0.720963
28
24.214285
20.315998
71
false
false
0
0
0
0
0
0
0.357143
false
false
14
0ae99232920159cdbfe93bc2c0d0048fe8b8a410
21,337,397,559,830
c3fd67f6e9852d58e1dfef31338489a54b232fd1
/src/main/java/com/bysj/utils/MyConstant.java
97e9d912ea1b802906430b33a3188eade1d5526b
[]
no_license
black0723/springboot01
https://github.com/black0723/springboot01
30757160c584eddafec65e6c95fb67bee9caac47
bf8c271afe9cb22653d4eddb368a440591bda577
refs/heads/master
2023-05-27T10:17:10.842000
2019-11-20T11:39:47
2019-11-20T11:39:47
197,673,079
0
0
null
false
2023-05-06T08:06:44
2019-07-19T00:12:30
2019-11-20T11:39:58
2023-05-06T08:06:43
2,677
0
0
3
JavaScript
false
false
package com.bysj.utils; import java.util.*; public class MyConstant { public static String UPLOAD_URL = "D:/upload"; public static String USER_ADMIN = "学工处"; public static String USER_MIDDLE = "辅导员"; public static String USER_LOW = "学生"; public static Map<String, Object> getDictionary() { Map<String, Object> map = new HashMap<>(); map.put("SYS_ROLE", getRoles()); map.put("SYS_NAME", "系统名称"); return map; } public static Map<String, Object> getRoles() { Map<String, Object> map = new LinkedHashMap<>(); map.put("admin-login", new LinkedList<>(Arrays.asList(USER_ADMIN))); map.put("admin-register", new LinkedList<>(Arrays.asList(USER_ADMIN, USER_MIDDLE))); map.put("client-login", new LinkedList<>(Arrays.asList(USER_MIDDLE, USER_LOW))); map.put("client-register", new LinkedList<>(Arrays.asList(USER_MIDDLE, USER_LOW))); return map; } }
UTF-8
Java
982
java
MyConstant.java
Java
[]
null
[]
package com.bysj.utils; import java.util.*; public class MyConstant { public static String UPLOAD_URL = "D:/upload"; public static String USER_ADMIN = "学工处"; public static String USER_MIDDLE = "辅导员"; public static String USER_LOW = "学生"; public static Map<String, Object> getDictionary() { Map<String, Object> map = new HashMap<>(); map.put("SYS_ROLE", getRoles()); map.put("SYS_NAME", "系统名称"); return map; } public static Map<String, Object> getRoles() { Map<String, Object> map = new LinkedHashMap<>(); map.put("admin-login", new LinkedList<>(Arrays.asList(USER_ADMIN))); map.put("admin-register", new LinkedList<>(Arrays.asList(USER_ADMIN, USER_MIDDLE))); map.put("client-login", new LinkedList<>(Arrays.asList(USER_MIDDLE, USER_LOW))); map.put("client-register", new LinkedList<>(Arrays.asList(USER_MIDDLE, USER_LOW))); return map; } }
982
0.629436
0.629436
28
33.214287
29.193146
92
false
false
0
0
0
0
0
0
1.035714
false
false
14
a1d33bbbf61e35ef301025de8cc1e3370abb61ae
13,005,161,003,357
db5d09e960008984c8025a1611a66d87d4a3effd
/spotify-be/src/main/java/app/spotify/spotifybe/repository/UserRepository.java
2d343121773a1d656e3a855b69b22ea38eee2196
[]
no_license
inuski/app-spotify-be
https://github.com/inuski/app-spotify-be
306efa58935e928e358959204bb2051e7dbf293c
43315d8b821be249747027b383182d75095765b9
refs/heads/master
2023-07-01T08:48:50.274000
2021-04-05T21:33:16
2021-04-05T21:33:16
343,385,228
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package app.spotify.spotifybe.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import app.spotify.spotifybe.model.PaymentMethod; import app.spotify.spotifybe.model.User; public interface UserRepository extends JpaRepository<User,String>{ @Query("Select sum(u.balance) from User u") public double getAllBalance(); @Query("Select count(u) from User u where u.id in (Select s.user.id from Staff s where s.online='1')") public int getOnlineStaff(); public User findByEmail(String email); @Query(value = "SELECT * FROM spotify.users u WHERE u.email=?1 AND u.password=?2", nativeQuery = true) public User findByEmailAndPassword( String email, String password); }
UTF-8
Java
814
java
UserRepository.java
Java
[ { "context": " spotify.users u WHERE u.email=?1 AND u.password=?2\", \n\t\t\t nativeQuery = true)\n\tpublic User findByEm", "end": 713, "score": 0.5348716974258423, "start": 712, "tag": "PASSWORD", "value": "2" } ]
null
[]
package app.spotify.spotifybe.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import app.spotify.spotifybe.model.PaymentMethod; import app.spotify.spotifybe.model.User; public interface UserRepository extends JpaRepository<User,String>{ @Query("Select sum(u.balance) from User u") public double getAllBalance(); @Query("Select count(u) from User u where u.id in (Select s.user.id from Staff s where s.online='1')") public int getOnlineStaff(); public User findByEmail(String email); @Query(value = "SELECT * FROM spotify.users u WHERE u.email=?1 AND u.password=?2", nativeQuery = true) public User findByEmailAndPassword( String email, String password); }
814
0.777641
0.773956
24
32.916668
30.171616
103
false
false
0
0
0
0
0
0
1
false
false
14
d6dc667df846ea75e964dc5bd22832e2bb65b782
13,005,161,004,357
b271633834851e6c44fe697d6bb1cbfdf7d27681
/app/src/main/java/model/db/DBHelper.java
64b7ddc829a41d8d51a5280aa8f06d94ed04eebe
[]
no_license
zengli199447/architectureMvp
https://github.com/zengli199447/architectureMvp
8369d67918210e2e68bb80e9575f9629f8d2ad6c
cd0615a1515ec97d3e3a8d771922a264ef4adbd0
refs/heads/master
2020-04-09T01:58:00.728000
2018-12-01T08:26:44
2018-12-01T08:26:44
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package model.db; import java.util.List; import model.db.entity.LoginUserInfo; /** * Created by Administrator on 2018/1/5. */ public interface DBHelper { //---------------------------条件查询--------------------------------------- /** * 查询 LoginUserInfo数据 * * @return */ LoginUserInfo queryLoginUserInfo(String mUserName); //---------------------------查询所有(无筛选条件)--------------------------- /** * 查询所有 LoginUserInfo数据 * * @return */ List<LoginUserInfo> loadLoginUserInfo(); //---------------------------插入数据(更新数据)----------------------------- /** * 插入一条 LoginUserInfo数据 * * @return */ void insertLoginUserInfo(LoginUserInfo mLoginUserInfo); //---------------------------删除数据(条件删除)------------------------------- /** * 删除一个 LoginUserInfo数据 * * @return */ void deleteLoginUserInfo(String mUserName); //---------------------------修改数据()------------------------------- /** * 修改一条 IpAndPortInfo数据 * * @return */ void UpDataLoginUserInfo(LoginUserInfo mLoginUserInfo); }
UTF-8
Java
1,271
java
DBHelper.java
Java
[ { "context": " model.db.entity.LoginUserInfo;\n\n/**\n * Created by Administrator on 2018/1/5.\n */\n\npublic interface DBHelper {\n\n ", "end": 113, "score": 0.4156535267829895, "start": 100, "tag": "NAME", "value": "Administrator" } ]
null
[]
package model.db; import java.util.List; import model.db.entity.LoginUserInfo; /** * Created by Administrator on 2018/1/5. */ public interface DBHelper { //---------------------------条件查询--------------------------------------- /** * 查询 LoginUserInfo数据 * * @return */ LoginUserInfo queryLoginUserInfo(String mUserName); //---------------------------查询所有(无筛选条件)--------------------------- /** * 查询所有 LoginUserInfo数据 * * @return */ List<LoginUserInfo> loadLoginUserInfo(); //---------------------------插入数据(更新数据)----------------------------- /** * 插入一条 LoginUserInfo数据 * * @return */ void insertLoginUserInfo(LoginUserInfo mLoginUserInfo); //---------------------------删除数据(条件删除)------------------------------- /** * 删除一个 LoginUserInfo数据 * * @return */ void deleteLoginUserInfo(String mUserName); //---------------------------修改数据()------------------------------- /** * 修改一条 IpAndPortInfo数据 * * @return */ void UpDataLoginUserInfo(LoginUserInfo mLoginUserInfo); }
1,271
0.430324
0.425066
61
17.704918
22.56818
76
false
false
0
0
0
0
0
0
0.131148
false
false
14
0870c5d834ccb5bcb22e291eaf52cbcce689f8d9
9,947,144,299,726
3c569af6f6cff937e0b41d086761eb59ff144df5
/app/src/main/java/com/example/jpr_dealear/Activity/Dealears_listActivity.java
0d5b6d7d7323eddfcb80effc06f677c60552e7f4
[]
no_license
shubhamdwivedibhumca15/Jpr_Dealear
https://github.com/shubhamdwivedibhumca15/Jpr_Dealear
f43daa2873893fcd0ef28c47825e864fd562972d
8daf17bee6676332daa80efcbfd575378a2a106b
refs/heads/master
2020-06-02T12:45:52.967000
2019-06-10T11:45:34
2019-06-10T11:45:34
191,157,727
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.jpr_dealear.Activity; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.CardView; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.Menu; import android.view.MenuItem; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.example.jpr_dealear.Constants; import com.example.jpr_dealear.Database.DatabaseHalper; import com.example.jpr_dealear.DealerModel; import com.example.jpr_dealear.R; import com.example.jpr_dealear.DealearsAdapter; import java.util.List; import static com.example.jpr_dealear.Constants.USER_ID; public class Dealears_listActivity extends AppCompatActivity implements DealearsAdapter.OnLongClickAction{ ImageView imageView; TextView dealearsname,dealearsphone; CardView cardView; private int userid; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.recyclerview); dealearsname=findViewById(R.id.name1); dealearsphone=findViewById(R.id.number1); imageView = findViewById(R.id.callicon); cardView =findViewById(R.id.cardview); Intent i=getIntent(); userid=i.getIntExtra(Constants.USER_ID,0); } @Override protected void onResume() { super.onResume(); RecyclerView dealearslist=findViewById(R.id.dealearslist); dealearslist.setLayoutManager(new LinearLayoutManager(this)); DatabaseHalper databaseHalper = new DatabaseHalper(this); List<DealerModel> dealers = databaseHalper.getAllDealears(userid); DealearsAdapter adapter = new DealearsAdapter(this,dealers); adapter.setOnLongClick(this); dealearslist.setAdapter(adapter); } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle item selection switch (item.getItemId()) { case R.id.add_dealears: Intent i = new Intent(Dealears_listActivity.this, Add_DealearsActivity.class); i.putExtra(USER_ID,userid); startActivity(i); return true; case R.id.mark_attendence: return true; default: return super.onOptionsItemSelected(item); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu, menu); return true; } @Override public void onLongClick(int position) { Toast.makeText(this,"Hi",Toast.LENGTH_LONG).show(); } }
UTF-8
Java
2,829
java
Dealears_listActivity.java
Java
[]
null
[]
package com.example.jpr_dealear.Activity; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.CardView; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.Menu; import android.view.MenuItem; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.example.jpr_dealear.Constants; import com.example.jpr_dealear.Database.DatabaseHalper; import com.example.jpr_dealear.DealerModel; import com.example.jpr_dealear.R; import com.example.jpr_dealear.DealearsAdapter; import java.util.List; import static com.example.jpr_dealear.Constants.USER_ID; public class Dealears_listActivity extends AppCompatActivity implements DealearsAdapter.OnLongClickAction{ ImageView imageView; TextView dealearsname,dealearsphone; CardView cardView; private int userid; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.recyclerview); dealearsname=findViewById(R.id.name1); dealearsphone=findViewById(R.id.number1); imageView = findViewById(R.id.callicon); cardView =findViewById(R.id.cardview); Intent i=getIntent(); userid=i.getIntExtra(Constants.USER_ID,0); } @Override protected void onResume() { super.onResume(); RecyclerView dealearslist=findViewById(R.id.dealearslist); dealearslist.setLayoutManager(new LinearLayoutManager(this)); DatabaseHalper databaseHalper = new DatabaseHalper(this); List<DealerModel> dealers = databaseHalper.getAllDealears(userid); DealearsAdapter adapter = new DealearsAdapter(this,dealers); adapter.setOnLongClick(this); dealearslist.setAdapter(adapter); } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle item selection switch (item.getItemId()) { case R.id.add_dealears: Intent i = new Intent(Dealears_listActivity.this, Add_DealearsActivity.class); i.putExtra(USER_ID,userid); startActivity(i); return true; case R.id.mark_attendence: return true; default: return super.onOptionsItemSelected(item); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu, menu); return true; } @Override public void onLongClick(int position) { Toast.makeText(this,"Hi",Toast.LENGTH_LONG).show(); } }
2,829
0.698834
0.696359
95
28.778948
24.417931
106
false
false
0
0
0
0
0
0
0.6
false
false
14
4da24f7e7d29d65b328c774f5fb0e7928c21be75
30,562,987,317,750
b3c865cf8115bba15ce85ba0749ab252e45f1b2a
/nim_demo/demo/src/com/android/samchat/activity/SamchatFaqActivity.java
827d810fc3a659d4dcafc56356c31f71c70e1d34
[]
no_license
samchat-org/android
https://github.com/samchat-org/android
66c4ba9941c283bdfbd3a9ba2dc5bce0196070ad
fb54022ffc95894796d7021df8e262496d27e281
refs/heads/master
2020-05-22T02:53:04.611000
2016-11-18T13:06:11
2016-11-18T13:06:11
63,519,106
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.android.samchat.activity; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import com.android.samchat.R; import android.widget.FrameLayout; public class SamchatFaqActivity extends Activity { private static final String TAG = SamchatFaqActivity.class.getSimpleName(); private FrameLayout back_arrow_layout; public static void start(Context context) { Intent intent = new Intent(context, SamchatFaqActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); context.startActivity(intent); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.samchat_faq_activity); setupPanel(); } @Override protected void onDestroy() { super.onDestroy(); } private void setupPanel() { back_arrow_layout = (FrameLayout)findViewById(R.id.back_arrow_layout); setupBackArrowClick(); } private void setupBackArrowClick(){ back_arrow_layout.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { finish(); } }); } }
UTF-8
Java
1,309
java
SamchatFaqActivity.java
Java
[]
null
[]
package com.android.samchat.activity; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import com.android.samchat.R; import android.widget.FrameLayout; public class SamchatFaqActivity extends Activity { private static final String TAG = SamchatFaqActivity.class.getSimpleName(); private FrameLayout back_arrow_layout; public static void start(Context context) { Intent intent = new Intent(context, SamchatFaqActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); context.startActivity(intent); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.samchat_faq_activity); setupPanel(); } @Override protected void onDestroy() { super.onDestroy(); } private void setupPanel() { back_arrow_layout = (FrameLayout)findViewById(R.id.back_arrow_layout); setupBackArrowClick(); } private void setupBackArrowClick(){ back_arrow_layout.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { finish(); } }); } }
1,309
0.725745
0.724981
49
24.428572
22.767681
84
false
false
0
0
0
0
0
0
1.489796
false
false
14
b7ae6935a49df20c0042679d5e67f25f619757ac
4,209,067,995,997
ddbe2fc241d4161310fc58d049ff8efabd4d9b9c
/src/org/usfirst/frc/team1157/robot/subsystems/DriveTrain.java
d1983a17415fb93bf15fbf56fa2df1bd6a646348
[ "MIT" ]
permissive
Team1157/2018-PowerDown
https://github.com/Team1157/2018-PowerDown
c4fb5c11acc62ba4c3cd3226adef9853b0d1e5c7
7d6b4c8706357b9c52683dbc9137cf57794225de
refs/heads/master
2021-03-24T12:55:06.343000
2018-09-14T17:14:28
2018-09-14T17:14:28
116,514,911
1
3
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.usfirst.frc.team1157.robot.subsystems; import org.usfirst.frc.team1157.robot.RobotMap; import org.usfirst.frc.team1157.robot.commands.ArcadeJoy; import com.ctre.phoenix.motorcontrol.ControlMode; import com.ctre.phoenix.motorcontrol.FeedbackDevice; import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX; import edu.wpi.first.wpilibj.command.Subsystem; import edu.wpi.first.wpilibj.drive.DifferentialDrive; /** * Main drive chain for robot Default command: PSTank */ public class DriveTrain extends Subsystem { public WPI_TalonSRX rightMotor = new WPI_TalonSRX(RobotMap.rightMotor); public WPI_TalonSRX leftMotor = new WPI_TalonSRX(RobotMap.leftMotor); public WPI_TalonSRX rightSlave = new WPI_TalonSRX(RobotMap.rightSlave); public WPI_TalonSRX leftSlave = new WPI_TalonSRX(RobotMap.leftSlave); public DifferentialDrive tankDrive = new DifferentialDrive(leftMotor, rightMotor); public DriveTrain() { rightSlave.set(ControlMode.Follower, RobotMap.rightMotor); leftSlave.set(ControlMode.Follower, RobotMap.leftMotor); leftMotor.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative, 0, 10); tankDrive.setSafetyEnabled(false); } public void initDefaultCommand() { // setDefaultCommand(new PSTank()); // setDefaultCommand(new ArcadeJoy()); setDefaultCommand(new ArcadeJoy()); } public void stop() { rightMotor.set(0); leftMotor.set(0); } }
UTF-8
Java
1,449
java
DriveTrain.java
Java
[]
null
[]
package org.usfirst.frc.team1157.robot.subsystems; import org.usfirst.frc.team1157.robot.RobotMap; import org.usfirst.frc.team1157.robot.commands.ArcadeJoy; import com.ctre.phoenix.motorcontrol.ControlMode; import com.ctre.phoenix.motorcontrol.FeedbackDevice; import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX; import edu.wpi.first.wpilibj.command.Subsystem; import edu.wpi.first.wpilibj.drive.DifferentialDrive; /** * Main drive chain for robot Default command: PSTank */ public class DriveTrain extends Subsystem { public WPI_TalonSRX rightMotor = new WPI_TalonSRX(RobotMap.rightMotor); public WPI_TalonSRX leftMotor = new WPI_TalonSRX(RobotMap.leftMotor); public WPI_TalonSRX rightSlave = new WPI_TalonSRX(RobotMap.rightSlave); public WPI_TalonSRX leftSlave = new WPI_TalonSRX(RobotMap.leftSlave); public DifferentialDrive tankDrive = new DifferentialDrive(leftMotor, rightMotor); public DriveTrain() { rightSlave.set(ControlMode.Follower, RobotMap.rightMotor); leftSlave.set(ControlMode.Follower, RobotMap.leftMotor); leftMotor.configSelectedFeedbackSensor(FeedbackDevice.CTRE_MagEncoder_Relative, 0, 10); tankDrive.setSafetyEnabled(false); } public void initDefaultCommand() { // setDefaultCommand(new PSTank()); // setDefaultCommand(new ArcadeJoy()); setDefaultCommand(new ArcadeJoy()); } public void stop() { rightMotor.set(0); leftMotor.set(0); } }
1,449
0.764665
0.752933
45
30.200001
27.940889
89
false
false
0
0
0
0
0
0
1.244444
false
false
14
46ace3bc83bbbb55760213f6b041c9e989736655
16,234,976,417,985
3bf4d98f7ab4ff342a3683b91860ea086aeaa0a7
/src/main/java/com/wdx/design/WebService/Client/ClientServer.java
bb9278dacafaf8379a75e03bea793e7e24a73629
[]
no_license
wdx082018/springstudy
https://github.com/wdx082018/springstudy
5796824573db787f93adffd5ef4b142b8603013c
49d012cd4ae5ca982c4d0b70a3620ef5cd2a5c43
refs/heads/master
2020-05-05T12:47:02.084000
2019-04-22T06:12:33
2019-04-22T06:12:33
180,044,749
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wdx.design.WebService.Client; import com.wdx.design.WebService.Server.impl.ServerImpl; import org.apache.cxf.endpoint.Client; import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory; public class ClientServer { public static void main(String[] args) { /*ServerImpl server = new ServerImpl(); String result = server.SayHello("wdx"); System.out.println("result is " + result);*/ /*JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance(); Client client = factory.createClient("http://localhost:8800/webServer/service?wsdl"); Object[] inputs = {"www"}; Object[] result = null; try { result = client.invoke("SayHello", inputs); System.out.println("result is " + result[0]); } catch (Exception e) { e.printStackTrace(); }*/ JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance(); Client client = factory.createClient("http://172.18.1.17/default/webCommonService?wsdl"); Object[] inputs = {"1", "1523547900000"}; Object[] result = null; try { result = client.invoke("invoke", inputs); System.out.println("result is " + result[0]); } catch (Exception e) { e.printStackTrace(); } } }
UTF-8
Java
1,259
java
ClientServer.java
Java
[ { "context": "\n Client client = factory.createClient(\"http://172.18.1.17/default/webCommonService?wsdl\");\n Object[] inp", "end": 973, "score": 0.9962972402572632, "start": 962, "tag": "IP_ADDRESS", "value": "172.18.1.17" } ]
null
[]
package com.wdx.design.WebService.Client; import com.wdx.design.WebService.Server.impl.ServerImpl; import org.apache.cxf.endpoint.Client; import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory; public class ClientServer { public static void main(String[] args) { /*ServerImpl server = new ServerImpl(); String result = server.SayHello("wdx"); System.out.println("result is " + result);*/ /*JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance(); Client client = factory.createClient("http://localhost:8800/webServer/service?wsdl"); Object[] inputs = {"www"}; Object[] result = null; try { result = client.invoke("SayHello", inputs); System.out.println("result is " + result[0]); } catch (Exception e) { e.printStackTrace(); }*/ JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance(); Client client = factory.createClient("http://172.18.1.17/default/webCommonService?wsdl"); Object[] inputs = {"1", "1523547900000"}; Object[] result = null; try { result = client.invoke("invoke", inputs); System.out.println("result is " + result[0]); } catch (Exception e) { e.printStackTrace(); } } }
1,259
0.681493
0.659253
39
31.282051
27.069662
93
false
false
0
0
0
0
0
0
0.615385
false
false
14
2278f2061583dc9956c5faf3fafdfa2e1aacd732
24,730,421,724,203
dfcd4f4a44ef633cd0faf5330a08c0797c67071f
/cs309_java_project/Backend/VanceKaw/spring_health/src/main/java/myProject/HospitalListService.java
cf54220fa8639f8ea4d164e1dd8a61484262b7e6
[]
no_license
vjkkaw18/coms_work
https://github.com/vjkkaw18/coms_work
5aaf6a83d3cb02596504b932fc98ef6567c22562
93aa04be90d79ac5ae519acdf40f170d7567a841
refs/heads/main
2023-01-28T16:09:38.458000
2020-12-09T04:33:36
2020-12-09T04:33:36
319,837,686
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package myProject; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class HospitalListService { @Autowired private HospitalListDB repository; public List<HospitalList> getHospitalByState(String state) { return repository.findByState(state); } public HospitalList getHospitalById(int fid) { return repository.findById(fid); } }
UTF-8
Java
446
java
HospitalListService.java
Java
[]
null
[]
package myProject; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class HospitalListService { @Autowired private HospitalListDB repository; public List<HospitalList> getHospitalByState(String state) { return repository.findByState(state); } public HospitalList getHospitalById(int fid) { return repository.findById(fid); } }
446
0.798206
0.798206
22
19.272728
20.631357
62
false
false
0
0
0
0
0
0
0.954545
false
false
14
ecda9e70d295fb745ea25ea688334b2ea24c91b0
24,730,421,728,094
497fcb88c10c94fed1caa160ee110561c07b594c
/web/web-lobby/src/test/java/com/yazino/web/controller/LoadBalancerControllerTest.java
246880e62f4d0be8b665be6f59156c69a69ec76b
[]
no_license
ShahakBH/jazzino-master
https://github.com/ShahakBH/jazzino-master
3f116a609c5648c00dfbe6ab89c6c3ce1903fc1a
2401394022106d2321873d15996953f2bbc2a326
refs/heads/master
2016-09-02T01:26:44.514000
2015-08-10T13:06:54
2015-08-10T13:06:54
40,482,590
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yazino.web.controller; import com.yazino.platform.session.SessionService; import com.yazino.web.util.WebApiResponses; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; import static java.util.Collections.singletonMap; import static org.mockito.Mockito.*; @RunWith(MockitoJUnitRunner.class) public class LoadBalancerControllerTest { @Mock private SessionService sessionService; @Mock private WebApiResponses webApiResponses; @Mock private HttpServletResponse response; private LoadBalancerController underTest; @Before public void setUp() throws IOException { when(sessionService.countSessions(false)).thenReturn(120); if (loadBalancerFile().exists() && !loadBalancerFile().delete()) { throw new IllegalStateException("Could not delete old test file: " + loadBalancerFile()); } underTest = new LoadBalancerController(sessionService, webApiResponses, loadBalancerFile()); } @Test public void theStatusIsReturnedAsOkayWhenEverythingIsGood() throws IOException { underTest.checkStatus(response); verify(webApiResponses).writeOk(response, singletonMap("status", "okay")); } @Test public void theStatusIsReturnedAsSuspendedWhenTheSuspensionFileExists() throws IOException { if (!loadBalancerFile().createNewFile()) { throw new IllegalStateException("Couldn't create test file: " + loadBalancerFile()); } loadBalancerFile().deleteOnExit(); underTest.checkStatus(response); verify(webApiResponses).writeOk(response, singletonMap("status", "suspended")); } @Test public void theStatusIsReturnedAsGridErrorWhenTheSpaceTestQueryFails() throws IOException { reset(sessionService); when(sessionService.countSessions(false)).thenThrow(new RuntimeException("aTestException")); underTest.checkStatus(response); verify(webApiResponses).writeOk(response, singletonMap("status", "grid-error")); } private File loadBalancerFile() { return new File(System.getProperty("java.io.tmpdir") + "/suspendFromLoadBalancer"); } }
UTF-8
Java
2,366
java
LoadBalancerControllerTest.java
Java
[]
null
[]
package com.yazino.web.controller; import com.yazino.platform.session.SessionService; import com.yazino.web.util.WebApiResponses; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; import static java.util.Collections.singletonMap; import static org.mockito.Mockito.*; @RunWith(MockitoJUnitRunner.class) public class LoadBalancerControllerTest { @Mock private SessionService sessionService; @Mock private WebApiResponses webApiResponses; @Mock private HttpServletResponse response; private LoadBalancerController underTest; @Before public void setUp() throws IOException { when(sessionService.countSessions(false)).thenReturn(120); if (loadBalancerFile().exists() && !loadBalancerFile().delete()) { throw new IllegalStateException("Could not delete old test file: " + loadBalancerFile()); } underTest = new LoadBalancerController(sessionService, webApiResponses, loadBalancerFile()); } @Test public void theStatusIsReturnedAsOkayWhenEverythingIsGood() throws IOException { underTest.checkStatus(response); verify(webApiResponses).writeOk(response, singletonMap("status", "okay")); } @Test public void theStatusIsReturnedAsSuspendedWhenTheSuspensionFileExists() throws IOException { if (!loadBalancerFile().createNewFile()) { throw new IllegalStateException("Couldn't create test file: " + loadBalancerFile()); } loadBalancerFile().deleteOnExit(); underTest.checkStatus(response); verify(webApiResponses).writeOk(response, singletonMap("status", "suspended")); } @Test public void theStatusIsReturnedAsGridErrorWhenTheSpaceTestQueryFails() throws IOException { reset(sessionService); when(sessionService.countSessions(false)).thenThrow(new RuntimeException("aTestException")); underTest.checkStatus(response); verify(webApiResponses).writeOk(response, singletonMap("status", "grid-error")); } private File loadBalancerFile() { return new File(System.getProperty("java.io.tmpdir") + "/suspendFromLoadBalancer"); } }
2,366
0.729501
0.728233
74
30.972973
31.942505
101
false
false
0
0
0
0
0
0
0.527027
false
false
14
cdb8de59305e1ed64c6d0e9c35b80e33bc384329
8,246,337,254,920
d4b9513b0529bfeb58c364379f167208863617ca
/src/main/java/br/com/matheus/moiptest/dto/PaymentRequestBody.java
ecc8bae229fa43e216b1c6680a330e97ce1e18a4
[]
no_license
MathBrandino/moip-test
https://github.com/MathBrandino/moip-test
21b30e9d8de8df8f5c24057c4f412e652a36a0ec
3905d131712a0e8a1f4f072e3712ae01e57d7d96
refs/heads/master
2020-03-23T23:26:44.315000
2018-07-25T03:52:03
2018-07-25T03:52:03
142,234,661
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.matheus.moiptest.dto; import br.com.matheus.moiptest.model.buyer.Buyer; import br.com.matheus.moiptest.model.client.Client; import javax.validation.Valid; import com.fasterxml.jackson.annotation.JsonProperty; public class PaymentRequestBody { @JsonProperty("payment") @Valid private PaymentMethodDTO paymentDTO; @JsonProperty("buyer") @Valid private Buyer buyer; @JsonProperty("client") private Client client; public PaymentMethodDTO getPaymentDTO() { return paymentDTO; } public Buyer getBuyer() { return buyer; } public Client getClient() { return client; } }
UTF-8
Java
668
java
PaymentRequestBody.java
Java
[]
null
[]
package br.com.matheus.moiptest.dto; import br.com.matheus.moiptest.model.buyer.Buyer; import br.com.matheus.moiptest.model.client.Client; import javax.validation.Valid; import com.fasterxml.jackson.annotation.JsonProperty; public class PaymentRequestBody { @JsonProperty("payment") @Valid private PaymentMethodDTO paymentDTO; @JsonProperty("buyer") @Valid private Buyer buyer; @JsonProperty("client") private Client client; public PaymentMethodDTO getPaymentDTO() { return paymentDTO; } public Buyer getBuyer() { return buyer; } public Client getClient() { return client; } }
668
0.693114
0.693114
35
18.085714
17.231817
53
false
false
0
0
0
0
0
0
0.314286
false
false
14
555001cb3bec52572d8e114a035ad5747037c312
17,858,474,060,719
0402a6a162b4e1272efd5c5cfb306e4fc6c2beb8
/src/main/java/com/gitblit/client/ClosableTabComponent.java
f6bbaebc15f6f481911a7c7f9449444a56b2b87f
[ "Apache-1.1", "CC-BY-4.0", "CDDL-1.0", "MIT", "BSD-3-Clause", "EPL-1.0", "OFL-1.1", "LGPL-2.1-or-later", "GPL-2.0-only", "Apache-2.0", "LicenseRef-scancode-public-domain", "GPL-1.0-or-later", "CC-BY-3.0" ]
permissive
gitblit-org/gitblit
https://github.com/gitblit-org/gitblit
a3b6df11da2f67c3e5d43a1cca43df33a63e54ed
e45fe069441d0cde5391e381500aab93a7fa11ac
refs/heads/master
2023-04-29T12:17:39.003000
2023-04-06T18:19:04
2023-04-06T18:19:04
1,937,202
85
21
Apache-2.0
false
2023-04-03T20:42:58
2011-06-22T19:54:49
2023-04-01T02:40:35
2023-04-03T20:42:57
23,429
2,154
661
232
Java
false
false
/* * Copyright 2011 gitblit.com. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.gitblit.client; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Stroke; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.AbstractButton; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.plaf.basic.BasicButtonUI; /** * Closable tab control. */ public class ClosableTabComponent extends JPanel { private static final long serialVersionUID = 1L; private static final MouseListener BUTTON_MOUSE_LISTENER = new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { Component component = e.getComponent(); if (component instanceof AbstractButton) { AbstractButton button = (AbstractButton) component; button.setBorderPainted(true); } } @Override public void mouseExited(MouseEvent e) { Component component = e.getComponent(); if (component instanceof AbstractButton) { AbstractButton button = (AbstractButton) component; button.setBorderPainted(false); } } }; private final JTabbedPane pane; private final JLabel label; private final JButton button = new TabButton(); private final CloseTabListener closeListener; public interface CloseTabListener { void closeTab(Component c); } public ClosableTabComponent(String title, ImageIcon icon, JTabbedPane pane, CloseTabListener closeListener) { super(new FlowLayout(FlowLayout.LEFT, 0, 0)); this.closeListener = closeListener; if (pane == null) { throw new NullPointerException("TabbedPane is null"); } this.pane = pane; setOpaque(false); label = new JLabel(title); if (icon != null) { label.setIcon(icon); } add(label); label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); add(button); setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0)); } private class TabButton extends JButton implements ActionListener { private static final long serialVersionUID = 1L; public TabButton() { int size = 17; setPreferredSize(new Dimension(size, size)); setToolTipText("Close"); setUI(new BasicButtonUI()); setContentAreaFilled(false); setFocusable(false); setBorder(BorderFactory.createEtchedBorder()); setBorderPainted(false); addMouseListener(BUTTON_MOUSE_LISTENER); setRolloverEnabled(true); addActionListener(this); } @Override public void actionPerformed(ActionEvent e) { int i = pane.indexOfTabComponent(ClosableTabComponent.this); Component c = pane.getComponentAt(i); if (i != -1) { pane.remove(i); } if (closeListener != null) { closeListener.closeTab(c); } } @Override public void updateUI() { } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; Stroke stroke = g2.getStroke(); g2.setStroke(new BasicStroke(2)); g.setColor(Color.BLACK); if (getModel().isRollover()) { Color highlight = new Color(0, 51, 153); g.setColor(highlight); } int delta = 5; g.drawLine(delta, delta, getWidth() - delta - 1, getHeight() - delta - 1); g.drawLine(getWidth() - delta - 1, delta, delta, getHeight() - delta - 1); g2.setStroke(stroke); int i = pane.indexOfTabComponent(ClosableTabComponent.this); pane.setTitleAt(i, label.getText()); } } }
UTF-8
Java
4,257
java
ClosableTabComponent.java
Java
[]
null
[]
/* * Copyright 2011 gitblit.com. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.gitblit.client; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Stroke; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.AbstractButton; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.plaf.basic.BasicButtonUI; /** * Closable tab control. */ public class ClosableTabComponent extends JPanel { private static final long serialVersionUID = 1L; private static final MouseListener BUTTON_MOUSE_LISTENER = new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { Component component = e.getComponent(); if (component instanceof AbstractButton) { AbstractButton button = (AbstractButton) component; button.setBorderPainted(true); } } @Override public void mouseExited(MouseEvent e) { Component component = e.getComponent(); if (component instanceof AbstractButton) { AbstractButton button = (AbstractButton) component; button.setBorderPainted(false); } } }; private final JTabbedPane pane; private final JLabel label; private final JButton button = new TabButton(); private final CloseTabListener closeListener; public interface CloseTabListener { void closeTab(Component c); } public ClosableTabComponent(String title, ImageIcon icon, JTabbedPane pane, CloseTabListener closeListener) { super(new FlowLayout(FlowLayout.LEFT, 0, 0)); this.closeListener = closeListener; if (pane == null) { throw new NullPointerException("TabbedPane is null"); } this.pane = pane; setOpaque(false); label = new JLabel(title); if (icon != null) { label.setIcon(icon); } add(label); label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); add(button); setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0)); } private class TabButton extends JButton implements ActionListener { private static final long serialVersionUID = 1L; public TabButton() { int size = 17; setPreferredSize(new Dimension(size, size)); setToolTipText("Close"); setUI(new BasicButtonUI()); setContentAreaFilled(false); setFocusable(false); setBorder(BorderFactory.createEtchedBorder()); setBorderPainted(false); addMouseListener(BUTTON_MOUSE_LISTENER); setRolloverEnabled(true); addActionListener(this); } @Override public void actionPerformed(ActionEvent e) { int i = pane.indexOfTabComponent(ClosableTabComponent.this); Component c = pane.getComponentAt(i); if (i != -1) { pane.remove(i); } if (closeListener != null) { closeListener.closeTab(c); } } @Override public void updateUI() { } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; Stroke stroke = g2.getStroke(); g2.setStroke(new BasicStroke(2)); g.setColor(Color.BLACK); if (getModel().isRollover()) { Color highlight = new Color(0, 51, 153); g.setColor(highlight); } int delta = 5; g.drawLine(delta, delta, getWidth() - delta - 1, getHeight() - delta - 1); g.drawLine(getWidth() - delta - 1, delta, delta, getHeight() - delta - 1); g2.setStroke(stroke); int i = pane.indexOfTabComponent(ClosableTabComponent.this); pane.setTitleAt(i, label.getText()); } } }
4,257
0.727977
0.718111
153
26.82353
21.316513
80
false
false
0
0
0
0
0
0
2.137255
false
false
14
d9b10e651415ec2e2712cf617fde80602b016a8e
13,898,514,216,822
3d653ed0b1005b6e2031929ce7741769ff980e48
/core/src/main/java/com/srotya/sidewinder/core/storage/compression/dod/DodWriter.java
d78f420620f2e7bec6a624a8f24462e03f5e4a3d
[ "Apache-2.0" ]
permissive
whidbey/sidewinder
https://github.com/whidbey/sidewinder
a7973197aca1be28b30e12d295dfa463b59d9fc0
d20b1a64937a0197b02c7c83b43067cb20723428
refs/heads/master
2021-01-23T18:33:14.093000
2017-09-06T21:36:18
2017-09-06T21:36:18
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Copyright 2017 Ambud Sharma * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.srotya.sidewinder.core.storage.compression.dod; import java.io.IOException; import java.nio.ByteBuffer; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock; import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock; import com.srotya.sidewinder.core.storage.DataPoint; import com.srotya.sidewinder.core.storage.RejectException; import com.srotya.sidewinder.core.storage.compression.Writer; /** * A simple delta-of-delta timeseries compression with no value compression * * @author ambud */ public class DodWriter implements Writer { private ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); private ReadLock read = lock.readLock(); private WriteLock write = lock.writeLock(); private BitWriter writer; private long prevTs; private long delta; private int count; private long lastTs; private boolean readOnly; private boolean full; public DodWriter() { } public DodWriter(long headTs, byte[] buf) { prevTs = headTs; writer = new BitWriter(buf); } @Override public void configure(Map<String, String> conf, ByteBuffer buf, boolean isNew) throws IOException { writer = new BitWriter(buf); } public void write(DataPoint dp) throws RejectException { if (readOnly) { throw WRITE_REJECT_EXCEPTION; } try { write.lock(); writeDataPoint(dp.getTimestamp(), dp.getLongValue()); } finally { write.unlock(); } } public void write(List<DataPoint> dps) { try { for (Iterator<DataPoint> itr = dps.iterator(); itr.hasNext();) { DataPoint dp = itr.next(); writeDataPoint(dp.getTimestamp(), dp.getLongValue()); } } finally { write.unlock(); } } /** * (a) Calculate the delta of delta: D = (tn - tn1) - (tn1 - tn2) (b) If D is * zero, then store a single `0' bit (c) If D is between [-63, 64], store `10' * followed by the value (7 bits) (d) If D is between [-255, 256], store `110' * followed by the value (9 bits) (e) if D is between [-2047, 2048], store * `1110' followed by the value (12 bits) (f) Otherwise store `1111' followed by * D using 32 bits * * @param dp */ private void writeDataPoint(long timestamp, long value) { lastTs = timestamp; long ts = timestamp; long newDelta = (ts - prevTs); int deltaOfDelta = (int) (newDelta - delta); writer.writeBits(deltaOfDelta, 32); writer.writeBits(value, 64); count++; prevTs = ts; delta = newDelta; } @Override public void addValue(long timestamp, double value) { addValue(timestamp, Double.doubleToLongBits(value)); } public DoDReader getReader() { DoDReader reader = null; read.lock(); ByteBuffer rbuf = writer.getBuffer().duplicate(); reader = new DoDReader(rbuf, count, lastTs); read.unlock(); return reader; } @Override public void addValue(long timestamp, long value) { try { write.lock(); writeDataPoint(timestamp, value); } finally { write.unlock(); } } @Override public double getCompressionRatio() { return 0.1; } @Override public void setHeaderTimestamp(long timestamp) { prevTs = timestamp; writer.writeBits(timestamp, 64); } public BitWriter getWriter() { return writer; } @Override public ByteBuffer getRawBytes() { read.lock(); ByteBuffer b = writer.getBuffer().duplicate(); b.rewind(); read.unlock(); return b; } @Override public void bootstrap(ByteBuffer buf) throws IOException { throw new UnsupportedOperationException(); } @Override public void setCounter(int counter) { this.count = counter; } @Override public void makeReadOnly() { write.lock(); readOnly = true; write.unlock(); } @Override public int currentOffset() { return 0; } @Override public int getCount() { return count; } @Override public boolean isFull() { return full; } @Override public long getHeaderTimestamp() { return 0; } }
UTF-8
Java
4,567
java
DodWriter.java
Java
[ { "context": "/**\n * Copyright 2017 Ambud Sharma\n * \n * Licensed under the Apache License, Version", "end": 34, "score": 0.999843180179596, "start": 22, "tag": "NAME", "value": "Ambud Sharma" }, { "context": "mpression with no value compression\n * \n * @author ambud\n */\npublic class DodWriter implements Writer {\n\n\t", "end": 1256, "score": 0.9995465874671936, "start": 1251, "tag": "USERNAME", "value": "ambud" } ]
null
[]
/** * Copyright 2017 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.srotya.sidewinder.core.storage.compression.dod; import java.io.IOException; import java.nio.ByteBuffer; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock; import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock; import com.srotya.sidewinder.core.storage.DataPoint; import com.srotya.sidewinder.core.storage.RejectException; import com.srotya.sidewinder.core.storage.compression.Writer; /** * A simple delta-of-delta timeseries compression with no value compression * * @author ambud */ public class DodWriter implements Writer { private ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); private ReadLock read = lock.readLock(); private WriteLock write = lock.writeLock(); private BitWriter writer; private long prevTs; private long delta; private int count; private long lastTs; private boolean readOnly; private boolean full; public DodWriter() { } public DodWriter(long headTs, byte[] buf) { prevTs = headTs; writer = new BitWriter(buf); } @Override public void configure(Map<String, String> conf, ByteBuffer buf, boolean isNew) throws IOException { writer = new BitWriter(buf); } public void write(DataPoint dp) throws RejectException { if (readOnly) { throw WRITE_REJECT_EXCEPTION; } try { write.lock(); writeDataPoint(dp.getTimestamp(), dp.getLongValue()); } finally { write.unlock(); } } public void write(List<DataPoint> dps) { try { for (Iterator<DataPoint> itr = dps.iterator(); itr.hasNext();) { DataPoint dp = itr.next(); writeDataPoint(dp.getTimestamp(), dp.getLongValue()); } } finally { write.unlock(); } } /** * (a) Calculate the delta of delta: D = (tn - tn1) - (tn1 - tn2) (b) If D is * zero, then store a single `0' bit (c) If D is between [-63, 64], store `10' * followed by the value (7 bits) (d) If D is between [-255, 256], store `110' * followed by the value (9 bits) (e) if D is between [-2047, 2048], store * `1110' followed by the value (12 bits) (f) Otherwise store `1111' followed by * D using 32 bits * * @param dp */ private void writeDataPoint(long timestamp, long value) { lastTs = timestamp; long ts = timestamp; long newDelta = (ts - prevTs); int deltaOfDelta = (int) (newDelta - delta); writer.writeBits(deltaOfDelta, 32); writer.writeBits(value, 64); count++; prevTs = ts; delta = newDelta; } @Override public void addValue(long timestamp, double value) { addValue(timestamp, Double.doubleToLongBits(value)); } public DoDReader getReader() { DoDReader reader = null; read.lock(); ByteBuffer rbuf = writer.getBuffer().duplicate(); reader = new DoDReader(rbuf, count, lastTs); read.unlock(); return reader; } @Override public void addValue(long timestamp, long value) { try { write.lock(); writeDataPoint(timestamp, value); } finally { write.unlock(); } } @Override public double getCompressionRatio() { return 0.1; } @Override public void setHeaderTimestamp(long timestamp) { prevTs = timestamp; writer.writeBits(timestamp, 64); } public BitWriter getWriter() { return writer; } @Override public ByteBuffer getRawBytes() { read.lock(); ByteBuffer b = writer.getBuffer().duplicate(); b.rewind(); read.unlock(); return b; } @Override public void bootstrap(ByteBuffer buf) throws IOException { throw new UnsupportedOperationException(); } @Override public void setCounter(int counter) { this.count = counter; } @Override public void makeReadOnly() { write.lock(); readOnly = true; write.unlock(); } @Override public int currentOffset() { return 0; } @Override public int getCount() { return count; } @Override public boolean isFull() { return full; } @Override public long getHeaderTimestamp() { return 0; } }
4,561
0.705934
0.693015
193
22.663212
23.003166
100
false
false
0
0
0
0
0
0
1.595855
false
false
14
7edf2bcc86d000a9141c165b637398e96c574774
15,023,795,641,426
15c9ebae5043f9e2c5c0d0379dcdd7e907d266f1
/src/P03_Algorithm/A01_Recursion/A04_StringPatternMatching/P01_subStrMatch.java
83eb557d54b38354b28cae4ed0b23b5befd5eaf6
[]
no_license
FlashXT/DataStruAlgo
https://github.com/FlashXT/DataStruAlgo
13c0571ca82c94fcfd99c3a5624c4f8769f6772e
4f7934865abe5d351918b9c0a79304af4f70eb3c
refs/heads/master
2020-05-14T05:05:40.405000
2019-09-23T14:44:42
2019-09-23T14:44:42
181,699,374
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package P03_Algorithm.A01_Recursion.A04_StringPatternMatching; /***************************************************************** * @Author:FlashXT; * @Date:2019/9/2,16:01 * @Version 1.0 * CopyRight © 2018-2020,FlashXT & turboMan . All Right Reserved. *****************************************************************/ public class P01_subStrMatch { public static void main(String [] args){ System.out.println(subStrMatch("abcd","e")); } //暴力匹配,时间复杂度O(m*n) public static int subStrMatch(String str,String sub){ for(int i = 0 ; i< str.length();i++){ boolean flag = false; for(int j = 0; j < sub.length();j++){ if(str.charAt(i+j)!=sub.charAt(j)){ flag = true; break; } } if(!flag) return i; } return -1; } //KMP // public static int KMP(){ // // } }
UTF-8
Java
957
java
P01_subStrMatch.java
Java
[ { "context": "**************************************\n * @Author:FlashXT;\n * @Date:2019/9/2,16:01\n * @Version 1.0\n * CopyR", "end": 149, "score": 0.9934501647949219, "start": 142, "tag": "USERNAME", "value": "FlashXT" }, { "context": "/2,16:01\n * @Version 1.0\n * CopyRight © 2018-2020,FlashXT & turboMan . All Right Reserved.\n ***************", "end": 223, "score": 0.9190921783447266, "start": 216, "tag": "USERNAME", "value": "FlashXT" } ]
null
[]
package P03_Algorithm.A01_Recursion.A04_StringPatternMatching; /***************************************************************** * @Author:FlashXT; * @Date:2019/9/2,16:01 * @Version 1.0 * CopyRight © 2018-2020,FlashXT & turboMan . All Right Reserved. *****************************************************************/ public class P01_subStrMatch { public static void main(String [] args){ System.out.println(subStrMatch("abcd","e")); } //暴力匹配,时间复杂度O(m*n) public static int subStrMatch(String str,String sub){ for(int i = 0 ; i< str.length();i++){ boolean flag = false; for(int j = 0; j < sub.length();j++){ if(str.charAt(i+j)!=sub.charAt(j)){ flag = true; break; } } if(!flag) return i; } return -1; } //KMP // public static int KMP(){ // // } }
957
0.441239
0.40812
31
29.193548
20.950663
67
false
false
0
0
0
0
0
0
0.516129
false
false
14
51156ada9e545e56114cc449be4e1f086a8c1b34
601,295,470,227
11d2dfff2b5cbb141aeb59e99cb29bb9e9572b82
/src/main/java/squier/john/javalabcd12/Main.java
55de0a7fcd6b689e41192bb045c5651c2df98f49
[]
no_license
jasquier/Java-Lab-CD12
https://github.com/jasquier/Java-Lab-CD12
af70336009b490bdd034113bb64517676607821d
8c89a447fede2a0578fddbbfa21b98877e478253
refs/heads/master
2021-05-02T01:13:16.350000
2017-01-13T14:03:32
2017-01-13T14:03:32
78,809,641
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package squier.john.javalabcd12; /** * Created by johnsquier on 1/12/17. */ public class Main { public static void main(String[] args) { InputOutput inputOutput = new InputOutput(); InputSummer inputSummer = new InputSummer(); InputFactorial inputFactorial = new InputFactorial(); int result; int input = inputOutput.getIntInput( "Enter the number you wish to operate on: "); boolean sumTproductF = inputOutput.getSumTProductF( "Do you wish to SUM or MULTIPLY?:"); if ( sumTproductF ) { result = inputSummer.sumUpToInput(input); } else { result = inputFactorial.calculateFactorial(input); } inputOutput.displayResult(result); } }
UTF-8
Java
791
java
Main.java
Java
[ { "context": "ackage squier.john.javalabcd12;\n\n/**\n * Created by johnsquier on 1/12/17.\n */\npublic class Main {\n\n public s", "end": 62, "score": 0.9931614995002747, "start": 52, "tag": "USERNAME", "value": "johnsquier" } ]
null
[]
package squier.john.javalabcd12; /** * Created by johnsquier on 1/12/17. */ public class Main { public static void main(String[] args) { InputOutput inputOutput = new InputOutput(); InputSummer inputSummer = new InputSummer(); InputFactorial inputFactorial = new InputFactorial(); int result; int input = inputOutput.getIntInput( "Enter the number you wish to operate on: "); boolean sumTproductF = inputOutput.getSumTProductF( "Do you wish to SUM or MULTIPLY?:"); if ( sumTproductF ) { result = inputSummer.sumUpToInput(input); } else { result = inputFactorial.calculateFactorial(input); } inputOutput.displayResult(result); } }
791
0.608091
0.599241
30
25.366667
23.313063
62
false
false
0
0
0
0
0
0
0.333333
false
false
14
f9d4332632a1c6b4a6ad923e52ac4561c47d9f6b
18,966,575,631,104
7be649febcb6fb558d6c7fc30faf0007e489acb7
/SpringBootDev/Demos/DemoRestClients/src/main/java/demo/restclients/MyRestClient.java
f427b2e561cca306a03493e2faa64f3c8ada0e0b
[]
no_license
nilavalagansugumaran/training-19-may
https://github.com/nilavalagansugumaran/training-19-may
2e74e96b9385cf9ec8978e616843a542b8981b0e
ad68f982c8fef1c65ad5b45bf73e83d027efb01b
refs/heads/main
2023-05-02T09:52:21.650000
2021-05-26T16:35:05
2021-05-26T16:35:05
368,742,020
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package demo.restclients; public interface MyRestClient { public void doRestCalls(); }
UTF-8
Java
92
java
MyRestClient.java
Java
[]
null
[]
package demo.restclients; public interface MyRestClient { public void doRestCalls(); }
92
0.76087
0.76087
5
16.799999
13.452137
31
false
false
0
0
0
0
0
0
0.6
false
false
14
f55bc9e17ac2f813ebe514d1e00ee6a2039996a7
13,829,794,744,991
ba3e9cff7e9232d90610178fcfcb9df811cf5bc8
/data-structure-algorithm/src/main/java/com/practice/dynamicprogramming/Easy.java
f132b58855423e440630296c593f6a84bc43c456
[]
no_license
vision-adwi/ownrepository
https://github.com/vision-adwi/ownrepository
874b26cfc64ccdf1591c912c0666288a598e5ec0
c3dc6efb5c097f48d2f0f167bfd9a2a9c3bd2e4f
refs/heads/master
2022-12-23T12:24:39.678000
2020-09-26T17:55:19
2020-09-26T17:55:19
266,111,095
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.practice.dynamicprogramming; public class Easy { /* Leetcode#509. Fibonacci Number The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. That is, F(0) = 0, F(1) = 1 F(N) = F(N - 1) + F(N - 2), for N > 1. Given N, calculate F(N). */ public int fib(int N) { if(N == 0) return 0; int[] memory = new int[N + 1]; memory[0] = 0; memory[1] = 1; for(int i = 2; i <= N; i++) { memory[i] = memory[i - 1] + memory[i - 2]; } return memory[N]; } /* Leetcode#70. Climbing Stairs You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? */ public int climbStairs(int n) { if(n == 0) return 1; int[] memory = new int[n + 1]; memory[0] = 1; memory[1] = 1; for(int i = 2; i <= n; i++) { memory[i] = memory[i -1] + memory[i - 2]; } return memory[n]; } /* Leetcode#62. Unique Paths A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below). How many possible unique paths are there? */ public int uniquePaths(int m, int n) { int[][] mem = new int[m + 1][n + 1]; for(int i = m - 1; i >= 0; i--) { for(int j = n - 1; j >= 0; j--) { if(i == (m - 1) && j == (n - 1)) { mem[i][j] = 1; } else { mem[i][j] = mem[i + 1][j] + mem[i][j + 1]; } } } return mem[0][0]; } /* Leetcode#122. Best Time to Buy and Sell Stock II Say you have an array prices for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times). */ //Valley-peak appraoch public int maxProfit(int[] prices) { int profit = 0; for(int i = 0; i < prices.length - 1; i++) { if(prices[i] < prices[i + 1]) { profit = profit + (prices[i + 1] - prices[i]); } } return profit; } }
UTF-8
Java
2,431
java
Easy.java
Java
[]
null
[]
package com.practice.dynamicprogramming; public class Easy { /* Leetcode#509. Fibonacci Number The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. That is, F(0) = 0, F(1) = 1 F(N) = F(N - 1) + F(N - 2), for N > 1. Given N, calculate F(N). */ public int fib(int N) { if(N == 0) return 0; int[] memory = new int[N + 1]; memory[0] = 0; memory[1] = 1; for(int i = 2; i <= N; i++) { memory[i] = memory[i - 1] + memory[i - 2]; } return memory[N]; } /* Leetcode#70. Climbing Stairs You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? */ public int climbStairs(int n) { if(n == 0) return 1; int[] memory = new int[n + 1]; memory[0] = 1; memory[1] = 1; for(int i = 2; i <= n; i++) { memory[i] = memory[i -1] + memory[i - 2]; } return memory[n]; } /* Leetcode#62. Unique Paths A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below). How many possible unique paths are there? */ public int uniquePaths(int m, int n) { int[][] mem = new int[m + 1][n + 1]; for(int i = m - 1; i >= 0; i--) { for(int j = n - 1; j >= 0; j--) { if(i == (m - 1) && j == (n - 1)) { mem[i][j] = 1; } else { mem[i][j] = mem[i + 1][j] + mem[i][j + 1]; } } } return mem[0][0]; } /* Leetcode#122. Best Time to Buy and Sell Stock II Say you have an array prices for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times). */ //Valley-peak appraoch public int maxProfit(int[] prices) { int profit = 0; for(int i = 0; i < prices.length - 1; i++) { if(prices[i] < prices[i + 1]) { profit = profit + (prices[i + 1] - prices[i]); } } return profit; } }
2,431
0.565199
0.54093
84
27.940475
30.208147
172
false
false
0
0
0
0
0
0
1.654762
false
false
14
55175f0e0b298c114fe21b5653e9f01762d27531
30,906,584,701,470
3963bc47e64dd22a5d22ce41605d73a90d3cac34
/Android/sbmp/SPS_App_2.0/src/com/skt/sps/db/task/story/Story04_Memo.java
1930a116d299595e304553bf406c0eb9aa2e98b9
[]
no_license
zerotake0/zerotake0
https://github.com/zerotake0/zerotake0
4d3b594709fa713fc0cdcebefcdc989c60968913
01857279f19956fda5ef4e0caef31e5934235de8
refs/heads/master
2016-08-08T18:29:51.785000
2015-08-04T12:54:11
2015-08-04T12:54:11
54,452,331
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.skt.sps.db.task.story; import android.content.Context; import com.mcu.lib.util.UCalendar; import com.skt.sps.db.table.CallStoryEntity; import com.skt.sps.db.table.CallStoryTypeEntity; public class Story04_Memo extends Story { public Story04_Memo(Context context) { super(context); } @Override public void makeStory(CallStoryTypeEntity storyType) { t(storyType); } /** * 콜메모 변경 시 스토리 등록 * @param context * @param name * @param callMemo */ public void makeStory(CallStoryTypeEntity storyType, String phoneNumber, String name, String callMemo) { t(storyType); try { String toDate = UCalendar.with().date(); CallStoryEntity storyEntity = callStorySql.getStory(storyType.getSubType(), phoneNumber, toDate); String content = Story.replaceInput(storyType.getContent(), name, callMemo); if (storyEntity == null) { callStorySql.insertPhone(storyType.getType(), storyType.getSubType(), storyType.getAction(), phoneNumber, storyType.getTitle(), content); } else { callStorySql.update(storyEntity.getId(), content, UCalendar.with().time()); } p("save memo"); } catch (Exception e) { e.printStackTrace(); } } }
UTF-8
Java
1,264
java
Story04_Memo.java
Java
[]
null
[]
package com.skt.sps.db.task.story; import android.content.Context; import com.mcu.lib.util.UCalendar; import com.skt.sps.db.table.CallStoryEntity; import com.skt.sps.db.table.CallStoryTypeEntity; public class Story04_Memo extends Story { public Story04_Memo(Context context) { super(context); } @Override public void makeStory(CallStoryTypeEntity storyType) { t(storyType); } /** * 콜메모 변경 시 스토리 등록 * @param context * @param name * @param callMemo */ public void makeStory(CallStoryTypeEntity storyType, String phoneNumber, String name, String callMemo) { t(storyType); try { String toDate = UCalendar.with().date(); CallStoryEntity storyEntity = callStorySql.getStory(storyType.getSubType(), phoneNumber, toDate); String content = Story.replaceInput(storyType.getContent(), name, callMemo); if (storyEntity == null) { callStorySql.insertPhone(storyType.getType(), storyType.getSubType(), storyType.getAction(), phoneNumber, storyType.getTitle(), content); } else { callStorySql.update(storyEntity.getId(), content, UCalendar.with().time()); } p("save memo"); } catch (Exception e) { e.printStackTrace(); } } }
1,264
0.68438
0.681159
47
24.425531
31.161039
141
false
false
0
0
0
0
0
0
2.085106
false
false
14
8c545ad7dc5f4505b5c92370a271d97926c6c846
25,460,566,175,859
7cc5bfe570c534f0bdc1f38f57057939060a4352
/ArraySearch.java
85567f9fce3241aaa7f2a06ef8a9ba22ee4da9ac
[]
no_license
Pratik3199/App-Development
https://github.com/Pratik3199/App-Development
1ac55180d0c5e8429149f2e78014a38ab0ef3763
fb50ead0cfabcc1818e962d4bbb6ac430d2f5a66
refs/heads/master
2021-05-11T09:31:53.598000
2018-05-01T10:18:04
2018-05-01T10:18:04
118,079,030
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Author: - Pratik */ package recursivepuzzle; public class ArraySearch{ static int search; public static void main(String[] args) { int container[] = {98,72,9,83,3,-8,-7,9,3,5}; System.out.println("Number found at index: " + search(container,0, container.length-1, 9)); } private static int search(int numbers[], int start, int end, int number) { int mid = (start+end)/2; if (numbers[mid]> number) end = mid; else if(numbers[mid]<number) start = mid; else if(numbers[mid]==number) return mid; else return -1; return search(numbers, start, end, number); } } //This code is implemented by PRATIK SINGH
UTF-8
Java
795
java
ArraySearch.java
Java
[ { "context": "/**\n * Author: - Pratik\n */\npackage recursivepuzzle;\n\npublic class ArrayS", "end": 23, "score": 0.9998443722724915, "start": 17, "tag": "NAME", "value": "Pratik" }, { "context": "nd, number);\t\t\t\n\t}\n}\n//This code is implemented by PRATIK SINGH\n", "end": 794, "score": 0.9995536208152771, "start": 782, "tag": "NAME", "value": "PRATIK SINGH" } ]
null
[]
/** * Author: - Pratik */ package recursivepuzzle; public class ArraySearch{ static int search; public static void main(String[] args) { int container[] = {98,72,9,83,3,-8,-7,9,3,5}; System.out.println("Number found at index: " + search(container,0, container.length-1, 9)); } private static int search(int numbers[], int start, int end, int number) { int mid = (start+end)/2; if (numbers[mid]> number) end = mid; else if(numbers[mid]<number) start = mid; else if(numbers[mid]==number) return mid; else return -1; return search(numbers, start, end, number); } } //This code is implemented by <NAME>
789
0.535849
0.513208
36
21.083334
22.936356
93
false
false
0
0
0
0
0
0
1.5
false
false
14
665d4385455584f08ff7c0818559cfc9fe562671
26,233,660,307,122
dd24d590a74611d662e9a6814d743e068bda83e0
/src/org/cniska/phaser/event/Event.java
dafc486f76609c5e448da429677e35ee182c521b
[]
no_license
crisu83/phaser-android
https://github.com/crisu83/phaser-android
cdd74c906829254823a7b55f7a860c68a3735321
312e96f79c17b8ba3edce6a9a04194f98b15ab3f
refs/heads/master
2016-09-06T05:39:18.112000
2012-09-23T19:51:17
2012-09-23T19:51:17
5,721,287
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.cniska.phaser.event; public class Event { protected String action; protected Publisher source; public Event(String action, Publisher source) { this.action = action; this.source = source; } public String getAction() { return action; } public Publisher getSource() { return source; } }
UTF-8
Java
318
java
Event.java
Java
[]
null
[]
package org.cniska.phaser.event; public class Event { protected String action; protected Publisher source; public Event(String action, Publisher source) { this.action = action; this.source = source; } public String getAction() { return action; } public Publisher getSource() { return source; } }
318
0.713836
0.713836
20
14.9
14.187671
48
false
false
0
0
0
0
0
0
1.25
false
false
14
58ac68878f6c2650689497bdf42e4d9072f0bac4
8,615,704,444,684
369522bdaa8e643ca25f30ea6ec9bb5f771a82b2
/me/odium/simpleextras/commands/fly.java
54e5e23629b92ca3636acfc076c000f56c08a936
[]
no_license
OdiumxXx/SimpleExtras
https://github.com/OdiumxXx/SimpleExtras
4498e9388b9a491221cd671aee9fe8f465d2a03b
38e35c462b9b9e6344ad8917bd42f9b0da180da2
refs/heads/master
2016-09-08T00:42:46.640000
2013-09-01T03:26:30
2013-09-01T03:26:30
3,617,730
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package me.odium.simpleextras.commands; import me.odium.simpleextras.SimpleExtras; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class fly implements CommandExecutor { public SimpleExtras plugin; public fly(SimpleExtras plugin) { this.plugin = plugin; } public boolean onCommand(final CommandSender sender, Command cmd, String label, String[] args) { Player player = null; if (sender instanceof Player) { player = (Player) sender; } if(args.length == 0) { if (player == null) { sender.sendMessage("This command can only be run by a player"); return true; } Boolean canfly = player.getAllowFlight(); if(canfly == true) { player.setAllowFlight(false); player.setFlying(false); sender.sendMessage(ChatColor.GOLD + "* " + ChatColor.RED + "Flight " + ChatColor.RED + "disabled "); return true; } else if(canfly == false) { player.setAllowFlight(true); sender.sendMessage(ChatColor.GOLD + "* " + ChatColor.GREEN + "Flight " + ChatColor.GREEN + "enabled "); return true; } } else if(args.length == 1 && player == null ||args.length == 1 && player.hasPermission("simpleextras.fly.other")) { Player target = Bukkit.getPlayer(args[0]); if (target == null) { sender.sendMessage(ChatColor.RED + args[0] + " is not online"); return true; } else { Boolean canfly = target.getAllowFlight(); String targetname = target.getDisplayName(); if(canfly == true) { target.setAllowFlight(false); target.setFlying(false); sender.sendMessage(ChatColor.GOLD + "* " + ChatColor.WHITE + "Flight " + ChatColor.RED + "disabled " + ChatColor.WHITE + "for " + ChatColor.DARK_GREEN + targetname); if (sender != target) { target.sendMessage(ChatColor.GOLD + "* " + ChatColor.WHITE + "Flight " + ChatColor.RED+ "disabled"); } return true; } else if(canfly == false) { target.setAllowFlight(true); sender.sendMessage(ChatColor.GOLD + "* " + ChatColor.WHITE + "Flight " + ChatColor.GREEN + "enabled " + ChatColor.WHITE + "for " + ChatColor.DARK_GREEN + targetname); if (sender != target) { target.sendMessage(ChatColor.GOLD + "* " + ChatColor.WHITE + "Flight " + ChatColor.GREEN + "enabled"); } return true; } } } else if(args.length == 2 && player == null || args.length == 2 && player.hasPermission("simpleextras.fly.other")) { final Player target1 = Bukkit.getPlayer(args[0]); if (target1 == null) { sender.sendMessage(ChatColor.RED + args[0] + " is not online"); return true; } else { // final Player player1 = player; Boolean canfly = target1.getAllowFlight(); String targetname = target1.getDisplayName(); String min = args[1]; int mintemp = Integer.parseInt( min ); int mins = 1200 * mintemp; int warningminstemp = 1200 * mintemp; int warningmins = warningminstemp - 200; if(canfly == true) { sender.sendMessage("Already allowed to fly, timer set anyway."); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin.getServer().getPluginManager().getPlugin("SimpleExtras"), new Runnable() { public void run() { target1.sendMessage(ChatColor.GOLD + "* " + ChatColor.RED + "Flight is about to " + ChatColor.RED + "expire! "); } }, warningmins); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin.getServer().getPluginManager().getPlugin("SimpleExtras"), new Runnable() { public void run() { target1.setAllowFlight(false); target1.setFlying(false); sender.sendMessage(ChatColor.GOLD + "* " + ChatColor.WHITE + "Flight " + ChatColor.RED + "disabled " + ChatColor.WHITE + "for " + ChatColor.DARK_GREEN + target1.getDisplayName()); if (sender != target1) { target1.sendMessage(ChatColor.GOLD + "* " + ChatColor.RED + "Flight " + ChatColor.RED + "disabled "); } } }, mins); return true; } else if(canfly == false) { sender.sendMessage(ChatColor.GOLD + "* " + ChatColor.WHITE + "Flight " + ChatColor.GREEN + "enabled " + ChatColor.WHITE + "for " + ChatColor.DARK_GREEN + targetname + ChatColor.WHITE + " for " + min + " minutes"); if (sender != target1) { target1.sendMessage(ChatColor.GOLD + "* " + ChatColor.WHITE + "Flight " + ChatColor.GREEN + "enabled " + ChatColor.WHITE + "for " + ChatColor.DARK_GREEN + min + ChatColor.WHITE + " minutes"); } target1.setAllowFlight(true); target1.setFlying(true); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin.getServer().getPluginManager().getPlugin("SimpleExtras"), new Runnable() { public void run() { target1.sendMessage(ChatColor.GOLD + "* " + ChatColor.RED + "Flight is about to " + ChatColor.RED + "expire! "); } }, warningmins); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin.getServer().getPluginManager().getPlugin("SimpleExtras"), new Runnable() { public void run() { target1.setAllowFlight(false); target1.setFlying(false); String targetname = target1.getDisplayName(); target1.sendMessage(ChatColor.GOLD + "* " + ChatColor.RED + "Flight " + ChatColor.RED + "disabled "); if (sender != target1) { sender.sendMessage(ChatColor.GOLD + "* " + ChatColor.WHITE + "Flight " + ChatColor.RED + "disabled " + ChatColor.WHITE + "for " + ChatColor.DARK_GREEN + targetname); } } }, mins); return true; } } } return true; } }
UTF-8
Java
6,398
java
fly.java
Java
[]
null
[]
package me.odium.simpleextras.commands; import me.odium.simpleextras.SimpleExtras; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class fly implements CommandExecutor { public SimpleExtras plugin; public fly(SimpleExtras plugin) { this.plugin = plugin; } public boolean onCommand(final CommandSender sender, Command cmd, String label, String[] args) { Player player = null; if (sender instanceof Player) { player = (Player) sender; } if(args.length == 0) { if (player == null) { sender.sendMessage("This command can only be run by a player"); return true; } Boolean canfly = player.getAllowFlight(); if(canfly == true) { player.setAllowFlight(false); player.setFlying(false); sender.sendMessage(ChatColor.GOLD + "* " + ChatColor.RED + "Flight " + ChatColor.RED + "disabled "); return true; } else if(canfly == false) { player.setAllowFlight(true); sender.sendMessage(ChatColor.GOLD + "* " + ChatColor.GREEN + "Flight " + ChatColor.GREEN + "enabled "); return true; } } else if(args.length == 1 && player == null ||args.length == 1 && player.hasPermission("simpleextras.fly.other")) { Player target = Bukkit.getPlayer(args[0]); if (target == null) { sender.sendMessage(ChatColor.RED + args[0] + " is not online"); return true; } else { Boolean canfly = target.getAllowFlight(); String targetname = target.getDisplayName(); if(canfly == true) { target.setAllowFlight(false); target.setFlying(false); sender.sendMessage(ChatColor.GOLD + "* " + ChatColor.WHITE + "Flight " + ChatColor.RED + "disabled " + ChatColor.WHITE + "for " + ChatColor.DARK_GREEN + targetname); if (sender != target) { target.sendMessage(ChatColor.GOLD + "* " + ChatColor.WHITE + "Flight " + ChatColor.RED+ "disabled"); } return true; } else if(canfly == false) { target.setAllowFlight(true); sender.sendMessage(ChatColor.GOLD + "* " + ChatColor.WHITE + "Flight " + ChatColor.GREEN + "enabled " + ChatColor.WHITE + "for " + ChatColor.DARK_GREEN + targetname); if (sender != target) { target.sendMessage(ChatColor.GOLD + "* " + ChatColor.WHITE + "Flight " + ChatColor.GREEN + "enabled"); } return true; } } } else if(args.length == 2 && player == null || args.length == 2 && player.hasPermission("simpleextras.fly.other")) { final Player target1 = Bukkit.getPlayer(args[0]); if (target1 == null) { sender.sendMessage(ChatColor.RED + args[0] + " is not online"); return true; } else { // final Player player1 = player; Boolean canfly = target1.getAllowFlight(); String targetname = target1.getDisplayName(); String min = args[1]; int mintemp = Integer.parseInt( min ); int mins = 1200 * mintemp; int warningminstemp = 1200 * mintemp; int warningmins = warningminstemp - 200; if(canfly == true) { sender.sendMessage("Already allowed to fly, timer set anyway."); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin.getServer().getPluginManager().getPlugin("SimpleExtras"), new Runnable() { public void run() { target1.sendMessage(ChatColor.GOLD + "* " + ChatColor.RED + "Flight is about to " + ChatColor.RED + "expire! "); } }, warningmins); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin.getServer().getPluginManager().getPlugin("SimpleExtras"), new Runnable() { public void run() { target1.setAllowFlight(false); target1.setFlying(false); sender.sendMessage(ChatColor.GOLD + "* " + ChatColor.WHITE + "Flight " + ChatColor.RED + "disabled " + ChatColor.WHITE + "for " + ChatColor.DARK_GREEN + target1.getDisplayName()); if (sender != target1) { target1.sendMessage(ChatColor.GOLD + "* " + ChatColor.RED + "Flight " + ChatColor.RED + "disabled "); } } }, mins); return true; } else if(canfly == false) { sender.sendMessage(ChatColor.GOLD + "* " + ChatColor.WHITE + "Flight " + ChatColor.GREEN + "enabled " + ChatColor.WHITE + "for " + ChatColor.DARK_GREEN + targetname + ChatColor.WHITE + " for " + min + " minutes"); if (sender != target1) { target1.sendMessage(ChatColor.GOLD + "* " + ChatColor.WHITE + "Flight " + ChatColor.GREEN + "enabled " + ChatColor.WHITE + "for " + ChatColor.DARK_GREEN + min + ChatColor.WHITE + " minutes"); } target1.setAllowFlight(true); target1.setFlying(true); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin.getServer().getPluginManager().getPlugin("SimpleExtras"), new Runnable() { public void run() { target1.sendMessage(ChatColor.GOLD + "* " + ChatColor.RED + "Flight is about to " + ChatColor.RED + "expire! "); } }, warningmins); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin.getServer().getPluginManager().getPlugin("SimpleExtras"), new Runnable() { public void run() { target1.setAllowFlight(false); target1.setFlying(false); String targetname = target1.getDisplayName(); target1.sendMessage(ChatColor.GOLD + "* " + ChatColor.RED + "Flight " + ChatColor.RED + "disabled "); if (sender != target1) { sender.sendMessage(ChatColor.GOLD + "* " + ChatColor.WHITE + "Flight " + ChatColor.RED + "disabled " + ChatColor.WHITE + "for " + ChatColor.DARK_GREEN + targetname); } } }, mins); return true; } } } return true; } }
6,398
0.577993
0.571429
140
44.707142
47.821915
225
false
false
0
0
0
0
0
0
0.614286
false
false
14
36a9115d1698b528a402b80b14ef34d5016cc8e3
17,678,085,438,550
26d21d93584634843b0c4001d3690468da2ea5e9
/app/src/main/java/com/romens/yjk/health/ui/cells/PayInfoCell.java
e3bc065bda9c954e0d2b098bedbc4f11609ab8ee
[]
no_license
hzh-romens/Health
https://github.com/hzh-romens/Health
14a9c81d3d595d42baac0b1d636949fd59d1f354
6a25acf74c014f5cd2bd55ea4298e46b71858531
refs/heads/master
2020-08-31T08:56:31.087000
2016-04-19T02:39:12
2016-04-19T02:39:12
94,393,688
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.romens.yjk.health.ui.cells; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.text.TextUtils; import android.util.TypedValue; import android.view.Gravity; import android.view.View; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.romens.android.AndroidUtilities; import com.romens.android.ui.Components.LayoutHelper; import com.romens.yjk.health.R; /** * @author Zhou Lisi * @create 16/2/26 * @description */ public class PayInfoCell extends LinearLayout { protected TextView textView; protected TextView valueTextView; private ImageView navView; private static Paint paint; private boolean needDivider; private boolean multiline; private boolean isSmall = false; public PayInfoCell(Context context) { super(context); if (paint == null) { paint = new Paint(); paint.setColor(0xffd9d9d9); paint.setStrokeWidth(1); } setMinimumHeight(AndroidUtilities.dp(44)); textView = new TextView(context); textView.setTextColor(0xff212121); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); textView.setLines(1); textView.setMaxLines(1); textView.setSingleLine(true); textView.setEllipsize(TextUtils.TruncateAt.END); textView.setGravity((Gravity.LEFT) | Gravity.CENTER_VERTICAL); AndroidUtilities.setMaterialTypeface(textView); addView(textView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 16, 10, 8, 8)); valueTextView = new TextView(context); valueTextView.setTextColor(0xff2f8cc9); valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); valueTextView.setLines(1); valueTextView.setMaxLines(1); valueTextView.setSingleLine(true); valueTextView.setEllipsize(TextUtils.TruncateAt.END); valueTextView.setGravity((Gravity.RIGHT) | Gravity.CENTER_VERTICAL); valueTextView.setMinWidth(AndroidUtilities.dp(64)); AndroidUtilities.setMaterialTypeface(valueTextView); addView(valueTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 1f, 16, 10, 16, 8)); navView = new ImageView(context); navView.setScaleType(ImageView.ScaleType.CENTER); navView.setColorFilter(0xffe5e5e5); navView.setImageResource(R.drawable.ic_chevron_right_grey600_24dp); navView.setVisibility(GONE); addView(navView, LayoutHelper.createLinear(24, 24, 0, 10, 8, 8)); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (!multiline) { super.onMeasure(widthMeasureSpec, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(isSmall ? 36 : 44) + (needDivider ? 1 : 0), View.MeasureSpec.EXACTLY)); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } // @Override // protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), AndroidUtilities.dp(isSmall ? 36 : 48) + (needDivider ? 1 : 0)); // // int availableWidth; // if (navView.getVisibility() == VISIBLE) { // availableWidth = getMeasuredWidth() - getPaddingLeft() - getPaddingRight() - AndroidUtilities.dp(58); // navView.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(24), MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(24), MeasureSpec.EXACTLY)); // } else { // availableWidth = getMeasuredWidth() - getPaddingLeft() - getPaddingRight() - AndroidUtilities.dp(34); // } // int width = (availableWidth * 2) / 3; // if (valueTextView.getVisibility() == VISIBLE) { // valueTextView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY)); // width = availableWidth - valueTextView.getMeasuredWidth() - AndroidUtilities.dp(8); // } else { // width = availableWidth; // } // textView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY)); // } public void setTextColor() { textView.setTextColor(0xff212121); } public void setTextColor(int color) { textView.setTextColor(color); } public void setValueTextColor(int color) { valueTextView.setTextColor(color); } public void setValueTextColor() { valueTextView.setTextColor(0xff2f8cc9); } public void setMultilineValue(boolean value) { multiline = value; if (value) { valueTextView.setLines(0); valueTextView.setMaxLines(0); valueTextView.setSingleLine(false); } else { valueTextView.setLines(1); valueTextView.setMaxLines(1); valueTextView.setSingleLine(true); } } public void setText(CharSequence text, boolean divider) { textView.setText(text); valueTextView.setVisibility(INVISIBLE); navView.setVisibility(GONE); needDivider = divider; setWillNotDraw(!divider); } public void setTextAndValue(CharSequence text, CharSequence value, boolean divider) { textView.setText(text); if (value != null) { valueTextView.setText(value); valueTextView.setVisibility(VISIBLE); } else { valueTextView.setVisibility(INVISIBLE); } navView.setVisibility(GONE); needDivider = divider; setWillNotDraw(!divider); requestLayout(); } public void setTextAndValueAndIcon(CharSequence text, CharSequence value, int iconResId, boolean divider) { textView.setText(text); if (value != null) { valueTextView.setText(value); valueTextView.setVisibility(VISIBLE); } else { valueTextView.setVisibility(INVISIBLE); } navView.setVisibility(VISIBLE); navView.setImageResource(iconResId); needDivider = divider; setWillNotDraw(!divider); requestLayout(); } public void setSmall(boolean small) { this.isSmall = small; setMinimumHeight(AndroidUtilities.dp(isSmall ? 36 : 44)); requestLayout(); } public void setTextSize(int size) { textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, size); } public void setValueTextSize(int size) { valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, size); } @Override protected void onDraw(Canvas canvas) { if (needDivider) { canvas.drawLine(getPaddingLeft(), getHeight() - 1, getWidth() - getPaddingRight(), getHeight() - 1, paint); } } }
UTF-8
Java
7,064
java
PayInfoCell.java
Java
[ { "context": "r;\nimport com.romens.yjk.health.R;\n\n/**\n * @author Zhou Lisi\n * @create 16/2/26\n * @description\n */\npublic cla", "end": 546, "score": 0.9998048543930054, "start": 537, "tag": "NAME", "value": "Zhou Lisi" } ]
null
[]
package com.romens.yjk.health.ui.cells; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.text.TextUtils; import android.util.TypedValue; import android.view.Gravity; import android.view.View; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.romens.android.AndroidUtilities; import com.romens.android.ui.Components.LayoutHelper; import com.romens.yjk.health.R; /** * @author <NAME> * @create 16/2/26 * @description */ public class PayInfoCell extends LinearLayout { protected TextView textView; protected TextView valueTextView; private ImageView navView; private static Paint paint; private boolean needDivider; private boolean multiline; private boolean isSmall = false; public PayInfoCell(Context context) { super(context); if (paint == null) { paint = new Paint(); paint.setColor(0xffd9d9d9); paint.setStrokeWidth(1); } setMinimumHeight(AndroidUtilities.dp(44)); textView = new TextView(context); textView.setTextColor(0xff212121); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); textView.setLines(1); textView.setMaxLines(1); textView.setSingleLine(true); textView.setEllipsize(TextUtils.TruncateAt.END); textView.setGravity((Gravity.LEFT) | Gravity.CENTER_VERTICAL); AndroidUtilities.setMaterialTypeface(textView); addView(textView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 16, 10, 8, 8)); valueTextView = new TextView(context); valueTextView.setTextColor(0xff2f8cc9); valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); valueTextView.setLines(1); valueTextView.setMaxLines(1); valueTextView.setSingleLine(true); valueTextView.setEllipsize(TextUtils.TruncateAt.END); valueTextView.setGravity((Gravity.RIGHT) | Gravity.CENTER_VERTICAL); valueTextView.setMinWidth(AndroidUtilities.dp(64)); AndroidUtilities.setMaterialTypeface(valueTextView); addView(valueTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 1f, 16, 10, 16, 8)); navView = new ImageView(context); navView.setScaleType(ImageView.ScaleType.CENTER); navView.setColorFilter(0xffe5e5e5); navView.setImageResource(R.drawable.ic_chevron_right_grey600_24dp); navView.setVisibility(GONE); addView(navView, LayoutHelper.createLinear(24, 24, 0, 10, 8, 8)); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (!multiline) { super.onMeasure(widthMeasureSpec, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(isSmall ? 36 : 44) + (needDivider ? 1 : 0), View.MeasureSpec.EXACTLY)); } else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } // @Override // protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), AndroidUtilities.dp(isSmall ? 36 : 48) + (needDivider ? 1 : 0)); // // int availableWidth; // if (navView.getVisibility() == VISIBLE) { // availableWidth = getMeasuredWidth() - getPaddingLeft() - getPaddingRight() - AndroidUtilities.dp(58); // navView.measure(MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(24), MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(24), MeasureSpec.EXACTLY)); // } else { // availableWidth = getMeasuredWidth() - getPaddingLeft() - getPaddingRight() - AndroidUtilities.dp(34); // } // int width = (availableWidth * 2) / 3; // if (valueTextView.getVisibility() == VISIBLE) { // valueTextView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY)); // width = availableWidth - valueTextView.getMeasuredWidth() - AndroidUtilities.dp(8); // } else { // width = availableWidth; // } // textView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY)); // } public void setTextColor() { textView.setTextColor(0xff212121); } public void setTextColor(int color) { textView.setTextColor(color); } public void setValueTextColor(int color) { valueTextView.setTextColor(color); } public void setValueTextColor() { valueTextView.setTextColor(0xff2f8cc9); } public void setMultilineValue(boolean value) { multiline = value; if (value) { valueTextView.setLines(0); valueTextView.setMaxLines(0); valueTextView.setSingleLine(false); } else { valueTextView.setLines(1); valueTextView.setMaxLines(1); valueTextView.setSingleLine(true); } } public void setText(CharSequence text, boolean divider) { textView.setText(text); valueTextView.setVisibility(INVISIBLE); navView.setVisibility(GONE); needDivider = divider; setWillNotDraw(!divider); } public void setTextAndValue(CharSequence text, CharSequence value, boolean divider) { textView.setText(text); if (value != null) { valueTextView.setText(value); valueTextView.setVisibility(VISIBLE); } else { valueTextView.setVisibility(INVISIBLE); } navView.setVisibility(GONE); needDivider = divider; setWillNotDraw(!divider); requestLayout(); } public void setTextAndValueAndIcon(CharSequence text, CharSequence value, int iconResId, boolean divider) { textView.setText(text); if (value != null) { valueTextView.setText(value); valueTextView.setVisibility(VISIBLE); } else { valueTextView.setVisibility(INVISIBLE); } navView.setVisibility(VISIBLE); navView.setImageResource(iconResId); needDivider = divider; setWillNotDraw(!divider); requestLayout(); } public void setSmall(boolean small) { this.isSmall = small; setMinimumHeight(AndroidUtilities.dp(isSmall ? 36 : 44)); requestLayout(); } public void setTextSize(int size) { textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, size); } public void setValueTextSize(int size) { valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, size); } @Override protected void onDraw(Canvas canvas) { if (needDivider) { canvas.drawLine(getPaddingLeft(), getHeight() - 1, getWidth() - getPaddingRight(), getHeight() - 1, paint); } } }
7,061
0.66846
0.653029
193
35.601036
33.141422
180
false
false
0
0
0
0
0
0
0.803109
false
false
14
f76fa44401d0b5eb6d331f38fdd78d2ea39d3ea4
13,692,355,740,800
ec074f72dc273fd6bdb5d164a58de0536b9a3a8d
/webapp/src/main/java/simulation/model/core/AgentPlanInitiator.java
74922c3f88bd183de34d72e0150d7e3873b7a605
[ "MIT" ]
permissive
GeoTecINIT/parking_occupancy_simulator
https://github.com/GeoTecINIT/parking_occupancy_simulator
127c15090ee141d46e519dcd8cb82ea640ab1f42
1f3b5d59da51069d2b3008f1d1793c5683088223
refs/heads/master
2020-03-25T17:35:28.300000
2018-08-08T09:47:52
2018-08-08T09:47:52
143,985,131
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package simulation.model.core; import sim.engine.SimState; import sim.engine.Steppable; public class AgentPlanInitiator implements Steppable{ private static final long serialVersionUID = 1L; AgentCreationProfileData agentCreationData = null; public AgentPlanInitiator(AgentCreationProfileData agentCreationData){ this.agentCreationData = agentCreationData; } @Override public void step(SimState state) { ParkingModel parkingModel = (ParkingModel)state; parkingModel.addAgent(agentCreationData); } public AgentCreationProfileData getAgentCreationData() { return agentCreationData; } }
UTF-8
Java
634
java
AgentPlanInitiator.java
Java
[]
null
[]
package simulation.model.core; import sim.engine.SimState; import sim.engine.Steppable; public class AgentPlanInitiator implements Steppable{ private static final long serialVersionUID = 1L; AgentCreationProfileData agentCreationData = null; public AgentPlanInitiator(AgentCreationProfileData agentCreationData){ this.agentCreationData = agentCreationData; } @Override public void step(SimState state) { ParkingModel parkingModel = (ParkingModel)state; parkingModel.addAgent(agentCreationData); } public AgentCreationProfileData getAgentCreationData() { return agentCreationData; } }
634
0.780757
0.77918
24
24.416666
22.958145
71
false
false
0
0
0
0
0
0
1.208333
false
false
14
0122a6a41d251330ec46533be1fd25fd331e8374
2,276,332,714,005
efa8abed73e94521460176e9177728ba01d22aae
/src/com/fortes/rh/business/ws/RHService.java
297e7bd1c3f7f80ab6e47aaab83874d58f1c1efd
[]
no_license
tonnarruda/testesCucumber
https://github.com/tonnarruda/testesCucumber
07a8a8919330ea1c683a8907227134356bfc3475
8a38c9369eb2ad6f2cf76dff835106fba2ce66f2
refs/heads/master
2021-08-22T16:22:30.965000
2017-11-29T14:39:32
2017-11-29T14:42:58
112,601,041
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.fortes.rh.business.ws; import com.fortes.rh.exception.TokenException; import com.fortes.rh.model.ws.FeedbackWebService; import com.fortes.rh.model.ws.TAreaOrganizacional; import com.fortes.rh.model.ws.TAuditoria; import com.fortes.rh.model.ws.TAula; import com.fortes.rh.model.ws.TCandidato; import com.fortes.rh.model.ws.TCargo; import com.fortes.rh.model.ws.TCidade; import com.fortes.rh.model.ws.TEmpregado; import com.fortes.rh.model.ws.TEmpresa; import com.fortes.rh.model.ws.TEstabelecimento; import com.fortes.rh.model.ws.TGrupo; import com.fortes.rh.model.ws.TIndice; import com.fortes.rh.model.ws.TIndiceHistorico; import com.fortes.rh.model.ws.TOcorrencia; import com.fortes.rh.model.ws.TOcorrenciaEmpregado; import com.fortes.rh.model.ws.TSituacao; import com.fortes.rh.model.ws.TSituacaoCargo; public interface RHService { String eco(String texto); String getToken(String login, String senha) throws Exception; //TEM QUE VER SE O AC, NÃO SEI QUE USSSSAAAAAAA boolean criarEmpresa(String token, TEmpresa empresa); boolean removerEmpresa(String empresaCodigoAC, String grupoAC); TEmpresa[] getEmpresas(String token) throws TokenException; TCidade[] getCidades(String token, String uf) throws TokenException; TCargo[] getCargos(String token, Long empresaId) throws TokenException; TCargo[] getFaixas(String token) throws TokenException; public String getNomesHomologos(String token, String nomeCandidato) throws TokenException; TGrupo[] getGrupos(String token) throws TokenException; TCargo[] getCargosAC(String token, String empCodigo, String codigo, String grupoAC) throws TokenException; //UTILIZADO PELO PLUGIN DO OFFICE boolean cadastrarCandidato(TCandidato candidato) throws Exception; //Tabela empregado no AC -> EPG FeedbackWebService removerEmpregado(String token, TEmpregado empregado); FeedbackWebService removerEmpregadoComDependencia(String token, TEmpregado empregado, TAuditoria tAuditoria); FeedbackWebService atualizarEmpregado(String token, TEmpregado empregado); FeedbackWebService atualizarEmpregadoAndSituacao(String token, TEmpregado empregado, TSituacao situacao);//O AC confirma cadastro de empregado que estava na CTT FeedbackWebService desligarEmpregado(String token, String codigo, String empCodigo, String dataDesligamento, String grupoAC); FeedbackWebService desligarEmpregadosEmLote(String token, String[] codigosAC, String empCodigo, String dataDesligamento, String grupoAC); FeedbackWebService religarEmpregado(String token, String codigo, String empCodigo, String grupoAC); FeedbackWebService atualizarCodigoEmpregado(String token, String grupoAC, String empresaCodigo, String codigo, String codigoNovo); FeedbackWebService cancelarContratacao(String token, TEmpregado empregado, TSituacao situacao, String mensagem); FeedbackWebService cancelarSolicitacaoDesligamentoAC(String token, TEmpregado empregado, String mensagem); void reSincronizarTabelaTemporariaAC (String token, String gruposAC) throws Exception; FeedbackWebService confirmarContratacao(String token, TEmpregado empregado, TSituacao situacao); //Tabela situacao no AC -> SEP FeedbackWebService removerSituacao(String token, TSituacao situacao); FeedbackWebService removerSituacaoEmLote(String token, Integer movimentoSalarialId, String empCodigo, String grupoAC); FeedbackWebService criarSituacaoEmLote(String token, TSituacao[] situacao); FeedbackWebService atualizarSituacaoEmLote(String token, TSituacao[] situacao); FeedbackWebService criarSituacao(String token, TEmpregado empregado, TSituacao situacao); FeedbackWebService atualizarSituacao(String token, TSituacao situacao); FeedbackWebService cancelarSituacao(String token, TSituacao situacao, String mensagem); FeedbackWebService setUltimaCategoriaESocialColaborador(String token, String categoriaESocial, String colaboradorCodigoAC, String empresaCodigoAC, String grupoAC); FeedbackWebService criarEstabelecimento(String token, TEstabelecimento testabelecimento); FeedbackWebService atualizarEstabelecimento(String token, TEstabelecimento testabelecimento); FeedbackWebService removerEstabelecimento(String token, String codigo, String empCodigo, String grupoAC); // AreaOrganizacional -> LOT FeedbackWebService criarAreaOrganizacional(String token, TAreaOrganizacional areaOrganizacional); FeedbackWebService atualizarAreaOrganizacional(String token, TAreaOrganizacional areaOrganizacional); FeedbackWebService removerAreaOrganizacional(String token, TAreaOrganizacional areaOrganizacional); // Indice -> IND FeedbackWebService criarIndice(String token, TIndice tindice); FeedbackWebService atualizarIndice(String token, TIndice tindice); FeedbackWebService removerIndice(String token, String codigo, String grupoAC); // Historico do Indice -> VID FeedbackWebService criarIndiceHistorico(String token, TIndiceHistorico tindiceHistorico); FeedbackWebService removerIndiceHistorico(String token, String data, String indiceCodigo, String grupoAC); FeedbackWebService setStatusFaixaSalarialHistorico(String token, Long faixaSalarialHistoricoId, Boolean aprovado, String mensagem, String empresaCodigoAC, String grupoAC); //Cargo, FaixaSalarial -> CAR FeedbackWebService criarCargo(String token, TCargo tCargo); FeedbackWebService atualizarCargo(String token, TCargo tCargo); FeedbackWebService removerCargo(String token, TCargo tCargo); FeedbackWebService criarSituacaoCargo(String token, TSituacaoCargo tSituacaoCargo); FeedbackWebService atualizarSituacaoCargo(String token, TSituacaoCargo tSituacaoCargo); FeedbackWebService removerSituacaoCargo(String token, TSituacaoCargo tSituacaoCargo); // Tipo de Ocorrencia -> OCR FeedbackWebService criarOcorrencia(String token, TOcorrencia tocorrencia); FeedbackWebService removerOcorrencia(String token, TOcorrencia tocorrencia); // Ocorrencia de Empregado -> OCE FeedbackWebService criarOcorrenciaEmpregado(String token, TOcorrenciaEmpregado[] ocorrenciaEmpregados); FeedbackWebService removerOcorrenciaEmpregado(String token, TOcorrenciaEmpregado[] ocorrenciaEmpregados); //Transferência em lote FeedbackWebService transferir(String token, TEmpresa tEmpresaOrigin, TEmpresa tEmpresaDestino, TEmpregado[] tEmpregados, TSituacao[] tSituacoes, String dataDesligamento); FeedbackWebService atualizarMovimentacaoEmLote(String token, String[] empregadoCodigos, String movimentacao, String codPessoalEstabOuArea, boolean atualizarTodasSituacoes, String empCodigo, String grupoAC) throws NumberFormatException, Exception; //TRU TAula[] getTreinamentosPrevistos(String empregadoCodigo, String empresaCodigo, String empresaGrupo, String dataIni, String dataFim); TAula[] getTreinamentosCursados(String empregadoCodigo, String empresaCodigo, String empresaGrupo, String dataIni, String dataFim); boolean existePesquisaParaSerRespondida(String empregadoCodigo, String empresaCodigo, String empresaGrupo); //Leitor10 public boolean existeColaboradorAtivo(String cpf); String versaoDoSistema(); }
UTF-8
Java
7,128
java
RHService.java
Java
[]
null
[]
package com.fortes.rh.business.ws; import com.fortes.rh.exception.TokenException; import com.fortes.rh.model.ws.FeedbackWebService; import com.fortes.rh.model.ws.TAreaOrganizacional; import com.fortes.rh.model.ws.TAuditoria; import com.fortes.rh.model.ws.TAula; import com.fortes.rh.model.ws.TCandidato; import com.fortes.rh.model.ws.TCargo; import com.fortes.rh.model.ws.TCidade; import com.fortes.rh.model.ws.TEmpregado; import com.fortes.rh.model.ws.TEmpresa; import com.fortes.rh.model.ws.TEstabelecimento; import com.fortes.rh.model.ws.TGrupo; import com.fortes.rh.model.ws.TIndice; import com.fortes.rh.model.ws.TIndiceHistorico; import com.fortes.rh.model.ws.TOcorrencia; import com.fortes.rh.model.ws.TOcorrenciaEmpregado; import com.fortes.rh.model.ws.TSituacao; import com.fortes.rh.model.ws.TSituacaoCargo; public interface RHService { String eco(String texto); String getToken(String login, String senha) throws Exception; //TEM QUE VER SE O AC, NÃO SEI QUE USSSSAAAAAAA boolean criarEmpresa(String token, TEmpresa empresa); boolean removerEmpresa(String empresaCodigoAC, String grupoAC); TEmpresa[] getEmpresas(String token) throws TokenException; TCidade[] getCidades(String token, String uf) throws TokenException; TCargo[] getCargos(String token, Long empresaId) throws TokenException; TCargo[] getFaixas(String token) throws TokenException; public String getNomesHomologos(String token, String nomeCandidato) throws TokenException; TGrupo[] getGrupos(String token) throws TokenException; TCargo[] getCargosAC(String token, String empCodigo, String codigo, String grupoAC) throws TokenException; //UTILIZADO PELO PLUGIN DO OFFICE boolean cadastrarCandidato(TCandidato candidato) throws Exception; //Tabela empregado no AC -> EPG FeedbackWebService removerEmpregado(String token, TEmpregado empregado); FeedbackWebService removerEmpregadoComDependencia(String token, TEmpregado empregado, TAuditoria tAuditoria); FeedbackWebService atualizarEmpregado(String token, TEmpregado empregado); FeedbackWebService atualizarEmpregadoAndSituacao(String token, TEmpregado empregado, TSituacao situacao);//O AC confirma cadastro de empregado que estava na CTT FeedbackWebService desligarEmpregado(String token, String codigo, String empCodigo, String dataDesligamento, String grupoAC); FeedbackWebService desligarEmpregadosEmLote(String token, String[] codigosAC, String empCodigo, String dataDesligamento, String grupoAC); FeedbackWebService religarEmpregado(String token, String codigo, String empCodigo, String grupoAC); FeedbackWebService atualizarCodigoEmpregado(String token, String grupoAC, String empresaCodigo, String codigo, String codigoNovo); FeedbackWebService cancelarContratacao(String token, TEmpregado empregado, TSituacao situacao, String mensagem); FeedbackWebService cancelarSolicitacaoDesligamentoAC(String token, TEmpregado empregado, String mensagem); void reSincronizarTabelaTemporariaAC (String token, String gruposAC) throws Exception; FeedbackWebService confirmarContratacao(String token, TEmpregado empregado, TSituacao situacao); //Tabela situacao no AC -> SEP FeedbackWebService removerSituacao(String token, TSituacao situacao); FeedbackWebService removerSituacaoEmLote(String token, Integer movimentoSalarialId, String empCodigo, String grupoAC); FeedbackWebService criarSituacaoEmLote(String token, TSituacao[] situacao); FeedbackWebService atualizarSituacaoEmLote(String token, TSituacao[] situacao); FeedbackWebService criarSituacao(String token, TEmpregado empregado, TSituacao situacao); FeedbackWebService atualizarSituacao(String token, TSituacao situacao); FeedbackWebService cancelarSituacao(String token, TSituacao situacao, String mensagem); FeedbackWebService setUltimaCategoriaESocialColaborador(String token, String categoriaESocial, String colaboradorCodigoAC, String empresaCodigoAC, String grupoAC); FeedbackWebService criarEstabelecimento(String token, TEstabelecimento testabelecimento); FeedbackWebService atualizarEstabelecimento(String token, TEstabelecimento testabelecimento); FeedbackWebService removerEstabelecimento(String token, String codigo, String empCodigo, String grupoAC); // AreaOrganizacional -> LOT FeedbackWebService criarAreaOrganizacional(String token, TAreaOrganizacional areaOrganizacional); FeedbackWebService atualizarAreaOrganizacional(String token, TAreaOrganizacional areaOrganizacional); FeedbackWebService removerAreaOrganizacional(String token, TAreaOrganizacional areaOrganizacional); // Indice -> IND FeedbackWebService criarIndice(String token, TIndice tindice); FeedbackWebService atualizarIndice(String token, TIndice tindice); FeedbackWebService removerIndice(String token, String codigo, String grupoAC); // Historico do Indice -> VID FeedbackWebService criarIndiceHistorico(String token, TIndiceHistorico tindiceHistorico); FeedbackWebService removerIndiceHistorico(String token, String data, String indiceCodigo, String grupoAC); FeedbackWebService setStatusFaixaSalarialHistorico(String token, Long faixaSalarialHistoricoId, Boolean aprovado, String mensagem, String empresaCodigoAC, String grupoAC); //Cargo, FaixaSalarial -> CAR FeedbackWebService criarCargo(String token, TCargo tCargo); FeedbackWebService atualizarCargo(String token, TCargo tCargo); FeedbackWebService removerCargo(String token, TCargo tCargo); FeedbackWebService criarSituacaoCargo(String token, TSituacaoCargo tSituacaoCargo); FeedbackWebService atualizarSituacaoCargo(String token, TSituacaoCargo tSituacaoCargo); FeedbackWebService removerSituacaoCargo(String token, TSituacaoCargo tSituacaoCargo); // Tipo de Ocorrencia -> OCR FeedbackWebService criarOcorrencia(String token, TOcorrencia tocorrencia); FeedbackWebService removerOcorrencia(String token, TOcorrencia tocorrencia); // Ocorrencia de Empregado -> OCE FeedbackWebService criarOcorrenciaEmpregado(String token, TOcorrenciaEmpregado[] ocorrenciaEmpregados); FeedbackWebService removerOcorrenciaEmpregado(String token, TOcorrenciaEmpregado[] ocorrenciaEmpregados); //Transferência em lote FeedbackWebService transferir(String token, TEmpresa tEmpresaOrigin, TEmpresa tEmpresaDestino, TEmpregado[] tEmpregados, TSituacao[] tSituacoes, String dataDesligamento); FeedbackWebService atualizarMovimentacaoEmLote(String token, String[] empregadoCodigos, String movimentacao, String codPessoalEstabOuArea, boolean atualizarTodasSituacoes, String empCodigo, String grupoAC) throws NumberFormatException, Exception; //TRU TAula[] getTreinamentosPrevistos(String empregadoCodigo, String empresaCodigo, String empresaGrupo, String dataIni, String dataFim); TAula[] getTreinamentosCursados(String empregadoCodigo, String empresaCodigo, String empresaGrupo, String dataIni, String dataFim); boolean existePesquisaParaSerRespondida(String empregadoCodigo, String empresaCodigo, String empresaGrupo); //Leitor10 public boolean existeColaboradorAtivo(String cpf); String versaoDoSistema(); }
7,128
0.827112
0.826831
118
58.40678
46.956749
247
false
false
0
0
0
0
0
0
2.271186
false
false
14
97357ef50f8e665b77fbeb2ef99e3c7987c47c95
5,231,270,225,627
ea91d2f68fba31f2d72eb382d4b0401d75924c27
/app/src/main/java/com/xwr/smarthosptial/arcface/view/CameraSurfaceView.java
d3efe1d503a00e59bd33832600fcdd6c1ca737b9
[]
no_license
huahua22/smarthosptial
https://github.com/huahua22/smarthosptial
445be154cd654bf8e02ed14e0769476bdfeb7a7d
32c3f83ee8a6895f0359748b417e2ceeb0b111e4
refs/heads/master
2022-07-25T03:11:17.564000
2020-05-22T09:28:12
2020-05-22T09:28:12
262,535,558
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.xwr.smarthosptial.arcface.view; import android.content.Context; import android.hardware.Camera; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.SurfaceView; public class CameraSurfaceView extends SurfaceView { private Handler mHandler=new Handler(Looper.getMainLooper()) { @Override public void handleMessage(Message msg) { } }; private Camera mCamera; public CameraSurfaceView(Context context) { super(context); } public CameraSurfaceView(Context context, AttributeSet attrs) { super(context, attrs); } public CameraSurfaceView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override public boolean onTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: break; case MotionEvent.ACTION_UP: break; } return super.onTouchEvent(event); } public void addCamera(Camera camera) { this.mCamera=camera; } }
UTF-8
Java
1,125
java
CameraSurfaceView.java
Java
[]
null
[]
package com.xwr.smarthosptial.arcface.view; import android.content.Context; import android.hardware.Camera; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.SurfaceView; public class CameraSurfaceView extends SurfaceView { private Handler mHandler=new Handler(Looper.getMainLooper()) { @Override public void handleMessage(Message msg) { } }; private Camera mCamera; public CameraSurfaceView(Context context) { super(context); } public CameraSurfaceView(Context context, AttributeSet attrs) { super(context, attrs); } public CameraSurfaceView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override public boolean onTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: break; case MotionEvent.ACTION_UP: break; } return super.onTouchEvent(event); } public void addCamera(Camera camera) { this.mCamera=camera; } }
1,125
0.728889
0.728889
50
21.5
20.536066
83
false
false
0
0
0
0
0
0
0.48
false
false
14