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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f17a0e4c1886c2b862d6e0af32c7d4f631b747a0 | 16,260,746,235,452 | 86d1c5145ba16be7350705fab454f2cbb04e7260 | /src/test/java/com/sf/doctor/TestWhiteList.java | b5fc166be7fbe586e868adfe3b285c4306b9561b | [
"Apache-2.0"
] | permissive | zizon/strange | https://github.com/zizon/strange | 45ff26cad86283dcef1e1f43604bcba60c35e6e3 | fdab165cec46e7b9bdd2a9c1d574bee688ce2e87 | refs/heads/master | 2020-08-31T09:29:42.741000 | 2019-12-12T19:01:16 | 2019-12-12T19:01:16 | 218,660,300 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sf.doctor;
import org.junit.Test;
public class TestWhiteList {
@Test
public void test() {
new WhiteList();
}
}
| UTF-8 | Java | 157 | java | TestWhiteList.java | Java | [] | null | [] | package com.sf.doctor;
import org.junit.Test;
public class TestWhiteList {
@Test
public void test() {
new WhiteList();
}
}
| 157 | 0.573248 | 0.573248 | 11 | 12.272727 | 11.095379 | 28 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.272727 | false | false | 11 |
151980d08e8648c716fa78a91c4198ae74fc4d75 | 36,421,322,688,536 | 0e06e096a9f95ab094b8078ea2cd310759af008b | /sources/com/google/android/gms/internal/ads/zzas.java | 58a23dc8c4c813e45ef01d0eb46f2b54a963c582 | [] | no_license | Manifold0/adcom_decompile | https://github.com/Manifold0/adcom_decompile | 4bc2907a057c73703cf141dc0749ed4c014ebe55 | fce3d59b59480abe91f90ba05b0df4eaadd849f7 | refs/heads/master | 2020-05-21T02:01:59.787000 | 2019-05-10T00:36:27 | 2019-05-10T00:36:27 | 185,856,424 | 1 | 2 | null | false | 2019-05-10T00:36:28 | 2019-05-09T19:04:28 | 2019-05-09T22:35:26 | 2019-05-10T00:36:27 | 95,641 | 0 | 2 | 0 | Java | false | false | package com.google.android.gms.internal.ads;
import com.adjust.sdk.Constants;
import com.applovin.sdk.AppLovinErrorCodes;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.net.ssl.SSLSocketFactory;
public final class zzas extends zzai {
private final zzat zzci;
private final SSLSocketFactory zzcj;
public zzas() {
this(null);
}
private zzas(zzat zzat) {
this(null, null);
}
private zzas(zzat zzat, SSLSocketFactory sSLSocketFactory) {
this.zzci = null;
this.zzcj = null;
}
private static InputStream zza(HttpURLConnection httpURLConnection) {
try {
return httpURLConnection.getInputStream();
} catch (IOException e) {
return httpURLConnection.getErrorStream();
}
}
private static List<zzl> zza(Map<String, List<String>> map) {
List<zzl> arrayList = new ArrayList(map.size());
for (Entry entry : map.entrySet()) {
if (entry.getKey() != null) {
for (String zzl : (List) entry.getValue()) {
arrayList.add(new zzl((String) entry.getKey(), zzl));
}
}
}
return arrayList;
}
private static void zza(HttpURLConnection httpURLConnection, zzr<?> zzr) throws IOException, zza {
byte[] zzg = zzr.zzg();
if (zzg != null) {
httpURLConnection.setDoOutput(true);
String str = "Content-Type";
String str2 = "application/x-www-form-urlencoded; charset=";
String valueOf = String.valueOf("UTF-8");
httpURLConnection.addRequestProperty(str, valueOf.length() != 0 ? str2.concat(valueOf) : new String(str2));
DataOutputStream dataOutputStream = new DataOutputStream(httpURLConnection.getOutputStream());
dataOutputStream.write(zzg);
dataOutputStream.close();
}
}
public final zzaq zza(zzr<?> zzr, Map<String, String> map) throws IOException, zza {
String zzg;
String url = zzr.getUrl();
HashMap hashMap = new HashMap();
hashMap.putAll(zzr.getHeaders());
hashMap.putAll(map);
if (this.zzci != null) {
zzg = this.zzci.zzg(url);
if (zzg == null) {
String str = "URL blocked by rewriter: ";
zzg = String.valueOf(url);
throw new IOException(zzg.length() != 0 ? str.concat(zzg) : new String(str));
}
}
zzg = url;
URL url2 = new URL(zzg);
HttpURLConnection httpURLConnection = (HttpURLConnection) url2.openConnection();
httpURLConnection.setInstanceFollowRedirects(HttpURLConnection.getFollowRedirects());
int zzi = zzr.zzi();
httpURLConnection.setConnectTimeout(zzi);
httpURLConnection.setReadTimeout(zzi);
httpURLConnection.setUseCaches(false);
httpURLConnection.setDoInput(true);
Constants.SCHEME.equals(url2.getProtocol());
for (String url3 : hashMap.keySet()) {
httpURLConnection.addRequestProperty(url3, (String) hashMap.get(url3));
}
switch (zzr.getMethod()) {
case -1:
break;
case 0:
httpURLConnection.setRequestMethod("GET");
break;
case 1:
httpURLConnection.setRequestMethod("POST");
zza(httpURLConnection, (zzr) zzr);
break;
case 2:
httpURLConnection.setRequestMethod("PUT");
zza(httpURLConnection, (zzr) zzr);
break;
case 3:
httpURLConnection.setRequestMethod("DELETE");
break;
case 4:
httpURLConnection.setRequestMethod("HEAD");
break;
case 5:
httpURLConnection.setRequestMethod("OPTIONS");
break;
case 6:
httpURLConnection.setRequestMethod("TRACE");
break;
case 7:
httpURLConnection.setRequestMethod("PATCH");
zza(httpURLConnection, (zzr) zzr);
break;
default:
throw new IllegalStateException("Unknown method type.");
}
zzi = httpURLConnection.getResponseCode();
if (zzi == -1) {
throw new IOException("Could not retrieve response code from HttpUrlConnection.");
}
boolean z = (zzr.getMethod() == 4 || ((100 <= zzi && zzi < 200) || zzi == AppLovinErrorCodes.NO_FILL || zzi == 304)) ? false : true;
return !z ? new zzaq(zzi, zza(httpURLConnection.getHeaderFields())) : new zzaq(zzi, zza(httpURLConnection.getHeaderFields()), httpURLConnection.getContentLength(), zza(httpURLConnection));
}
}
| UTF-8 | Java | 5,065 | java | zzas.java | Java | [] | null | [] | package com.google.android.gms.internal.ads;
import com.adjust.sdk.Constants;
import com.applovin.sdk.AppLovinErrorCodes;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.net.ssl.SSLSocketFactory;
public final class zzas extends zzai {
private final zzat zzci;
private final SSLSocketFactory zzcj;
public zzas() {
this(null);
}
private zzas(zzat zzat) {
this(null, null);
}
private zzas(zzat zzat, SSLSocketFactory sSLSocketFactory) {
this.zzci = null;
this.zzcj = null;
}
private static InputStream zza(HttpURLConnection httpURLConnection) {
try {
return httpURLConnection.getInputStream();
} catch (IOException e) {
return httpURLConnection.getErrorStream();
}
}
private static List<zzl> zza(Map<String, List<String>> map) {
List<zzl> arrayList = new ArrayList(map.size());
for (Entry entry : map.entrySet()) {
if (entry.getKey() != null) {
for (String zzl : (List) entry.getValue()) {
arrayList.add(new zzl((String) entry.getKey(), zzl));
}
}
}
return arrayList;
}
private static void zza(HttpURLConnection httpURLConnection, zzr<?> zzr) throws IOException, zza {
byte[] zzg = zzr.zzg();
if (zzg != null) {
httpURLConnection.setDoOutput(true);
String str = "Content-Type";
String str2 = "application/x-www-form-urlencoded; charset=";
String valueOf = String.valueOf("UTF-8");
httpURLConnection.addRequestProperty(str, valueOf.length() != 0 ? str2.concat(valueOf) : new String(str2));
DataOutputStream dataOutputStream = new DataOutputStream(httpURLConnection.getOutputStream());
dataOutputStream.write(zzg);
dataOutputStream.close();
}
}
public final zzaq zza(zzr<?> zzr, Map<String, String> map) throws IOException, zza {
String zzg;
String url = zzr.getUrl();
HashMap hashMap = new HashMap();
hashMap.putAll(zzr.getHeaders());
hashMap.putAll(map);
if (this.zzci != null) {
zzg = this.zzci.zzg(url);
if (zzg == null) {
String str = "URL blocked by rewriter: ";
zzg = String.valueOf(url);
throw new IOException(zzg.length() != 0 ? str.concat(zzg) : new String(str));
}
}
zzg = url;
URL url2 = new URL(zzg);
HttpURLConnection httpURLConnection = (HttpURLConnection) url2.openConnection();
httpURLConnection.setInstanceFollowRedirects(HttpURLConnection.getFollowRedirects());
int zzi = zzr.zzi();
httpURLConnection.setConnectTimeout(zzi);
httpURLConnection.setReadTimeout(zzi);
httpURLConnection.setUseCaches(false);
httpURLConnection.setDoInput(true);
Constants.SCHEME.equals(url2.getProtocol());
for (String url3 : hashMap.keySet()) {
httpURLConnection.addRequestProperty(url3, (String) hashMap.get(url3));
}
switch (zzr.getMethod()) {
case -1:
break;
case 0:
httpURLConnection.setRequestMethod("GET");
break;
case 1:
httpURLConnection.setRequestMethod("POST");
zza(httpURLConnection, (zzr) zzr);
break;
case 2:
httpURLConnection.setRequestMethod("PUT");
zza(httpURLConnection, (zzr) zzr);
break;
case 3:
httpURLConnection.setRequestMethod("DELETE");
break;
case 4:
httpURLConnection.setRequestMethod("HEAD");
break;
case 5:
httpURLConnection.setRequestMethod("OPTIONS");
break;
case 6:
httpURLConnection.setRequestMethod("TRACE");
break;
case 7:
httpURLConnection.setRequestMethod("PATCH");
zza(httpURLConnection, (zzr) zzr);
break;
default:
throw new IllegalStateException("Unknown method type.");
}
zzi = httpURLConnection.getResponseCode();
if (zzi == -1) {
throw new IOException("Could not retrieve response code from HttpUrlConnection.");
}
boolean z = (zzr.getMethod() == 4 || ((100 <= zzi && zzi < 200) || zzi == AppLovinErrorCodes.NO_FILL || zzi == 304)) ? false : true;
return !z ? new zzaq(zzi, zza(httpURLConnection.getHeaderFields())) : new zzaq(zzi, zza(httpURLConnection.getHeaderFields()), httpURLConnection.getContentLength(), zza(httpURLConnection));
}
}
| 5,065 | 0.58618 | 0.579862 | 135 | 36.51852 | 29.877987 | 196 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.77037 | false | false | 11 |
fb0c9a747e2a231b01d949581b02eba348faa615 | 27,762,668,662,372 | 9d8bda2d897f5ab809795195db6cbc8aa8eab3bb | /codes/day32/src/cn/itcast/demo/InetAddressDemo.java | 23161fd2c7fe88192189480343b5c2bd35b134b0 | [] | no_license | survivorrr/code_all | https://github.com/survivorrr/code_all | bd70142bd8f1b05e6f793ccf5abde625d0a29b5a | 85285224ecd1968dcdd162fd503ec08f7824c1cf | refs/heads/master | 2022-12-27T16:17:07.075000 | 2019-08-02T14:30:37 | 2019-08-02T14:30:37 | 200,228,500 | 0 | 0 | null | false | 2022-12-16T02:34:36 | 2019-08-02T12:10:33 | 2019-08-02T14:40:32 | 2022-12-16T02:34:34 | 6,831 | 0 | 0 | 11 | CSS | false | false | package cn.itcast.demo;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class InetAddressDemo {
public static void main(String[] args) throws UnknownHostException {
InetAddress inet = InetAddress.getLocalHost();//输出结果就是主机名
System.out.println(inet);
String ip = inet.getHostAddress();
String name = inet.getHostName();
System.out.println(ip+" "+name);
/* String host = inet.toString();
String[] str = host.split("/");//切割字符串
for(int i=0;i<str.length;i++){
System.out.println(str[i]);
}*/
}
}
| GB18030 | Java | 572 | java | InetAddressDemo.java | Java | [] | null | [] | package cn.itcast.demo;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class InetAddressDemo {
public static void main(String[] args) throws UnknownHostException {
InetAddress inet = InetAddress.getLocalHost();//输出结果就是主机名
System.out.println(inet);
String ip = inet.getHostAddress();
String name = inet.getHostName();
System.out.println(ip+" "+name);
/* String host = inet.toString();
String[] str = host.split("/");//切割字符串
for(int i=0;i<str.length;i++){
System.out.println(str[i]);
}*/
}
}
| 572 | 0.702206 | 0.700368 | 20 | 26.200001 | 18.993683 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.9 | false | false | 11 |
89dad77514fec25345012daf14a85744ca8ec5e8 | 4,707,284,211,071 | 5fada6025b58f4f0d093c01b464e4bb332f95b6e | /common/mybatis-model/src/main/java/com/domain/biz/settlement/po/BalanceExample.java | 12f930ce877c37a588bc1109d91b20a3818e2ffe | [] | no_license | vinesmario/PlanA | https://github.com/vinesmario/PlanA | a7b64e5a828694bd0fe95ebe45f21878afb5de1f | 6bdd51e9701fea4522549ba9bb84457be0fca15f | refs/heads/master | 2018-10-22T19:34:13.280000 | 2018-07-27T09:18:12 | 2018-07-27T09:18:12 | 120,159,291 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.domain.biz.settlement.po;
import com.domain.biz.model.po.CrudEntityExample;
public class BalanceExample extends CrudEntityExample {
}
| UTF-8 | Java | 149 | java | BalanceExample.java | Java | [] | null | [] | package com.domain.biz.settlement.po;
import com.domain.biz.model.po.CrudEntityExample;
public class BalanceExample extends CrudEntityExample {
}
| 149 | 0.818792 | 0.818792 | 7 | 20.285715 | 23.650517 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false | 11 |
293b0594802eef7fb77cc6bf2330e5b44977cbed | 25,039,659,340,722 | 6634dfd55656cd187293aa4985efa2c4b6a1633b | /src/main/java/uk/ac/ebi/spot/gwas/curation/rest/dto/PublicationDtoAssembler.java | 372fe52f6e725bc17a1727d035ba9fa4f09bd0ee | [] | no_license | EBISPOT/gwasdepo-curation-service | https://github.com/EBISPOT/gwasdepo-curation-service | 8586033eeef39d83debdf5c9a2a8f45b43ff27a8 | 974c50f476461e665de1d6d7541af12e24f546ee | refs/heads/master | 2023-02-26T02:41:56.375000 | 2022-12-06T13:22:33 | 2022-12-06T13:22:33 | 309,315,145 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package uk.ac.ebi.spot.gwas.curation.rest.dto;
import org.springframework.stereotype.Component;
import uk.ac.ebi.spot.gwas.deposition.domain.Publication;
import uk.ac.ebi.spot.gwas.deposition.dto.CorrespondingAuthorDto;
import uk.ac.ebi.spot.gwas.deposition.dto.PublicationDto;
@Component
public class PublicationDtoAssembler {
public static PublicationDto assemble(Publication publication) {
return new PublicationDto(publication.getId(),
publication.getPmid(),
publication.getTitle(),
publication.getJournal(),
publication.getFirstAuthor(),
publication.getPublicationDate(),
publication.getCorrespondingAuthor() != null ?
new CorrespondingAuthorDto(publication.getCorrespondingAuthor().getAuthorName(),
publication.getCorrespondingAuthor().getEmail()) : null,
publication.getStatus());
}
}
| UTF-8 | Java | 984 | java | PublicationDtoAssembler.java | Java | [] | null | [] | package uk.ac.ebi.spot.gwas.curation.rest.dto;
import org.springframework.stereotype.Component;
import uk.ac.ebi.spot.gwas.deposition.domain.Publication;
import uk.ac.ebi.spot.gwas.deposition.dto.CorrespondingAuthorDto;
import uk.ac.ebi.spot.gwas.deposition.dto.PublicationDto;
@Component
public class PublicationDtoAssembler {
public static PublicationDto assemble(Publication publication) {
return new PublicationDto(publication.getId(),
publication.getPmid(),
publication.getTitle(),
publication.getJournal(),
publication.getFirstAuthor(),
publication.getPublicationDate(),
publication.getCorrespondingAuthor() != null ?
new CorrespondingAuthorDto(publication.getCorrespondingAuthor().getAuthorName(),
publication.getCorrespondingAuthor().getEmail()) : null,
publication.getStatus());
}
}
| 984 | 0.66565 | 0.66565 | 27 | 35.444443 | 29.543858 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.518519 | false | false | 11 |
d555b56a4bda403bf401f0ae37b35a9d705c8581 | 11,158,325,054,315 | 8faf1d8ac6e8e60ab08836bb8f5572d180043f52 | /src/dominion/Chancellor.java | fe3acc9f265a791764ef0c9313c5191a48faa172 | [
"MIT"
] | permissive | drsirmrpresidentfathercharles/dominion | https://github.com/drsirmrpresidentfathercharles/dominion | f3dd7645e28d2a703cb45be73d4d0b3b0934b40b | 005a097a62cb95bf76e131cac580901a0cd19dba | HEAD | 2018-01-07T08:24:35.728000 | 2014-05-21T19:02:49 | 2014-05-21T19:02:49 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package dominion;
import java.util.ArrayList;
import java.util.Random;
public class Chancellor extends ActionCard {
Chancellor() {
money = 2.0;
price = 3.0;
}
Interface inter = new Interface();
Random generator = new Random();
DeckHolder doAction(DeckHolder player) {
ArrayList<Card> deck = player.deck();
ArrayList<Card> hand = player.hand();
ArrayList<Card> discard = player.discard();
if(player.playerType()) {
if(inter.in("Would you like to discard your deck?[Y/N]").equals("Y")) {
for(Card k:deck) {
discard.add(k);
deck.remove(k);
}
}
}
else {
if(generator.nextBoolean()) {
for(Card k:deck) {
discard.add(k);
deck.remove(k);
}
}
}
return new DeckHolder(deck,hand,discard);
}
}
| UTF-8 | Java | 794 | java | Chancellor.java | Java | [] | null | [] | package dominion;
import java.util.ArrayList;
import java.util.Random;
public class Chancellor extends ActionCard {
Chancellor() {
money = 2.0;
price = 3.0;
}
Interface inter = new Interface();
Random generator = new Random();
DeckHolder doAction(DeckHolder player) {
ArrayList<Card> deck = player.deck();
ArrayList<Card> hand = player.hand();
ArrayList<Card> discard = player.discard();
if(player.playerType()) {
if(inter.in("Would you like to discard your deck?[Y/N]").equals("Y")) {
for(Card k:deck) {
discard.add(k);
deck.remove(k);
}
}
}
else {
if(generator.nextBoolean()) {
for(Card k:deck) {
discard.add(k);
deck.remove(k);
}
}
}
return new DeckHolder(deck,hand,discard);
}
}
| 794 | 0.609572 | 0.604534 | 35 | 20.685715 | 16.94659 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.6 | false | false | 11 |
d07c5f267e0d0c470de5eaee18308ae6a8ac216b | 3,427,383,927,274 | b37726900ee16a5b72a6cd7b2a2d72814fffe924 | /src/main/java/vn/com/vndirect/lucene/finfodb/beans/AnalysisIndexingBean.java | faae826b2ba99b78537fd7fac80bb97dc0974f1b | [] | no_license | UnsungHero0/portal | https://github.com/UnsungHero0/portal | 6b9cfd7271f2b1d587a6f311de49c67e8dd8ff9f | 32325d3e1732d900ee3f874c55890afc8f347700 | refs/heads/master | 2021-01-20T06:18:01.548000 | 2014-11-12T10:27:43 | 2014-11-12T10:27:43 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*--------------------------------------------------------------------------*
| Modification Logs:
| DATE AUTHOR DESCRIPTION
| ------------------------------------------------
| Mar 4, 2008 TungNQ First generate code
*--------------------------------------------------------------------------*/
package vn.com.vndirect.lucene.finfodb.beans;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import vn.com.vndirect.domain.embeddb.DynamicMetaTable;
/**
* @author tungnq.nguyen
*
*/
@SuppressWarnings("serial")
public class AnalysisIndexingBean implements Serializable {
private long companyId;
private String symbol;
private String exchangeCode;
private String sectorCode;
private String industryCode;
private String intraday;
private double closePrice;
private String companyName;
private String companyFullName;
private String abbName;
private Date firstTradingDate;
private String industryName;
private String locale;
private String exchangeName;
private String sectorGroupCode;
private String industryGroupCode;
private double pctAbove52WeekLow;
private double pctBelow52WeekHigh;
private double vsSma13Day;
private double vsSma50Day;
private Map<String, AnalysisCachingValueInfo> mapValues = new HashMap<String, AnalysisCachingValueInfo>();
public AnalysisIndexingBean() {
}
public AnalysisIndexingBean(long companyId, String symbol) {
this.companyId = companyId;
this.symbol = symbol;
}
/**
* @return the companyId
*/
public long getCompanyId() {
return companyId;
}
/**
* @param companyId
* the companyId to set
*/
public void setCompanyId(long companyId) {
this.companyId = companyId;
}
/**
* @return the symbol
*/
public String getSymbol() {
return symbol;
}
/**
* @param symbol
* the symbol to set
*/
public void setSymbol(String symbol) {
this.symbol = symbol;
}
/**
*
* @param itemCode
* @param value
*/
public void addValue(String itemCode, AnalysisCachingValueInfo value) {
this.mapValues.put(converKey(itemCode), value);
}
/**
*
* @param itemCode
* @return
*/
public AnalysisCachingValueInfo getValue(String itemCode) {
return this.mapValues.get(converKey(DynamicMetaTable.checkPrefix(itemCode) ? itemCode : DynamicMetaTable.generateFieldName(itemCode)));
}
/**
*
* @return
*/
public String[] getValueKeys() {
return (String[]) this.mapValues.keySet().toArray(new String[this.mapValues.size()]);
}
/**
*
* @param key
* @return
*/
private String converKey(String key) {
return (key == null ? "" : key.toLowerCase());
}
/**
*
*/
public String toString() {
return "AnalysisBean-[companyId:" + companyId + ", symbol: " + symbol + ", mapValues: " + mapValues + "]";
}
/**
* @return the exchangeCode
*/
public String getExchangeCode() {
return this.exchangeCode;
}
/**
* @param exchangeCode
* the exchangeCode to set
*/
public void setExchangeCode(String exchangeCode) {
this.exchangeCode = exchangeCode;
}
/**
* @return the sectorCode
*/
public String getSectorCode() {
return this.sectorCode;
}
/**
* @param sectorCode
* the sectorCode to set
*/
public void setSectorCode(String sectorCode) {
this.sectorCode = sectorCode;
}
/**
* @return the industryCode
*/
public String getIndustryCode() {
return this.industryCode;
}
/**
* @param industryCode
* the industryCode to set
*/
public void setIndustryCode(String industryCode) {
this.industryCode = industryCode;
}
/**
* @return the mapValues
*/
public Map<String, AnalysisCachingValueInfo> getMapValues() {
return mapValues;
}
/**
* @return the intraday
*/
public String getIntraday() {
return intraday;
}
/**
* @param intraday
* the intraday to set
*/
public void setIntraday(String intraday) {
this.intraday = intraday;
}
public double getClosePrice() {
return closePrice;
}
public void setClosePrice(double closePrice) {
this.closePrice = closePrice;
}
public String getCompanyName() {
return companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
public String getCompanyFullName() {
return companyFullName;
}
public void setCompanyFullName(String companyFullName) {
this.companyFullName = companyFullName;
}
public String getIndustryName() {
return industryName;
}
public void setIndustryName(String industryName) {
this.industryName = industryName;
}
public String getExchangeName() {
return exchangeName;
}
public void setExchangeName(String exchangeName) {
this.exchangeName = exchangeName;
}
public String getSectorGroupCode() {
return sectorGroupCode;
}
public void setSectorGroupCode(String sectorGroupCode) {
this.sectorGroupCode = sectorGroupCode;
}
public String getIndustryGroupCode() {
return industryGroupCode;
}
public void setIndustryGroupCode(String industryGroupCode) {
this.industryGroupCode = industryGroupCode;
}
public String getLocale() {
return locale;
}
public void setLocale(String locale) {
this.locale = locale;
}
public Date getFirstTradingDate() {
return firstTradingDate;
}
public void setFirstTradingDate(Date firstTradingDate) {
this.firstTradingDate = firstTradingDate;
}
public String getAbbName() {
return abbName;
}
public void setAbbName(String abbName) {
this.abbName = abbName;
}
public void setMapValues(Map<String, AnalysisCachingValueInfo> mapValues) {
this.mapValues = mapValues;
}
public double getPctAbove52WeekLow() {
return pctAbove52WeekLow;
}
public void setPctAbove52WeekLow(double pctAbove52WeekLow) {
this.pctAbove52WeekLow = pctAbove52WeekLow;
}
public double getPctBelow52WeekHigh() {
return pctBelow52WeekHigh;
}
public void setPctBelow52WeekHigh(double pctBelow52WeekHigh) {
this.pctBelow52WeekHigh = pctBelow52WeekHigh;
}
public double getVsSma13Day() {
return vsSma13Day;
}
public void setVsSma13Day(double vsSma13Day) {
this.vsSma13Day = vsSma13Day;
}
public double getVsSma50Day() {
return vsSma50Day;
}
public void setVsSma50Day(double vsSma50Day) {
this.vsSma50Day = vsSma50Day;
}
}
| UTF-8 | Java | 6,288 | java | AnalysisIndexingBean.java | Java | [
{
"context": "---------------------------------\n | Mar 4, 2008 TungNQ First generate code\n *---------------------",
"end": 212,
"score": 0.705560028553009,
"start": 208,
"tag": "NAME",
"value": "Tung"
},
{
"context": "----------------------------\n | Mar 4, 2008 TungNQ First generate code\n *-----------------------",
"end": 214,
"score": 0.9050268530845642,
"start": 212,
"tag": "USERNAME",
"value": "NQ"
},
{
"context": "t.domain.embeddb.DynamicMetaTable;\n\n/**\n * @author tungnq.nguyen\n * \n */\n@SuppressWarnings(\"serial\")\npublic class ",
"end": 552,
"score": 0.998731791973114,
"start": 539,
"tag": "USERNAME",
"value": "tungnq.nguyen"
}
] | null | [] | /*--------------------------------------------------------------------------*
| Modification Logs:
| DATE AUTHOR DESCRIPTION
| ------------------------------------------------
| Mar 4, 2008 TungNQ First generate code
*--------------------------------------------------------------------------*/
package vn.com.vndirect.lucene.finfodb.beans;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import vn.com.vndirect.domain.embeddb.DynamicMetaTable;
/**
* @author tungnq.nguyen
*
*/
@SuppressWarnings("serial")
public class AnalysisIndexingBean implements Serializable {
private long companyId;
private String symbol;
private String exchangeCode;
private String sectorCode;
private String industryCode;
private String intraday;
private double closePrice;
private String companyName;
private String companyFullName;
private String abbName;
private Date firstTradingDate;
private String industryName;
private String locale;
private String exchangeName;
private String sectorGroupCode;
private String industryGroupCode;
private double pctAbove52WeekLow;
private double pctBelow52WeekHigh;
private double vsSma13Day;
private double vsSma50Day;
private Map<String, AnalysisCachingValueInfo> mapValues = new HashMap<String, AnalysisCachingValueInfo>();
public AnalysisIndexingBean() {
}
public AnalysisIndexingBean(long companyId, String symbol) {
this.companyId = companyId;
this.symbol = symbol;
}
/**
* @return the companyId
*/
public long getCompanyId() {
return companyId;
}
/**
* @param companyId
* the companyId to set
*/
public void setCompanyId(long companyId) {
this.companyId = companyId;
}
/**
* @return the symbol
*/
public String getSymbol() {
return symbol;
}
/**
* @param symbol
* the symbol to set
*/
public void setSymbol(String symbol) {
this.symbol = symbol;
}
/**
*
* @param itemCode
* @param value
*/
public void addValue(String itemCode, AnalysisCachingValueInfo value) {
this.mapValues.put(converKey(itemCode), value);
}
/**
*
* @param itemCode
* @return
*/
public AnalysisCachingValueInfo getValue(String itemCode) {
return this.mapValues.get(converKey(DynamicMetaTable.checkPrefix(itemCode) ? itemCode : DynamicMetaTable.generateFieldName(itemCode)));
}
/**
*
* @return
*/
public String[] getValueKeys() {
return (String[]) this.mapValues.keySet().toArray(new String[this.mapValues.size()]);
}
/**
*
* @param key
* @return
*/
private String converKey(String key) {
return (key == null ? "" : key.toLowerCase());
}
/**
*
*/
public String toString() {
return "AnalysisBean-[companyId:" + companyId + ", symbol: " + symbol + ", mapValues: " + mapValues + "]";
}
/**
* @return the exchangeCode
*/
public String getExchangeCode() {
return this.exchangeCode;
}
/**
* @param exchangeCode
* the exchangeCode to set
*/
public void setExchangeCode(String exchangeCode) {
this.exchangeCode = exchangeCode;
}
/**
* @return the sectorCode
*/
public String getSectorCode() {
return this.sectorCode;
}
/**
* @param sectorCode
* the sectorCode to set
*/
public void setSectorCode(String sectorCode) {
this.sectorCode = sectorCode;
}
/**
* @return the industryCode
*/
public String getIndustryCode() {
return this.industryCode;
}
/**
* @param industryCode
* the industryCode to set
*/
public void setIndustryCode(String industryCode) {
this.industryCode = industryCode;
}
/**
* @return the mapValues
*/
public Map<String, AnalysisCachingValueInfo> getMapValues() {
return mapValues;
}
/**
* @return the intraday
*/
public String getIntraday() {
return intraday;
}
/**
* @param intraday
* the intraday to set
*/
public void setIntraday(String intraday) {
this.intraday = intraday;
}
public double getClosePrice() {
return closePrice;
}
public void setClosePrice(double closePrice) {
this.closePrice = closePrice;
}
public String getCompanyName() {
return companyName;
}
public void setCompanyName(String companyName) {
this.companyName = companyName;
}
public String getCompanyFullName() {
return companyFullName;
}
public void setCompanyFullName(String companyFullName) {
this.companyFullName = companyFullName;
}
public String getIndustryName() {
return industryName;
}
public void setIndustryName(String industryName) {
this.industryName = industryName;
}
public String getExchangeName() {
return exchangeName;
}
public void setExchangeName(String exchangeName) {
this.exchangeName = exchangeName;
}
public String getSectorGroupCode() {
return sectorGroupCode;
}
public void setSectorGroupCode(String sectorGroupCode) {
this.sectorGroupCode = sectorGroupCode;
}
public String getIndustryGroupCode() {
return industryGroupCode;
}
public void setIndustryGroupCode(String industryGroupCode) {
this.industryGroupCode = industryGroupCode;
}
public String getLocale() {
return locale;
}
public void setLocale(String locale) {
this.locale = locale;
}
public Date getFirstTradingDate() {
return firstTradingDate;
}
public void setFirstTradingDate(Date firstTradingDate) {
this.firstTradingDate = firstTradingDate;
}
public String getAbbName() {
return abbName;
}
public void setAbbName(String abbName) {
this.abbName = abbName;
}
public void setMapValues(Map<String, AnalysisCachingValueInfo> mapValues) {
this.mapValues = mapValues;
}
public double getPctAbove52WeekLow() {
return pctAbove52WeekLow;
}
public void setPctAbove52WeekLow(double pctAbove52WeekLow) {
this.pctAbove52WeekLow = pctAbove52WeekLow;
}
public double getPctBelow52WeekHigh() {
return pctBelow52WeekHigh;
}
public void setPctBelow52WeekHigh(double pctBelow52WeekHigh) {
this.pctBelow52WeekHigh = pctBelow52WeekHigh;
}
public double getVsSma13Day() {
return vsSma13Day;
}
public void setVsSma13Day(double vsSma13Day) {
this.vsSma13Day = vsSma13Day;
}
public double getVsSma50Day() {
return vsSma50Day;
}
public void setVsSma50Day(double vsSma50Day) {
this.vsSma50Day = vsSma50Day;
}
}
| 6,288 | 0.689408 | 0.679707 | 311 | 19.218649 | 21.333 | 137 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.202572 | false | false | 11 |
315d516293fcbc019bd53ec780ab6220ad6cd88e | 31,439,160,608,629 | 9992921ddeae3d27810c0d9eb4bbf7423e7908bc | /yantianpeng-web/src/main/java/com/yantianpeng/entity/kuaiDiaNiao/addService.java | bd01998af8727a11d21e715ca31d59b05bbe6f13 | [] | no_license | yantianpeng123/yantianpengparent | https://github.com/yantianpeng123/yantianpengparent | 1765ca41f881b160922840eddf0ff1989e8372d7 | 9ab115b8aef4f7a65b76180fad121c748a20968a | refs/heads/master | 2022-07-20T01:18:21.553000 | 2019-09-01T09:36:51 | 2019-09-01T09:36:51 | 153,115,591 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.yantianpeng.entity.kuaiDiaNiao;
import lombok.Data;
/**
* @Description: z增值服务类
* @Author: yantianpeng
* @CreateDate: 2018/11/29 下午4:36
*/
@Data
public class addService {
/**
* 增值服务名称
*/
private String name;
/**
* 增值服务值
*/
private String value;
/**
* 客户标示
*/
private String CustomerID;
}
| UTF-8 | Java | 418 | java | addService.java | Java | [
{
"context": "\n/**\n\n* @Description: z增值服务类\n\n* @Author: yantianpeng\n\n* @CreateDate: 2018/11/29 下午4:36\n\n\n*/\n@Data\n",
"end": 127,
"score": 0.9977589845657349,
"start": 116,
"tag": "USERNAME",
"value": "yantianpeng"
}
] | null | [] | package com.yantianpeng.entity.kuaiDiaNiao;
import lombok.Data;
/**
* @Description: z增值服务类
* @Author: yantianpeng
* @CreateDate: 2018/11/29 下午4:36
*/
@Data
public class addService {
/**
* 增值服务名称
*/
private String name;
/**
* 增值服务值
*/
private String value;
/**
* 客户标示
*/
private String CustomerID;
}
| 418 | 0.558824 | 0.529412 | 29 | 11.896552 | 12.262487 | 43 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.172414 | false | false | 11 |
db1630b984ca82640941fa8603656e640b808f40 | 28,793,460,813,033 | 5d7eceb50fcc79fa09ca9f34d665ec8223cbbc09 | /JxSmartHome/src/com/jinxin/db/impl/CustomerMessageDaoImpl.java | d9cf7022a49a8645be0a430fff72ac59374276ea | [] | no_license | WonderFannn/WFJxSmartHome | https://github.com/WonderFannn/WFJxSmartHome | 253abbae09bf84d63db55ba7f6b0df41ea806286 | 7d1168741b626da9e9ca128694d622f86e725a99 | refs/heads/master | 2021-01-01T18:40:37.713000 | 2018-02-02T02:33:55 | 2018-02-02T02:33:55 | 98,402,240 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jinxin.db.impl;
import android.content.Context;
import com.jinxin.db.util.DBHelper;
import com.jinxin.jxsmarthome.entity.CustomerMeassage;
import com.tgb.lk.ahibernate.dao.impl.BaseDaoImpl;
public class CustomerMessageDaoImpl extends BaseDaoImpl<CustomerMeassage> {
public CustomerMessageDaoImpl(Context context) {
super(new DBHelper(context), CustomerMeassage.class);
}
}
| UTF-8 | Java | 405 | java | CustomerMessageDaoImpl.java | Java | [] | null | [] | package com.jinxin.db.impl;
import android.content.Context;
import com.jinxin.db.util.DBHelper;
import com.jinxin.jxsmarthome.entity.CustomerMeassage;
import com.tgb.lk.ahibernate.dao.impl.BaseDaoImpl;
public class CustomerMessageDaoImpl extends BaseDaoImpl<CustomerMeassage> {
public CustomerMessageDaoImpl(Context context) {
super(new DBHelper(context), CustomerMeassage.class);
}
}
| 405 | 0.792593 | 0.792593 | 13 | 29.153847 | 25.325106 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.846154 | false | false | 11 |
30e948889c737472e54727b49199e23185f2f3a4 | 9,216,999,841,424 | 27f4d46b15f29ab9a5001133a4623051525816e2 | /app/src/main/java/com/example/aleix/myapplication/MenuActivity.java | 8284d280c9719172726b435daa7eaea61f722441 | [] | no_license | DSA-EETAC-GUILLEMMIKELALEIX/Eetac-emonAndroid | https://github.com/DSA-EETAC-GUILLEMMIKELALEIX/Eetac-emonAndroid | d654b1a480de825e650b29d51aa43bf1c874a560 | 2e987e6f3fc332788ce6afb3e9e3805e2232b415 | refs/heads/master | 2020-12-30T16:27:13.173000 | 2017-06-16T13:41:55 | 2017-06-16T13:41:55 | 90,982,679 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.aleix.myapplication;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MenuActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu);
Button mvMapa = (Button) findViewById(R.id.vMapa);
mvMapa.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MenuActivity.this, MapsActivity.class);
startActivity(intent);
}
});
Button Eetakedex = (Button) findViewById(R.id.eetakedex);
Eetakedex.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MenuActivity.this, EetakedexActivity.class);
startActivity(intent);
}
});
Button TusEetakemons = (Button) findViewById(R.id.tuseetak);
TusEetakemons.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MenuActivity.this, TusEetakemonsActivity.class);
startActivity(intent);
}
});
Button Statistics = (Button) findViewById(R.id.Estadisticas);
Statistics.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MenuActivity.this, StatisticsActivity.class);
startActivity(intent);
}
});
Button Logout = (Button) findViewById(R.id.Salir);
Logout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MenuActivity.this, LogoutActivity.class);
startActivity(intent);
}
});
}
}
| UTF-8 | Java | 2,190 | java | MenuActivity.java | Java | [
{
"context": "package com.example.aleix.myapplication;\n\nimport android.content.Intent;\nim",
"end": 25,
"score": 0.8151952028274536,
"start": 20,
"tag": "USERNAME",
"value": "aleix"
}
] | null | [] | package com.example.aleix.myapplication;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MenuActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu);
Button mvMapa = (Button) findViewById(R.id.vMapa);
mvMapa.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MenuActivity.this, MapsActivity.class);
startActivity(intent);
}
});
Button Eetakedex = (Button) findViewById(R.id.eetakedex);
Eetakedex.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MenuActivity.this, EetakedexActivity.class);
startActivity(intent);
}
});
Button TusEetakemons = (Button) findViewById(R.id.tuseetak);
TusEetakemons.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MenuActivity.this, TusEetakemonsActivity.class);
startActivity(intent);
}
});
Button Statistics = (Button) findViewById(R.id.Estadisticas);
Statistics.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MenuActivity.this, StatisticsActivity.class);
startActivity(intent);
}
});
Button Logout = (Button) findViewById(R.id.Salir);
Logout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MenuActivity.this, LogoutActivity.class);
startActivity(intent);
}
});
}
}
| 2,190 | 0.615525 | 0.615068 | 66 | 32.18182 | 26.978054 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 11 |
e04192b2ec48a289c537f4341edb51c91a7bac39 | 20,109,036,907,730 | 09c2440dca6a9dccef583e0128130030dc01e4ed | /src/main/java/com/easyorder/modules/supplier/vo/SupplierVO.java | 797e46ab44dde4799e282d22d5a37a47afa2fef2 | [] | no_license | coding-dogs/console | https://github.com/coding-dogs/console | ce3cd9ec8de843f43e986f40baef3d534bc30369 | c8b8aad00c1e39899493a3829282720e965fbafc | refs/heads/master | 2021-01-20T12:56:34.977000 | 2018-02-25T06:04:55 | 2018-02-25T06:04:55 | 90,429,288 | 0 | 3 | null | false | 2018-02-25T06:04:56 | 2017-05-06T01:30:39 | 2017-05-06T03:18:21 | 2018-02-25T06:04:56 | 53,930 | 0 | 2 | 0 | JavaScript | false | null | package com.easyorder.modules.supplier.vo;
import com.jeeplus.common.persistence.DataEntity;
import com.jeeplus.common.utils.excel.annotation.ExcelField;
/**
* 供应商Entity
* @author qiudequan
* @version 2017-05-07
*/
public class SupplierVO extends DataEntity<SupplierVO> {
private static final long serialVersionUID = 1L;
private String name; // 供货商名称
private String bossName; // 老板姓名
private String supplierNo; // 供货商编号
private String logoPictureUrl; // 供货商logo图片地址
private String managerId; // 供货商管理员ID
private String mobile; // 供货商联系电话
private String description; // 简述
private String storeAddress; // 供应商地址
private String managerName; // 供货商管理员名称
public SupplierVO() {
super();
}
public SupplierVO(String id){
super(id);
}
@ExcelField(title="供货商名称", align=2, sort=2)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@ExcelField(title="供货商编号", align=2, sort=1)
public String getSupplierNo() {
return supplierNo;
}
public void setSupplierNo(String supplierNo) {
this.supplierNo = supplierNo;
}
@ExcelField(title="供货商logo图片地址", align=2, sort=3)
public String getLogoPictureUrl() {
return logoPictureUrl;
}
public void setLogoPictureUrl(String logoPictureUrl) {
this.logoPictureUrl = logoPictureUrl;
}
public String getManagerId() {
return managerId;
}
public void setManagerId(String managerId) {
this.managerId = managerId;
}
@ExcelField(title="简述", align=2, sort=4)
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getManagerName() {
return managerName;
}
public void setManagerName(String managerName) {
this.managerName = managerName;
}
public String getStoreAddress() {
return storeAddress;
}
public void setStoreAddress(String storeAddress) {
this.storeAddress = storeAddress;
}
public String getBossName() {
return bossName;
}
public void setBossName(String bossName) {
this.bossName = bossName;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
} | UTF-8 | Java | 2,347 | java | SupplierVO.java | Java | [
{
"context": "nnotation.ExcelField;\n\n/**\n * 供应商Entity\n * @author qiudequan\n * @version 2017-05-07\n */\npublic class SupplierV",
"end": 193,
"score": 0.9996210336685181,
"start": 184,
"tag": "USERNAME",
"value": "qiudequan"
}
] | null | [] | package com.easyorder.modules.supplier.vo;
import com.jeeplus.common.persistence.DataEntity;
import com.jeeplus.common.utils.excel.annotation.ExcelField;
/**
* 供应商Entity
* @author qiudequan
* @version 2017-05-07
*/
public class SupplierVO extends DataEntity<SupplierVO> {
private static final long serialVersionUID = 1L;
private String name; // 供货商名称
private String bossName; // 老板姓名
private String supplierNo; // 供货商编号
private String logoPictureUrl; // 供货商logo图片地址
private String managerId; // 供货商管理员ID
private String mobile; // 供货商联系电话
private String description; // 简述
private String storeAddress; // 供应商地址
private String managerName; // 供货商管理员名称
public SupplierVO() {
super();
}
public SupplierVO(String id){
super(id);
}
@ExcelField(title="供货商名称", align=2, sort=2)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@ExcelField(title="供货商编号", align=2, sort=1)
public String getSupplierNo() {
return supplierNo;
}
public void setSupplierNo(String supplierNo) {
this.supplierNo = supplierNo;
}
@ExcelField(title="供货商logo图片地址", align=2, sort=3)
public String getLogoPictureUrl() {
return logoPictureUrl;
}
public void setLogoPictureUrl(String logoPictureUrl) {
this.logoPictureUrl = logoPictureUrl;
}
public String getManagerId() {
return managerId;
}
public void setManagerId(String managerId) {
this.managerId = managerId;
}
@ExcelField(title="简述", align=2, sort=4)
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getManagerName() {
return managerName;
}
public void setManagerName(String managerName) {
this.managerName = managerName;
}
public String getStoreAddress() {
return storeAddress;
}
public void setStoreAddress(String storeAddress) {
this.storeAddress = storeAddress;
}
public String getBossName() {
return bossName;
}
public void setBossName(String bossName) {
this.bossName = bossName;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
} | 2,347 | 0.725624 | 0.717914 | 109 | 19.238533 | 18.362757 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.458716 | false | false | 11 |
853d87f74fe961e2a5946d5f6bd76448eab83627 | 8,289,286,936,242 | 237a3f0fffcee7a98a48918b30327c6420688ee1 | /src/com/littleGreenMan/Pong_Madness/model/GameTournement.java | fbd00b3f6812611b5ba40f69328f8eebfd61943c | [] | no_license | little-green-men/Pong-Madness-Android | https://github.com/little-green-men/Pong-Madness-Android | 78a60409acf701bfe559bd8b406f2b6244f16788 | 62502eb8492dd00b6cc8970e9706bece109a01e2 | refs/heads/master | 2016-09-05T21:26:05.515000 | 2013-06-24T02:00:30 | 2013-06-24T02:00:30 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.littleGreenMan.Pong_Madness.model;
// THIS CODE IS GENERATED BY greenDAO, EDIT ONLY INSIDE THE "KEEP"-SECTIONS
// KEEP INCLUDES - put your custom includes here
// KEEP INCLUDES END
/**
* Entity mapped to table GAME_TOURNEMENT.
*/
public class GameTournement {
private Long id;
private Long gameId;
private Long tournementId;
// KEEP FIELDS - put your custom fields here
// KEEP FIELDS END
public GameTournement() {
}
public GameTournement(Long id) {
this.id = id;
}
public GameTournement(Long id, Long gameId, Long tournementId) {
this.id = id;
this.gameId = gameId;
this.tournementId = tournementId;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getGameId() {
return gameId;
}
public void setGameId(Long gameId) {
this.gameId = gameId;
}
public Long getTournementId() {
return tournementId;
}
public void setTournementId(Long tournementId) {
this.tournementId = tournementId;
}
// KEEP METHODS - put your custom methods here
// KEEP METHODS END
}
| UTF-8 | Java | 1,264 | java | GameTournement.java | Java | [] | null | [] | package com.littleGreenMan.Pong_Madness.model;
// THIS CODE IS GENERATED BY greenDAO, EDIT ONLY INSIDE THE "KEEP"-SECTIONS
// KEEP INCLUDES - put your custom includes here
// KEEP INCLUDES END
/**
* Entity mapped to table GAME_TOURNEMENT.
*/
public class GameTournement {
private Long id;
private Long gameId;
private Long tournementId;
// KEEP FIELDS - put your custom fields here
// KEEP FIELDS END
public GameTournement() {
}
public GameTournement(Long id) {
this.id = id;
}
public GameTournement(Long id, Long gameId, Long tournementId) {
this.id = id;
this.gameId = gameId;
this.tournementId = tournementId;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getGameId() {
return gameId;
}
public void setGameId(Long gameId) {
this.gameId = gameId;
}
public Long getTournementId() {
return tournementId;
}
public void setTournementId(Long tournementId) {
this.tournementId = tournementId;
}
// KEEP METHODS - put your custom methods here
// KEEP METHODS END
}
| 1,264 | 0.596519 | 0.596519 | 59 | 19.423729 | 19.074522 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.288136 | false | false | 11 |
5e04780bd0f276c061c8ff41e692329cbed2a12e | 13,297,218,806,684 | 98a129be76d40ea79e0c82aac4380730317f12f3 | /src/main/dungeon/contents/mob/skelton/MineralizationArcher.java | 344ee1f40cb5767e582d84f4f95cfc6e56513d5d | [] | no_license | namiken/LBM_DUNGEON | https://github.com/namiken/LBM_DUNGEON | 29ee9906cc17afe6937755d0a1125b9833c0e6b0 | 5da0dcd98ac664813b8a6c1606b285c278c7ae3a | refs/heads/master | 2016-12-12T21:54:56.381000 | 2016-12-12T09:23:05 | 2016-12-12T09:23:05 | 56,368,615 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package main.dungeon.contents.mob.skelton;
import java.util.HashMap;
import main.common.event.player.PlayerCustomMobSpawnEvent;
import main.common.other.Stun;
import main.mob.mob.abstractmob.AbstractSkelton;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDeathEvent;
public class MineralizationArcher extends AbstractSkelton{
HashMap<Player, Integer> mineralizationCountMap = new HashMap<Player, Integer>();
@Override
public void onProjectileHitEntity(LivingEntity mob, LivingEntity target,
EntityDamageByEntityEvent e) {
if (!(target instanceof Player)) {
return;
}
final Player p = (Player) target;
Integer integer = mineralizationCountMap.get(p);
if (integer == null) {
integer = 0;
}
int count = integer;
count++;
if (getCount(p) <= count) {
Stun.addStun(p, (int) (20 * 2.5));
count = 0;
}
mineralizationCountMap.put(p, count);
}
protected int getCount(Player p) {
return 4;
}
@Override
public String getName() {
return "Mineralization Archer";
}
@Override
public void onSpawn(PlayerCustomMobSpawnEvent e) {
}
@Override
public void onAttack(LivingEntity mob, LivingEntity target,
EntityDamageByEntityEvent e) {
}
@Override
public void onDamage(LivingEntity mob, Entity damager,
EntityDamageByEntityEvent e) {
}
@Override
public void onDeathPrivate(EntityDeathEvent e) {
}
}
| UTF-8 | Java | 1,518 | java | MineralizationArcher.java | Java | [] | null | [] | package main.dungeon.contents.mob.skelton;
import java.util.HashMap;
import main.common.event.player.PlayerCustomMobSpawnEvent;
import main.common.other.Stun;
import main.mob.mob.abstractmob.AbstractSkelton;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDeathEvent;
public class MineralizationArcher extends AbstractSkelton{
HashMap<Player, Integer> mineralizationCountMap = new HashMap<Player, Integer>();
@Override
public void onProjectileHitEntity(LivingEntity mob, LivingEntity target,
EntityDamageByEntityEvent e) {
if (!(target instanceof Player)) {
return;
}
final Player p = (Player) target;
Integer integer = mineralizationCountMap.get(p);
if (integer == null) {
integer = 0;
}
int count = integer;
count++;
if (getCount(p) <= count) {
Stun.addStun(p, (int) (20 * 2.5));
count = 0;
}
mineralizationCountMap.put(p, count);
}
protected int getCount(Player p) {
return 4;
}
@Override
public String getName() {
return "Mineralization Archer";
}
@Override
public void onSpawn(PlayerCustomMobSpawnEvent e) {
}
@Override
public void onAttack(LivingEntity mob, LivingEntity target,
EntityDamageByEntityEvent e) {
}
@Override
public void onDamage(LivingEntity mob, Entity damager,
EntityDamageByEntityEvent e) {
}
@Override
public void onDeathPrivate(EntityDeathEvent e) {
}
}
| 1,518 | 0.745059 | 0.740448 | 72 | 20.083334 | 21.552746 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.388889 | false | false | 11 |
c11156f0ef973990d6b083ee3f361838481cf50a | 9,543,417,396,135 | 44b1c551e483d426e9d7f9d789de184068e06fcf | /src/main/java/com/gimis/emcs/ps/msg/end/End.java | 7e8c86404be87e46e2fd6d3fe2c60b14869e8208 | [] | no_license | feng-hai/analysisCan01 | https://github.com/feng-hai/analysisCan01 | 86f19347208a91288e8b547662804698a53cce3b | 8829f020fab5bbf47c6c8624013cf7588201bac8 | refs/heads/master | 2020-06-26T10:06:56.378000 | 2017-08-09T05:36:17 | 2017-08-09T05:36:17 | 97,016,031 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.gimis.emcs.ps.msg.end;
public interface End
{
public Short getCrcCode();
public void setCrcCode(Short crcCode);
}
| UTF-8 | Java | 137 | java | End.java | Java | [] | null | [] | package com.gimis.emcs.ps.msg.end;
public interface End
{
public Short getCrcCode();
public void setCrcCode(Short crcCode);
}
| 137 | 0.715328 | 0.715328 | 9 | 14.222222 | 16.335222 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 11 |
4b668c94c8391058427001475dfbe7ee4761eae8 | 2,860,448,260,413 | f32b03d9d0194d556326538db709a16153f8b124 | /sourcecode/struts2test/src/main/java/org/cz/HelloWorldAction.java | 9f0642c5b089e4ef6f31b2db23ac57e346470de2 | [
"Apache-2.0"
] | permissive | czlovewyw/mytest | https://github.com/czlovewyw/mytest | 2e14e317cf7b12e832819e2dfe52e52be5f36cdb | 41bfd74ef7177b096d2b14a4947d4050ff4a450b | refs/heads/master | 2020-12-31T00:39:53.545000 | 2017-12-05T02:10:20 | 2017-12-05T02:10:20 | 86,573,612 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.cz;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.inject.Inject;
import org.apache.struts2.ServletActionContext;
import javax.servlet.http.HttpServletRequest;
/**
* Created by chenzhe8 on 2017/3/9.
*/
public class HelloWorldAction extends ActionSupport
{
public final static String MESSAGE = "Struts2 is up and running ...";
private String message;
@Inject("developer")
private String developer;
public String getDeveloper() {
return developer;
}
public void setDeveloper(String developer) {
this.developer = developer;
}
/**
* @return the message
*/
public String getMessage()
{
return message;
}
/**
* @param message the message to set
*/
public void setMessage(String message)
{
this.message = message;
}
public String execute() throws Exception
{
setMessage(MESSAGE);
// return SUCCESS;
return "success";
}
public String myPage(){
return "mypage";
}
public String add1(){
HttpServletRequest request = ServletActionContext.getRequest();
return "add1";
}
public String add2(){
return "add2";
}
public String form(){
return "form";
}
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getForm(){
return "getform";
}
}
| UTF-8 | Java | 1,538 | java | HelloWorldAction.java | Java | [
{
"context": "ervlet.http.HttpServletRequest;\n\n/**\n * Created by chenzhe8 on 2017/3/9.\n */\npublic class HelloWorldAction ex",
"end": 231,
"score": 0.9996663928031921,
"start": 223,
"tag": "USERNAME",
"value": "chenzhe8"
}
] | null | [] | package org.cz;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.inject.Inject;
import org.apache.struts2.ServletActionContext;
import javax.servlet.http.HttpServletRequest;
/**
* Created by chenzhe8 on 2017/3/9.
*/
public class HelloWorldAction extends ActionSupport
{
public final static String MESSAGE = "Struts2 is up and running ...";
private String message;
@Inject("developer")
private String developer;
public String getDeveloper() {
return developer;
}
public void setDeveloper(String developer) {
this.developer = developer;
}
/**
* @return the message
*/
public String getMessage()
{
return message;
}
/**
* @param message the message to set
*/
public void setMessage(String message)
{
this.message = message;
}
public String execute() throws Exception
{
setMessage(MESSAGE);
// return SUCCESS;
return "success";
}
public String myPage(){
return "mypage";
}
public String add1(){
HttpServletRequest request = ServletActionContext.getRequest();
return "add1";
}
public String add2(){
return "add2";
}
public String form(){
return "form";
}
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getForm(){
return "getform";
}
}
| 1,538 | 0.609233 | 0.59948 | 83 | 17.530121 | 17.552906 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.289157 | false | false | 11 |
878bac27ba85a5b976cb036ca97ae97fab1cc098 | 31,293,131,773,285 | 6299b678c45bce4ea602e06d065dff19d0eb7aa4 | /src/main/java/cn/cntv/esb/coproc/model/BackupModel.java | 694df5b94370a0d6d6ce0ed56cbd9efe5950f352 | [] | no_license | dafei5299/esb-coprocessor | https://github.com/dafei5299/esb-coprocessor | 5eb5bbf40a9636738ff938da96058e14890eb6c6 | 255bd2d8eb9f28dc4b1bc51d40c3e1697aed993e | refs/heads/master | 2020-03-16T05:30:24.933000 | 2018-05-08T01:04:22 | 2018-05-08T01:04:22 | 132,533,623 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.portal.esb.coproc.model;
import java.util.Date;
import java.util.Map;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
public class BackupModel implements Comparable<BackupModel> {
private Date timestamp;
private String size;
private String md5;
private String type;
private long fromLsn;
private long toLsn;
private boolean binlogInfo;
private int elapsed;
public static BackupModel fromMap(Map<String, Object> map) {
BackupModel backup = new BackupModel();
String timestamp = (String) map.get("timestamp");
backup.setTimestamp(timestamp);
String size = (String) map.get("size");
backup.setSize(size);
String md5 = (String) map.get("md5");
backup.setMd5(md5);
String type = (String) map.get("type");
backup.setType(type);
String fromLsn = (String) map.get("from_lsn");
backup.setFromLsn(Long.parseLong(fromLsn));
String toLsn = (String) map.get("to_lsn");
backup.setToLsn(Long.parseLong(toLsn));
String binlogInfo = (String) map.get("binlog_info");
backup.setBinlogInfo("yes".equals(binlogInfo));
int elapsed = (int) map.get("elapsed");
backup.setElapsed(elapsed);
return backup;
}
public boolean isBefore(long time) {
return new DateTime(timestamp).isBefore(time);
}
public boolean isAfter(long time) {
return new DateTime(timestamp).isAfter(time);
}
public String getTimestamp() {
return new DateTime(timestamp).toString("YYYY-MM-dd_HH-mm-ss");
}
public void setTimestamp(String timestamp) {
this.timestamp = DateTime.parse(timestamp,
DateTimeFormat.forPattern("YYYY-MM-dd_HH-mm-ss")).toDate();
}
public String getSize() {
return size;
}
public void setSize(String size) {
this.size = size;
}
public String getMd5() {
return md5;
}
public void setMd5(String md5) {
this.md5 = md5;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public long getFromLsn() {
return fromLsn;
}
public void setFromLsn(long fromLsn) {
this.fromLsn = fromLsn;
}
public long getToLsn() {
return toLsn;
}
public void setToLsn(long toLsn) {
this.toLsn = toLsn;
}
public boolean isBinlogInfo() {
return binlogInfo;
}
public void setBinlogInfo(boolean binlogInfo) {
this.binlogInfo = binlogInfo;
}
public int getElapsed() {
return elapsed;
}
public void setElapsed(int elapsed) {
this.elapsed = elapsed;
}
@Override
public int compareTo(BackupModel o) {
return timestamp.compareTo(o.timestamp);
}
}
| UTF-8 | Java | 2,513 | java | BackupModel.java | Java | [] | null | [] | package cn.portal.esb.coproc.model;
import java.util.Date;
import java.util.Map;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
public class BackupModel implements Comparable<BackupModel> {
private Date timestamp;
private String size;
private String md5;
private String type;
private long fromLsn;
private long toLsn;
private boolean binlogInfo;
private int elapsed;
public static BackupModel fromMap(Map<String, Object> map) {
BackupModel backup = new BackupModel();
String timestamp = (String) map.get("timestamp");
backup.setTimestamp(timestamp);
String size = (String) map.get("size");
backup.setSize(size);
String md5 = (String) map.get("md5");
backup.setMd5(md5);
String type = (String) map.get("type");
backup.setType(type);
String fromLsn = (String) map.get("from_lsn");
backup.setFromLsn(Long.parseLong(fromLsn));
String toLsn = (String) map.get("to_lsn");
backup.setToLsn(Long.parseLong(toLsn));
String binlogInfo = (String) map.get("binlog_info");
backup.setBinlogInfo("yes".equals(binlogInfo));
int elapsed = (int) map.get("elapsed");
backup.setElapsed(elapsed);
return backup;
}
public boolean isBefore(long time) {
return new DateTime(timestamp).isBefore(time);
}
public boolean isAfter(long time) {
return new DateTime(timestamp).isAfter(time);
}
public String getTimestamp() {
return new DateTime(timestamp).toString("YYYY-MM-dd_HH-mm-ss");
}
public void setTimestamp(String timestamp) {
this.timestamp = DateTime.parse(timestamp,
DateTimeFormat.forPattern("YYYY-MM-dd_HH-mm-ss")).toDate();
}
public String getSize() {
return size;
}
public void setSize(String size) {
this.size = size;
}
public String getMd5() {
return md5;
}
public void setMd5(String md5) {
this.md5 = md5;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public long getFromLsn() {
return fromLsn;
}
public void setFromLsn(long fromLsn) {
this.fromLsn = fromLsn;
}
public long getToLsn() {
return toLsn;
}
public void setToLsn(long toLsn) {
this.toLsn = toLsn;
}
public boolean isBinlogInfo() {
return binlogInfo;
}
public void setBinlogInfo(boolean binlogInfo) {
this.binlogInfo = binlogInfo;
}
public int getElapsed() {
return elapsed;
}
public void setElapsed(int elapsed) {
this.elapsed = elapsed;
}
@Override
public int compareTo(BackupModel o) {
return timestamp.compareTo(o.timestamp);
}
}
| 2,513 | 0.709511 | 0.705133 | 119 | 20.117647 | 18.360159 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.504202 | false | false | 11 |
fb0ae955d049c1275b783533b2e4465c3a2ab56b | 10,900,627,022,462 | 037637a2c0d177362285e0608d4f4f00dc4cfce9 | /components/camel-jcache/src/main/java/org/apache/camel/component/jcache/policy/JCachePolicy.java | c2ae7ba1a24107491c3ed77991368bc16295d499 | [
"Apache-2.0",
"LicenseRef-scancode-unknown",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | dmgerman/camel | https://github.com/dmgerman/camel | 07379b6a1d191078b085b62bbb0a6732141994aa | cab53c57b3e58871df1f96d54b2a2ad5a73ce220 | refs/heads/master | 2023-01-03T23:00:15.190000 | 2019-12-20T08:30:29 | 2019-12-20T08:30:29 | 230,528,998 | 0 | 0 | Apache-2.0 | false | 2023-01-02T22:14:35 | 2019-12-27T22:50:51 | 2019-12-28T01:30:10 | 2023-01-02T22:14:34 | 129,843 | 0 | 0 | 3 | Java | false | false | begin_unit|revision:0.9.5;language:Java;cregit-version:0.0.1
begin_comment
comment|/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
end_comment
begin_package
DECL|package|org.apache.camel.component.jcache.policy
package|package
name|org
operator|.
name|apache
operator|.
name|camel
operator|.
name|component
operator|.
name|jcache
operator|.
name|policy
package|;
end_package
begin_import
import|import
name|java
operator|.
name|util
operator|.
name|Set
import|;
end_import
begin_import
import|import
name|javax
operator|.
name|cache
operator|.
name|Cache
import|;
end_import
begin_import
import|import
name|javax
operator|.
name|cache
operator|.
name|CacheManager
import|;
end_import
begin_import
import|import
name|javax
operator|.
name|cache
operator|.
name|Caching
import|;
end_import
begin_import
import|import
name|javax
operator|.
name|cache
operator|.
name|configuration
operator|.
name|Configuration
import|;
end_import
begin_import
import|import
name|javax
operator|.
name|cache
operator|.
name|configuration
operator|.
name|MutableConfiguration
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|camel
operator|.
name|Expression
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|camel
operator|.
name|NamedNode
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|camel
operator|.
name|Processor
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|camel
operator|.
name|spi
operator|.
name|Policy
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|camel
operator|.
name|spi
operator|.
name|RouteContext
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|camel
operator|.
name|util
operator|.
name|ObjectHelper
import|;
end_import
begin_import
import|import
name|org
operator|.
name|slf4j
operator|.
name|Logger
import|;
end_import
begin_import
import|import
name|org
operator|.
name|slf4j
operator|.
name|LoggerFactory
import|;
end_import
begin_comment
comment|/** * Policy for routes. It caches the final body of a route and next time takes it from the cache instead of executing the route. * The cache key is determined by the keyExpression (message body by default). * If there is an object in the cache under that key the rest of the route is not executed, but the cached object is added to the Exchange. * * Fields: * cache: JCache to use * cacheManager: If cache is not set, a new one is get or created using this cacheManager. If cacheManager is not set, we try to lookup one from CamelContext. * cacheName: Name of the cache to use or create. RouteId is used by default. * cacheConfiguration: CacheConfiguration used if a new cache is created. Using default MutableConfiguration if not set. * keyExpression: The Expression to generate the key for the cache. E.g simple("${header.username}") * enabled: If JCachePolicy is not enabled, no policy is added to the route. Has an impact only during startup. */
end_comment
begin_class
DECL|class|JCachePolicy
specifier|public
class|class
name|JCachePolicy
implements|implements
name|Policy
block|{
DECL|field|LOG
specifier|private
specifier|static
specifier|final
name|Logger
name|LOG
init|=
name|LoggerFactory
operator|.
name|getLogger
argument_list|(
name|JCachePolicy
operator|.
name|class
argument_list|)
decl_stmt|;
DECL|field|cache
specifier|private
name|Cache
name|cache
decl_stmt|;
DECL|field|cacheManager
specifier|private
name|CacheManager
name|cacheManager
decl_stmt|;
DECL|field|cacheName
specifier|private
name|String
name|cacheName
decl_stmt|;
DECL|field|cacheConfiguration
specifier|private
name|Configuration
name|cacheConfiguration
decl_stmt|;
DECL|field|keyExpression
specifier|private
name|Expression
name|keyExpression
decl_stmt|;
DECL|field|enabled
specifier|private
name|boolean
name|enabled
init|=
literal|true
decl_stmt|;
annotation|@
name|Override
DECL|method|beforeWrap (RouteContext routeContext, NamedNode namedNode)
specifier|public
name|void
name|beforeWrap
parameter_list|(
name|RouteContext
name|routeContext
parameter_list|,
name|NamedNode
name|namedNode
parameter_list|)
block|{ }
annotation|@
name|Override
DECL|method|wrap (RouteContext routeContext, Processor processor)
specifier|public
name|Processor
name|wrap
parameter_list|(
name|RouteContext
name|routeContext
parameter_list|,
name|Processor
name|processor
parameter_list|)
block|{
comment|//Don't add JCachePolicyProcessor if JCachePolicy is disabled. This means enable/disable has impact only during startup
if|if
condition|(
operator|!
name|isEnabled
argument_list|()
condition|)
block|{
return|return
name|processor
return|;
block|}
name|Cache
name|cache
init|=
name|this
operator|.
name|cache
decl_stmt|;
if|if
condition|(
name|cache
operator|==
literal|null
condition|)
block|{
comment|//Create cache based on given configuration
comment|//Find CacheManager
name|CacheManager
name|cacheManager
init|=
name|this
operator|.
name|cacheManager
decl_stmt|;
comment|//Lookup CacheManager from CamelContext if it's not set
if|if
condition|(
name|cacheManager
operator|==
literal|null
condition|)
block|{
name|Set
argument_list|<
name|CacheManager
argument_list|>
name|lookupResult
init|=
name|routeContext
operator|.
name|getCamelContext
argument_list|()
operator|.
name|getRegistry
argument_list|()
operator|.
name|findByType
argument_list|(
name|CacheManager
operator|.
name|class
argument_list|)
decl_stmt|;
if|if
condition|(
name|ObjectHelper
operator|.
name|isNotEmpty
argument_list|(
name|lookupResult
argument_list|)
condition|)
block|{
comment|//Use the first cache manager found
name|cacheManager
operator|=
name|lookupResult
operator|.
name|iterator
argument_list|()
operator|.
name|next
argument_list|()
expr_stmt|;
name|LOG
operator|.
name|debug
argument_list|(
literal|"CacheManager from CamelContext registry: {}"
argument_list|,
name|cacheManager
argument_list|)
expr_stmt|;
block|}
block|}
comment|//Lookup CacheManager the standard way
if|if
condition|(
name|cacheManager
operator|==
literal|null
condition|)
block|{
name|cacheManager
operator|=
name|Caching
operator|.
name|getCachingProvider
argument_list|()
operator|.
name|getCacheManager
argument_list|()
expr_stmt|;
name|LOG
operator|.
name|debug
argument_list|(
literal|"CacheManager from CachingProvider: {}"
argument_list|,
name|cacheManager
argument_list|)
expr_stmt|;
block|}
comment|//Use routeId as cacheName if it's not set
name|String
name|cacheName
init|=
name|ObjectHelper
operator|.
name|isNotEmpty
argument_list|(
name|this
operator|.
name|cacheName
argument_list|)
condition|?
name|this
operator|.
name|cacheName
else|:
name|routeContext
operator|.
name|getRouteId
argument_list|()
decl_stmt|;
name|LOG
operator|.
name|debug
argument_list|(
literal|"Getting cache:{}"
argument_list|,
name|cacheName
argument_list|)
expr_stmt|;
comment|//Get cache or create a new one using the cacheConfiguration
name|cache
operator|=
name|cacheManager
operator|.
name|getCache
argument_list|(
name|cacheName
argument_list|)
expr_stmt|;
if|if
condition|(
name|cache
operator|==
literal|null
condition|)
block|{
name|LOG
operator|.
name|debug
argument_list|(
literal|"Create cache:{}"
argument_list|,
name|cacheName
argument_list|)
expr_stmt|;
name|cache
operator|=
name|cacheManager
operator|.
name|createCache
argument_list|(
name|cacheName
argument_list|,
name|cacheConfiguration
operator|!=
literal|null
condition|?
name|this
operator|.
name|cacheConfiguration
else|:
operator|(
name|Configuration
operator|)
operator|new
name|MutableConfiguration
argument_list|()
argument_list|)
expr_stmt|;
block|}
block|}
comment|//Create processor
return|return
operator|new
name|JCachePolicyProcessor
argument_list|(
name|cache
argument_list|,
name|keyExpression
argument_list|,
name|processor
argument_list|)
return|;
block|}
DECL|method|getCache ()
specifier|public
name|Cache
name|getCache
parameter_list|()
block|{
return|return
name|cache
return|;
block|}
DECL|method|setCache (Cache cache)
specifier|public
name|void
name|setCache
parameter_list|(
name|Cache
name|cache
parameter_list|)
block|{
name|this
operator|.
name|cache
operator|=
name|cache
expr_stmt|;
block|}
DECL|method|getCacheManager ()
specifier|public
name|CacheManager
name|getCacheManager
parameter_list|()
block|{
return|return
name|cacheManager
return|;
block|}
DECL|method|setCacheManager (CacheManager cacheManager)
specifier|public
name|void
name|setCacheManager
parameter_list|(
name|CacheManager
name|cacheManager
parameter_list|)
block|{
name|this
operator|.
name|cacheManager
operator|=
name|cacheManager
expr_stmt|;
block|}
DECL|method|getCacheConfiguration ()
specifier|public
name|Configuration
name|getCacheConfiguration
parameter_list|()
block|{
return|return
name|cacheConfiguration
return|;
block|}
DECL|method|setCacheConfiguration (Configuration cacheConfiguration)
specifier|public
name|void
name|setCacheConfiguration
parameter_list|(
name|Configuration
name|cacheConfiguration
parameter_list|)
block|{
name|this
operator|.
name|cacheConfiguration
operator|=
name|cacheConfiguration
expr_stmt|;
block|}
DECL|method|getCacheName ()
specifier|public
name|String
name|getCacheName
parameter_list|()
block|{
return|return
name|cacheName
return|;
block|}
DECL|method|setCacheName (String cacheName)
specifier|public
name|void
name|setCacheName
parameter_list|(
name|String
name|cacheName
parameter_list|)
block|{
name|this
operator|.
name|cacheName
operator|=
name|cacheName
expr_stmt|;
block|}
DECL|method|getKeyExpression ()
specifier|public
name|Expression
name|getKeyExpression
parameter_list|()
block|{
return|return
name|keyExpression
return|;
block|}
DECL|method|setKeyExpression (Expression keyExpression)
specifier|public
name|void
name|setKeyExpression
parameter_list|(
name|Expression
name|keyExpression
parameter_list|)
block|{
name|this
operator|.
name|keyExpression
operator|=
name|keyExpression
expr_stmt|;
block|}
DECL|method|isEnabled ()
specifier|public
name|boolean
name|isEnabled
parameter_list|()
block|{
return|return
name|enabled
return|;
block|}
DECL|method|setEnabled (boolean enabled)
specifier|public
name|void
name|setEnabled
parameter_list|(
name|boolean
name|enabled
parameter_list|)
block|{
name|this
operator|.
name|enabled
operator|=
name|enabled
expr_stmt|;
block|}
annotation|@
name|Override
DECL|method|toString ()
specifier|public
name|String
name|toString
parameter_list|()
block|{
return|return
literal|"JCachePolicy{"
operator|+
literal|"keyExpression="
operator|+
name|keyExpression
operator|+
literal|", enabled="
operator|+
name|enabled
operator|+
literal|'}'
return|;
block|}
block|}
end_class
end_unit
| UTF-8 | Java | 11,504 | java | JCachePolicy.java | Java | [] | null | [] | begin_unit|revision:0.9.5;language:Java;cregit-version:0.0.1
begin_comment
comment|/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
end_comment
begin_package
DECL|package|org.apache.camel.component.jcache.policy
package|package
name|org
operator|.
name|apache
operator|.
name|camel
operator|.
name|component
operator|.
name|jcache
operator|.
name|policy
package|;
end_package
begin_import
import|import
name|java
operator|.
name|util
operator|.
name|Set
import|;
end_import
begin_import
import|import
name|javax
operator|.
name|cache
operator|.
name|Cache
import|;
end_import
begin_import
import|import
name|javax
operator|.
name|cache
operator|.
name|CacheManager
import|;
end_import
begin_import
import|import
name|javax
operator|.
name|cache
operator|.
name|Caching
import|;
end_import
begin_import
import|import
name|javax
operator|.
name|cache
operator|.
name|configuration
operator|.
name|Configuration
import|;
end_import
begin_import
import|import
name|javax
operator|.
name|cache
operator|.
name|configuration
operator|.
name|MutableConfiguration
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|camel
operator|.
name|Expression
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|camel
operator|.
name|NamedNode
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|camel
operator|.
name|Processor
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|camel
operator|.
name|spi
operator|.
name|Policy
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|camel
operator|.
name|spi
operator|.
name|RouteContext
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|camel
operator|.
name|util
operator|.
name|ObjectHelper
import|;
end_import
begin_import
import|import
name|org
operator|.
name|slf4j
operator|.
name|Logger
import|;
end_import
begin_import
import|import
name|org
operator|.
name|slf4j
operator|.
name|LoggerFactory
import|;
end_import
begin_comment
comment|/** * Policy for routes. It caches the final body of a route and next time takes it from the cache instead of executing the route. * The cache key is determined by the keyExpression (message body by default). * If there is an object in the cache under that key the rest of the route is not executed, but the cached object is added to the Exchange. * * Fields: * cache: JCache to use * cacheManager: If cache is not set, a new one is get or created using this cacheManager. If cacheManager is not set, we try to lookup one from CamelContext. * cacheName: Name of the cache to use or create. RouteId is used by default. * cacheConfiguration: CacheConfiguration used if a new cache is created. Using default MutableConfiguration if not set. * keyExpression: The Expression to generate the key for the cache. E.g simple("${header.username}") * enabled: If JCachePolicy is not enabled, no policy is added to the route. Has an impact only during startup. */
end_comment
begin_class
DECL|class|JCachePolicy
specifier|public
class|class
name|JCachePolicy
implements|implements
name|Policy
block|{
DECL|field|LOG
specifier|private
specifier|static
specifier|final
name|Logger
name|LOG
init|=
name|LoggerFactory
operator|.
name|getLogger
argument_list|(
name|JCachePolicy
operator|.
name|class
argument_list|)
decl_stmt|;
DECL|field|cache
specifier|private
name|Cache
name|cache
decl_stmt|;
DECL|field|cacheManager
specifier|private
name|CacheManager
name|cacheManager
decl_stmt|;
DECL|field|cacheName
specifier|private
name|String
name|cacheName
decl_stmt|;
DECL|field|cacheConfiguration
specifier|private
name|Configuration
name|cacheConfiguration
decl_stmt|;
DECL|field|keyExpression
specifier|private
name|Expression
name|keyExpression
decl_stmt|;
DECL|field|enabled
specifier|private
name|boolean
name|enabled
init|=
literal|true
decl_stmt|;
annotation|@
name|Override
DECL|method|beforeWrap (RouteContext routeContext, NamedNode namedNode)
specifier|public
name|void
name|beforeWrap
parameter_list|(
name|RouteContext
name|routeContext
parameter_list|,
name|NamedNode
name|namedNode
parameter_list|)
block|{ }
annotation|@
name|Override
DECL|method|wrap (RouteContext routeContext, Processor processor)
specifier|public
name|Processor
name|wrap
parameter_list|(
name|RouteContext
name|routeContext
parameter_list|,
name|Processor
name|processor
parameter_list|)
block|{
comment|//Don't add JCachePolicyProcessor if JCachePolicy is disabled. This means enable/disable has impact only during startup
if|if
condition|(
operator|!
name|isEnabled
argument_list|()
condition|)
block|{
return|return
name|processor
return|;
block|}
name|Cache
name|cache
init|=
name|this
operator|.
name|cache
decl_stmt|;
if|if
condition|(
name|cache
operator|==
literal|null
condition|)
block|{
comment|//Create cache based on given configuration
comment|//Find CacheManager
name|CacheManager
name|cacheManager
init|=
name|this
operator|.
name|cacheManager
decl_stmt|;
comment|//Lookup CacheManager from CamelContext if it's not set
if|if
condition|(
name|cacheManager
operator|==
literal|null
condition|)
block|{
name|Set
argument_list|<
name|CacheManager
argument_list|>
name|lookupResult
init|=
name|routeContext
operator|.
name|getCamelContext
argument_list|()
operator|.
name|getRegistry
argument_list|()
operator|.
name|findByType
argument_list|(
name|CacheManager
operator|.
name|class
argument_list|)
decl_stmt|;
if|if
condition|(
name|ObjectHelper
operator|.
name|isNotEmpty
argument_list|(
name|lookupResult
argument_list|)
condition|)
block|{
comment|//Use the first cache manager found
name|cacheManager
operator|=
name|lookupResult
operator|.
name|iterator
argument_list|()
operator|.
name|next
argument_list|()
expr_stmt|;
name|LOG
operator|.
name|debug
argument_list|(
literal|"CacheManager from CamelContext registry: {}"
argument_list|,
name|cacheManager
argument_list|)
expr_stmt|;
block|}
block|}
comment|//Lookup CacheManager the standard way
if|if
condition|(
name|cacheManager
operator|==
literal|null
condition|)
block|{
name|cacheManager
operator|=
name|Caching
operator|.
name|getCachingProvider
argument_list|()
operator|.
name|getCacheManager
argument_list|()
expr_stmt|;
name|LOG
operator|.
name|debug
argument_list|(
literal|"CacheManager from CachingProvider: {}"
argument_list|,
name|cacheManager
argument_list|)
expr_stmt|;
block|}
comment|//Use routeId as cacheName if it's not set
name|String
name|cacheName
init|=
name|ObjectHelper
operator|.
name|isNotEmpty
argument_list|(
name|this
operator|.
name|cacheName
argument_list|)
condition|?
name|this
operator|.
name|cacheName
else|:
name|routeContext
operator|.
name|getRouteId
argument_list|()
decl_stmt|;
name|LOG
operator|.
name|debug
argument_list|(
literal|"Getting cache:{}"
argument_list|,
name|cacheName
argument_list|)
expr_stmt|;
comment|//Get cache or create a new one using the cacheConfiguration
name|cache
operator|=
name|cacheManager
operator|.
name|getCache
argument_list|(
name|cacheName
argument_list|)
expr_stmt|;
if|if
condition|(
name|cache
operator|==
literal|null
condition|)
block|{
name|LOG
operator|.
name|debug
argument_list|(
literal|"Create cache:{}"
argument_list|,
name|cacheName
argument_list|)
expr_stmt|;
name|cache
operator|=
name|cacheManager
operator|.
name|createCache
argument_list|(
name|cacheName
argument_list|,
name|cacheConfiguration
operator|!=
literal|null
condition|?
name|this
operator|.
name|cacheConfiguration
else|:
operator|(
name|Configuration
operator|)
operator|new
name|MutableConfiguration
argument_list|()
argument_list|)
expr_stmt|;
block|}
block|}
comment|//Create processor
return|return
operator|new
name|JCachePolicyProcessor
argument_list|(
name|cache
argument_list|,
name|keyExpression
argument_list|,
name|processor
argument_list|)
return|;
block|}
DECL|method|getCache ()
specifier|public
name|Cache
name|getCache
parameter_list|()
block|{
return|return
name|cache
return|;
block|}
DECL|method|setCache (Cache cache)
specifier|public
name|void
name|setCache
parameter_list|(
name|Cache
name|cache
parameter_list|)
block|{
name|this
operator|.
name|cache
operator|=
name|cache
expr_stmt|;
block|}
DECL|method|getCacheManager ()
specifier|public
name|CacheManager
name|getCacheManager
parameter_list|()
block|{
return|return
name|cacheManager
return|;
block|}
DECL|method|setCacheManager (CacheManager cacheManager)
specifier|public
name|void
name|setCacheManager
parameter_list|(
name|CacheManager
name|cacheManager
parameter_list|)
block|{
name|this
operator|.
name|cacheManager
operator|=
name|cacheManager
expr_stmt|;
block|}
DECL|method|getCacheConfiguration ()
specifier|public
name|Configuration
name|getCacheConfiguration
parameter_list|()
block|{
return|return
name|cacheConfiguration
return|;
block|}
DECL|method|setCacheConfiguration (Configuration cacheConfiguration)
specifier|public
name|void
name|setCacheConfiguration
parameter_list|(
name|Configuration
name|cacheConfiguration
parameter_list|)
block|{
name|this
operator|.
name|cacheConfiguration
operator|=
name|cacheConfiguration
expr_stmt|;
block|}
DECL|method|getCacheName ()
specifier|public
name|String
name|getCacheName
parameter_list|()
block|{
return|return
name|cacheName
return|;
block|}
DECL|method|setCacheName (String cacheName)
specifier|public
name|void
name|setCacheName
parameter_list|(
name|String
name|cacheName
parameter_list|)
block|{
name|this
operator|.
name|cacheName
operator|=
name|cacheName
expr_stmt|;
block|}
DECL|method|getKeyExpression ()
specifier|public
name|Expression
name|getKeyExpression
parameter_list|()
block|{
return|return
name|keyExpression
return|;
block|}
DECL|method|setKeyExpression (Expression keyExpression)
specifier|public
name|void
name|setKeyExpression
parameter_list|(
name|Expression
name|keyExpression
parameter_list|)
block|{
name|this
operator|.
name|keyExpression
operator|=
name|keyExpression
expr_stmt|;
block|}
DECL|method|isEnabled ()
specifier|public
name|boolean
name|isEnabled
parameter_list|()
block|{
return|return
name|enabled
return|;
block|}
DECL|method|setEnabled (boolean enabled)
specifier|public
name|void
name|setEnabled
parameter_list|(
name|boolean
name|enabled
parameter_list|)
block|{
name|this
operator|.
name|enabled
operator|=
name|enabled
expr_stmt|;
block|}
annotation|@
name|Override
DECL|method|toString ()
specifier|public
name|String
name|toString
parameter_list|()
block|{
return|return
literal|"JCachePolicy{"
operator|+
literal|"keyExpression="
operator|+
name|keyExpression
operator|+
literal|", enabled="
operator|+
name|enabled
operator|+
literal|'}'
return|;
block|}
block|}
end_class
end_unit
| 11,504 | 0.793724 | 0.792681 | 674 | 16.066765 | 48.825127 | 971 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.060831 | false | false | 11 |
e5fcf0cb17f011e6189a7e7bc37768c9d448af5f | 3,779,571,225,054 | 9ff7f266250e0b9ab7a8809f85747a6eebc0ba83 | /Kagami/Code/ThirdRelease/Kag/recruitment-poc-generation/kagami-transaction/src/main/java/com/bcv/kagami/transaction/dao/service/GenericDaoService.java | 9b731fd969033c6dbb345e1e07f7cc944d08575b | [] | no_license | Ravi-Rsankar/GitRepo | https://github.com/Ravi-Rsankar/GitRepo | ade1d5b350dd25be23d214f68449575dbb83375f | 72db5a44630802ed271780ad6f99612242eb04a1 | refs/heads/master | 2017-11-02T08:16:16.356000 | 2017-08-09T10:06:36 | 2017-08-09T10:06:36 | 64,459,314 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.bcv.kagami.transaction.dao.service;
import javax.persistence.LockModeType;
public interface GenericDaoService {
public void lock(Object entity, LockModeType lockMode);
public void persist(Object entity);
}
| UTF-8 | Java | 226 | java | GenericDaoService.java | Java | [] | null | [] | package com.bcv.kagami.transaction.dao.service;
import javax.persistence.LockModeType;
public interface GenericDaoService {
public void lock(Object entity, LockModeType lockMode);
public void persist(Object entity);
}
| 226 | 0.800885 | 0.800885 | 10 | 21.6 | 21.721878 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.9 | false | false | 11 |
30d6534cc9b959b3eb850937cd1f4fcde98c9289 | 24,154,896,140,001 | 0f71f83ee3597e1b733f3b5d1a3cf677d396ecfa | /idea_test/src/com/zps/Map/HashTbleDemo.java | 1cddc2f62e21dcc2586ac095a7b91d992d2f52a9 | [] | no_license | yeyshengge/allmyself | https://github.com/yeyshengge/allmyself | a9514aa3abe88f3dc4711fc4d003200de8b0d031 | 0a45fc836a03e3ab7ce456381eb12382caed6ffb | refs/heads/master | 2022-05-17T13:57:12.135000 | 2020-02-12T10:33:01 | 2020-02-12T10:33:01 | 239,975,581 | 0 | 0 | null | false | 2022-04-23T02:34:25 | 2020-02-12T09:38:52 | 2020-02-12T10:50:56 | 2022-04-23T02:34:23 | 166,687 | 0 | 0 | 54 | JavaScript | false | false | package com.zps.Map;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Set;
/*
* 同步的,单线程,速度慢,安全
* 底层是一个hash表
*之前学的所有集合可以存储空值,但是Hsahtable不可以
* */
public class HashTbleDemo {
public static void main(String[] args) {
HashMap<String,String> map = new HashMap<>();
map.put(null,"a");
map.put("a",null);
System.out.println(map);//{null=a, a=null}
Set<String> s = map.keySet();
Iterator<String> it = s.iterator();
while ((it.hasNext())){
String next = it.next();
System.out.println(next+"-->"+map.get(next));
}
System.out.println("------------------------");
Hashtable<String,String> table = new Hashtable<>();
table.put(null,null);
System.out.println(table);//NullPointerException报错
}
}
| UTF-8 | Java | 943 | java | HashTbleDemo.java | Java | [] | null | [] | package com.zps.Map;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Set;
/*
* 同步的,单线程,速度慢,安全
* 底层是一个hash表
*之前学的所有集合可以存储空值,但是Hsahtable不可以
* */
public class HashTbleDemo {
public static void main(String[] args) {
HashMap<String,String> map = new HashMap<>();
map.put(null,"a");
map.put("a",null);
System.out.println(map);//{null=a, a=null}
Set<String> s = map.keySet();
Iterator<String> it = s.iterator();
while ((it.hasNext())){
String next = it.next();
System.out.println(next+"-->"+map.get(next));
}
System.out.println("------------------------");
Hashtable<String,String> table = new Hashtable<>();
table.put(null,null);
System.out.println(table);//NullPointerException报错
}
}
| 943 | 0.583236 | 0.583236 | 30 | 27.633333 | 18.394716 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.766667 | false | false | 11 |
13721898287da9b0a1c22c65223c8da025fcaef4 | 20,220,706,086,568 | c9f2bd34255a1f7822fe0fbf4c7e51fa26eede14 | /java-project/src/main/java/ar/uba/dc/analysis/automaticinvariants/instrumentation/daikon/parameters/DI_Int.java | 39c7a5a738726e71bce51d7896116096d65e1888 | [] | no_license | billy-mosse/jconsume | https://github.com/billy-mosse/jconsume | eca93b696eaf8edcb8af5730eebd95f49e736fd4 | b782a55f20c416a73c967b2225786677af5f52ba | refs/heads/master | 2022-09-22T18:10:43.784000 | 2020-03-09T01:00:38 | 2020-03-09T01:00:38 | 97,016,318 | 4 | 0 | null | false | 2022-09-01T22:58:04 | 2017-07-12T14:18:01 | 2021-07-05T11:40:07 | 2022-09-01T22:58:01 | 139,356 | 3 | 0 | 7 | C | false | false | /*
* Created on 05/01/2005
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package ar.uba.dc.analysis.automaticinvariants.instrumentation.daikon.parameters;
import ar.uba.dc.analysis.automaticinvariants.instrumentation.daikon.parameters.DIParameter;
import soot.IntType;
import soot.Local;
/**
* @author Diego
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class DI_Int extends DIParameter {
DI_Int(String name)
{
super(name, IntType.v());
}
DI_Int(Local var)
{
super(var);
}
}
| UTF-8 | Java | 704 | java | DI_Int.java | Java | [
{
"context": "ot.IntType;\r\nimport soot.Local;\r\n\r\n/**\r\n * @author Diego\r\n *\r\n * TODO To change the template for this gene",
"end": 411,
"score": 0.9997341632843018,
"start": 406,
"tag": "NAME",
"value": "Diego"
}
] | null | [] | /*
* Created on 05/01/2005
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package ar.uba.dc.analysis.automaticinvariants.instrumentation.daikon.parameters;
import ar.uba.dc.analysis.automaticinvariants.instrumentation.daikon.parameters.DIParameter;
import soot.IntType;
import soot.Local;
/**
* @author Diego
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class DI_Int extends DIParameter {
DI_Int(String name)
{
super(name, IntType.v());
}
DI_Int(Local var)
{
super(var);
}
}
| 704 | 0.693182 | 0.681818 | 31 | 20.709677 | 26.681145 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.548387 | false | false | 11 |
318c6999cd31187426fbf2db728b858d6e83daf4 | 18,425,409,762,124 | 7c21d8e872521766d0cab4d539d98b4333926fe5 | /AddressBook/src/main/java/com/example/persistence/jdbc/DeleteEntryDAO.java | 734f1e8b07cf9e199d588acee5cbc6ed9ee881eb | [] | no_license | PreethySasi/Address-Book | https://github.com/PreethySasi/Address-Book | 71fe4ecf2b6a47d8f52ef205d8977e7f653fed52 | 44fff8cce0b5a2d41715b689acbc259b9a36f517 | refs/heads/master | 2022-01-24T02:05:42.888000 | 2019-09-10T09:56:08 | 2019-09-10T09:56:08 | 207,523,437 | 0 | 1 | null | false | 2022-01-21T23:29:41 | 2019-09-10T09:53:46 | 2019-09-10T09:56:11 | 2022-01-21T23:29:39 | 365 | 0 | 0 | 1 | CSS | false | false | package com.example.persistence.jdbc;
import org.springframework.stereotype.Repository;
import com.example.AddressBookEntry;
@Repository
public class DeleteEntryDAO extends BaseDAO{
private final String QUERY = "DELETE from ENTRIES where ID = ?;";
public int deleteEntry(int id){
return this.jdbcTemplate.update(QUERY, id);
}
}
| UTF-8 | Java | 339 | java | DeleteEntryDAO.java | Java | [] | null | [] | package com.example.persistence.jdbc;
import org.springframework.stereotype.Repository;
import com.example.AddressBookEntry;
@Repository
public class DeleteEntryDAO extends BaseDAO{
private final String QUERY = "DELETE from ENTRIES where ID = ?;";
public int deleteEntry(int id){
return this.jdbcTemplate.update(QUERY, id);
}
}
| 339 | 0.778761 | 0.778761 | 13 | 25.076923 | 22.238089 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.076923 | false | false | 11 |
0fa2320c7aab3b19785b631f901d0cde5d594b3e | 10,883,447,180,240 | 1b1f6d6ba49e4ce5e95dfb2239be634b7a2090b4 | /myTools/src/test/Test.java | be78757ad753bc20228fc21777099836a721ddc9 | [] | no_license | 873802894/Dbutil | https://github.com/873802894/Dbutil | 0a86b8df3d6e90432639692325783aad3f59b940 | 9695fada1d51643affb17ec4a630b506116581c1 | refs/heads/master | 2022-11-15T01:01:22.208000 | 2020-07-09T05:38:38 | 2020-07-09T05:38:38 | 277,521,361 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package test;
import JDBC.Crud;
import bean.StudentBean;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
public class Test {
public static void main(String[] args) throws SQLException {
{
// String sql = "insert into student(sid,sname) values(?,?);";
// Object[] param = {2,"xxx"};
// Crud crud = new Crud();
// int res = crud.addDelEdit(sql,param);
// System.out.println(res);
// String sql = "select * from student where sid=?";
// int sid=1;
// Crud crud = new Crud();
// List<StudentBean> list = new ArrayList<>();
// list = crud.findByID(sql,sid);
// System.out.println(list.get(0).getSid());
// System.out.println(list.get(0).getSname());
// String sql = "select * from student;";
// Crud crud = new Crud();
// List<StudentBean> list = new ArrayList<>();
// list = crud.findAll(sql);
// for(StudentBean n:list){
// System.out.println(n.getSid()+n.getSname());
// }
// Crud crud = new Crud();
// String sql = "delete from student where sid=?";
// Object[][] param= new Object[1][];
// for(int i=10;i<=20;i++) {
// param[0][]
// }
// boolean flag=crud.batch(sql,param);
// if(flag) System.out.println("chenggong");
// else {
// System.out.println("shibai");
// }
// }
}
AccountTest accountTest = new AccountTest();
accountTest.transfer(1,2,2000);
}
} | UTF-8 | Java | 1,668 | java | Test.java | Java | [] | null | [] | package test;
import JDBC.Crud;
import bean.StudentBean;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
public class Test {
public static void main(String[] args) throws SQLException {
{
// String sql = "insert into student(sid,sname) values(?,?);";
// Object[] param = {2,"xxx"};
// Crud crud = new Crud();
// int res = crud.addDelEdit(sql,param);
// System.out.println(res);
// String sql = "select * from student where sid=?";
// int sid=1;
// Crud crud = new Crud();
// List<StudentBean> list = new ArrayList<>();
// list = crud.findByID(sql,sid);
// System.out.println(list.get(0).getSid());
// System.out.println(list.get(0).getSname());
// String sql = "select * from student;";
// Crud crud = new Crud();
// List<StudentBean> list = new ArrayList<>();
// list = crud.findAll(sql);
// for(StudentBean n:list){
// System.out.println(n.getSid()+n.getSname());
// }
// Crud crud = new Crud();
// String sql = "delete from student where sid=?";
// Object[][] param= new Object[1][];
// for(int i=10;i<=20;i++) {
// param[0][]
// }
// boolean flag=crud.batch(sql,param);
// if(flag) System.out.println("chenggong");
// else {
// System.out.println("shibai");
// }
// }
}
AccountTest accountTest = new AccountTest();
accountTest.transfer(1,2,2000);
}
} | 1,668 | 0.520983 | 0.511391 | 55 | 29.345455 | 20.89299 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.8 | false | false | 11 |
e88eed6ad903f11498c28ccebc26a3da5a49848f | 13,692,355,759,292 | e0d606be8c7b2274de3aadc5387088bde7e945c1 | /src/main/java/com/example/config/BookProperties.java | 0e562ab445febe572ddb42b389735a4b210166a5 | [] | no_license | jundin/test | https://github.com/jundin/test | 60ca1e7708b61fea43edf14a93de398e8d78112c | 4916780a9942065e5345fe134106bb1e7e7ddb1b | refs/heads/master | 2023-04-22T03:54:59.403000 | 2021-05-19T02:48:23 | 2021-05-19T02:48:23 | 86,693,272 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import javax.validation.constraints.NotEmpty;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Component
@Data
@ConfigurationProperties(prefix = "library")
public class BookProperties {
@NotEmpty
private String location;
private List<Book> books;
private Map<String, String> price = new HashMap<>();
@Data
static class Book {
String name;
String description;
}
}
| UTF-8 | Java | 607 | java | BookProperties.java | Java | [] | null | [] | package com.example.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import javax.validation.constraints.NotEmpty;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Component
@Data
@ConfigurationProperties(prefix = "library")
public class BookProperties {
@NotEmpty
private String location;
private List<Book> books;
private Map<String, String> price = new HashMap<>();
@Data
static class Book {
String name;
String description;
}
}
| 607 | 0.744646 | 0.744646 | 26 | 22.346153 | 18.818857 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.538462 | false | false | 11 |
43a0c4a6e87d750796b2ea37149abcf34822e2e9 | 32,573,032,035,733 | f1e24a5fb020b1f3cbbdf15965bdfdf1670f52e3 | /src/Array/821_Time Intersection.java | 6febf24701c4662748305f9e2b720886647f59c0 | [] | no_license | junj0619/algorithm-1 | https://github.com/junj0619/algorithm-1 | 1c308d1d8dc61de4632426a1f6521353cde58c88 | 3de9435c18e6d6b1663c890ec58e592f4e1cc697 | refs/heads/master | 2020-03-28T13:32:28.604000 | 2018-09-11T21:25:46 | 2018-09-11T21:25:46 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Definition of Interval:
* public classs Interval {
* int start, end;
* Interval(int start, int end) {
* this.start = start;
* this.end = end;
* }
* }
*/
class Event {
public static final int EVENT_TYPE_IN = 1;
public static final int EVENT_TYPE_OUT = -1;
int time;
int type;
public Event(int time, int type){
this.time = time;
this.type = type;
}
}
public class Solution {
/**
* @param seqA: the list of intervals
* @param seqB: the list of intervals
* @return: the time periods
*/
static final int EVENT_TYPE_IN = 1;
static final int EVENT_TYPE_OUT = -1;
public List<Interval> timeIntersection(List<Interval> seqA, List<Interval> seqB) {
List<Interval> result = new ArrayList<Interval>();
List<Event> eventList = new ArrayList<Event>();
for (Interval interval: seqA){
eventList.add(new Event(interval.start, Event.EVENT_TYPE_IN));
eventList.add(new Event(interval.end, Event.EVENT_TYPE_OUT));
}
for (Interval interval: seqB){
eventList.add(new Event(interval.start, Event.EVENT_TYPE_IN));
eventList.add(new Event(interval.end, Event.EVENT_TYPE_OUT));
}
eventList.sort(Comparator.comparing((Event event) -> event.time));
int count = 0;
Interval last = new Interval(0, 0);;
for (Event event : eventList){
count = count + event.type;
if (event.type == Event.EVENT_TYPE_IN && count == 2){ // both users are online
last.start = event.time;
}
if (event.type == Event.EVENT_TYPE_OUT && count == 1){ // end of both user online
last.end = event.time;
result.add(new Interval(last.start, last.end));
}
}
return result;
}
}
| UTF-8 | Java | 1,944 | java | 821_Time Intersection.java | Java | [] | null | [] | /**
* Definition of Interval:
* public classs Interval {
* int start, end;
* Interval(int start, int end) {
* this.start = start;
* this.end = end;
* }
* }
*/
class Event {
public static final int EVENT_TYPE_IN = 1;
public static final int EVENT_TYPE_OUT = -1;
int time;
int type;
public Event(int time, int type){
this.time = time;
this.type = type;
}
}
public class Solution {
/**
* @param seqA: the list of intervals
* @param seqB: the list of intervals
* @return: the time periods
*/
static final int EVENT_TYPE_IN = 1;
static final int EVENT_TYPE_OUT = -1;
public List<Interval> timeIntersection(List<Interval> seqA, List<Interval> seqB) {
List<Interval> result = new ArrayList<Interval>();
List<Event> eventList = new ArrayList<Event>();
for (Interval interval: seqA){
eventList.add(new Event(interval.start, Event.EVENT_TYPE_IN));
eventList.add(new Event(interval.end, Event.EVENT_TYPE_OUT));
}
for (Interval interval: seqB){
eventList.add(new Event(interval.start, Event.EVENT_TYPE_IN));
eventList.add(new Event(interval.end, Event.EVENT_TYPE_OUT));
}
eventList.sort(Comparator.comparing((Event event) -> event.time));
int count = 0;
Interval last = new Interval(0, 0);;
for (Event event : eventList){
count = count + event.type;
if (event.type == Event.EVENT_TYPE_IN && count == 2){ // both users are online
last.start = event.time;
}
if (event.type == Event.EVENT_TYPE_OUT && count == 1){ // end of both user online
last.end = event.time;
result.add(new Interval(last.start, last.end));
}
}
return result;
}
}
| 1,944 | 0.55144 | 0.546811 | 61 | 30.868853 | 24.662626 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.590164 | false | false | 11 |
bf92dba7b489e2fd6806736a4bdb0d251e7cf2e6 | 22,359,599,802,969 | 84c1d900b8c39369952f6845c6739f7acd0b01af | /Spring Boot/src/main/java/com/gmail/hossain/tanvir/k/amarloan/contact/ContactDataController.java | cc25ae84eb4a37c96513cce395e83fd809aa0038 | [] | no_license | KhondokerTanvirHossain/Amar-Loan | https://github.com/KhondokerTanvirHossain/Amar-Loan | 2d7c46ba5271058d26bc60db2a99800a166b6be8 | 7fb783127bdf30abda2906ab469120a92f560b68 | refs/heads/master | 2020-08-22T22:15:17.812000 | 2019-10-21T05:57:04 | 2019-10-21T05:57:04 | 216,486,191 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.gmail.hossain.tanvir.k.amarloan.contact;
import com.gmail.hossain.tanvir.k.amarloan.form.FormDataModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
public class ContactDataController {
@Autowired
private ContactDataService dataService;
@RequestMapping(method = RequestMethod.GET, value = "user/{userId}/form/{formId}/contact")
public ContactDataModel getByFormId(@PathVariable int userId, @PathVariable int formId){
return dataService.getOneByFormId(formId);
}
@RequestMapping(method = RequestMethod.GET, value = "user/{userId}/form/{formId}/contact/{id}")
public ContactDataModel getOneById(@PathVariable int id){
return dataService.getOneById(id);
}
@RequestMapping(method = RequestMethod.POST, value = "user/{userId}/form/{formId}/contact")
public int addOne(@RequestBody ContactDataModel dataModel, @PathVariable int userId, @PathVariable int formId){
return dataService.addContact(dataModel, userId, formId);
}
@RequestMapping(method = RequestMethod.PUT, value = "user/{userId}/form/{formId}/contact")
public int updateOne(@RequestBody ContactDataModel dataModel, @PathVariable int userId, @PathVariable int formId){
return dataService.updateContact(dataModel, userId, formId);
}
@RequestMapping(method = RequestMethod.DELETE, value = "user/{userId}/form/{formId}/contact")
public void deleteOne(@RequestBody ContactDataModel dataModel){
dataService.deleteContact(dataModel);
}
@RequestMapping(method = RequestMethod.DELETE, value = "user/{userId}/form/{formId}/contact/{id}")
public void deleteOneById(@PathVariable int userId, @PathVariable int formId, @PathVariable int id){
dataService.deleteContactById(id);
}
}
| UTF-8 | Java | 1,855 | java | ContactDataController.java | Java | [] | null | [] | package com.gmail.hossain.tanvir.k.amarloan.contact;
import com.gmail.hossain.tanvir.k.amarloan.form.FormDataModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
public class ContactDataController {
@Autowired
private ContactDataService dataService;
@RequestMapping(method = RequestMethod.GET, value = "user/{userId}/form/{formId}/contact")
public ContactDataModel getByFormId(@PathVariable int userId, @PathVariable int formId){
return dataService.getOneByFormId(formId);
}
@RequestMapping(method = RequestMethod.GET, value = "user/{userId}/form/{formId}/contact/{id}")
public ContactDataModel getOneById(@PathVariable int id){
return dataService.getOneById(id);
}
@RequestMapping(method = RequestMethod.POST, value = "user/{userId}/form/{formId}/contact")
public int addOne(@RequestBody ContactDataModel dataModel, @PathVariable int userId, @PathVariable int formId){
return dataService.addContact(dataModel, userId, formId);
}
@RequestMapping(method = RequestMethod.PUT, value = "user/{userId}/form/{formId}/contact")
public int updateOne(@RequestBody ContactDataModel dataModel, @PathVariable int userId, @PathVariable int formId){
return dataService.updateContact(dataModel, userId, formId);
}
@RequestMapping(method = RequestMethod.DELETE, value = "user/{userId}/form/{formId}/contact")
public void deleteOne(@RequestBody ContactDataModel dataModel){
dataService.deleteContact(dataModel);
}
@RequestMapping(method = RequestMethod.DELETE, value = "user/{userId}/form/{formId}/contact/{id}")
public void deleteOneById(@PathVariable int userId, @PathVariable int formId, @PathVariable int id){
dataService.deleteContactById(id);
}
}
| 1,855 | 0.744474 | 0.744474 | 41 | 44.243904 | 39.541138 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.682927 | false | false | 11 |
1368f4efff8b3a084168426949b23bbaddc9c70b | 5,660,766,962,159 | fbcd282197544f7d7e3e4820dd83322676c20253 | /livegoods_by_time/src/main/java/com/livegoods/bytime/service/impl/BuyTimeServiceImpl.java | f993df0cc289e08bb616a5dc2f46b59ea66c66eb | [] | no_license | DaleAB2/livegoods | https://github.com/DaleAB2/livegoods | ed8bd5bd68789ffa35dfd151dbc22ff1c6e39781 | 6cb5e25d0867b4e7054434ad187faba81a09b25e | refs/heads/main | 2023-04-02T14:38:23.337000 | 2021-04-06T13:10:18 | 2021-04-06T13:10:18 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.livegoods.bytime.service.impl;
import com.livegoods.bytime.dao.BuyTimeDao;
import com.livegoods.bytime.service.BuyTimeService;
import com.livegoods.commons.pojo.Result;
import com.livegoods.pojo.Houses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class BuyTimeServiceImpl implements BuyTimeService {
@Autowired
private BuyTimeDao buyTimeDao;
public Result<Object> getHouseBuyTime(String id){
Houses houses = buyTimeDao.findHouseById(id);
if(null == houses){
return new Result<>();
}
System.out.println(houses.getBuytime());
long buytime = houses.getBuytime().getTime();
Result<Object> result = new Result<>();
result.setStatus(200);
result.setTime(buytime);
return result;
}
}
| UTF-8 | Java | 875 | java | BuyTimeServiceImpl.java | Java | [] | null | [] | package com.livegoods.bytime.service.impl;
import com.livegoods.bytime.dao.BuyTimeDao;
import com.livegoods.bytime.service.BuyTimeService;
import com.livegoods.commons.pojo.Result;
import com.livegoods.pojo.Houses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class BuyTimeServiceImpl implements BuyTimeService {
@Autowired
private BuyTimeDao buyTimeDao;
public Result<Object> getHouseBuyTime(String id){
Houses houses = buyTimeDao.findHouseById(id);
if(null == houses){
return new Result<>();
}
System.out.println(houses.getBuytime());
long buytime = houses.getBuytime().getTime();
Result<Object> result = new Result<>();
result.setStatus(200);
result.setTime(buytime);
return result;
}
}
| 875 | 0.709714 | 0.706286 | 28 | 30.25 | 20.318228 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false | 11 |
13d339c4de9b850db4e99abf61e0046d9e9812a2 | 24,558,623,064,992 | df83cd8a8f4d320b5be8109fa5335ece6da4ae58 | /app/src/main/java/com/jd/jarvisdemonim/ui/model/StickyIndexBean.java | 9ce1bc3f672f65a4f4fb7bafe0d7daa30f244bf3 | [] | no_license | JarvisBuop/jdAdapter | https://github.com/JarvisBuop/jdAdapter | e3e1a99063a94ebb994c3d7324731375fbf77349 | f3b5578ea19fba6f97e92ba24ee01a1ab39b87bb | refs/heads/master | 2021-01-12T04:10:22.748000 | 2018-03-29T13:30:25 | 2018-03-29T13:31:43 | 77,509,403 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jd.jarvisdemonim.ui.model;
import com.jd.jdkit.entity.BaseSortIndexBean;
/**
* Auther: Jarvis Dong
* Time: on 2017/1/12 0012
* Name:
* OverView: 索引列表和吸顶列表的数据类型;
* Usage:
*/
public class StickyIndexBean extends BaseSortIndexBean {
//其他数据;
public String name;
public String gender;
public String profession;
public StickyIndexBean(String stickyTop, String name, String gender, String profession) {
this.topName= stickyTop;
this.name = name;
this.gender = gender;
this.profession = profession;
}
@Override
public String toString() {
return "StickyIndexBean{" +
"stickyTop='" + topName + '\'' +
", sortLetters='" + sortLetters + '\'' +
", name='" + name + '\'' +
", gender='" + gender + '\'' +
", profession='" + profession + '\'' +
'}';
}
}
| UTF-8 | Java | 969 | java | StickyIndexBean.java | Java | [
{
"context": "jd.jdkit.entity.BaseSortIndexBean;\n\n/**\n * Auther: Jarvis Dong\n * Time: on 2017/1/12 0012\n * Name:\n * OverView: ",
"end": 113,
"score": 0.9998809099197388,
"start": 102,
"tag": "NAME",
"value": "Jarvis Dong"
}
] | null | [] | package com.jd.jarvisdemonim.ui.model;
import com.jd.jdkit.entity.BaseSortIndexBean;
/**
* Auther: <NAME>
* Time: on 2017/1/12 0012
* Name:
* OverView: 索引列表和吸顶列表的数据类型;
* Usage:
*/
public class StickyIndexBean extends BaseSortIndexBean {
//其他数据;
public String name;
public String gender;
public String profession;
public StickyIndexBean(String stickyTop, String name, String gender, String profession) {
this.topName= stickyTop;
this.name = name;
this.gender = gender;
this.profession = profession;
}
@Override
public String toString() {
return "StickyIndexBean{" +
"stickyTop='" + topName + '\'' +
", sortLetters='" + sortLetters + '\'' +
", name='" + name + '\'' +
", gender='" + gender + '\'' +
", profession='" + profession + '\'' +
'}';
}
}
| 964 | 0.555198 | 0.543408 | 36 | 24.916666 | 21.059935 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.527778 | false | false | 11 |
7a1dee4d3f746724413b8a22b6bfefd2de2f6d1c | 1,228,360,654,580 | a122e65460a8f42ab21d2c30ce3c8a6d7e8425e1 | /src/main/java/io/automatenow/pages/TablesPage.java | 8c99b242d8b2bc39e6ec9974f483aeb07d996da7 | [
"MIT"
] | permissive | automatenow/IntermediateWebDriver | https://github.com/automatenow/IntermediateWebDriver | de29f7c1bd585fc205a90b9173dd10f88f43de6c | 8a1f34ae3e361af01d2243f859ca9048b41f32ea | refs/heads/main | 2023-07-12T09:54:00.304000 | 2022-05-12T12:28:13 | 2022-05-12T12:28:13 | 354,611,514 | 1 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | package io.automatenow.pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import java.util.List;
/**
* @author Marco A. Cruz
*/
public class TablesPage extends BasePage {
private By countrySort = By.cssSelector(".column-2.sorting");
private By noNextBtn = By.cssSelector(".paginate_button.next.disabled");
private By nextBtn = By.xpath("//a[normalize-space()='Next']");
public String getItemPrice(String item) {
return driver.findElement(By.xpath("//td[text()='" + item + "']/following-sibling::td")).getText();
}
public void sortByCountry() {
click(countrySort);
}
/**
* Gets a country's population
*
* @param country The name of the country
* @return Population in millions when country is found; -1 otherwise.
*/
public String getPopulation(String country) {
boolean foundCountry = false;
while (!foundCountry) {
List<WebElement> countryListedOnCurrentPage = driver.findElements(By.xpath("//table[@id='tablepress-1']//td[normalize-space()='"+ country +"']"));
List<WebElement> disabledNextBtn = driver.findElements(noNextBtn);
if (countryListedOnCurrentPage.size() > 0) {
foundCountry = true;
} else if (disabledNextBtn.size() == 0) {
click(nextBtn);
} else {
return "-1";
}
}
// Return the country's population
return getText(By.xpath("//td[normalize-space()='" + country + "']/following-sibling::td"));
}
}
| UTF-8 | Java | 1,590 | java | TablesPage.java | Java | [
{
"context": "ebElement;\n\nimport java.util.List;\n\n/**\n * @author Marco A. Cruz\n */\npublic class TablesPage extends BasePage {\n ",
"end": 154,
"score": 0.9998576045036316,
"start": 141,
"tag": "NAME",
"value": "Marco A. Cruz"
}
] | null | [] | package io.automatenow.pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import java.util.List;
/**
* @author <NAME>
*/
public class TablesPage extends BasePage {
private By countrySort = By.cssSelector(".column-2.sorting");
private By noNextBtn = By.cssSelector(".paginate_button.next.disabled");
private By nextBtn = By.xpath("//a[normalize-space()='Next']");
public String getItemPrice(String item) {
return driver.findElement(By.xpath("//td[text()='" + item + "']/following-sibling::td")).getText();
}
public void sortByCountry() {
click(countrySort);
}
/**
* Gets a country's population
*
* @param country The name of the country
* @return Population in millions when country is found; -1 otherwise.
*/
public String getPopulation(String country) {
boolean foundCountry = false;
while (!foundCountry) {
List<WebElement> countryListedOnCurrentPage = driver.findElements(By.xpath("//table[@id='tablepress-1']//td[normalize-space()='"+ country +"']"));
List<WebElement> disabledNextBtn = driver.findElements(noNextBtn);
if (countryListedOnCurrentPage.size() > 0) {
foundCountry = true;
} else if (disabledNextBtn.size() == 0) {
click(nextBtn);
} else {
return "-1";
}
}
// Return the country's population
return getText(By.xpath("//td[normalize-space()='" + country + "']/following-sibling::td"));
}
}
| 1,583 | 0.611321 | 0.607547 | 49 | 31.44898 | 33.009621 | 158 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.346939 | false | false | 11 |
4ba3bce703bab79025e8b2421ab067c7a4411012 | 17,085,379,934,710 | e99e5bc39164cf5fb18db1b10c9b78aa4fa0cf26 | /teamob/src/com/sunny/teamob/view/SimplePagerTitle.java | fea23d7318fcaed5780fec700bb5834dfb7f29eb | [] | no_license | ljl8086/projects | https://github.com/ljl8086/projects | 918f6df501472e8839c866807e0f2e3b1845c5dd | 9c93e04b17e89c75b24aedad358a8b95cda637f1 | refs/heads/master | 2021-01-10T08:10:49.754000 | 2015-11-10T03:37:47 | 2015-11-10T03:37:47 | 45,885,074 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sunny.teamob.view;
import java.util.ArrayList;
import java.util.List;
import android.graphics.Color;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.sunny.teamob.adapter.SimplePagerAdapter;
/**
* 标题导航组件。
*
* @author ljl
*
*/
public class SimplePagerTitle implements OnPageChangeListener {
private ViewGroup viewGroup = null;
private List<TextView> titleTextView = new ArrayList<TextView>();
private ViewPager viewPager = null;
private SimplePagerAdapter<Object> pagerAdapter;
private HorizontalScrollView horizontalScrollView;
private Margins margins = new Margins(25, 0, 25, 0);
/**
* 构造标题导航组件。
* @param viewGroup 装载标题栏的容器
* @param pagerAdapter 导航组件的适配器
* @param viewPager
* @param horizontalScrollView 滚动条组件
*/
public SimplePagerTitle(ViewGroup viewGroup, SimplePagerAdapter<Object> pagerAdapter, ViewPager viewPager,
HorizontalScrollView horizontalScrollView) {
this.viewGroup = viewGroup;
this.pagerAdapter = pagerAdapter;
this.viewPager = viewPager;
this.horizontalScrollView = horizontalScrollView;
createViews();
}
/**
* 构造标题导航组件。
* @param viewGroup 装载标题栏的容器
* @param pagerAdapter 导航组件的适配器
* @param viewPager
* @param horizontalScrollView 滚动条组件
*/
public SimplePagerTitle(ViewGroup viewGroup, SimplePagerAdapter<Object> pagerAdapter, ViewPager viewPager,
HorizontalScrollView horizontalScrollView,Margins margins) {
this.viewGroup = viewGroup;
this.pagerAdapter = pagerAdapter;
this.viewPager = viewPager;
this.horizontalScrollView = horizontalScrollView;
this.margins = margins;
createViews();
}
public void setMargins(Margins margins){
this.margins = margins;
}
private void createViews() {
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
layoutParams.setMargins(margins.left, margins.top, margins.right, margins.bottom);
for (int i = 0; i < pagerAdapter.getCount(); i++) {
final int index = i;
TextView textView = new TextView(viewGroup.getContext());
textView.setLayoutParams(layoutParams);
textView.setText(pagerAdapter.getTitleList().get(i));
textView.setTextSize(18);
textView.setPadding(10, 5, 10, 5);
textView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View paramView) {
viewPager.setCurrentItem(index);
}
});
viewGroup.addView(textView);
titleTextView.add(textView);
onPageSelected(0);
}
}
@Override
public void onPageScrolled(int onPageScrolled, float paramFloat, int paramInt2) {
}
@Override
public void onPageSelected(int paramInt) {
for (TextView item : titleTextView) {
item.setTextColor(Color.BLACK);
}
titleTextView.get(paramInt).setTextColor(Color.RED);
int left = 0;
for(int i=0;i<paramInt;i++){
left += titleTextView.get(i).getWidth() + 50;
}
horizontalScrollView.smoothScrollTo(left, 0);
}
@Override
public void onPageScrollStateChanged(int paramInt) {
}
class Margins{
public Margins(int left, int top, int right, int bottom) {
super();
this.left = left;
this.top = top;
this.right = right;
this.bottom = bottom;
}
public int left;
public int top;
public int right;
public int bottom;
}
}
| UTF-8 | Java | 3,716 | java | SimplePagerTitle.java | Java | [
{
"context": "SimplePagerAdapter;\n\n/**\n * 标题导航组件。\n * \n * @author ljl\n *\n */\npublic class SimplePagerTitle implements O",
"end": 562,
"score": 0.9996179342269897,
"start": 559,
"tag": "USERNAME",
"value": "ljl"
}
] | null | [] | package com.sunny.teamob.view;
import java.util.ArrayList;
import java.util.List;
import android.graphics.Color;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.sunny.teamob.adapter.SimplePagerAdapter;
/**
* 标题导航组件。
*
* @author ljl
*
*/
public class SimplePagerTitle implements OnPageChangeListener {
private ViewGroup viewGroup = null;
private List<TextView> titleTextView = new ArrayList<TextView>();
private ViewPager viewPager = null;
private SimplePagerAdapter<Object> pagerAdapter;
private HorizontalScrollView horizontalScrollView;
private Margins margins = new Margins(25, 0, 25, 0);
/**
* 构造标题导航组件。
* @param viewGroup 装载标题栏的容器
* @param pagerAdapter 导航组件的适配器
* @param viewPager
* @param horizontalScrollView 滚动条组件
*/
public SimplePagerTitle(ViewGroup viewGroup, SimplePagerAdapter<Object> pagerAdapter, ViewPager viewPager,
HorizontalScrollView horizontalScrollView) {
this.viewGroup = viewGroup;
this.pagerAdapter = pagerAdapter;
this.viewPager = viewPager;
this.horizontalScrollView = horizontalScrollView;
createViews();
}
/**
* 构造标题导航组件。
* @param viewGroup 装载标题栏的容器
* @param pagerAdapter 导航组件的适配器
* @param viewPager
* @param horizontalScrollView 滚动条组件
*/
public SimplePagerTitle(ViewGroup viewGroup, SimplePagerAdapter<Object> pagerAdapter, ViewPager viewPager,
HorizontalScrollView horizontalScrollView,Margins margins) {
this.viewGroup = viewGroup;
this.pagerAdapter = pagerAdapter;
this.viewPager = viewPager;
this.horizontalScrollView = horizontalScrollView;
this.margins = margins;
createViews();
}
public void setMargins(Margins margins){
this.margins = margins;
}
private void createViews() {
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
layoutParams.setMargins(margins.left, margins.top, margins.right, margins.bottom);
for (int i = 0; i < pagerAdapter.getCount(); i++) {
final int index = i;
TextView textView = new TextView(viewGroup.getContext());
textView.setLayoutParams(layoutParams);
textView.setText(pagerAdapter.getTitleList().get(i));
textView.setTextSize(18);
textView.setPadding(10, 5, 10, 5);
textView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View paramView) {
viewPager.setCurrentItem(index);
}
});
viewGroup.addView(textView);
titleTextView.add(textView);
onPageSelected(0);
}
}
@Override
public void onPageScrolled(int onPageScrolled, float paramFloat, int paramInt2) {
}
@Override
public void onPageSelected(int paramInt) {
for (TextView item : titleTextView) {
item.setTextColor(Color.BLACK);
}
titleTextView.get(paramInt).setTextColor(Color.RED);
int left = 0;
for(int i=0;i<paramInt;i++){
left += titleTextView.get(i).getWidth() + 50;
}
horizontalScrollView.smoothScrollTo(left, 0);
}
@Override
public void onPageScrollStateChanged(int paramInt) {
}
class Margins{
public Margins(int left, int top, int right, int bottom) {
super();
this.left = left;
this.top = top;
this.right = right;
this.bottom = bottom;
}
public int left;
public int top;
public int right;
public int bottom;
}
}
| 3,716 | 0.74679 | 0.740089 | 132 | 26.136364 | 23.307163 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.045455 | false | false | 11 |
502fd2d8e70d8b7e1d0ecbebf22f689ef394e1bc | 14,697,378,111,433 | b8a65b68e106a34ae1476838419a8ece57f38a08 | /src/view/screens/Screen2Controller.java | 27a29b4628826ef30e669d90b8c03dba249f439a | [] | no_license | adrianoabrantes/ScreensFramework | https://github.com/adrianoabrantes/ScreensFramework | d97f2dbc9955360dee612f925a239000b1935c25 | 2d271ba05d25b22afdeba041a0c2fc18c8876804 | refs/heads/master | 2021-04-03T07:17:28.076000 | 2018-03-13T15:39:50 | 2018-03-13T15:39:50 | 125,074,836 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package view.screens;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
/**
* FXML Controller class
*
* @author adrianoabrantesdeandrade
*/
public class Screen2Controller implements Initializable, ControlledScreen {
ScreensController myController;
@FXML
private Button Buttton;
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}
@Override
public void setScreenParent(ScreensController screenPage) {
myController = screenPage;
}
@FXML
private void headleButtonEvent(ActionEvent event) {
myController.setScreen(ScreensFramework.screen1ID);
}
}
| UTF-8 | Java | 832 | java | Screen2Controller.java | Java | [
{
"context": "utton;\n\n/**\n * FXML Controller class\n *\n * @author adrianoabrantesdeandrade\n */\npublic class Screen2Controller implements Ini",
"end": 273,
"score": 0.965893566608429,
"start": 249,
"tag": "USERNAME",
"value": "adrianoabrantesdeandrade"
}
] | null | [] | package view.screens;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
/**
* FXML Controller class
*
* @author adrianoabrantesdeandrade
*/
public class Screen2Controller implements Initializable, ControlledScreen {
ScreensController myController;
@FXML
private Button Buttton;
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}
@Override
public void setScreenParent(ScreensController screenPage) {
myController = screenPage;
}
@FXML
private void headleButtonEvent(ActionEvent event) {
myController.setScreen(ScreensFramework.screen1ID);
}
}
| 832 | 0.717548 | 0.715144 | 39 | 20.333334 | 20.170216 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 11 |
c09dfce4c114dff38c25a9c5140caeb2f93c1097 | 14,998,025,824,634 | 0d446e4e5f95ce183dde1f28d310b794aa0cc468 | /android/app/src/main/java/com/demoapp/MyModule.java | 1e1f1f9b222e3e270fa28b6cdb860b409e53795f | [] | no_license | harsh8088/RN_Firebase_Demo | https://github.com/harsh8088/RN_Firebase_Demo | 483dafbbb6b5b63dca2e20a1b41b9b9c3b80c1b8 | 9967ae263eb950e1d8f91476030e27974262ff8d | refs/heads/master | 2021-09-07T17:03:27.571000 | 2018-02-26T14:38:59 | 2018-02-26T14:38:59 | 103,136,002 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.demoapp;
import android.app.Dialog;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.demoapp.model.Book;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
/**
* Created by hrawat on 8/3/2017.
*/
public class MyModule extends ReactContextBaseJavaModule {
private Book book;
public MyModule(ReactApplicationContext reactContext) {
super(reactContext);
}
/**
* The string returned by getName() has to be same as the class name.
*/
@Override
public String getName() {
return "MyModule";
}
@ReactMethod
public void alert(String message) {
Toast.makeText(getReactApplicationContext(), message, Toast.LENGTH_SHORT).show();
}
@ReactMethod
public void dialog(String url, final Callback callback) {
// custom dialog
final Dialog dialog = new Dialog(getCurrentActivity());
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setCancelable(false);
dialog.setContentView(R.layout.custom_dialog);
final TextView textViewUrl = (TextView) dialog.findViewById(R.id.img_url);
final EditText inputBookName = (EditText) dialog.findViewById(R.id.input_book_name);
final EditText inputAuthor = (EditText) dialog.findViewById(R.id.input_author);
final EditText inputPrice = (EditText) dialog.findViewById(R.id.input_price);
final EditText inputPublishYear = (EditText) dialog.findViewById(R.id.input_publish_year);
if (url != null)
textViewUrl.setText(url);
Button btnCancel = (Button) dialog.findViewById(R.id.btn_cancel);
Button btnSave = (Button) dialog.findViewById(R.id.btn_save);
btnSave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
book = new Book(inputBookName.getText().toString(),
textViewUrl.getText().toString(), inputAuthor.getText().toString(),
inputPrice.getText().toString(), inputPublishYear.getText().toString());
callback.invoke(inputBookName.getText().toString(), textViewUrl.getText().toString(),
inputAuthor.getText().toString(), inputPrice.getText().toString(),
inputPublishYear.getText().toString());
dialog.dismiss();
}
});
btnCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.show();
}
@ReactMethod
private void getBookDetails(Callback booleanCallback) {
// return new Book("fds","www.nlksndcsn.sdc","bhaki","1354","2016");
// booleanCallback.invoke(new Book("fds","www.nlksndcsn.sdc","bhaki","1354","2016"));
booleanCallback.invoke("a", "b", "c");
}
@ReactMethod
public void settingsDialog(final Callback callback) {
// custom dialog
final Dialog dialog = new Dialog(getCurrentActivity());
dialog.setContentView(R.layout.setting_dialog);
dialog.setTitle("Select Theme");
final RadioGroup radioGroup = (RadioGroup) dialog.findViewById(R.id.rg_theme);
Button btnDone = (Button) dialog.findViewById(R.id.btn_done);
btnDone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String theme = "";
switch (radioGroup.getCheckedRadioButtonId()) {
case R.id.rb_blue_grey:
theme = "blue_grey";
break;
case R.id.rb_deep_orange:
theme = "deep_orange";
break;
case R.id.rb_deep_purple:
theme = "deep_purple";
break;
case R.id.rb_green:
theme = "green";
break;
case R.id.rb_teal:
theme = "teal";
break;
case R.id.rb_default:
theme = "default";
break;
}
callback.invoke(theme);
dialog.dismiss();
}
});
dialog.show();
}
} | UTF-8 | Java | 4,748 | java | MyModule.java | Java | [
{
"context": "ebook.react.bridge.ReactMethod;\n\n/**\n * Created by hrawat on 8/3/2017.\n */\npublic class MyModule extends Re",
"end": 525,
"score": 0.9995293021202087,
"start": 519,
"tag": "USERNAME",
"value": "hrawat"
}
] | null | [] | package com.demoapp;
import android.app.Dialog;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.demoapp.model.Book;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
/**
* Created by hrawat on 8/3/2017.
*/
public class MyModule extends ReactContextBaseJavaModule {
private Book book;
public MyModule(ReactApplicationContext reactContext) {
super(reactContext);
}
/**
* The string returned by getName() has to be same as the class name.
*/
@Override
public String getName() {
return "MyModule";
}
@ReactMethod
public void alert(String message) {
Toast.makeText(getReactApplicationContext(), message, Toast.LENGTH_SHORT).show();
}
@ReactMethod
public void dialog(String url, final Callback callback) {
// custom dialog
final Dialog dialog = new Dialog(getCurrentActivity());
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setCancelable(false);
dialog.setContentView(R.layout.custom_dialog);
final TextView textViewUrl = (TextView) dialog.findViewById(R.id.img_url);
final EditText inputBookName = (EditText) dialog.findViewById(R.id.input_book_name);
final EditText inputAuthor = (EditText) dialog.findViewById(R.id.input_author);
final EditText inputPrice = (EditText) dialog.findViewById(R.id.input_price);
final EditText inputPublishYear = (EditText) dialog.findViewById(R.id.input_publish_year);
if (url != null)
textViewUrl.setText(url);
Button btnCancel = (Button) dialog.findViewById(R.id.btn_cancel);
Button btnSave = (Button) dialog.findViewById(R.id.btn_save);
btnSave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
book = new Book(inputBookName.getText().toString(),
textViewUrl.getText().toString(), inputAuthor.getText().toString(),
inputPrice.getText().toString(), inputPublishYear.getText().toString());
callback.invoke(inputBookName.getText().toString(), textViewUrl.getText().toString(),
inputAuthor.getText().toString(), inputPrice.getText().toString(),
inputPublishYear.getText().toString());
dialog.dismiss();
}
});
btnCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.show();
}
@ReactMethod
private void getBookDetails(Callback booleanCallback) {
// return new Book("fds","www.nlksndcsn.sdc","bhaki","1354","2016");
// booleanCallback.invoke(new Book("fds","www.nlksndcsn.sdc","bhaki","1354","2016"));
booleanCallback.invoke("a", "b", "c");
}
@ReactMethod
public void settingsDialog(final Callback callback) {
// custom dialog
final Dialog dialog = new Dialog(getCurrentActivity());
dialog.setContentView(R.layout.setting_dialog);
dialog.setTitle("Select Theme");
final RadioGroup radioGroup = (RadioGroup) dialog.findViewById(R.id.rg_theme);
Button btnDone = (Button) dialog.findViewById(R.id.btn_done);
btnDone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String theme = "";
switch (radioGroup.getCheckedRadioButtonId()) {
case R.id.rb_blue_grey:
theme = "blue_grey";
break;
case R.id.rb_deep_orange:
theme = "deep_orange";
break;
case R.id.rb_deep_purple:
theme = "deep_purple";
break;
case R.id.rb_green:
theme = "green";
break;
case R.id.rb_teal:
theme = "teal";
break;
case R.id.rb_default:
theme = "default";
break;
}
callback.invoke(theme);
dialog.dismiss();
}
});
dialog.show();
}
} | 4,748 | 0.586142 | 0.581508 | 126 | 36.690475 | 26.752085 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.65873 | false | false | 11 |
05f6fd1e0c31e61d1169c30e743ae5c78997625f | 24,807,731,120,043 | 7c55a0167e319dfc910443777cfc699330de65a9 | /TccModuloOO/MarioKart/src/Itens/Baletao.java | 42c349691f9cb10c1b7e10b77dfdb2e13739c4d5 | [] | no_license | luanwinck/Tarefas-cwi | https://github.com/luanwinck/Tarefas-cwi | 429a42d0ccc545bac5fc4a75a376ff5b598fbb62 | 658e2a712d9ad7f6656fef5efcccb2ff9eea89c5 | refs/heads/master | 2020-03-10T18:11:35.963000 | 2018-04-19T13:46:02 | 2018-04-19T13:46:02 | 129,519,632 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Itens;
public class Baletao implements ItemDeAtaque, ItemDeBonus{
@Override
public int casasExtras() {
return 7;
}
@Override
public int danoCausado() {
return 5;
}
}
| UTF-8 | Java | 216 | java | Baletao.java | Java | [] | null | [] | package Itens;
public class Baletao implements ItemDeAtaque, ItemDeBonus{
@Override
public int casasExtras() {
return 7;
}
@Override
public int danoCausado() {
return 5;
}
}
| 216 | 0.615741 | 0.606481 | 13 | 15.615385 | 15.583712 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.307692 | false | false | 11 |
825bd91499783b87a8035fb00445bab81bc6021a | 13,511,967,134,695 | 74766c69bcadab8ff53eab31bbac4c46ff16615e | /src/test/java/com/navexplorer/indexer/softfork/entity/SoftForkTest.java | d37385efdfadf12e02da22f0a285cdce73338778 | [
"MIT"
] | permissive | NavExplorer/navexplorer-indexer | https://github.com/NavExplorer/navexplorer-indexer | 82cabf20d5ef1be4a9c403a6cef274c720af0681 | 658721ae50bbbf812bb77a23759fddf6f3d5b123 | refs/heads/master | 2022-07-08T04:38:06.109000 | 2020-02-24T23:37:35 | 2020-02-24T23:37:35 | 138,702,797 | 0 | 2 | MIT | false | 2022-06-25T07:28:23 | 2018-06-26T07:44:14 | 2020-02-24T23:37:39 | 2022-06-25T07:28:23 | 207 | 0 | 2 | 3 | Java | false | false | package com.navexplorer.indexer.softfork.entity;
import org.junit.Test;
import java.util.Arrays;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
public class SoftForkTest {
@Test
public void it_can_set_and_get_the_id() {
String id = "SOFTFORK_ID";
SoftFork softFork = new SoftFork();
softFork.setId(id);
assertThat(softFork.getId()).isEqualTo(id);
}
@Test
public void it_can_set_and_get_the_name() {
String name = "SOFTFORK_NAME";
SoftFork softFork = new SoftFork();
softFork.setName(name);
assertThat(softFork.getName()).isEqualTo(name);
}
@Test
public void it_can_set_and_get_the_signal_bit() {
Integer signalBit = 10;
SoftFork softFork = new SoftFork();
softFork.setSignalBit(signalBit);
assertThat(softFork.getSignalBit()).isEqualTo(signalBit);
}
@Test
public void it_can_set_and_get_the_state() {
SoftForkState state = SoftForkState.LOCKED_IN;
SoftFork softFork = new SoftFork();
softFork.setState(state);
assertThat(softFork.getState()).isEqualTo(state);
}
@Test
public void it_can_set_and_get_the_blocks_signalling() {
Integer blockSignalling = 10;
SoftFork softFork = new SoftFork();
softFork.setBlocksSignalling(blockSignalling);
assertThat(softFork.getBlocksSignalling()).isEqualTo(blockSignalling);
}
@Test
public void it_can_set_and_get_the_signalled_to_block() {
Long signalledToBlock = 10000L;
SoftFork softFork = new SoftFork();
softFork.setSignalledToBlock(signalledToBlock);
assertThat(softFork.getSignalledToBlock()).isEqualTo(signalledToBlock);
}
@Test
public void it_can_set_and_get_the_locked_in_height() {
Long lockedInHeight = 10000L;
SoftFork softFork = new SoftFork();
softFork.setLockedInHeight(lockedInHeight);
assertThat(softFork.getLockedInHeight()).isEqualTo(lockedInHeight);
}
@Test
public void it_can_set_and_get_the_activation_height() {
Long activationHeight = 20000L;
SoftFork softFork = new SoftFork();
softFork.setActivationHeight(activationHeight);
assertThat(softFork.getActivationHeight()).isEqualTo(activationHeight);
}
@Test
public void it_can_set_and_get_the_blocks_in_cycle() {
Integer blocksInCycle = 20000;
SoftFork softFork = new SoftFork();
softFork.setBlocksInCycle(blocksInCycle);
assertThat(softFork.getBlocksInCycle()).isEqualTo(blocksInCycle);
}
@Test
public void it_can_set_and_get_the_blocks_remaining() {
Integer blocksRemaining = 500;
SoftFork softFork = new SoftFork();
softFork.setBlocksRemaining(blocksRemaining);
assertThat(softFork.getBlocksRemaining()).isEqualTo(blocksRemaining);
}
@Test
public void it_can_set_and_get_the_previous_cycles() {
List<Integer> previousCycles = Arrays.asList(10,20,30);
SoftFork softFork = new SoftFork();
softFork.setPreviousCycles(previousCycles);
assertThat(softFork.getPreviousCycles()).isEqualTo(previousCycles);
}
@Test
public void it_can_increment_signalling() {
Integer blockSignalling = 500;
SoftFork softFork = new SoftFork();
softFork.setBlocksSignalling(blockSignalling);
assertThat(softFork.getBlocksSignalling()).isEqualTo(blockSignalling);
softFork.incrementSignalling();
assertThat(softFork.getBlocksSignalling()).isEqualTo(blockSignalling + 1);
}
@Test
public void it_can_start_a_new_cycle() {
Integer blockSignalling1 = 500;
Integer blockSignalling2 = 500;
SoftFork softFork = new SoftFork();
softFork.setBlocksSignalling(blockSignalling1);
softFork.startNewCycle();
assertThat(softFork.getBlocksSignalling()).isEqualTo(0);
assertThat(softFork.getPreviousCycles().size()).isEqualTo(1);
assertThat(softFork.getPreviousCycles().get(0)).isEqualTo(blockSignalling1);
softFork.setBlocksSignalling(blockSignalling2);
softFork.startNewCycle();
assertThat(softFork.getBlocksSignalling()).isEqualTo(0);
assertThat(softFork.getPreviousCycles().size()).isEqualTo(2);
assertThat(softFork.getPreviousCycles().get(0)).isEqualTo(blockSignalling1);
assertThat(softFork.getPreviousCycles().get(1)).isEqualTo(blockSignalling2);
}
}
| UTF-8 | Java | 4,560 | java | SoftForkTest.java | Java | [] | null | [] | package com.navexplorer.indexer.softfork.entity;
import org.junit.Test;
import java.util.Arrays;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
public class SoftForkTest {
@Test
public void it_can_set_and_get_the_id() {
String id = "SOFTFORK_ID";
SoftFork softFork = new SoftFork();
softFork.setId(id);
assertThat(softFork.getId()).isEqualTo(id);
}
@Test
public void it_can_set_and_get_the_name() {
String name = "SOFTFORK_NAME";
SoftFork softFork = new SoftFork();
softFork.setName(name);
assertThat(softFork.getName()).isEqualTo(name);
}
@Test
public void it_can_set_and_get_the_signal_bit() {
Integer signalBit = 10;
SoftFork softFork = new SoftFork();
softFork.setSignalBit(signalBit);
assertThat(softFork.getSignalBit()).isEqualTo(signalBit);
}
@Test
public void it_can_set_and_get_the_state() {
SoftForkState state = SoftForkState.LOCKED_IN;
SoftFork softFork = new SoftFork();
softFork.setState(state);
assertThat(softFork.getState()).isEqualTo(state);
}
@Test
public void it_can_set_and_get_the_blocks_signalling() {
Integer blockSignalling = 10;
SoftFork softFork = new SoftFork();
softFork.setBlocksSignalling(blockSignalling);
assertThat(softFork.getBlocksSignalling()).isEqualTo(blockSignalling);
}
@Test
public void it_can_set_and_get_the_signalled_to_block() {
Long signalledToBlock = 10000L;
SoftFork softFork = new SoftFork();
softFork.setSignalledToBlock(signalledToBlock);
assertThat(softFork.getSignalledToBlock()).isEqualTo(signalledToBlock);
}
@Test
public void it_can_set_and_get_the_locked_in_height() {
Long lockedInHeight = 10000L;
SoftFork softFork = new SoftFork();
softFork.setLockedInHeight(lockedInHeight);
assertThat(softFork.getLockedInHeight()).isEqualTo(lockedInHeight);
}
@Test
public void it_can_set_and_get_the_activation_height() {
Long activationHeight = 20000L;
SoftFork softFork = new SoftFork();
softFork.setActivationHeight(activationHeight);
assertThat(softFork.getActivationHeight()).isEqualTo(activationHeight);
}
@Test
public void it_can_set_and_get_the_blocks_in_cycle() {
Integer blocksInCycle = 20000;
SoftFork softFork = new SoftFork();
softFork.setBlocksInCycle(blocksInCycle);
assertThat(softFork.getBlocksInCycle()).isEqualTo(blocksInCycle);
}
@Test
public void it_can_set_and_get_the_blocks_remaining() {
Integer blocksRemaining = 500;
SoftFork softFork = new SoftFork();
softFork.setBlocksRemaining(blocksRemaining);
assertThat(softFork.getBlocksRemaining()).isEqualTo(blocksRemaining);
}
@Test
public void it_can_set_and_get_the_previous_cycles() {
List<Integer> previousCycles = Arrays.asList(10,20,30);
SoftFork softFork = new SoftFork();
softFork.setPreviousCycles(previousCycles);
assertThat(softFork.getPreviousCycles()).isEqualTo(previousCycles);
}
@Test
public void it_can_increment_signalling() {
Integer blockSignalling = 500;
SoftFork softFork = new SoftFork();
softFork.setBlocksSignalling(blockSignalling);
assertThat(softFork.getBlocksSignalling()).isEqualTo(blockSignalling);
softFork.incrementSignalling();
assertThat(softFork.getBlocksSignalling()).isEqualTo(blockSignalling + 1);
}
@Test
public void it_can_start_a_new_cycle() {
Integer blockSignalling1 = 500;
Integer blockSignalling2 = 500;
SoftFork softFork = new SoftFork();
softFork.setBlocksSignalling(blockSignalling1);
softFork.startNewCycle();
assertThat(softFork.getBlocksSignalling()).isEqualTo(0);
assertThat(softFork.getPreviousCycles().size()).isEqualTo(1);
assertThat(softFork.getPreviousCycles().get(0)).isEqualTo(blockSignalling1);
softFork.setBlocksSignalling(blockSignalling2);
softFork.startNewCycle();
assertThat(softFork.getBlocksSignalling()).isEqualTo(0);
assertThat(softFork.getPreviousCycles().size()).isEqualTo(2);
assertThat(softFork.getPreviousCycles().get(0)).isEqualTo(blockSignalling1);
assertThat(softFork.getPreviousCycles().get(1)).isEqualTo(blockSignalling2);
}
}
| 4,560 | 0.673904 | 0.661404 | 144 | 30.666666 | 26.599916 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.493056 | false | false | 11 |
d8398a13bd0cde5e84d79a28c00d44485cfd07b6 | 10,084,583,239,711 | f73016aaae9ad5db8774dce534947789414e4865 | /src/main/java/leetcode/easy/array/BTimeBSStockII.java | 72335dac79f2dceb65c76c8270bc1deb4ba90779 | [] | no_license | awakn123/Learning | https://github.com/awakn123/Learning | 99da93184ca77dff4e8d1381f019d229f159b2d2 | 7d2fbf548767a57377d836e1596bba052ba8c703 | refs/heads/master | 2023-06-25T14:42:03.844000 | 2022-10-20T20:57:18 | 2022-10-20T20:57:18 | 82,987,306 | 0 | 0 | null | false | 2023-06-14T22:54:23 | 2017-02-24T01:11:10 | 2022-09-23T22:20:45 | 2023-06-14T22:54:23 | 504 | 0 | 0 | 1 | Java | false | false | package leetcode.easy.array;
/**
* Created by 曹云 on 2020/8/1.
* 122.Best Time to Buy and Sell Stock II
* https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/
*/
public class BTimeBSStockII {
public int maxProfit(int[] prices) {
if (prices.length == 0 || prices.length == 1) return 0;
int minIdx = 0;
int profit = 0;
int sump = 0;
for (int i=1; i<prices.length; i++){
if (prices[i] < prices[i-1]) {
minIdx = i;
sump += profit;
profit = 0;
} else {
profit = prices[i] - prices[minIdx];
}
}
sump += profit;
return sump;
}
public static void main(String[] args){
int[] priceI = {2,0,4,5,9,3,7};
int profitI = 13;
int[] priceII = {277,44,19,333,88,1110,377,5,8};
int profitII = 1339;
int[] priceIII = {7,6,4,3,1};
int profitIII = 0;
BTimeBSStockII main = new BTimeBSStockII();
int rI = main.maxProfit(priceI);
System.out.println("I right:" + (rI == profitI));
System.out.println("result:" + rI);
int rII = main.maxProfit(priceII);
System.out.println("II right:" + (rII == profitII));
System.out.println("result:" + rII);
int rIII = main.maxProfit(priceIII);
System.out.println("III right:" + (rIII == profitIII));
System.out.println("result:" + rIII);
}
}
| UTF-8 | Java | 1,252 | java | BTimeBSStockII.java | Java | [
{
"context": "package leetcode.easy.array;\n\n/**\n * Created by 曹云 on 2020/8/1.\n * 122.Best Time to Buy and Sell Sto",
"end": 50,
"score": 0.9992130398750305,
"start": 48,
"tag": "NAME",
"value": "曹云"
}
] | null | [] | package leetcode.easy.array;
/**
* Created by 曹云 on 2020/8/1.
* 122.Best Time to Buy and Sell Stock II
* https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/
*/
public class BTimeBSStockII {
public int maxProfit(int[] prices) {
if (prices.length == 0 || prices.length == 1) return 0;
int minIdx = 0;
int profit = 0;
int sump = 0;
for (int i=1; i<prices.length; i++){
if (prices[i] < prices[i-1]) {
minIdx = i;
sump += profit;
profit = 0;
} else {
profit = prices[i] - prices[minIdx];
}
}
sump += profit;
return sump;
}
public static void main(String[] args){
int[] priceI = {2,0,4,5,9,3,7};
int profitI = 13;
int[] priceII = {277,44,19,333,88,1110,377,5,8};
int profitII = 1339;
int[] priceIII = {7,6,4,3,1};
int profitIII = 0;
BTimeBSStockII main = new BTimeBSStockII();
int rI = main.maxProfit(priceI);
System.out.println("I right:" + (rI == profitI));
System.out.println("result:" + rI);
int rII = main.maxProfit(priceII);
System.out.println("II right:" + (rII == profitII));
System.out.println("result:" + rII);
int rIII = main.maxProfit(priceIII);
System.out.println("III right:" + (rIII == profitIII));
System.out.println("result:" + rIII);
}
}
| 1,252 | 0.620192 | 0.573718 | 46 | 26.130434 | 17.937826 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.73913 | false | false | 11 |
0f4901ef1b84ecc3ba0a04f62c9a2f3e745676e7 | 13,168,369,753,303 | 3f5f104c56f28c86918a557bb3c287fb64ff05c0 | /src/main/java/com/alibaba/csp/sentinel/dashboard/Constants.java | c1034a9cd0d3f5aaae727da0ac3eb3249ff0c1b6 | [] | no_license | finefuture/sentinel-dashboard-X | https://github.com/finefuture/sentinel-dashboard-X | 5e5a510a90663082c508ec8bf9f88d366acb96fd | ab462b1864ce2f9cd5184ee8511c61e70f94de42 | refs/heads/master | 2022-12-15T19:29:03.247000 | 2019-09-27T09:47:36 | 2019-09-27T09:47:36 | 183,847,652 | 5 | 6 | null | false | 2022-12-03T07:36:50 | 2019-04-28T02:59:22 | 2021-11-27T06:52:58 | 2022-12-03T07:36:50 | 1,502 | 6 | 5 | 13 | Java | false | false | package com.alibaba.csp.sentinel.dashboard;
/**
* @author longqiang
*/
public class Constants {
private Constants() {
throw new IllegalStateException("Constants class");
}
public static final String PARAM_FLOW_RULE_STORE = "ParamFlowRuleStore";
public static final String SYSTEM_RULE_STORE = "SystemRuleStore";
public static final String AUTHORITY_RULE_STORE = "AuthorityRuleStore";
public static final String DEGRADE_RULE_STORE = "DegradeRuleStore";
public static final String FLOW_RULE_STORE = "FlowRuleStore";
public static final String FETCHER = "Fetcher";
public static final String PUBLISHER = "Publisher";
public static final String STORE = "Store";
public static final String CONFIG_CHANGE_CHECKER = "ConfigChangeChecker";
public static final String MANAGEMENT = "Management";
public static final String FLOW_RULE = "FlowRule";
public static final String DEGRADE_RULE = "DegradeRule";
public static final String AUTHORITY_RULE = "AuthorityRule";
public static final String SYSTEM_RULE = "SystemRule";
public static final String PARAM_FLOW_RULE = "ParamFlowRule";
public static final String DATASOURCE_APOLLO = "Apollo";
public static final String DATASOURCE_NACOS = "Nacos";
public static final String DATASOURCE_IN_MEMORY = "InMemory";
}
| UTF-8 | Java | 1,358 | java | Constants.java | Java | [
{
"context": "om.alibaba.csp.sentinel.dashboard;\n\n/**\n * @author longqiang\n */\npublic class Constants {\n\n private Constan",
"end": 69,
"score": 0.9980877041816711,
"start": 60,
"tag": "USERNAME",
"value": "longqiang"
}
] | null | [] | package com.alibaba.csp.sentinel.dashboard;
/**
* @author longqiang
*/
public class Constants {
private Constants() {
throw new IllegalStateException("Constants class");
}
public static final String PARAM_FLOW_RULE_STORE = "ParamFlowRuleStore";
public static final String SYSTEM_RULE_STORE = "SystemRuleStore";
public static final String AUTHORITY_RULE_STORE = "AuthorityRuleStore";
public static final String DEGRADE_RULE_STORE = "DegradeRuleStore";
public static final String FLOW_RULE_STORE = "FlowRuleStore";
public static final String FETCHER = "Fetcher";
public static final String PUBLISHER = "Publisher";
public static final String STORE = "Store";
public static final String CONFIG_CHANGE_CHECKER = "ConfigChangeChecker";
public static final String MANAGEMENT = "Management";
public static final String FLOW_RULE = "FlowRule";
public static final String DEGRADE_RULE = "DegradeRule";
public static final String AUTHORITY_RULE = "AuthorityRule";
public static final String SYSTEM_RULE = "SystemRule";
public static final String PARAM_FLOW_RULE = "ParamFlowRule";
public static final String DATASOURCE_APOLLO = "Apollo";
public static final String DATASOURCE_NACOS = "Nacos";
public static final String DATASOURCE_IN_MEMORY = "InMemory";
}
| 1,358 | 0.723859 | 0.723859 | 48 | 27.291666 | 29.949234 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416667 | false | false | 11 |
fabf8ea1a6499054d50658a42ed4877505602352 | 11,055,245,858,218 | feaba941a895a6acc9f7589ce48cacd84b2011a3 | /_lhmf/src/it/polito/ai/lhmf/json/PurchaseProductSerializer.java | dbb9bd39e00e6117fd7fc312aec58e129fb18a55 | [] | no_license | fbrundu/lhmf | https://github.com/fbrundu/lhmf | 61f4666fbf326ed24020f31cab912049ac1b9d47 | 4aa666b21f5c2a151b2e8a54fb481b3cdd562d3f | refs/heads/master | 2016-09-06T14:50:38.181000 | 2012-10-10T07:02:42 | 2012-10-10T07:02:42 | 32,212,148 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package it.polito.ai.lhmf.json;
import java.io.IOException;
import it.polito.ai.lhmf.orm.PurchaseProduct;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
public class PurchaseProductSerializer extends JsonSerializer<PurchaseProduct>
{
@Override
public void serialize(PurchaseProduct value, JsonGenerator jgen,
SerializerProvider provider) throws IOException,
JsonProcessingException
{
jgen.writeStartObject();
jgen.writeObjectField("id", value.getId());
jgen.writeObjectField("purchase", value.getPurchase());
jgen.writeObjectField("product", value.getProduct());
jgen.writeNumberField("amount", value.getAmount());
jgen.writeStringField("insertedTimestamp",ISO8601DateParser.toString(value.getInsertedTimestamp()));
jgen.writeEndObject();
}
}
| UTF-8 | Java | 954 | java | PurchaseProductSerializer.java | Java | [] | null | [] | package it.polito.ai.lhmf.json;
import java.io.IOException;
import it.polito.ai.lhmf.orm.PurchaseProduct;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
public class PurchaseProductSerializer extends JsonSerializer<PurchaseProduct>
{
@Override
public void serialize(PurchaseProduct value, JsonGenerator jgen,
SerializerProvider provider) throws IOException,
JsonProcessingException
{
jgen.writeStartObject();
jgen.writeObjectField("id", value.getId());
jgen.writeObjectField("purchase", value.getPurchase());
jgen.writeObjectField("product", value.getProduct());
jgen.writeNumberField("amount", value.getAmount());
jgen.writeStringField("insertedTimestamp",ISO8601DateParser.toString(value.getInsertedTimestamp()));
jgen.writeEndObject();
}
}
| 954 | 0.77673 | 0.772537 | 30 | 29.799999 | 27.607244 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.533333 | false | false | 11 |
2c79cbb3e0e084fa732cd9f07d0c58051bc70861 | 11,055,245,854,492 | 4419bbecc195b63a8d0b23cd0a646477c652fb85 | /my-java-core-app/src/main/java/com/app/сh16/stack/MyStackImpl.java | 1888d9686cea31c6a314d8179b1fd5ddfe06a808 | [] | no_license | softwareengineerhub/test | https://github.com/softwareengineerhub/test | c81affe5a53d5e9d3f2e052b8921abb4c4662c21 | 26915613b2613c1112219b2d3efebcbbf82097f3 | refs/heads/master | 2022-11-22T00:54:35.738000 | 2020-03-15T20:16:51 | 2020-03-15T20:16:51 | 143,843,743 | 0 | 1 | null | false | 2022-11-16T11:51:41 | 2018-08-07T08:32:22 | 2020-03-15T20:17:04 | 2022-11-16T11:51:38 | 140 | 0 | 1 | 10 | Java | false | false | package com.app.сh16.stack;
import java.util.Arrays;
public class MyStackImpl implements MyStack {
private Object[] data;
private int n;
private int capacity;
public MyStackImpl(int capacity) {
this.capacity = capacity;
data = new Object[capacity];
}
public MyStackImpl() {
this(10);
}
@Override
public boolean isEmpty() {
return n==0;
}
@Override
public int size() {
return n;
}
@Override
public void push(Object item) {
if(n+1>data.length){
data = Arrays.copyOf(data, data.length+capacity);
}
data[n++]=item;
}
@Override
public Object peek() {
return data[n-1];
}
/*
[1,2,3,4,5,6]
6 - [1,2,3,4,5, null]
5 - [1,2,3,4,null, null]
4 - [1,2,3,null,null, null]
*/
@Override
public Object poll() {
Object value = data[n-1];
data[n-1] = null;
n--;
return value;
}
}
| UTF-8 | Java | 1,002 | java | MyStackImpl.java | Java | [] | null | [] | package com.app.сh16.stack;
import java.util.Arrays;
public class MyStackImpl implements MyStack {
private Object[] data;
private int n;
private int capacity;
public MyStackImpl(int capacity) {
this.capacity = capacity;
data = new Object[capacity];
}
public MyStackImpl() {
this(10);
}
@Override
public boolean isEmpty() {
return n==0;
}
@Override
public int size() {
return n;
}
@Override
public void push(Object item) {
if(n+1>data.length){
data = Arrays.copyOf(data, data.length+capacity);
}
data[n++]=item;
}
@Override
public Object peek() {
return data[n-1];
}
/*
[1,2,3,4,5,6]
6 - [1,2,3,4,5, null]
5 - [1,2,3,4,null, null]
4 - [1,2,3,null,null, null]
*/
@Override
public Object poll() {
Object value = data[n-1];
data[n-1] = null;
n--;
return value;
}
}
| 1,002 | 0.519481 | 0.48951 | 57 | 16.561403 | 13.645921 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 11 |
91d91952459c5d3fee74924bc5cb1790ee902b8d | 27,187,143,006,269 | 2ee7af58655e34fe0df8505c15c0336bf3b1509d | /Sim327/src/sim327/FXMLDocumentController.java | 8da10d68c56e8e845f7e20f992ebaf8d26919dba | [] | no_license | AlexisFabianCarranza/Tp-Final-Sim-327 | https://github.com/AlexisFabianCarranza/Tp-Final-Sim-327 | 6ba98167354dcbffedcd70d1a91dcbc3cef3e5fa | bdb11a4adac4651e71afc5f261305b867eab800b | refs/heads/master | 2020-06-21T06:44:51.029000 | 2019-07-23T03:21:08 | 2019-07-23T03:21:08 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package sim327;
import Clases.GestorSimulacion;
import Clases.VectorEstadoView;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.input.MouseEvent;
/**
*
* @author aleex
*/
public class FXMLDocumentController implements Initializable {
private Label label;
@FXML
private TableView<VectorEstadoView> tableVectorEstado;
@FXML
private TableColumn<?, ?> relojColumn;
@FXML
private TableColumn<?, ?> rndLlegadaColumn;
@FXML
private TableColumn<?, ?> tiempoLlegadaColumn;
@FXML
private TableColumn<?, ?> proximaLlegadaColumn;
@FXML
private TableColumn<?, ?> rndLlegadaColumn1;
@FXML
private TableColumn<?, ?> rndParColumn;
@FXML
private TableColumn<?, ?> tmpParqColumn;
@FXML
private TableColumn<?, ?> tiempoLlegadaColumn11;
@FXML
private TableColumn<?, ?> rndOcupColumn;
@FXML
private TableColumn<?, ?> rndLlegadaColumn111;
@FXML
private TableColumn<?, ?> tmpOcup1Column;
@FXML
private TableColumn<?, ?> rndLlegadaColumn1111;
@FXML
private TableColumn<?, ?> tmpOcup2Column;
@FXML
private TableColumn<?, ?> rndLlegadaColumn11112;
@FXML
private TableColumn<?, ?> tmpOcup3Column;
@FXML
private TableColumn<?, ?> rndMonedaColumn;
@FXML
private TableColumn<?, ?> colocaMonedaColumn;
@FXML
private TableColumn<?, ?> est1Column;
@FXML
private TableColumn<?, ?> finOcup1Column;
@FXML
private TableColumn<?, ?> finParq1Column;
@FXML
private TableColumn<?, ?> est2Column;
@FXML
private TableColumn<?, ?> finOcup2Column;
@FXML
private TableColumn<?, ?> finParq2Column;
@FXML
private TableColumn<?, ?> est3Column;
@FXML
private TableColumn<?, ?> finOcup3Column;
@FXML
private TableColumn<?, ?> finParq3Column;
@FXML
private TableColumn<?, ?> est4Column;
@FXML
private TableColumn<?, ?> finOcup4Column;
@FXML
private TableColumn<?, ?> finParq4Column;
@FXML
private TableColumn<?, ?> est5Column;
@FXML
private TableColumn<?, ?> finOcup5Column;
@FXML
private TableColumn<?, ?> finParq5Column;
@FXML
private TableColumn<?, ?> est6Column;
@FXML
private TableColumn<?, ?> finOcup6Column;
@FXML
private TableColumn<?, ?> finParq6Column;
@FXML
private TableColumn<?, ?> est7Column;
@FXML
private TableColumn<?, ?> finOcup7Column;
@FXML
private TableColumn<?, ?> finParq7Column;
@FXML
private TableColumn<?, ?> est8Column;
@FXML
private TableColumn<?, ?> finOcup8Column;
@FXML
private TableColumn<?, ?> finParq8Column;
@FXML
private TableColumn<?, ?> est9Column;
@FXML
private TableColumn<?, ?> finOcup9Column;
@FXML
private TableColumn<?, ?> finParq9Column;
@FXML
private TableColumn<?, ?> est10Column;
@FXML
private TableColumn<?, ?> finOcup10Column;
@FXML
private TableColumn<?, ?> finParq10Column;
@FXML
private TableColumn<?, ?> est11Column;
@FXML
private TableColumn<?, ?> finOcup11Column;
@FXML
private TableColumn<?, ?> finParq11Column;
@FXML
private TableColumn<?, ?> est12Column;
@FXML
private TableColumn<?, ?> finOcup12Column;
@FXML
private TableColumn<?, ?> finParq12Column;
@FXML
private TableColumn<?, ?> contSLugarColumn;
@FXML
private TableColumn<?, ?> contVehiculosColumn;
@FXML
private TableColumn<?, ?> contInfraColumn;
@FXML
private TableColumn<?, ?> contInfraColumn1;
@FXML
private TextField txtHorasSimulacion;
@FXML
private Button btnSimular;
@FXML
private TextField txtHoraDesde;
@FXML
private TextField txtHoraHasta;
private double minSimulacion, minHasta, minDesde;
private GestorSimulacion simulador;
private ObservableList<VectorEstadoView> estados;
@FXML
private TextField txtCantVehiculosSinLugar;
@FXML
private TextField txtPorcentajeInfraccion;
@FXML
private TextField txtRecaudacion;
@FXML
private TextField txtPerdidaPorInfraccion;
@FXML
private TableColumn<?, ?> acumPaquimetro;
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
this.relojColumn.setCellValueFactory(new PropertyValueFactory("reloj"));
//Llegada automovil
this.rndLlegadaColumn.setCellValueFactory(new PropertyValueFactory("rndLlegadaAutomovil"));
this.tiempoLlegadaColumn.setCellValueFactory(new PropertyValueFactory("tiempoLlegadaAutomovil"));
this.proximaLlegadaColumn.setCellValueFactory(new PropertyValueFactory("proximaLlegada"));
//Tiempo estacionamiento vehiculo
this.rndParColumn.setCellValueFactory(new PropertyValueFactory("rndParq"));
this.tmpParqColumn.setCellValueFactory(new PropertyValueFactory("tiempoParquimetro"));
this.rndOcupColumn.setCellValueFactory(new PropertyValueFactory("rndOcup"));
this.tmpOcup1Column.setCellValueFactory(new PropertyValueFactory("tiempoOcupacion1"));
this.tmpOcup2Column.setCellValueFactory(new PropertyValueFactory("tiempoOcupacion2"));
this.tmpOcup3Column.setCellValueFactory(new PropertyValueFactory("tiempoOcupacion3"));
//Coloca monedas
this.rndMonedaColumn.setCellValueFactory(new PropertyValueFactory("rndMonedas"));
this.colocaMonedaColumn.setCellValueFactory(new PropertyValueFactory("colocaMonedas"));
//Estacionamientos
this.est1Column.setCellValueFactory(new PropertyValueFactory("est1"));
this.finOcup1Column.setCellValueFactory(new PropertyValueFactory("finOcupacion1"));
this.finParq1Column.setCellValueFactory(new PropertyValueFactory("finParquimetro1"));
this.est2Column.setCellValueFactory(new PropertyValueFactory("est2"));
this.finOcup2Column.setCellValueFactory(new PropertyValueFactory("finOcupacion2"));
this.finParq2Column.setCellValueFactory(new PropertyValueFactory("finParquimetro2"));
this.est3Column.setCellValueFactory(new PropertyValueFactory("est3"));
this.finOcup3Column.setCellValueFactory(new PropertyValueFactory("finOcupacion3"));
this.finParq3Column.setCellValueFactory(new PropertyValueFactory("finParquimetro3"));
this.est4Column.setCellValueFactory(new PropertyValueFactory("est4"));
this.finOcup4Column.setCellValueFactory(new PropertyValueFactory("finOcupacion4"));
this.finParq4Column.setCellValueFactory(new PropertyValueFactory("finParquimetro4"));
this.est5Column.setCellValueFactory(new PropertyValueFactory("est5"));
this.finOcup5Column.setCellValueFactory(new PropertyValueFactory("finOcupacion5"));
this.finParq5Column.setCellValueFactory(new PropertyValueFactory("finParquimetro5"));
this.est6Column.setCellValueFactory(new PropertyValueFactory("est6"));
this.finOcup6Column.setCellValueFactory(new PropertyValueFactory("finOcupacion6"));
this.finParq6Column.setCellValueFactory(new PropertyValueFactory("finParquimetro6"));
this.est7Column.setCellValueFactory(new PropertyValueFactory("est7"));
this.finOcup7Column.setCellValueFactory(new PropertyValueFactory("finOcupacion7"));
this.finParq7Column.setCellValueFactory(new PropertyValueFactory("finParquimetro7"));
this.est8Column.setCellValueFactory(new PropertyValueFactory("est8"));
this.finOcup8Column.setCellValueFactory(new PropertyValueFactory("finOcupacion8"));
this.finParq8Column.setCellValueFactory(new PropertyValueFactory("finParquimetro8"));
this.est9Column.setCellValueFactory(new PropertyValueFactory("est9"));
this.finOcup9Column.setCellValueFactory(new PropertyValueFactory("finOcupacion9"));
this.finParq9Column.setCellValueFactory(new PropertyValueFactory("finParquimetro9"));
this.est10Column.setCellValueFactory(new PropertyValueFactory("est10"));
this.finOcup10Column.setCellValueFactory(new PropertyValueFactory("finOcupacion10"));
this.finParq10Column.setCellValueFactory(new PropertyValueFactory("finParquimetro10"));
this.est11Column.setCellValueFactory(new PropertyValueFactory("est11"));
this.finOcup11Column.setCellValueFactory(new PropertyValueFactory("finOcupacion11"));
this.finParq11Column.setCellValueFactory(new PropertyValueFactory("finParquimetro11"));
this.est12Column.setCellValueFactory(new PropertyValueFactory("est12"));
this.finOcup12Column.setCellValueFactory(new PropertyValueFactory("finOcupacion12"));
this.finParq12Column.setCellValueFactory(new PropertyValueFactory("finParquimetro12"));
//Variables
this.contSLugarColumn.setCellValueFactory(new PropertyValueFactory("contVehiSinLugar"));
this.contVehiculosColumn.setCellValueFactory(new PropertyValueFactory("contVehiculos"));
this.contInfraColumn.setCellValueFactory(new PropertyValueFactory("contInfracciones"));
this.contInfraColumn1.setCellValueFactory(new PropertyValueFactory("acumTiempoInfracciones"));
this.acumPaquimetro.setCellValueFactory(new PropertyValueFactory("acumTiempoParquimetro"));
}
@FXML
private void clickBtnSimular(MouseEvent event) {
if (validarDatos()) {
simulador = new GestorSimulacion(this.minDesde, this.minHasta, this.minSimulacion);
this.estados = simulador.inicarSimulacion();
tableVectorEstado.setItems(estados);
this.txtCantVehiculosSinLugar.setText(String.valueOf(simulador.getContadorVehiculosSinLugar()));
this.txtPorcentajeInfraccion.setText(String.format("%.0f", simulador.getPorcentajeInfraccion()) + " %");
this.txtRecaudacion.setText(String.valueOf(simulador.getRecaudacion()));
this.txtPerdidaPorInfraccion.setText(String.format("%.0f", simulador.getPerdidaPorInfraccion()) + " monedas");
this.txtRecaudacion.setText(String.format("%.0f", simulador.getRecaudacion()) + " monedas");
Alert dialog = new Alert(Alert.AlertType.INFORMATION);
dialog.setTitle("Éxito");
dialog.setHeaderText("Simulacion");
dialog.showAndWait();
}
}
private boolean validarDatos(){
Alert dialog = new Alert(Alert.AlertType.INFORMATION);
dialog.setTitle("ERROR");
try{
minSimulacion = Double.parseDouble(txtHorasSimulacion.textProperty().get());
minDesde = Double.parseDouble(txtHoraDesde.textProperty().get());
minHasta = Double.parseDouble(txtHoraHasta.textProperty().get());
}
catch (NumberFormatException e){
dialog.setHeaderText("Debe cargar números");
dialog.showAndWait();
return false;
}
if (minSimulacion < 0 || minDesde < 0 || minHasta < 0) {
dialog.setHeaderText("Los números deben ser superiores a 0");
dialog.showAndWait();
return false;
}
if (minDesde >= minHasta) {
dialog.setHeaderText("Intervalo invalido");
dialog.showAndWait();
return false;
}
return true;
}
} | UTF-8 | Java | 11,851 | java | FXMLDocumentController.java | Java | [
{
"context": " javafx.scene.input.MouseEvent;\n\n/**\n *\n * @author aleex\n */\npublic class FXMLDocumentController implement",
"end": 796,
"score": 0.999474048614502,
"start": 791,
"tag": "USERNAME",
"value": "aleex"
}
] | 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 sim327;
import Clases.GestorSimulacion;
import Clases.VectorEstadoView;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.input.MouseEvent;
/**
*
* @author aleex
*/
public class FXMLDocumentController implements Initializable {
private Label label;
@FXML
private TableView<VectorEstadoView> tableVectorEstado;
@FXML
private TableColumn<?, ?> relojColumn;
@FXML
private TableColumn<?, ?> rndLlegadaColumn;
@FXML
private TableColumn<?, ?> tiempoLlegadaColumn;
@FXML
private TableColumn<?, ?> proximaLlegadaColumn;
@FXML
private TableColumn<?, ?> rndLlegadaColumn1;
@FXML
private TableColumn<?, ?> rndParColumn;
@FXML
private TableColumn<?, ?> tmpParqColumn;
@FXML
private TableColumn<?, ?> tiempoLlegadaColumn11;
@FXML
private TableColumn<?, ?> rndOcupColumn;
@FXML
private TableColumn<?, ?> rndLlegadaColumn111;
@FXML
private TableColumn<?, ?> tmpOcup1Column;
@FXML
private TableColumn<?, ?> rndLlegadaColumn1111;
@FXML
private TableColumn<?, ?> tmpOcup2Column;
@FXML
private TableColumn<?, ?> rndLlegadaColumn11112;
@FXML
private TableColumn<?, ?> tmpOcup3Column;
@FXML
private TableColumn<?, ?> rndMonedaColumn;
@FXML
private TableColumn<?, ?> colocaMonedaColumn;
@FXML
private TableColumn<?, ?> est1Column;
@FXML
private TableColumn<?, ?> finOcup1Column;
@FXML
private TableColumn<?, ?> finParq1Column;
@FXML
private TableColumn<?, ?> est2Column;
@FXML
private TableColumn<?, ?> finOcup2Column;
@FXML
private TableColumn<?, ?> finParq2Column;
@FXML
private TableColumn<?, ?> est3Column;
@FXML
private TableColumn<?, ?> finOcup3Column;
@FXML
private TableColumn<?, ?> finParq3Column;
@FXML
private TableColumn<?, ?> est4Column;
@FXML
private TableColumn<?, ?> finOcup4Column;
@FXML
private TableColumn<?, ?> finParq4Column;
@FXML
private TableColumn<?, ?> est5Column;
@FXML
private TableColumn<?, ?> finOcup5Column;
@FXML
private TableColumn<?, ?> finParq5Column;
@FXML
private TableColumn<?, ?> est6Column;
@FXML
private TableColumn<?, ?> finOcup6Column;
@FXML
private TableColumn<?, ?> finParq6Column;
@FXML
private TableColumn<?, ?> est7Column;
@FXML
private TableColumn<?, ?> finOcup7Column;
@FXML
private TableColumn<?, ?> finParq7Column;
@FXML
private TableColumn<?, ?> est8Column;
@FXML
private TableColumn<?, ?> finOcup8Column;
@FXML
private TableColumn<?, ?> finParq8Column;
@FXML
private TableColumn<?, ?> est9Column;
@FXML
private TableColumn<?, ?> finOcup9Column;
@FXML
private TableColumn<?, ?> finParq9Column;
@FXML
private TableColumn<?, ?> est10Column;
@FXML
private TableColumn<?, ?> finOcup10Column;
@FXML
private TableColumn<?, ?> finParq10Column;
@FXML
private TableColumn<?, ?> est11Column;
@FXML
private TableColumn<?, ?> finOcup11Column;
@FXML
private TableColumn<?, ?> finParq11Column;
@FXML
private TableColumn<?, ?> est12Column;
@FXML
private TableColumn<?, ?> finOcup12Column;
@FXML
private TableColumn<?, ?> finParq12Column;
@FXML
private TableColumn<?, ?> contSLugarColumn;
@FXML
private TableColumn<?, ?> contVehiculosColumn;
@FXML
private TableColumn<?, ?> contInfraColumn;
@FXML
private TableColumn<?, ?> contInfraColumn1;
@FXML
private TextField txtHorasSimulacion;
@FXML
private Button btnSimular;
@FXML
private TextField txtHoraDesde;
@FXML
private TextField txtHoraHasta;
private double minSimulacion, minHasta, minDesde;
private GestorSimulacion simulador;
private ObservableList<VectorEstadoView> estados;
@FXML
private TextField txtCantVehiculosSinLugar;
@FXML
private TextField txtPorcentajeInfraccion;
@FXML
private TextField txtRecaudacion;
@FXML
private TextField txtPerdidaPorInfraccion;
@FXML
private TableColumn<?, ?> acumPaquimetro;
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
this.relojColumn.setCellValueFactory(new PropertyValueFactory("reloj"));
//Llegada automovil
this.rndLlegadaColumn.setCellValueFactory(new PropertyValueFactory("rndLlegadaAutomovil"));
this.tiempoLlegadaColumn.setCellValueFactory(new PropertyValueFactory("tiempoLlegadaAutomovil"));
this.proximaLlegadaColumn.setCellValueFactory(new PropertyValueFactory("proximaLlegada"));
//Tiempo estacionamiento vehiculo
this.rndParColumn.setCellValueFactory(new PropertyValueFactory("rndParq"));
this.tmpParqColumn.setCellValueFactory(new PropertyValueFactory("tiempoParquimetro"));
this.rndOcupColumn.setCellValueFactory(new PropertyValueFactory("rndOcup"));
this.tmpOcup1Column.setCellValueFactory(new PropertyValueFactory("tiempoOcupacion1"));
this.tmpOcup2Column.setCellValueFactory(new PropertyValueFactory("tiempoOcupacion2"));
this.tmpOcup3Column.setCellValueFactory(new PropertyValueFactory("tiempoOcupacion3"));
//Coloca monedas
this.rndMonedaColumn.setCellValueFactory(new PropertyValueFactory("rndMonedas"));
this.colocaMonedaColumn.setCellValueFactory(new PropertyValueFactory("colocaMonedas"));
//Estacionamientos
this.est1Column.setCellValueFactory(new PropertyValueFactory("est1"));
this.finOcup1Column.setCellValueFactory(new PropertyValueFactory("finOcupacion1"));
this.finParq1Column.setCellValueFactory(new PropertyValueFactory("finParquimetro1"));
this.est2Column.setCellValueFactory(new PropertyValueFactory("est2"));
this.finOcup2Column.setCellValueFactory(new PropertyValueFactory("finOcupacion2"));
this.finParq2Column.setCellValueFactory(new PropertyValueFactory("finParquimetro2"));
this.est3Column.setCellValueFactory(new PropertyValueFactory("est3"));
this.finOcup3Column.setCellValueFactory(new PropertyValueFactory("finOcupacion3"));
this.finParq3Column.setCellValueFactory(new PropertyValueFactory("finParquimetro3"));
this.est4Column.setCellValueFactory(new PropertyValueFactory("est4"));
this.finOcup4Column.setCellValueFactory(new PropertyValueFactory("finOcupacion4"));
this.finParq4Column.setCellValueFactory(new PropertyValueFactory("finParquimetro4"));
this.est5Column.setCellValueFactory(new PropertyValueFactory("est5"));
this.finOcup5Column.setCellValueFactory(new PropertyValueFactory("finOcupacion5"));
this.finParq5Column.setCellValueFactory(new PropertyValueFactory("finParquimetro5"));
this.est6Column.setCellValueFactory(new PropertyValueFactory("est6"));
this.finOcup6Column.setCellValueFactory(new PropertyValueFactory("finOcupacion6"));
this.finParq6Column.setCellValueFactory(new PropertyValueFactory("finParquimetro6"));
this.est7Column.setCellValueFactory(new PropertyValueFactory("est7"));
this.finOcup7Column.setCellValueFactory(new PropertyValueFactory("finOcupacion7"));
this.finParq7Column.setCellValueFactory(new PropertyValueFactory("finParquimetro7"));
this.est8Column.setCellValueFactory(new PropertyValueFactory("est8"));
this.finOcup8Column.setCellValueFactory(new PropertyValueFactory("finOcupacion8"));
this.finParq8Column.setCellValueFactory(new PropertyValueFactory("finParquimetro8"));
this.est9Column.setCellValueFactory(new PropertyValueFactory("est9"));
this.finOcup9Column.setCellValueFactory(new PropertyValueFactory("finOcupacion9"));
this.finParq9Column.setCellValueFactory(new PropertyValueFactory("finParquimetro9"));
this.est10Column.setCellValueFactory(new PropertyValueFactory("est10"));
this.finOcup10Column.setCellValueFactory(new PropertyValueFactory("finOcupacion10"));
this.finParq10Column.setCellValueFactory(new PropertyValueFactory("finParquimetro10"));
this.est11Column.setCellValueFactory(new PropertyValueFactory("est11"));
this.finOcup11Column.setCellValueFactory(new PropertyValueFactory("finOcupacion11"));
this.finParq11Column.setCellValueFactory(new PropertyValueFactory("finParquimetro11"));
this.est12Column.setCellValueFactory(new PropertyValueFactory("est12"));
this.finOcup12Column.setCellValueFactory(new PropertyValueFactory("finOcupacion12"));
this.finParq12Column.setCellValueFactory(new PropertyValueFactory("finParquimetro12"));
//Variables
this.contSLugarColumn.setCellValueFactory(new PropertyValueFactory("contVehiSinLugar"));
this.contVehiculosColumn.setCellValueFactory(new PropertyValueFactory("contVehiculos"));
this.contInfraColumn.setCellValueFactory(new PropertyValueFactory("contInfracciones"));
this.contInfraColumn1.setCellValueFactory(new PropertyValueFactory("acumTiempoInfracciones"));
this.acumPaquimetro.setCellValueFactory(new PropertyValueFactory("acumTiempoParquimetro"));
}
@FXML
private void clickBtnSimular(MouseEvent event) {
if (validarDatos()) {
simulador = new GestorSimulacion(this.minDesde, this.minHasta, this.minSimulacion);
this.estados = simulador.inicarSimulacion();
tableVectorEstado.setItems(estados);
this.txtCantVehiculosSinLugar.setText(String.valueOf(simulador.getContadorVehiculosSinLugar()));
this.txtPorcentajeInfraccion.setText(String.format("%.0f", simulador.getPorcentajeInfraccion()) + " %");
this.txtRecaudacion.setText(String.valueOf(simulador.getRecaudacion()));
this.txtPerdidaPorInfraccion.setText(String.format("%.0f", simulador.getPerdidaPorInfraccion()) + " monedas");
this.txtRecaudacion.setText(String.format("%.0f", simulador.getRecaudacion()) + " monedas");
Alert dialog = new Alert(Alert.AlertType.INFORMATION);
dialog.setTitle("Éxito");
dialog.setHeaderText("Simulacion");
dialog.showAndWait();
}
}
private boolean validarDatos(){
Alert dialog = new Alert(Alert.AlertType.INFORMATION);
dialog.setTitle("ERROR");
try{
minSimulacion = Double.parseDouble(txtHorasSimulacion.textProperty().get());
minDesde = Double.parseDouble(txtHoraDesde.textProperty().get());
minHasta = Double.parseDouble(txtHoraHasta.textProperty().get());
}
catch (NumberFormatException e){
dialog.setHeaderText("Debe cargar números");
dialog.showAndWait();
return false;
}
if (minSimulacion < 0 || minDesde < 0 || minHasta < 0) {
dialog.setHeaderText("Los números deben ser superiores a 0");
dialog.showAndWait();
return false;
}
if (minDesde >= minHasta) {
dialog.setHeaderText("Intervalo invalido");
dialog.showAndWait();
return false;
}
return true;
}
} | 11,851 | 0.714129 | 0.699696 | 278 | 41.622303 | 31.3622 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.866906 | false | false | 11 |
778d9e12180e903f71321a7563ac3f224b116a1a | 21,775,484,226,265 | 32be3d1b60c384a2d6fa7102f47ac7bbb338ea89 | /app/src/androidTest/java/com/zeelo/android/architecture/assignment/booksapp/data/source/local/BooksLocalDataSourceTest.java | e17c93cb04f6ee46ea39a4ee6fd87ff0e5a0e8b1 | [] | no_license | ipalermo/booksapp | https://github.com/ipalermo/booksapp | e171f906506fe3ecf86ae2538cde2cfe971cf1e9 | a58b45837083d8f8a567c590c468eb18d60b5fcc | refs/heads/develop | 2020-03-23T15:32:29.870000 | 2018-07-27T20:21:43 | 2018-07-27T20:21:43 | 141,755,318 | 0 | 0 | null | false | 2018-07-25T17:21:29 | 2018-07-20T20:34:56 | 2018-07-25T02:42:59 | 2018-07-25T16:55:56 | 313 | 0 | 0 | 0 | null | false | null |
package com.zeelo.android.architecture.assignment.booksapp.data.source.local;
import android.arch.persistence.room.Room;
import android.support.test.InstrumentationRegistry;
import android.support.test.filters.LargeTest;
import android.support.test.runner.AndroidJUnit4;
import com.zeelo.android.architecture.assignment.booksapp.data.BookListItem;
import com.zeelo.android.architecture.assignment.booksapp.data.source.BooksDataSource;
import com.zeelo.android.architecture.assignment.booksapp.util.SingleExecutors;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.List;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.anyList;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
/**
* Integration test for the {@link BooksDataSource}.
*/
@RunWith(AndroidJUnit4.class)
@LargeTest
public class BooksLocalDataSourceTest {
private final static String TITLE = "title";
private final static String TITLE2 = "title2";
private final static String TITLE3 = "title3";
private BooksLocalDataSource mLocalDataSource;
private BooksDatabase mDatabase;
@Before
public void setup() {
// using an in-memory database for testing, since it doesn't survive killing the process
mDatabase = Room.inMemoryDatabaseBuilder(InstrumentationRegistry.getContext(),
BooksDatabase.class)
.build();
BooksDao booksDao = mDatabase.bookDao();
// Make sure that we're not keeping a reference to the wrong instance.
BooksLocalDataSource.clearInstance();
mLocalDataSource = BooksLocalDataSource.getInstance(new SingleExecutors(), booksDao);
}
@After
public void cleanUp() {
mDatabase.close();
BooksLocalDataSource.clearInstance();
}
@Test
public void testPreConditions() {
assertNotNull(mLocalDataSource);
}
@Test
public void saveBook_retrievesBook() {
// Given a new book
final BookListItem newBook = new BookListItem(TITLE, "");
// When saved into the persistent repository
mLocalDataSource.saveBook(newBook);
// Then the book can be retrieved from the persistent repository
mLocalDataSource.getBookDetails(newBook.getId(), new BooksDataSource.GetBookDetailsCallback() {
@Override
public void onBookDetailsLoaded(BookListItem book) {
assertThat(book, is(newBook));
}
@Override
public void onDataNotAvailable() {
fail("Callback error");
}
});
}
@Test
public void completeBook_retrievedBookIsComplete() {
// Initialize mock for the callback.
BooksDataSource.GetBookDetailsCallback callback = mock(BooksDataSource.GetBookDetailsCallback.class);
// Given a new book in the persistent repository
final BookListItem newBook = new BookListItem(TITLE, "");
mLocalDataSource.saveBook(newBook);
// When favorited in the persistent repository
mLocalDataSource.completeBook(newBook);
// Then the book can be retrieved from the persistent repository and is complete
mLocalDataSource.getBookDetails(newBook.getId(), new BooksDataSource.GetBookDetailsCallback() {
@Override
public void onBookDetailsLoaded(BookListItem book) {
assertThat(book, is(newBook));
assertThat(book.isCompleted(), is(true));
}
@Override
public void onDataNotAvailable() {
fail("Callback error");
}
});
}
@Test
public void activateBook_retrievedBookIsActive() {
// Initialize mock for the callback.
BooksDataSource.GetBookDetailsCallback callback = mock(BooksDataSource.GetBookDetailsCallback.class);
// Given a new favorited book in the persistent repository
final BookListItem newBook = new BookListItem(TITLE, "");
mLocalDataSource.saveBook(newBook);
mLocalDataSource.completeBook(newBook);
// When activated in the persistent repository
mLocalDataSource.activateBook(newBook);
// Then the book can be retrieved from the persistent repository and is active
mLocalDataSource.getBookDetails(newBook.getId(), callback);
verify(callback, never()).onDataNotAvailable();
verify(callback).onBookDetailsLoaded(newBook);
assertThat(newBook.isCompleted(), is(false));
}
@Test
public void clearCompletedBook_bookNotRetrievable() {
// Initialize mocks for the callbacks.
BooksDataSource.GetBookDetailsCallback callback1 = mock(BooksDataSource.GetBookDetailsCallback.class);
BooksDataSource.GetBookDetailsCallback callback2 = mock(BooksDataSource.GetBookDetailsCallback.class);
BooksDataSource.GetBookDetailsCallback callback3 = mock(BooksDataSource.GetBookDetailsCallback.class);
// Given 2 new favorited books and 1 active book in the persistent repository
final BookListItem newBook1 = new BookListItem(TITLE, "");
mLocalDataSource.saveBook(newBook1);
mLocalDataSource.completeBook(newBook1);
final BookListItem newBook2 = new BookListItem(TITLE2, "");
mLocalDataSource.saveBook(newBook2);
mLocalDataSource.completeBook(newBook2);
final BookListItem newBook3 = new BookListItem(TITLE3, "");
mLocalDataSource.saveBook(newBook3);
// When favorited books are cleared in the repository
mLocalDataSource.clearCompletedBooks();
// Then the favorited books cannot be retrieved and the active one can
mLocalDataSource.getBookDetails(newBook1.getId(), callback1);
verify(callback1).onDataNotAvailable();
verify(callback1, never()).onBookDetailsLoaded(newBook1);
mLocalDataSource.getBookDetails(newBook2.getId(), callback2);
verify(callback2).onDataNotAvailable();
verify(callback2, never()).onBookDetailsLoaded(newBook2);
mLocalDataSource.getBookDetails(newBook3.getId(), callback3);
verify(callback3, never()).onDataNotAvailable();
verify(callback3).onBookDetailsLoaded(newBook3);
}
@Test
public void deleteAllBooks_emptyListOfRetrievedBook() {
// Given a new book in the persistent repository and a mocked callback
BookListItem newBook = new BookListItem(TITLE, "");
mLocalDataSource.saveBook(newBook);
BooksDataSource.LoadBooksListCallback callback = mock(BooksDataSource.LoadBooksListCallback.class);
// When all books are deleted
mLocalDataSource.deleteAllBooks();
// Then the retrieved books is an empty list
mLocalDataSource.getBooks(callback);
verify(callback).onDataNotAvailable();
verify(callback, never()).onBooksListLoaded(anyList());
}
@Test
public void getBooks_retrieveSavedBooks() {
// Given 2 new books in the persistent repository
final BookListItem newBook1 = new BookListItem(TITLE, "");
mLocalDataSource.saveBook(newBook1);
final BookListItem newBook2 = new BookListItem(TITLE, "");
mLocalDataSource.saveBook(newBook2);
// Then the books can be retrieved from the persistent repository
mLocalDataSource.getBooks(new BooksDataSource.LoadBooksListCallback() {
@Override
public void onBooksListLoaded(List<BookListItem> books) {
assertNotNull(books);
assertTrue(books.size() >= 2);
boolean newBook1IdFound = false;
boolean newBook2IdFound = false;
for (BookListItem book : books) {
if (book.getId().equals(newBook1.getId())) {
newBook1IdFound = true;
}
if (book.getId().equals(newBook2.getId())) {
newBook2IdFound = true;
}
}
assertTrue(newBook1IdFound);
assertTrue(newBook2IdFound);
}
@Override
public void onDataNotAvailable() {
fail();
}
});
}
}
| UTF-8 | Java | 8,546 | java | BooksLocalDataSourceTest.java | Java | [] | null | [] |
package com.zeelo.android.architecture.assignment.booksapp.data.source.local;
import android.arch.persistence.room.Room;
import android.support.test.InstrumentationRegistry;
import android.support.test.filters.LargeTest;
import android.support.test.runner.AndroidJUnit4;
import com.zeelo.android.architecture.assignment.booksapp.data.BookListItem;
import com.zeelo.android.architecture.assignment.booksapp.data.source.BooksDataSource;
import com.zeelo.android.architecture.assignment.booksapp.util.SingleExecutors;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.List;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.anyList;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
/**
* Integration test for the {@link BooksDataSource}.
*/
@RunWith(AndroidJUnit4.class)
@LargeTest
public class BooksLocalDataSourceTest {
private final static String TITLE = "title";
private final static String TITLE2 = "title2";
private final static String TITLE3 = "title3";
private BooksLocalDataSource mLocalDataSource;
private BooksDatabase mDatabase;
@Before
public void setup() {
// using an in-memory database for testing, since it doesn't survive killing the process
mDatabase = Room.inMemoryDatabaseBuilder(InstrumentationRegistry.getContext(),
BooksDatabase.class)
.build();
BooksDao booksDao = mDatabase.bookDao();
// Make sure that we're not keeping a reference to the wrong instance.
BooksLocalDataSource.clearInstance();
mLocalDataSource = BooksLocalDataSource.getInstance(new SingleExecutors(), booksDao);
}
@After
public void cleanUp() {
mDatabase.close();
BooksLocalDataSource.clearInstance();
}
@Test
public void testPreConditions() {
assertNotNull(mLocalDataSource);
}
@Test
public void saveBook_retrievesBook() {
// Given a new book
final BookListItem newBook = new BookListItem(TITLE, "");
// When saved into the persistent repository
mLocalDataSource.saveBook(newBook);
// Then the book can be retrieved from the persistent repository
mLocalDataSource.getBookDetails(newBook.getId(), new BooksDataSource.GetBookDetailsCallback() {
@Override
public void onBookDetailsLoaded(BookListItem book) {
assertThat(book, is(newBook));
}
@Override
public void onDataNotAvailable() {
fail("Callback error");
}
});
}
@Test
public void completeBook_retrievedBookIsComplete() {
// Initialize mock for the callback.
BooksDataSource.GetBookDetailsCallback callback = mock(BooksDataSource.GetBookDetailsCallback.class);
// Given a new book in the persistent repository
final BookListItem newBook = new BookListItem(TITLE, "");
mLocalDataSource.saveBook(newBook);
// When favorited in the persistent repository
mLocalDataSource.completeBook(newBook);
// Then the book can be retrieved from the persistent repository and is complete
mLocalDataSource.getBookDetails(newBook.getId(), new BooksDataSource.GetBookDetailsCallback() {
@Override
public void onBookDetailsLoaded(BookListItem book) {
assertThat(book, is(newBook));
assertThat(book.isCompleted(), is(true));
}
@Override
public void onDataNotAvailable() {
fail("Callback error");
}
});
}
@Test
public void activateBook_retrievedBookIsActive() {
// Initialize mock for the callback.
BooksDataSource.GetBookDetailsCallback callback = mock(BooksDataSource.GetBookDetailsCallback.class);
// Given a new favorited book in the persistent repository
final BookListItem newBook = new BookListItem(TITLE, "");
mLocalDataSource.saveBook(newBook);
mLocalDataSource.completeBook(newBook);
// When activated in the persistent repository
mLocalDataSource.activateBook(newBook);
// Then the book can be retrieved from the persistent repository and is active
mLocalDataSource.getBookDetails(newBook.getId(), callback);
verify(callback, never()).onDataNotAvailable();
verify(callback).onBookDetailsLoaded(newBook);
assertThat(newBook.isCompleted(), is(false));
}
@Test
public void clearCompletedBook_bookNotRetrievable() {
// Initialize mocks for the callbacks.
BooksDataSource.GetBookDetailsCallback callback1 = mock(BooksDataSource.GetBookDetailsCallback.class);
BooksDataSource.GetBookDetailsCallback callback2 = mock(BooksDataSource.GetBookDetailsCallback.class);
BooksDataSource.GetBookDetailsCallback callback3 = mock(BooksDataSource.GetBookDetailsCallback.class);
// Given 2 new favorited books and 1 active book in the persistent repository
final BookListItem newBook1 = new BookListItem(TITLE, "");
mLocalDataSource.saveBook(newBook1);
mLocalDataSource.completeBook(newBook1);
final BookListItem newBook2 = new BookListItem(TITLE2, "");
mLocalDataSource.saveBook(newBook2);
mLocalDataSource.completeBook(newBook2);
final BookListItem newBook3 = new BookListItem(TITLE3, "");
mLocalDataSource.saveBook(newBook3);
// When favorited books are cleared in the repository
mLocalDataSource.clearCompletedBooks();
// Then the favorited books cannot be retrieved and the active one can
mLocalDataSource.getBookDetails(newBook1.getId(), callback1);
verify(callback1).onDataNotAvailable();
verify(callback1, never()).onBookDetailsLoaded(newBook1);
mLocalDataSource.getBookDetails(newBook2.getId(), callback2);
verify(callback2).onDataNotAvailable();
verify(callback2, never()).onBookDetailsLoaded(newBook2);
mLocalDataSource.getBookDetails(newBook3.getId(), callback3);
verify(callback3, never()).onDataNotAvailable();
verify(callback3).onBookDetailsLoaded(newBook3);
}
@Test
public void deleteAllBooks_emptyListOfRetrievedBook() {
// Given a new book in the persistent repository and a mocked callback
BookListItem newBook = new BookListItem(TITLE, "");
mLocalDataSource.saveBook(newBook);
BooksDataSource.LoadBooksListCallback callback = mock(BooksDataSource.LoadBooksListCallback.class);
// When all books are deleted
mLocalDataSource.deleteAllBooks();
// Then the retrieved books is an empty list
mLocalDataSource.getBooks(callback);
verify(callback).onDataNotAvailable();
verify(callback, never()).onBooksListLoaded(anyList());
}
@Test
public void getBooks_retrieveSavedBooks() {
// Given 2 new books in the persistent repository
final BookListItem newBook1 = new BookListItem(TITLE, "");
mLocalDataSource.saveBook(newBook1);
final BookListItem newBook2 = new BookListItem(TITLE, "");
mLocalDataSource.saveBook(newBook2);
// Then the books can be retrieved from the persistent repository
mLocalDataSource.getBooks(new BooksDataSource.LoadBooksListCallback() {
@Override
public void onBooksListLoaded(List<BookListItem> books) {
assertNotNull(books);
assertTrue(books.size() >= 2);
boolean newBook1IdFound = false;
boolean newBook2IdFound = false;
for (BookListItem book : books) {
if (book.getId().equals(newBook1.getId())) {
newBook1IdFound = true;
}
if (book.getId().equals(newBook2.getId())) {
newBook2IdFound = true;
}
}
assertTrue(newBook1IdFound);
assertTrue(newBook2IdFound);
}
@Override
public void onDataNotAvailable() {
fail();
}
});
}
}
| 8,546 | 0.675872 | 0.670021 | 229 | 36.314411 | 29.146921 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.545852 | false | false | 11 |
72a7c0449d077907aa4556281332f550984954ca | 27,333,171,892,635 | 78f7a23e4d5d517aa492418b91b2f544242fd4fb | /ZamongProject-FrontEnd/src/controller/database/DatabaseController.java | a8e9ee2971f28bcb6869896125404fe88163adc8 | [] | no_license | baedockhoon/zamong_frontend_final | https://github.com/baedockhoon/zamong_frontend_final | 8480a24e29d94e227e9b126dbb0fb575ee6cb417 | 268e2940ea24f9b4c52c60265c7bd9d701d8514b | refs/heads/master | 2021-07-12T09:43:11.051000 | 2017-10-13T05:02:37 | 2017-10-13T05:02:37 | 106,777,949 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package controller.database;
import java.sql.Connection;
import java.util.Map;
import javax.annotation.Resource;
import javax.sql.DataSource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
//컨트롤러 클래스]
@Controller
public class DatabaseController {
@Resource(name="datasourceByJDBC")
//데이타 소스를 자동으로 주입 받기 위한(와이어링) 멤버변수(속성) 선언]
private DataSource datasourceByJDBC;
@Resource(name="datasourceByJNDI")
private DataSource datasourceByJNDI;
//컨트롤러 메소드]
@RequestMapping("/Database/JDBCConnection.do")
public String jdbc(@RequestParam String method,Map map) throws Exception{
//주입받은 DataSource객체로 Connection객체 얻기]
Connection conn= datasourceByJDBC.getConnection();
//데이타 저장]
map.put("message",conn==null? "[데이타베이스 연결 실패]" : "[데이타베이스 연결 성공:"+method+"]");
//커넥션 객체 메모리 해제
if(conn !=null) conn.close();
//뷰정보 반환]
return "/connectionpool_Test/Database.jsp";
}///////////////////jdbc
@RequestMapping("/Database/JNDIConnection.do")
public String jndi(@RequestParam String method,Map map) throws Exception{
//주입받은 DataSource객체로 Connection객체 얻기]
Connection conn= datasourceByJNDI.getConnection();
//데이타 저장]
map.put("message",conn==null? "[데이타베이스 연결 실패]" : "[데이타베이스 연결 성공:"+method+"]");
//커넥션 객체 메모리 해제
if(conn !=null) conn.close();
//뷰정보 반환]
return "/connectionpool_Test/Database.jsp";
}///////////////////jdbc
}
| UTF-8 | Java | 1,836 | java | DatabaseController.java | Java | [] | null | [] | package controller.database;
import java.sql.Connection;
import java.util.Map;
import javax.annotation.Resource;
import javax.sql.DataSource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
//컨트롤러 클래스]
@Controller
public class DatabaseController {
@Resource(name="datasourceByJDBC")
//데이타 소스를 자동으로 주입 받기 위한(와이어링) 멤버변수(속성) 선언]
private DataSource datasourceByJDBC;
@Resource(name="datasourceByJNDI")
private DataSource datasourceByJNDI;
//컨트롤러 메소드]
@RequestMapping("/Database/JDBCConnection.do")
public String jdbc(@RequestParam String method,Map map) throws Exception{
//주입받은 DataSource객체로 Connection객체 얻기]
Connection conn= datasourceByJDBC.getConnection();
//데이타 저장]
map.put("message",conn==null? "[데이타베이스 연결 실패]" : "[데이타베이스 연결 성공:"+method+"]");
//커넥션 객체 메모리 해제
if(conn !=null) conn.close();
//뷰정보 반환]
return "/connectionpool_Test/Database.jsp";
}///////////////////jdbc
@RequestMapping("/Database/JNDIConnection.do")
public String jndi(@RequestParam String method,Map map) throws Exception{
//주입받은 DataSource객체로 Connection객체 얻기]
Connection conn= datasourceByJNDI.getConnection();
//데이타 저장]
map.put("message",conn==null? "[데이타베이스 연결 실패]" : "[데이타베이스 연결 성공:"+method+"]");
//커넥션 객체 메모리 해제
if(conn !=null) conn.close();
//뷰정보 반환]
return "/connectionpool_Test/Database.jsp";
}///////////////////jdbc
}
| 1,836 | 0.690568 | 0.690568 | 53 | 27.207546 | 22.965403 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.528302 | false | false | 11 |
f69a6e97c3de16ca91e25b5743c7e3fbcf7635ab | 27,333,171,895,016 | 8aadade537d40afbbf229b3023aa2be7c2a6aa9f | /src/test/java/tests/particular/LookingForBrokenLoginCase.java | a62f4c06a424e5672bd132c7b9b1b59c57ed5671 | [] | no_license | sergey1git1hub/gbwebphone-automation-admin | https://github.com/sergey1git1hub/gbwebphone-automation-admin | 0d3e305edeb2148af77b259cce9a2ca68a8c4346 | de120fa523091f272390e8e0ab95d1a2870a09bb | refs/heads/master | 2021-08-28T05:33:30.411000 | 2017-12-11T09:31:22 | 2017-12-11T09:31:22 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package tests.particular;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import utils.ConfigurationsExtentReport;
import utils.ConfigurationsSelenide;
import utils.UserData;
import webpages.admin_mode.navigation.Navigation;
import webpages.agent_mode.Controls;
import webpages.agent_mode.Status;
import webpages.login.LoginPage;
import webpages.select_user_or_admin.SelectModePage;
import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Condition.visible;
import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.WebDriverRunner.getWebDriver;
import static utils.ConfigurationsSelenide.closeDriver;
import static utils.ConfigurationsSelenide.openURL;
public class LookingForBrokenLoginCase {
private LoginPage loginPage = new LoginPage();
private UserData userData = new UserData();
private SelectModePage selectModePage = new SelectModePage();
private Navigation navigation = new Navigation();
private Controls controls = new Controls();
private Status status = new Status();
@BeforeClass
public void set() {
ConfigurationsSelenide.setConfiguration();
ConfigurationsExtentReport.startExtentReporting();
}
@BeforeMethod
public void openBrowser() {
openURL();
}
@AfterClass
public void exit() {
closeDriver();
}
@Test(description = "This TC#00001 uses loop (100 times) login for admin to verify there is no broken page (according to the issue #5154).")
public void testLoopLoginAsAdmin() {
for (int i = 1; i < 100; i++) {
loginPage.getPassword().waitUntil(visible, 10000);
loginPage.getUsername().shouldBe(visible);
loginPage.setUserData(userData.getUsernameAdminValid(), userData.getPasswordAdminValid());
loginPage.getConnect().shouldBe(visible).click();
selectModePage.getAdministratorPanelButton().shouldBe(visible).click();
navigation.getLogout().shouldBe(visible).hover().click();
navigation.getLogout().shouldBe(visible).hover().click();
}
}
//Agent must have AgentDesktopTab in chosen group!
@Test(description = "This TC#00005 uses loop (100 times) login for agent to verify there is no broken stage in the AgentDesktop Tab (according to the issue #5187).",
enabled = false)
public void testLoopLoginAsAgentAndSwitchToAgentDesktopTab() {
for (int i = 1; i < 100; i++) {
loginPage.getPassword().waitUntil(visible, 10000);
loginPage.getUsername().shouldBe(visible);
loginPage.setUserData(userData.getUsernameAgentValid(), userData.getPasswordAgentValid());
loginPage.getConnect().shouldBe(visible).click();
selectModePage.getContinueButton().shouldBe(visible).click();
getWebDriver().switchTo().frame($("#TAB_123")); //globalButtonName of AD_Tab, given by Admin in WP.
$("#main>h1").waitUntil(visible, 10000).shouldHave(text("Welcome!"));
getWebDriver().switchTo().defaultContent();
status.getCallStatus().waitUntil(text("Registered"), 30000); //Should be used in brilliant case.
controls.clickPower();
loginPage.getConnect().shouldBe(visible);
}
}
} | UTF-8 | Java | 3,430 | java | LookingForBrokenLoginCase.java | Java | [] | null | [] | package tests.particular;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import utils.ConfigurationsExtentReport;
import utils.ConfigurationsSelenide;
import utils.UserData;
import webpages.admin_mode.navigation.Navigation;
import webpages.agent_mode.Controls;
import webpages.agent_mode.Status;
import webpages.login.LoginPage;
import webpages.select_user_or_admin.SelectModePage;
import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Condition.visible;
import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.WebDriverRunner.getWebDriver;
import static utils.ConfigurationsSelenide.closeDriver;
import static utils.ConfigurationsSelenide.openURL;
public class LookingForBrokenLoginCase {
private LoginPage loginPage = new LoginPage();
private UserData userData = new UserData();
private SelectModePage selectModePage = new SelectModePage();
private Navigation navigation = new Navigation();
private Controls controls = new Controls();
private Status status = new Status();
@BeforeClass
public void set() {
ConfigurationsSelenide.setConfiguration();
ConfigurationsExtentReport.startExtentReporting();
}
@BeforeMethod
public void openBrowser() {
openURL();
}
@AfterClass
public void exit() {
closeDriver();
}
@Test(description = "This TC#00001 uses loop (100 times) login for admin to verify there is no broken page (according to the issue #5154).")
public void testLoopLoginAsAdmin() {
for (int i = 1; i < 100; i++) {
loginPage.getPassword().waitUntil(visible, 10000);
loginPage.getUsername().shouldBe(visible);
loginPage.setUserData(userData.getUsernameAdminValid(), userData.getPasswordAdminValid());
loginPage.getConnect().shouldBe(visible).click();
selectModePage.getAdministratorPanelButton().shouldBe(visible).click();
navigation.getLogout().shouldBe(visible).hover().click();
navigation.getLogout().shouldBe(visible).hover().click();
}
}
//Agent must have AgentDesktopTab in chosen group!
@Test(description = "This TC#00005 uses loop (100 times) login for agent to verify there is no broken stage in the AgentDesktop Tab (according to the issue #5187).",
enabled = false)
public void testLoopLoginAsAgentAndSwitchToAgentDesktopTab() {
for (int i = 1; i < 100; i++) {
loginPage.getPassword().waitUntil(visible, 10000);
loginPage.getUsername().shouldBe(visible);
loginPage.setUserData(userData.getUsernameAgentValid(), userData.getPasswordAgentValid());
loginPage.getConnect().shouldBe(visible).click();
selectModePage.getContinueButton().shouldBe(visible).click();
getWebDriver().switchTo().frame($("#TAB_123")); //globalButtonName of AD_Tab, given by Admin in WP.
$("#main>h1").waitUntil(visible, 10000).shouldHave(text("Welcome!"));
getWebDriver().switchTo().defaultContent();
status.getCallStatus().waitUntil(text("Registered"), 30000); //Should be used in brilliant case.
controls.clickPower();
loginPage.getConnect().shouldBe(visible);
}
}
} | 3,430 | 0.705539 | 0.689213 | 81 | 41.358025 | 33.16264 | 169 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.728395 | false | false | 11 |
17ab1216ab456261332a2cfec870c9f50d8aaf88 | 24,163,486,046,179 | 03edba2d9dc32c4701f19925b345e577e58b9f4c | /core/src/main/java/com/leo/core/iapi/main/IHasControllerApi.java | 40d005250c862b1a659775656ebfb1c4fdc2d191 | [] | no_license | liushunxin4613/full | https://github.com/liushunxin4613/full | 0a8495985be09685c27eae57c65ff1e1c16a28f6 | f8f542944e71628d9f4b42cd5e54b48932f363e9 | refs/heads/master | 2021-06-02T14:07:59.313000 | 2019-12-04T16:18:41 | 2019-12-04T16:18:41 | 133,017,218 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.leo.core.iapi.main;
import com.leo.core.iapi.core.IApi;
public interface IHasControllerApi<T extends IHasControllerApi> extends IApi {
IControllerApi controllerApi();
}
| UTF-8 | Java | 189 | java | IHasControllerApi.java | Java | [] | null | [] | package com.leo.core.iapi.main;
import com.leo.core.iapi.core.IApi;
public interface IHasControllerApi<T extends IHasControllerApi> extends IApi {
IControllerApi controllerApi();
}
| 189 | 0.783069 | 0.783069 | 9 | 20 | 25.595139 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false | 11 |
1be6086cf749ed2139d5eb91d191eeb4b5095e16 | 3,796,751,131,481 | 320ba3283bdbcc664b1c1eabc6dc21318449d2f9 | /src/main/java/com/opera/survway/exception/RewardException.java | f7b5b9b3d7215d5e653a3e1d9466582e69ab22aa | [] | no_license | gurwns1540/Opera | https://github.com/gurwns1540/Opera | ec251a671fdc9e43216eb081876bca8be6c95429 | 4c53e890f52a9249112c9a6e74bf424371769b12 | refs/heads/master | 2021-12-16T11:01:41.568000 | 2021-09-18T12:19:30 | 2021-09-18T12:19:30 | 234,023,802 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.opera.survway.exception;
public class RewardException extends Exception{
public RewardException(String msg) {
super(msg);
}
}
| UTF-8 | Java | 150 | java | RewardException.java | Java | [] | null | [] | package com.opera.survway.exception;
public class RewardException extends Exception{
public RewardException(String msg) {
super(msg);
}
}
| 150 | 0.74 | 0.74 | 7 | 19.428572 | 18.538433 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.857143 | false | false | 11 |
088e5ba2a1774621c0be270e9827558818f3c7f0 | 33,732,673,165,667 | d2301e7ba65fa4ebf9401132f58d73ea8114faf3 | /SpagoBIUtils/src/main/java/it/eng/spagobi/services/validation/GenericValidator.java | b37376c5808ed0ab0bd185df4c3e3f1fdfd4f5b0 | [] | no_license | ghlingjun/SpagoBI | https://github.com/ghlingjun/SpagoBI | 43dd8ae678d03eb6572d9589f137c7af3d8e14b4 | 765ab836907102af62e283e245da3c6b99cd64d0 | refs/heads/master | 2021-01-18T02:01:21.186000 | 2016-07-14T08:19:14 | 2016-07-14T08:19:14 | 63,924,477 | 1 | 0 | null | true | 2016-07-22T04:51:43 | 2016-07-22T04:51:43 | 2016-07-22T04:51:34 | 2016-07-14T08:19:48 | 1,786,462 | 0 | 0 | 0 | null | null | null | package it.eng.spagobi.services.validation;
import java.lang.annotation.Annotation;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
/* Used to validate fields and methods annotated with annotation that .. TODO scrivere bene... */
public class GenericValidator implements ConstraintValidator<Annotation, String> {
public void initialize(Annotation arg0) {
}
public boolean isValid(String arg0, ConstraintValidatorContext arg1) {
return true;
}
}
| UTF-8 | Java | 522 | java | GenericValidator.java | Java | [] | null | [] | package it.eng.spagobi.services.validation;
import java.lang.annotation.Annotation;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
/* Used to validate fields and methods annotated with annotation that .. TODO scrivere bene... */
public class GenericValidator implements ConstraintValidator<Annotation, String> {
public void initialize(Annotation arg0) {
}
public boolean isValid(String arg0, ConstraintValidatorContext arg1) {
return true;
}
}
| 522 | 0.779693 | 0.773946 | 17 | 28.705883 | 31.661379 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.764706 | false | false | 11 |
2de4deaa697c28007c5eeb0886c37feb230080aa | 15,118,284,901,140 | c9a8d0282b9c68532299f9667a3aed7e25a07704 | /src/project07/Node.java | 4fd13092ab2a976d4a76c66c83b27232bbfc15d8 | [] | no_license | loriswit/oop18 | https://github.com/loriswit/oop18 | 64aaa6e5111e9b3792fae127254995e43cc3ef33 | ee88ff5d9453b04fc328fc79f8ac28bddf33709b | refs/heads/master | 2020-03-14T06:59:35.744000 | 2018-05-23T00:53:36 | 2018-05-23T00:53:59 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package project07;
public class Node<T> {
Node<T> previous;
Node<T> next;
T content;
public Node(T content) {
this.content = content;
}
}
| UTF-8 | Java | 168 | java | Node.java | Java | [] | null | [] | package project07;
public class Node<T> {
Node<T> previous;
Node<T> next;
T content;
public Node(T content) {
this.content = content;
}
}
| 168 | 0.583333 | 0.571429 | 11 | 14.272727 | 10.720337 | 31 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.454545 | false | false | 11 |
93eb2a0fd53e830bbdca46d6abb02150fe4c60d0 | 12,171,937,348,054 | 10e6e21549663395c4cf59fffa4c0d901a109cf9 | /Assignment 5/src/StudentArrayAdvanced.java | 8398bb3af6fc35a193191ce0cfa3fe435fcc09ff | [] | no_license | jnartey/Assignment-5 | https://github.com/jnartey/Assignment-5 | 801e4a4dd21573c5178c79e56f369eed90f64111 | 93fe8f2b07514517d001c1e1a28396f6dee3865a | refs/heads/master | 2020-03-08T00:38:51.166000 | 2018-04-03T05:36:15 | 2018-04-03T05:36:15 | 127,810,656 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* @author Jacob Nartey
* 3.Student Advanced
*
*/
public class StudentArrayAdvanced {
public static void main(String[] args) {
//Instantiating class InputOutput
InputOutput inputOutput = new InputOutput();
int numStudents = inputOutput.inputInt("Input the number of students you would like to enter");
//Creating an array of student class of size numStudents
Student[] studentArray = new Student[numStudents];
//Take input and print students and GPA Average
inputOutput.prStrArrStudentsGpaAvg(inputOutput.inputStudentArray(studentArray));
}
}
| UTF-8 | Java | 578 | java | StudentArrayAdvanced.java | Java | [
{
"context": "/**\n * @author Jacob Nartey\n * 3.Student Advanced\n *\n */\n\npublic class Studen",
"end": 27,
"score": 0.9998811483383179,
"start": 15,
"tag": "NAME",
"value": "Jacob Nartey"
}
] | null | [] | /**
* @author <NAME>
* 3.Student Advanced
*
*/
public class StudentArrayAdvanced {
public static void main(String[] args) {
//Instantiating class InputOutput
InputOutput inputOutput = new InputOutput();
int numStudents = inputOutput.inputInt("Input the number of students you would like to enter");
//Creating an array of student class of size numStudents
Student[] studentArray = new Student[numStudents];
//Take input and print students and GPA Average
inputOutput.prStrArrStudentsGpaAvg(inputOutput.inputStudentArray(studentArray));
}
}
| 572 | 0.747405 | 0.745675 | 21 | 26.523809 | 28.523373 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.285714 | false | false | 11 |
669acff98f7cd11043f080d94468f2e7a95329a0 | 12,171,937,347,246 | fd1407557b12dc808a69808bf09cf1ed838caf30 | /e.demo01.a/src/main/java/com/letuo/demo/test/TestForEmail.java | 3d820ba0a943f0712d6f508d074fe72bfe3a1b28 | [] | no_license | helloTuoTuo/zoo | https://github.com/helloTuoTuo/zoo | 114339c6ef7f55c575fbb6a65f43eb32f011aae9 | 491e3c5393586b3e4124f09d8e8b999d6e559547 | refs/heads/master | 2018-09-10T21:06:19.160000 | 2018-07-28T02:29:29 | 2018-07-28T02:29:29 | 134,141,944 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.letuo.demo.test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
public class TestForEmail {
public static void main(String[] args) {
// TODO Auto-generated method stub
ApplicationContext context = new ClassPathXmlApplicationContext("xmls/testforEmail.xml");
JavaMailSender mailSender = (JavaMailSender) context.getBean("mailSender");
SimpleMailMessage templateMessage = (SimpleMailMessage) context.getBean("templateMessage");
SimpleMailMessage msg = new SimpleMailMessage(templateMessage);
msg.setTo("18661205847@163.com");
msg.setText("hello world!!!!!!");
mailSender.send(msg);
}
}
| UTF-8 | Java | 831 | java | TestForEmail.java | Java | [
{
"context": "SimpleMailMessage(templateMessage);\n\t\t msg.setTo(\"18661205847@163.com\");\n\t\t msg.setText(\"hello world!!!!!!\");\n\t\t \n\t\t ma",
"end": 754,
"score": 0.9919707179069519,
"start": 735,
"tag": "EMAIL",
"value": "18661205847@163.com"
}
] | null | [] | package com.letuo.demo.test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
public class TestForEmail {
public static void main(String[] args) {
// TODO Auto-generated method stub
ApplicationContext context = new ClassPathXmlApplicationContext("xmls/testforEmail.xml");
JavaMailSender mailSender = (JavaMailSender) context.getBean("mailSender");
SimpleMailMessage templateMessage = (SimpleMailMessage) context.getBean("templateMessage");
SimpleMailMessage msg = new SimpleMailMessage(templateMessage);
msg.setTo("<EMAIL>");
msg.setText("hello world!!!!!!");
mailSender.send(msg);
}
}
| 819 | 0.780987 | 0.76414 | 27 | 29.777779 | 30.516945 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.481481 | false | false | 11 |
c7ad8074b3f9e7de2539eaffa7f2b743241b74bd | 2,808,908,632,131 | 63a81d7351ab23395de2eabf8e3bef2d13ec19b6 | /Programming/src/message/drawconfirm/DrawConfirmClientMessage.java | 159ea8b93f66e27d28d1ce81e4956d3725a50dec | [] | no_license | ntmchau2202/Network-Programming-20202 | https://github.com/ntmchau2202/Network-Programming-20202 | 34466ea037b5b7ac2a99a2bf2084131bd375bd2c | 14939642b421b77e8d9efd4519cbb54958d1c019 | refs/heads/master | 2023-06-04T10:56:23.331000 | 2021-06-29T03:17:06 | 2021-06-29T03:17:06 | 353,409,716 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package message.drawconfirm;
import message.ClientMessage;
import protocol.Command;
public class DrawConfirmClientMessage extends ClientMessage {
private int matchID;
private String confirmPlayer, sessionID;
private boolean acceptance;
public DrawConfirmClientMessage(int matchID, String confirmPlayer, String sessionID, boolean acceptance) {
super();
this.matchID = matchID;
this.confirmPlayer = confirmPlayer;
this.sessionID = sessionID;
this.acceptance = acceptance;
this.setCommand(Command.DRAW_CONFIRM);
this.requestBody.createDrawConfirmBody(matchID, sessionID, confirmPlayer, acceptance);
this.finalizeMessageObject();
}
public DrawConfirmClientMessage(String inputMessage) {
super(inputMessage);
this.matchID = this.requestBody.getBody().getInt("match_id");
this.confirmPlayer = this.requestBody.getBody().getString("move_player");
this.sessionID = this.requestBody.getBody().getString("session_id");
this.acceptance = this.requestBody.getBody().getBoolean("acceptance");
}
public int getMatchID() {
return this.matchID;
}
public String getSessionID() {
return this.sessionID;
}
public String getConfirmPlayer() {
return this.confirmPlayer;
}
public boolean getAcceptance() {
return this.acceptance;
}
}
| UTF-8 | Java | 1,284 | java | DrawConfirmClientMessage.java | Java | [] | null | [] | package message.drawconfirm;
import message.ClientMessage;
import protocol.Command;
public class DrawConfirmClientMessage extends ClientMessage {
private int matchID;
private String confirmPlayer, sessionID;
private boolean acceptance;
public DrawConfirmClientMessage(int matchID, String confirmPlayer, String sessionID, boolean acceptance) {
super();
this.matchID = matchID;
this.confirmPlayer = confirmPlayer;
this.sessionID = sessionID;
this.acceptance = acceptance;
this.setCommand(Command.DRAW_CONFIRM);
this.requestBody.createDrawConfirmBody(matchID, sessionID, confirmPlayer, acceptance);
this.finalizeMessageObject();
}
public DrawConfirmClientMessage(String inputMessage) {
super(inputMessage);
this.matchID = this.requestBody.getBody().getInt("match_id");
this.confirmPlayer = this.requestBody.getBody().getString("move_player");
this.sessionID = this.requestBody.getBody().getString("session_id");
this.acceptance = this.requestBody.getBody().getBoolean("acceptance");
}
public int getMatchID() {
return this.matchID;
}
public String getSessionID() {
return this.sessionID;
}
public String getConfirmPlayer() {
return this.confirmPlayer;
}
public boolean getAcceptance() {
return this.acceptance;
}
}
| 1,284 | 0.762461 | 0.762461 | 48 | 25.75 | 25.942644 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.895833 | false | false | 11 |
997c97dd333bb2f8e318873371b14f60feea10a0 | 1,864,015,829,210 | cb4ac8f98a7d6dfbdd3f4159c2822e5c46c3d14d | /serversvn/shophomecloud/shophomecloud-service-common/src/main/java/com/sitrigroup/shophomecloud/service/common/repository/AliPushRepository.java | 61a1e1d920e712f8c3e3497a1117c033611871be | [] | no_license | pslwapgit/backend | https://github.com/pslwapgit/backend | 61ac56eb9ea0ad0c620b4e30c12c0f4b9b6c4f9c | 8107a1519b795fe38b2ff700577c035aac15d41d | refs/heads/master | 2018-09-18T15:53:16.019000 | 2018-06-06T02:22:48 | 2018-06-06T02:22:48 | 136,149,408 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sitrigroup.shophomecloud.service.common.repository;
import java.util.List;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import com.sitrigroup.shophomecloud.facade.common.entity.AliPush;
import com.sitrigroup.shophomecloud.facade.common.entity.BaiduPush;
import com.sitrigroup.shophomecloud.facade.common.entity.User;
import com.sitrigroup.shophomecloud.facade.common.entity.UserGroupRole;
@Repository
public interface AliPushRepository extends CrudRepository<AliPush, Long> {
//根据用户获取绑定信息
List<AliPush> findByUser(User user);
//根据设备ID查询信息
AliPush findByDeviceId(String deviceId);
//APP端解绑推送操作
void delete(AliPush bp);
}
| UTF-8 | Java | 766 | java | AliPushRepository.java | Java | [] | null | [] | package com.sitrigroup.shophomecloud.service.common.repository;
import java.util.List;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import com.sitrigroup.shophomecloud.facade.common.entity.AliPush;
import com.sitrigroup.shophomecloud.facade.common.entity.BaiduPush;
import com.sitrigroup.shophomecloud.facade.common.entity.User;
import com.sitrigroup.shophomecloud.facade.common.entity.UserGroupRole;
@Repository
public interface AliPushRepository extends CrudRepository<AliPush, Long> {
//根据用户获取绑定信息
List<AliPush> findByUser(User user);
//根据设备ID查询信息
AliPush findByDeviceId(String deviceId);
//APP端解绑推送操作
void delete(AliPush bp);
}
| 766 | 0.824022 | 0.824022 | 25 | 27.639999 | 27.214525 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.8 | false | false | 11 |
147d24dc997195c57edc76fe132befc8487ce6ad | 33,517,924,794,249 | 464443c69e4b44fb7eb30598b6afb73f0257d770 | /src/main/java/app/DBConnectionCheckApplication.java | 3ab931bba233cdbc204b091836e9b5a05fcc40d2 | [] | no_license | ewisuru/demo-hibernate-basics | https://github.com/ewisuru/demo-hibernate-basics | f7b418218b992a87808ed6669cb8fdc4e31fa82a | 39d397582d62d3a0b30dd8fd00d2e2a6986963cc | refs/heads/master | 2022-02-18T07:15:20.394000 | 2019-08-03T00:38:57 | 2019-08-03T00:38:57 | 200,313,339 | 0 | 0 | null | false | 2022-02-10T01:07:00 | 2019-08-03T00:29:17 | 2019-08-03T00:39:24 | 2022-02-10T01:06:59 | 4 | 0 | 0 | 2 | Java | false | false | package app;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class DBConnectionCheckApplication {
private static final String DB_DRIVER = "org.h2.driver";
private static final String CONNECTION_URL ="jdbc:h2:mem:test;DB_CLOSE_DELAY=-1";
public static final String CREATE_TABLE_USER = "CREATE TABLE USER(Id int primary key, name varchar(255))";
public static void main(String[] args) throws SQLException {
Connection connection = getConnection();
Statement statement = connection.createStatement();
statement.execute(CREATE_TABLE_USER);
connection.close();
}
public static Connection getConnection() throws SQLException {
return DriverManager.getConnection(CONNECTION_URL);
}
}
| UTF-8 | Java | 826 | java | DBConnectionCheckApplication.java | Java | [] | null | [] | package app;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class DBConnectionCheckApplication {
private static final String DB_DRIVER = "org.h2.driver";
private static final String CONNECTION_URL ="jdbc:h2:mem:test;DB_CLOSE_DELAY=-1";
public static final String CREATE_TABLE_USER = "CREATE TABLE USER(Id int primary key, name varchar(255))";
public static void main(String[] args) throws SQLException {
Connection connection = getConnection();
Statement statement = connection.createStatement();
statement.execute(CREATE_TABLE_USER);
connection.close();
}
public static Connection getConnection() throws SQLException {
return DriverManager.getConnection(CONNECTION_URL);
}
}
| 826 | 0.727603 | 0.720339 | 25 | 32.040001 | 30.280661 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false | 11 |
f59ff5695fd7ea0a221cfc214bc5b0437677e065 | 33,517,924,798,399 | 3e08f1541e1f81054b1230ac33def977fef60d6f | /src/test/java/io/fourfinanceit/services/riskconstraints/ipaddress/IPAddressRiskValidatorTest.java | f49f1b198650fffe08b9602f304d28df2cf01789 | [] | no_license | olegssedacs/homework-lv | https://github.com/olegssedacs/homework-lv | da9a1ce83f21208a654592b8a13b11c98ad03188 | d1edfc657983cf53aa67431c5733f6c7b09020f0 | refs/heads/master | 2018-01-10T15:08:27.301000 | 2016-03-04T18:43:35 | 2016-03-04T18:43:35 | 52,219,611 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* homework for 4finance by Oleg Sedach
*/
package io.fourfinanceit.services.riskconstraints.ipaddress;
import io.fourfinanceit.domain.loans.ExtensionLoan;
import io.fourfinanceit.domain.loans.MainLoan;
import io.fourfinanceit.dto.ValidationDto;
import io.fourfinanceit.services.loan.LoanService;
import io.fourfinanceit.services.riskconstraints.RiskValidator;
import io.fourfinanceit.services.riskconstraints.exceptions.RiskIPAddressException;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public class IPAddressRiskValidatorTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
@Mock
private LoanService loanService;
private RiskValidator ipRiskValidator;
private ValidationDto validationDto;
private List<MainLoan> threeLoans;
private List<MainLoan> twoLoans;
@Before
public void before() {
ipRiskValidator = new IPAddressRiskValidatorImpl(loanService);
validationDto = new ValidationDto();
validationDto.setIpAddress("0.0.0.0");
MainLoan mainLoan0 = new MainLoan();
ExtensionLoan extLoan0 = new ExtensionLoan();
mainLoan0.setExtensionLoans(Arrays.asList(extLoan0));
MainLoan mainLoan1 = new MainLoan();
mainLoan0.setIpAddress("0.0.0.0");
extLoan0.setIpAddress("0.0.0.0");
mainLoan1.setIpAddress("0.0.0.0");
mainLoan0.setCreatedAt(LocalDateTime.now());
extLoan0.setCreatedAt(LocalDateTime.now());
mainLoan1.setCreatedAt(LocalDateTime.now());
threeLoans = Arrays.asList(mainLoan0, mainLoan1);
twoLoans = Arrays.asList(mainLoan0);
}
@Test
public void should_ThrowException_WhenThreeLoansWithSameIPAndDate() {
when(loanService.findByIpAddress("0.0.0.0")).thenReturn(threeLoans);
thrown.expect(RiskIPAddressException.class);
ipRiskValidator.validate(validationDto);
}
@Test
public void should_ValidateWithoutException_WhenTwoLoansWithSameIPAndDate() {
when(loanService.findByIpAddress("0.0.0.0")).thenReturn(twoLoans);
ipRiskValidator.validate(validationDto);
}
} | UTF-8 | Java | 2,462 | java | IPAddressRiskValidatorTest.java | Java | [
{
"context": "/*\n * homework for 4finance by Oleg Sedach\n */\n\npackage io.fourfinanceit.services.riskconstr",
"end": 42,
"score": 0.9996283054351807,
"start": 31,
"tag": "NAME",
"value": "Oleg Sedach"
}
] | null | [] | /*
* homework for 4finance by <NAME>
*/
package io.fourfinanceit.services.riskconstraints.ipaddress;
import io.fourfinanceit.domain.loans.ExtensionLoan;
import io.fourfinanceit.domain.loans.MainLoan;
import io.fourfinanceit.dto.ValidationDto;
import io.fourfinanceit.services.loan.LoanService;
import io.fourfinanceit.services.riskconstraints.RiskValidator;
import io.fourfinanceit.services.riskconstraints.exceptions.RiskIPAddressException;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public class IPAddressRiskValidatorTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
@Mock
private LoanService loanService;
private RiskValidator ipRiskValidator;
private ValidationDto validationDto;
private List<MainLoan> threeLoans;
private List<MainLoan> twoLoans;
@Before
public void before() {
ipRiskValidator = new IPAddressRiskValidatorImpl(loanService);
validationDto = new ValidationDto();
validationDto.setIpAddress("0.0.0.0");
MainLoan mainLoan0 = new MainLoan();
ExtensionLoan extLoan0 = new ExtensionLoan();
mainLoan0.setExtensionLoans(Arrays.asList(extLoan0));
MainLoan mainLoan1 = new MainLoan();
mainLoan0.setIpAddress("0.0.0.0");
extLoan0.setIpAddress("0.0.0.0");
mainLoan1.setIpAddress("0.0.0.0");
mainLoan0.setCreatedAt(LocalDateTime.now());
extLoan0.setCreatedAt(LocalDateTime.now());
mainLoan1.setCreatedAt(LocalDateTime.now());
threeLoans = Arrays.asList(mainLoan0, mainLoan1);
twoLoans = Arrays.asList(mainLoan0);
}
@Test
public void should_ThrowException_WhenThreeLoansWithSameIPAndDate() {
when(loanService.findByIpAddress("0.0.0.0")).thenReturn(threeLoans);
thrown.expect(RiskIPAddressException.class);
ipRiskValidator.validate(validationDto);
}
@Test
public void should_ValidateWithoutException_WhenTwoLoansWithSameIPAndDate() {
when(loanService.findByIpAddress("0.0.0.0")).thenReturn(twoLoans);
ipRiskValidator.validate(validationDto);
}
} | 2,457 | 0.740049 | 0.724208 | 83 | 28.674698 | 24.745504 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.542169 | false | false | 11 |
288f481f36814a2d76e37341365c734c005d9de9 | 20,237,885,961,238 | 8a9173dc6496c08344c247eb79c6e3480ce516a5 | /app/src/main/java/com/zpxt/zhyd/adapter/WeeklyDateListAdapter.java | 3df92b4144e4912f76172d1c3f6cbc1b93d04c31 | [] | no_license | Xiaofei1013/IntelligentElectricityUse | https://github.com/Xiaofei1013/IntelligentElectricityUse | fe0ad8661215a5f57af7ac917c007e49604f5141 | e2e407e6665c706d13894c32e36587329f3a839a | refs/heads/master | 2022-01-12T01:04:30.442000 | 2019-02-28T07:29:52 | 2019-02-28T07:29:52 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.zpxt.zhyd.adapter;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.zpxt.zhyd.R;
import com.zpxt.zhyd.model.AlarmListModule;
import com.zpxt.zhyd.model.WeeklyDateListModuel;
import com.zpxt.zhyd.ui.report.AreaSecReportListActivity;
import com.zpxt.zhyd.ui.report.ZoneReportListActivity;
import java.util.List;
/**
* Description: 监测周报日期列表适配器
* Autour: LF
* Date: 2018/3/30 11:07
*/
public class WeeklyDateListAdapter extends RecyclerView.Adapter<WeeklyDateListAdapter.MyViewHolder> {
private List<WeeklyDateListModuel.WeeklyDateModule> mList;
private Context mContext;
/**
* 记录当前页面的类型
* 实时数据、历史数据、检测周报、历史告警
*/
private String mPType;
//父节点id和名字
private String mPId;
private String mPNodeName;
public WeeklyDateListAdapter(Context context, List<WeeklyDateListModuel.WeeklyDateModule> list,String id,String nodeName ,String type){
this.mContext=context;
this.mList=list;
this.mPId=id;
this.mPNodeName=nodeName;
this.mPType=type;
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(mContext).inflate(R.layout.weekly_date_list_item,parent,false);
MyViewHolder holder = new MyViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
WeeklyDateListModuel.WeeklyDateModule item = mList.get(position);
holder.mTitleTv.setText(item.getOrgName());
holder.mStartDate.setText(item.getStartTime().replace("-","."));
holder.mEndDate.setText(item.getEndTime().replace("-","."));
}
@Override
public int getItemCount() {
return mList.size();
}
public void setData(List<WeeklyDateListModuel.WeeklyDateModule> list){
this.mList=list;
}
class MyViewHolder extends RecyclerView.ViewHolder{
TextView mTitleTv;
TextView mStartDate;
TextView mEndDate;
public MyViewHolder(View itemView) {
super(itemView);
mTitleTv=itemView.findViewById(R.id.weeklyDateItem_titleTv);
mStartDate=itemView.findViewById(R.id.weeklyDateItem_startDateTv);
mEndDate=itemView.findViewById(R.id.weeklyDateItem_endDateTv);
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Bundle bundle=new Bundle();
bundle.putString("pId",mPId);
bundle.putString("pType",mPType);
bundle.putString("pNodeName",mPNodeName);
bundle.putString("startTime",mList.get(getPosition()).getStartTime());
bundle.putString("endTime",mList.get(getPosition()).getEndTime());
Intent intent=new Intent(mContext, ZoneReportListActivity.class);
intent.putExtras(bundle);
mContext.startActivity(intent);
}
});
}
}
}
| UTF-8 | Java | 3,427 | java | WeeklyDateListAdapter.java | Java | [] | null | [] | package com.zpxt.zhyd.adapter;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.zpxt.zhyd.R;
import com.zpxt.zhyd.model.AlarmListModule;
import com.zpxt.zhyd.model.WeeklyDateListModuel;
import com.zpxt.zhyd.ui.report.AreaSecReportListActivity;
import com.zpxt.zhyd.ui.report.ZoneReportListActivity;
import java.util.List;
/**
* Description: 监测周报日期列表适配器
* Autour: LF
* Date: 2018/3/30 11:07
*/
public class WeeklyDateListAdapter extends RecyclerView.Adapter<WeeklyDateListAdapter.MyViewHolder> {
private List<WeeklyDateListModuel.WeeklyDateModule> mList;
private Context mContext;
/**
* 记录当前页面的类型
* 实时数据、历史数据、检测周报、历史告警
*/
private String mPType;
//父节点id和名字
private String mPId;
private String mPNodeName;
public WeeklyDateListAdapter(Context context, List<WeeklyDateListModuel.WeeklyDateModule> list,String id,String nodeName ,String type){
this.mContext=context;
this.mList=list;
this.mPId=id;
this.mPNodeName=nodeName;
this.mPType=type;
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(mContext).inflate(R.layout.weekly_date_list_item,parent,false);
MyViewHolder holder = new MyViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
WeeklyDateListModuel.WeeklyDateModule item = mList.get(position);
holder.mTitleTv.setText(item.getOrgName());
holder.mStartDate.setText(item.getStartTime().replace("-","."));
holder.mEndDate.setText(item.getEndTime().replace("-","."));
}
@Override
public int getItemCount() {
return mList.size();
}
public void setData(List<WeeklyDateListModuel.WeeklyDateModule> list){
this.mList=list;
}
class MyViewHolder extends RecyclerView.ViewHolder{
TextView mTitleTv;
TextView mStartDate;
TextView mEndDate;
public MyViewHolder(View itemView) {
super(itemView);
mTitleTv=itemView.findViewById(R.id.weeklyDateItem_titleTv);
mStartDate=itemView.findViewById(R.id.weeklyDateItem_startDateTv);
mEndDate=itemView.findViewById(R.id.weeklyDateItem_endDateTv);
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Bundle bundle=new Bundle();
bundle.putString("pId",mPId);
bundle.putString("pType",mPType);
bundle.putString("pNodeName",mPNodeName);
bundle.putString("startTime",mList.get(getPosition()).getStartTime());
bundle.putString("endTime",mList.get(getPosition()).getEndTime());
Intent intent=new Intent(mContext, ZoneReportListActivity.class);
intent.putExtras(bundle);
mContext.startActivity(intent);
}
});
}
}
}
| 3,427 | 0.661866 | 0.658266 | 99 | 32.666668 | 28.597168 | 139 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.676768 | false | false | 11 |
80adda8ed8e6a90f5c9cade884d1c5949d844281 | 3,899,830,362,440 | 8de8724a10b4ff2fb35cd91cb2bbcfc2941ef218 | /src/main/java/cn/forchange/parse/helper/OSSHelper.java | a10f295e37d5943d194ec3dbabceb79e9948e0ec | [] | no_license | chenxv/parse | https://github.com/chenxv/parse | e76804a73d84a749c962121847e15f87e5c9be96 | ed39084c99190a669c3d105bc7155033bc6d898d | refs/heads/master | 2016-08-11T17:23:26.535000 | 2015-10-26T08:29:57 | 2015-10-26T08:29:57 | 44,952,845 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.forchange.parse.helper;
import cn.forchange.parse.AppConst;
import cn.forchange.parse.util.OSSUtil;
import cn.forchange.parse.util.PropertyUtil;
import com.aliyun.oss.OSSClient;
import com.aliyun.oss.model.OSSObject;
import com.aliyun.oss.model.PutObjectResult;
import java.io.IOException;
import java.io.InputStream;
import java.util.ResourceBundle;
import static cn.forchange.parse.AppConst.*;
/**
* Created by iamnoi on 15/10/17.
*/
public class OSSHelper {
private static final ResourceBundle OSS_CONFIG = PropertyUtil.getProperty(AppConst.OSS_PROPERTY_PATH);
private static final OSSClient OSS_CLIENT;
static {
OSS_CLIENT = new OSSClient(getOssEndPoint(), getOssKey(), getOssSecret());
}
/**
* 获取OSSClient实例
*/
public static final OSSClient getOssClient() {
return OSS_CLIENT;
}
/**
* 获取OSS文件存储区名
*/
public static final String getOssBucket() {
return OSS_CONFIG.getString(OSS_BUCKET);
}
/**
* 获取AccessKey
*/
public static final String getOssKey() {
return OSS_CONFIG.getString(OSS_KEY);
}
/**
* 获取AccessSecret
*/
public static final String getOssSecret() {
return OSS_CONFIG.getString(OSS_SECRET);
}
/**
* 获取OSS节点
*/
public static final String getOssEndPoint() {
return OSS_CONFIG.getString(OSS_ENDPOINT);
}
public static final String getOssPreviewDir() throws Exception {
String preview = OSS_CONFIG.getString(OSS_PREVIEW);
if (preview == null) {
throw new Exception("未配置图片预览虚拟文件夹名称");
}
return preview.concat("/");
}
/**
* 上传一个文件到阿里OSS
*/
public static final PutObjectResult putObject(String key, InputStream in) throws IOException {
return OSSUtil.putObject(getOssClient(), getOssBucket(), key, in);
}
/**
* 从阿里oss下载一个文件
*
* @param ossPath
* @return
*/
public static final OSSObject getObject(String ossPath) {
return OSSUtil.getObject(getOssClient(), getOssBucket(), ossPath);
}
}
| UTF-8 | Java | 2,224 | java | OSSHelper.java | Java | [
{
"context": " cn.forchange.parse.AppConst.*;\n\n/**\n * Created by iamnoi on 15/10/17.\n */\npublic class OSSHelper {\n\n pr",
"end": 435,
"score": 0.9996902942657471,
"start": 429,
"tag": "USERNAME",
"value": "iamnoi"
}
] | null | [] | package cn.forchange.parse.helper;
import cn.forchange.parse.AppConst;
import cn.forchange.parse.util.OSSUtil;
import cn.forchange.parse.util.PropertyUtil;
import com.aliyun.oss.OSSClient;
import com.aliyun.oss.model.OSSObject;
import com.aliyun.oss.model.PutObjectResult;
import java.io.IOException;
import java.io.InputStream;
import java.util.ResourceBundle;
import static cn.forchange.parse.AppConst.*;
/**
* Created by iamnoi on 15/10/17.
*/
public class OSSHelper {
private static final ResourceBundle OSS_CONFIG = PropertyUtil.getProperty(AppConst.OSS_PROPERTY_PATH);
private static final OSSClient OSS_CLIENT;
static {
OSS_CLIENT = new OSSClient(getOssEndPoint(), getOssKey(), getOssSecret());
}
/**
* 获取OSSClient实例
*/
public static final OSSClient getOssClient() {
return OSS_CLIENT;
}
/**
* 获取OSS文件存储区名
*/
public static final String getOssBucket() {
return OSS_CONFIG.getString(OSS_BUCKET);
}
/**
* 获取AccessKey
*/
public static final String getOssKey() {
return OSS_CONFIG.getString(OSS_KEY);
}
/**
* 获取AccessSecret
*/
public static final String getOssSecret() {
return OSS_CONFIG.getString(OSS_SECRET);
}
/**
* 获取OSS节点
*/
public static final String getOssEndPoint() {
return OSS_CONFIG.getString(OSS_ENDPOINT);
}
public static final String getOssPreviewDir() throws Exception {
String preview = OSS_CONFIG.getString(OSS_PREVIEW);
if (preview == null) {
throw new Exception("未配置图片预览虚拟文件夹名称");
}
return preview.concat("/");
}
/**
* 上传一个文件到阿里OSS
*/
public static final PutObjectResult putObject(String key, InputStream in) throws IOException {
return OSSUtil.putObject(getOssClient(), getOssBucket(), key, in);
}
/**
* 从阿里oss下载一个文件
*
* @param ossPath
* @return
*/
public static final OSSObject getObject(String ossPath) {
return OSSUtil.getObject(getOssClient(), getOssBucket(), ossPath);
}
}
| 2,224 | 0.649057 | 0.646226 | 89 | 22.820225 | 24.254995 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.359551 | false | false | 11 |
dba9dcfc2992ddcea2168452a9074c63ba530864 | 31,353,261,330,394 | 32bede586e0d579aaa7e68142234400660055c23 | /src/main/java/com/create4/scenarios/TS_39.java | 426d80c829ed7b251b9215d561321bc779bd152c | [] | no_license | Bablu506kumar506prasad506/Vidhisinghania_Ar | https://github.com/Bablu506kumar506prasad506/Vidhisinghania_Ar | ec3ccf7c878dd6318924252edf072d6ce6123b8a | 2f477b70e6fda69855a23ccd985e037ccde0d50e | refs/heads/master | 2020-03-09T04:50:29.141000 | 2018-04-20T11:06:01 | 2018-04-20T11:06:01 | 128,597,150 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.create4.scenarios;
import java.io.FileInputStream;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.testng.Assert;
import com.global.methods.GlobalMethods;
import com.global.methods.GlobalWait;
import jxl.Sheet;
import jxl.Workbook;
/*
* Check for PI header menu
*/
public class TS_39 {
public TS_39() {
PageFactory.initElements(GlobalMethods.driver, this);
}
GlobalWait GWait = new GlobalWait(GlobalMethods.driver);
Actions action = new Actions(GlobalMethods.driver);
// PI submit new project page elements
@FindBy(linkText = "My Projects")
WebElement PI_project_menu;
@FindBy(xpath = "//ul[@id='accordion']/li/div/a")
WebElement submenu_projects;
@FindBy(linkText = "Submit New Project")
WebElement submenu_submitnewproject;
@FindBy(linkText = "Archived Projects")
WebElement submenu_archivedprojects;
@FindBy(css = "h3.projects-search")
WebElement list_search;
@FindBy(xpath = "//span[3]/a")
WebElement logoutt;
@FindBy(css = "img")
WebElement logo;
//
public void CRe4_1204() throws Exception {
GlobalMethods.PI_Login();
WebElement PI_project_menu =GWait.Wait_GetElementByLinkText("My Projects");
PI_project_menu.click();
FileInputStream fi = new FileInputStream("C:\\Selenium_Files\\Create4_v2\\CReATE4_Data.xls");
Workbook wb = Workbook.getWorkbook(fi);
Sheet r1 = wb.getSheet("Projects");
String PI_Menu1 = r1.getCell(2, 13).getContents();
String PI_Menu2 = r1.getCell(3, 13).getContents();
String PI_Menu3 = r1.getCell(4, 13).getContents();
String PI_Menu4 = r1.getCell(5, 13).getContents();
Assert.assertEquals(submenu_projects.getText().trim(), PI_Menu1);
Assert.assertEquals(submenu_submitnewproject.getText().trim(), PI_Menu2);
Assert.assertEquals(submenu_archivedprojects.getText().trim(), PI_Menu3);
Assert.assertEquals(list_search.getText().trim(), PI_Menu4);
WebElement logoutt2 = GWait.Wait_GetElementByXpath("//span/a");
logoutt2.click();
WebElement logo2 = GWait.Wait_GetElementByCSS("img");
logo2.click();
}
}
| UTF-8 | Java | 2,220 | java | TS_39.java | Java | [] | null | [] | package com.create4.scenarios;
import java.io.FileInputStream;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.testng.Assert;
import com.global.methods.GlobalMethods;
import com.global.methods.GlobalWait;
import jxl.Sheet;
import jxl.Workbook;
/*
* Check for PI header menu
*/
public class TS_39 {
public TS_39() {
PageFactory.initElements(GlobalMethods.driver, this);
}
GlobalWait GWait = new GlobalWait(GlobalMethods.driver);
Actions action = new Actions(GlobalMethods.driver);
// PI submit new project page elements
@FindBy(linkText = "My Projects")
WebElement PI_project_menu;
@FindBy(xpath = "//ul[@id='accordion']/li/div/a")
WebElement submenu_projects;
@FindBy(linkText = "Submit New Project")
WebElement submenu_submitnewproject;
@FindBy(linkText = "Archived Projects")
WebElement submenu_archivedprojects;
@FindBy(css = "h3.projects-search")
WebElement list_search;
@FindBy(xpath = "//span[3]/a")
WebElement logoutt;
@FindBy(css = "img")
WebElement logo;
//
public void CRe4_1204() throws Exception {
GlobalMethods.PI_Login();
WebElement PI_project_menu =GWait.Wait_GetElementByLinkText("My Projects");
PI_project_menu.click();
FileInputStream fi = new FileInputStream("C:\\Selenium_Files\\Create4_v2\\CReATE4_Data.xls");
Workbook wb = Workbook.getWorkbook(fi);
Sheet r1 = wb.getSheet("Projects");
String PI_Menu1 = r1.getCell(2, 13).getContents();
String PI_Menu2 = r1.getCell(3, 13).getContents();
String PI_Menu3 = r1.getCell(4, 13).getContents();
String PI_Menu4 = r1.getCell(5, 13).getContents();
Assert.assertEquals(submenu_projects.getText().trim(), PI_Menu1);
Assert.assertEquals(submenu_submitnewproject.getText().trim(), PI_Menu2);
Assert.assertEquals(submenu_archivedprojects.getText().trim(), PI_Menu3);
Assert.assertEquals(list_search.getText().trim(), PI_Menu4);
WebElement logoutt2 = GWait.Wait_GetElementByXpath("//span/a");
logoutt2.click();
WebElement logo2 = GWait.Wait_GetElementByCSS("img");
logo2.click();
}
}
| 2,220 | 0.721171 | 0.701351 | 93 | 22.870968 | 23.779554 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.516129 | false | false | 11 |
e1b998637d7fdb665e5f18643c9a44547048a0c8 | 27,315,992,026,419 | 99a8722d0d16e123b69e345df7aadad409649f6c | /jpa/deferred/src/main/java/example/service/Customer1303Service.java | 8d6bc68a913b97d8f381a23a4ed07b4251ce28c8 | [
"Apache-2.0"
] | permissive | spring-projects/spring-data-examples | https://github.com/spring-projects/spring-data-examples | 9c69a0e9f3e2e73c4533dbbab00deae77b2aacd7 | c4d1ca270fcf32a93c2a5e9d7e91a5592b7720ff | refs/heads/main | 2023-09-01T14:17:56.622000 | 2023-08-22T16:51:10 | 2023-08-24T19:48:04 | 16,381,571 | 5,331 | 3,985 | Apache-2.0 | false | 2023-08-25T09:02:19 | 2014-01-30T15:42:43 | 2023-08-25T07:00:20 | 2023-08-25T09:02:19 | 11,551 | 4,870 | 3,303 | 19 | Java | false | false | package example.service;
import example.repo.Customer1303Repository;
import org.springframework.stereotype.Service;
@Service
public class Customer1303Service {
public Customer1303Service(Customer1303Repository repo) {}
}
| UTF-8 | Java | 225 | java | Customer1303Service.java | Java | [] | null | [] | package example.service;
import example.repo.Customer1303Repository;
import org.springframework.stereotype.Service;
@Service
public class Customer1303Service {
public Customer1303Service(Customer1303Repository repo) {}
}
| 225 | 0.84 | 0.768889 | 10 | 21.5 | 21.495348 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 11 |
3bb4518ef603a764f6b6b850a9f214445117cab7 | 266,288,036,498 | 17f81f4c6328da21d0682187dcfc83cdf95ea4d9 | /src/day12/SistemAkademik/src/main/java/com/xsis/batch197/model/FakultasModel.java | 200ce0e2e486f321ec0be883164940889201058b | [] | no_license | nurtaufikhidayat/java-batch197 | https://github.com/nurtaufikhidayat/java-batch197 | 5532848b825b787edc0a42598f4c221f27391e1e | eb139984e989adc3d46937718b3158709e60456c | refs/heads/master | 2020-05-18T22:19:22.831000 | 2019-07-12T03:46:20 | 2019-07-12T03:46:20 | 184,684,778 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.xsis.batch197.model;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
@Entity
@Table(name ="fakultas")
public class FakultasModel {
public List<JurusanModel> getListJurusan() {
return listJurusan;
}
public void setListJurusan(List<JurusanModel> listJurusan) {
this.listJurusan = listJurusan;
}
@Id
@GeneratedValue(strategy = GenerationType.TABLE, generator = "fakultas_seq")
@TableGenerator(name = "fakultas_seq", table = "tbl_sequences", pkColumnName = "seq_id", valueColumnName = "seq_value", initialValue = 0, allocationSize = 1)
@Column(name = "id")
private int id;
@Column(name ="kd_fakultas", length = 10)
private String kdFakultas;
@Column(name ="nm_fakultas", length = 50)
private String nmFakultas;
@OneToMany(mappedBy ="fakultas")
private List<JurusanModel> listJurusan = new ArrayList<JurusanModel>();
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getKdFakultas() {
return kdFakultas;
}
public void setKdFakultas(String kdFakultas) {
this.kdFakultas = kdFakultas;
}
public String getNmFakultas() {
return nmFakultas;
}
public void setNmFakultas(String nmFakultas) {
this.nmFakultas = nmFakultas;
}
}
| UTF-8 | Java | 1,530 | java | FakultasModel.java | Java | [] | null | [] | package com.xsis.batch197.model;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
@Entity
@Table(name ="fakultas")
public class FakultasModel {
public List<JurusanModel> getListJurusan() {
return listJurusan;
}
public void setListJurusan(List<JurusanModel> listJurusan) {
this.listJurusan = listJurusan;
}
@Id
@GeneratedValue(strategy = GenerationType.TABLE, generator = "fakultas_seq")
@TableGenerator(name = "fakultas_seq", table = "tbl_sequences", pkColumnName = "seq_id", valueColumnName = "seq_value", initialValue = 0, allocationSize = 1)
@Column(name = "id")
private int id;
@Column(name ="kd_fakultas", length = 10)
private String kdFakultas;
@Column(name ="nm_fakultas", length = 50)
private String nmFakultas;
@OneToMany(mappedBy ="fakultas")
private List<JurusanModel> listJurusan = new ArrayList<JurusanModel>();
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getKdFakultas() {
return kdFakultas;
}
public void setKdFakultas(String kdFakultas) {
this.kdFakultas = kdFakultas;
}
public String getNmFakultas() {
return nmFakultas;
}
public void setNmFakultas(String nmFakultas) {
this.nmFakultas = nmFakultas;
}
}
| 1,530 | 0.74183 | 0.735948 | 64 | 22.90625 | 25.772877 | 161 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.15625 | false | false | 11 |
3c7e8417dc4b45c065b33636ba7b5661fcf36c85 | 35,673,998,402,136 | 5b83092a3181a02405a16ec07ee15fb14be9cccd | /leetcode/editor/cn/[117]填充每个节点的下一个右侧节点指针 II.java | f58aaf5fefe7926510192a59ff90f27eb8b3795f | [] | no_license | fifadxj/myleetcode | https://github.com/fifadxj/myleetcode | cbbb933f489c1aef25ae6ba08635c1898b015482 | 806412f871e494bbc34eb99d1f8d50bacc76e1d2 | refs/heads/main | 2023-07-14T06:41:12.124000 | 2021-08-08T13:18:25 | 2021-08-08T13:18:25 | 334,059,169 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | //给定一个二叉树
//
//
//struct Node {
// int val;
// Node *left;
// Node *right;
// Node *next;
//}
//
// 填充它的每个 next 指针,让这个指针指向其下一个右侧节点。如果找不到下一个右侧节点,则将 next 指针设置为 NULL。
//
// 初始状态下,所有 next 指针都被设置为 NULL。
//
//
//
// 进阶:
//
//
// 你只能使用常量级额外空间。
// 使用递归解题也符合要求,本题中递归程序占用的栈空间不算做额外的空间复杂度。
//
//
//
//
// 示例:
//
//
//
//
//输入:root = [1,2,3,4,5,null,7]
//输出:[1,#,2,3,#,4,5,7,#]
//解释:给定二叉树如图 A 所示,你的函数应该填充它的每个 next 指针,以指向其下一个右侧节点,如图 B 所示。序列化输出按层序遍历顺序(由 next 指
//针连接),'#' 表示每层的末尾。
//
//
//
// 提示:
//
//
// 树中的节点数小于 6000
// -100 <= node.val <= 100
//
//
//
//
//
//
// Related Topics 树 深度优先搜索 广度优先搜索 二叉树
// 👍 418 👎 0
//leetcode submit region begin(Prohibit modification and deletion)
/*
// Definition for a Node.
class Node {
public int val;
public Node left;
public Node right;
public Node next;
public Node() {}
public Node(int _val) {
val = _val;
}
public Node(int _val, Node _left, Node _right, Node _next) {
val = _val;
left = _left;
right = _right;
next = _next;
}
};
*/
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
class Solution {
public Node connect(Node root) {
if (root == null) {
return null;
}
Queue<Node> queue = new LinkedList<>();
queue.offer(root);
while (queue.size() > 0) {
int size = queue.size();
List<Node> nodes = new ArrayList<>();
for (int i = 0; i < size; i++) {
Node node = queue.poll();
nodes.add(node);
if (node.left != null) {
queue.offer(node.left);
}
if (node.right != null) {
queue.offer(node.right);
}
}
for (int i = 0; i < nodes.size() - 1; i++) {
nodes.get(i).next = nodes.get(i + 1);
}
}
return root;
}
}
//leetcode submit region end(Prohibit modification and deletion)
| UTF-8 | Java | 2,538 | java | [117]填充每个节点的下一个右侧节点指针 II.java | Java | [] | null | [] | //给定一个二叉树
//
//
//struct Node {
// int val;
// Node *left;
// Node *right;
// Node *next;
//}
//
// 填充它的每个 next 指针,让这个指针指向其下一个右侧节点。如果找不到下一个右侧节点,则将 next 指针设置为 NULL。
//
// 初始状态下,所有 next 指针都被设置为 NULL。
//
//
//
// 进阶:
//
//
// 你只能使用常量级额外空间。
// 使用递归解题也符合要求,本题中递归程序占用的栈空间不算做额外的空间复杂度。
//
//
//
//
// 示例:
//
//
//
//
//输入:root = [1,2,3,4,5,null,7]
//输出:[1,#,2,3,#,4,5,7,#]
//解释:给定二叉树如图 A 所示,你的函数应该填充它的每个 next 指针,以指向其下一个右侧节点,如图 B 所示。序列化输出按层序遍历顺序(由 next 指
//针连接),'#' 表示每层的末尾。
//
//
//
// 提示:
//
//
// 树中的节点数小于 6000
// -100 <= node.val <= 100
//
//
//
//
//
//
// Related Topics 树 深度优先搜索 广度优先搜索 二叉树
// 👍 418 👎 0
//leetcode submit region begin(Prohibit modification and deletion)
/*
// Definition for a Node.
class Node {
public int val;
public Node left;
public Node right;
public Node next;
public Node() {}
public Node(int _val) {
val = _val;
}
public Node(int _val, Node _left, Node _right, Node _next) {
val = _val;
left = _left;
right = _right;
next = _next;
}
};
*/
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
class Solution {
public Node connect(Node root) {
if (root == null) {
return null;
}
Queue<Node> queue = new LinkedList<>();
queue.offer(root);
while (queue.size() > 0) {
int size = queue.size();
List<Node> nodes = new ArrayList<>();
for (int i = 0; i < size; i++) {
Node node = queue.poll();
nodes.add(node);
if (node.left != null) {
queue.offer(node.left);
}
if (node.right != null) {
queue.offer(node.right);
}
}
for (int i = 0; i < nodes.size() - 1; i++) {
nodes.get(i).next = nodes.get(i + 1);
}
}
return root;
}
}
//leetcode submit region end(Prohibit modification and deletion)
| 2,538 | 0.498068 | 0.483092 | 112 | 17.482143 | 17.990068 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.446429 | false | false | 11 |
ad30bedca63b18041b27365991f785006e9d90a7 | 34,153,579,995,484 | 8313257b171087f49f95574155aa392b87eebe29 | /src/main/java/Depth_search_traverse/Solution872.java | fde4ffa65cd69dcfd24584252c498014dcaa88d1 | [] | no_license | Jessie0914/leetcode | https://github.com/Jessie0914/leetcode | d4c26e729aa0bc8a3a86c1121fe7d9d48c9f2287 | 1c521a7313a170b69a39f2591094fcf88e8be05b | refs/heads/master | 2021-07-09T13:56:09.692000 | 2020-08-04T17:08:57 | 2020-08-04T17:08:57 | 194,860,763 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Depth_search_traverse;
import java.util.ArrayList;
import java.util.List;
/**
* @ClassName Solution872
* @Description 872.叶子相似的树
* @Author shishi
* @Date 2019/7/27 10:20
**/
public class Solution872 {
public boolean leafSimilar(TreeNode root1, TreeNode root2) {
List<Integer> allLeafOfTree1 = findAllLeaf(root1);
List<Integer> allLeafOfTree2 = findAllLeaf(root2);
// 这里我是自己比较两个list的大小
// if (allLeafOfTree1.size()!=allLeafOfTree2.size()) return false;
// else {
// for (int i=0;i<allLeafOfTree1.size();i++){
// if (allLeafOfTree1.get(i)!=allLeafOfTree2.get(i)){
// return false;
// }
// }
// return true;
// }
// 也可以直接比较
return allLeafOfTree1.equals(allLeafOfTree2);
}
public List<Integer> findAllLeaf(TreeNode root) {
List<Integer> list = new ArrayList<>();
if (root == null) return list;
if (root.left == null && root.right == null)
list.add(root.val);
list.addAll(findAllLeaf(root.left));
list.addAll(findAllLeaf(root.right));
return list;
}
}
| UTF-8 | Java | 1,237 | java | Solution872.java | Java | [
{
"context": " Solution872\n * @Description 872.叶子相似的树\n * @Author shishi\n * @Date 2019/7/27 10:20\n **/\n\npublic class Solut",
"end": 158,
"score": 0.9865133762359619,
"start": 152,
"tag": "USERNAME",
"value": "shishi"
}
] | null | [] | package Depth_search_traverse;
import java.util.ArrayList;
import java.util.List;
/**
* @ClassName Solution872
* @Description 872.叶子相似的树
* @Author shishi
* @Date 2019/7/27 10:20
**/
public class Solution872 {
public boolean leafSimilar(TreeNode root1, TreeNode root2) {
List<Integer> allLeafOfTree1 = findAllLeaf(root1);
List<Integer> allLeafOfTree2 = findAllLeaf(root2);
// 这里我是自己比较两个list的大小
// if (allLeafOfTree1.size()!=allLeafOfTree2.size()) return false;
// else {
// for (int i=0;i<allLeafOfTree1.size();i++){
// if (allLeafOfTree1.get(i)!=allLeafOfTree2.get(i)){
// return false;
// }
// }
// return true;
// }
// 也可以直接比较
return allLeafOfTree1.equals(allLeafOfTree2);
}
public List<Integer> findAllLeaf(TreeNode root) {
List<Integer> list = new ArrayList<>();
if (root == null) return list;
if (root.left == null && root.right == null)
list.add(root.val);
list.addAll(findAllLeaf(root.left));
list.addAll(findAllLeaf(root.right));
return list;
}
}
| 1,237 | 0.581435 | 0.552743 | 42 | 27.214285 | 21.329094 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false | 11 |
c40c5e62527b7c484ff7375b64bb1db3fbce3ab4 | 39,522,289,093,075 | 8ad1c72af5b82a7e7da686fa613b702b1a2e3bed | /GoodPlace/src/main/java/com/kh/goodplace/room/model/vo/Room.java | 9c0aa6311866528f762e649d98b9331cdb6c1045 | [] | no_license | HaJungBong/GoodPlace_workspace | https://github.com/HaJungBong/GoodPlace_workspace | 836b4c499e40aac39760bd34896e137d00581fb7 | cea8b0271933e4c14802c1653a43487972e74694 | refs/heads/master | 2023-04-20T06:02:26.261000 | 2020-07-04T05:29:27 | 2020-07-04T05:29:27 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.kh.goodplace.room.model.vo;
import java.sql.Date;
import java.util.ArrayList;
import com.kh.goodplace.board.model.vo.Board;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class Room {
/* Rooms 테이블 컬럼 */
private int roNo; // 숙소번호
private int userNo; // 회원번호
private String roomsTitle; // 숙소명
private int minPeople; // 최소인원
private int maxPeople; // 최대인원
private int price; // 숙소가격
private int addPrice; // 추가가격
private String roomsNotice; // 숙소정보
private String roomsTag; // 숙소태그
private int roomCount; // 방갯수
private int bedCount; // 침대수
private int bathCount; // 샤워실수
private int restroomCount; // 화장실수
private String facility; // 숙소시설(주차여부,...)
private String service; // 제공서비스(샴푸,비누,수건...)
private String meal; // 숙소포함사항(조식,중식,석식)
private String deny; // 거절사유
private String denyContent; // 거절상세내용
private String addBasic; // 기본주소
private String addDetail; // 상세주소
private String addRef; // 참고주소
private int zipCode; // 우편번호
private Date applyDate; // 숙소신청일
private Date startDate; // 숙소승인일
private Date endDate; // 숙소종료일
private String operateDay; // 운영요일
private String checkIn; // 체크인시간
private String checkOut; // 체크아웃시간
private String deadline; // 예약가능시간
private String originName; // 숙소썸네일 원본명
private String changeName; // 숙소썸네일 수정명
private String filePath; // 숙소썸네일 저장경로
private int status; // 운영중(1),승인대기(2),승인거절(3),휴면(4),노출안됨(5)
private int totalSal;
/* 파워 등록 쪽 */
private int poNo1; // 파워등록유무 (기본0)
private Date powerStart; // 파워시작일
private Date powerEnd; // 파워종료일
private int rpNo; // 숙소결제번호
/*관리자 검색용 키워드*/
private String searchSelect;
private String keyword;
/* 파워 테이블 컬럼 */
private int poNo; // 파워번호
private String powerKind; // 파워종류
private int period; // 파워기간
private int powerPrice; // 파워가격
private String email; // 회원아이디
/* DB에는 없지만 새로 생성한 변수 */
private String addArea; // ~시 // ex) 서울특별시, 화성시
/* Roomspay 테이블 컬럼 */
private int payUserNo; // 결제자의 회원번호
private int amount; // 결제금액
private String birthday; // 생년월일
private String payDate; // 결제날짜
private int addPoint; // 추가포인트
private String CheckInTime; // 예약자가 직접 입력한 체크인시간
private int reserveStatus; // 확정대기(1),확정(2),여행완료(3),취소(4)
private int usePoint; // 사용포인트
private int people; // 인원수
private String concept; // 여행컨셉
private String request; // 요청사항
private String startDays; // 예약시작일자
private String endDays; // 예약끝일자
/* DB에는 없지만 새로 생성한 변수 */
private int reviewCount; // 숙소별 Review 개수
private String filterStatus;// 필터 조건에 만족하는지 숙소의 상태값 설정
private String detailImg1; // Attachment 테이블에 담겨있는 숙소상세이미지1
private String detailImg2; // Attachment 테이블에 담겨있는 숙소상세이미지2
private String detailImg3; // Attachment 테이블에 담겨있는 숙소상세이미지3
private String detailImg4; // Attachment 테이블에 담겨있는 숙소상세이미지4
private int days;
/* Member테이블 + Partner테이블 */
private String paPofile; // 프로필사진 변경이름
private String partnerIntro;// 파트너소개
private String paName; // 파트너 이름
private String paAccountName; //은행명
private String paAccountNum; //계좌번호
private String phone; //전화번호
/* 리뷰 관련 컬럼들 */
private int reNo; // 리뷰번호
private String userName;
private String reTitle; // 리뷰제목
private String reContent; // 리뷰내용
private Date reviewDate; // 리뷰작성일
private int score; // 평점
private String reply; // 답글내용
private Date replyDate; // 답글작성일
private String replyStatus; // 답글 상태
private String age; // 연령대
/* DB에는 없지만 새로 생성한 변수 */
private String usOriginName; //댓글단회원 프로필사진 원본이름
private String usChangeName; //댓글단회원 프로필사진 변경이름
private String region; //지역 표시 ex)서울특별시 강남구
ArrayList<Board> reviewList; // Review테이블
private String statusString; //에러 막으려고 만듬
private String tripStartDate; // 예약시작일
private String tripEndDate; // 예약시작일
}
| UTF-8 | Java | 5,154 | java | Room.java | Java | [
{
"context": "들 */\n\tprivate int reNo;\t\t\t\t// 리뷰번호\n\tprivate String userName;\n\tprivate String reTitle;\t\t\t// 리뷰제목\n\tprivate Stri",
"end": 3322,
"score": 0.9975771307945251,
"start": 3314,
"tag": "USERNAME",
"value": "userName"
}
] | null | [] | package com.kh.goodplace.room.model.vo;
import java.sql.Date;
import java.util.ArrayList;
import com.kh.goodplace.board.model.vo.Board;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class Room {
/* Rooms 테이블 컬럼 */
private int roNo; // 숙소번호
private int userNo; // 회원번호
private String roomsTitle; // 숙소명
private int minPeople; // 최소인원
private int maxPeople; // 최대인원
private int price; // 숙소가격
private int addPrice; // 추가가격
private String roomsNotice; // 숙소정보
private String roomsTag; // 숙소태그
private int roomCount; // 방갯수
private int bedCount; // 침대수
private int bathCount; // 샤워실수
private int restroomCount; // 화장실수
private String facility; // 숙소시설(주차여부,...)
private String service; // 제공서비스(샴푸,비누,수건...)
private String meal; // 숙소포함사항(조식,중식,석식)
private String deny; // 거절사유
private String denyContent; // 거절상세내용
private String addBasic; // 기본주소
private String addDetail; // 상세주소
private String addRef; // 참고주소
private int zipCode; // 우편번호
private Date applyDate; // 숙소신청일
private Date startDate; // 숙소승인일
private Date endDate; // 숙소종료일
private String operateDay; // 운영요일
private String checkIn; // 체크인시간
private String checkOut; // 체크아웃시간
private String deadline; // 예약가능시간
private String originName; // 숙소썸네일 원본명
private String changeName; // 숙소썸네일 수정명
private String filePath; // 숙소썸네일 저장경로
private int status; // 운영중(1),승인대기(2),승인거절(3),휴면(4),노출안됨(5)
private int totalSal;
/* 파워 등록 쪽 */
private int poNo1; // 파워등록유무 (기본0)
private Date powerStart; // 파워시작일
private Date powerEnd; // 파워종료일
private int rpNo; // 숙소결제번호
/*관리자 검색용 키워드*/
private String searchSelect;
private String keyword;
/* 파워 테이블 컬럼 */
private int poNo; // 파워번호
private String powerKind; // 파워종류
private int period; // 파워기간
private int powerPrice; // 파워가격
private String email; // 회원아이디
/* DB에는 없지만 새로 생성한 변수 */
private String addArea; // ~시 // ex) 서울특별시, 화성시
/* Roomspay 테이블 컬럼 */
private int payUserNo; // 결제자의 회원번호
private int amount; // 결제금액
private String birthday; // 생년월일
private String payDate; // 결제날짜
private int addPoint; // 추가포인트
private String CheckInTime; // 예약자가 직접 입력한 체크인시간
private int reserveStatus; // 확정대기(1),확정(2),여행완료(3),취소(4)
private int usePoint; // 사용포인트
private int people; // 인원수
private String concept; // 여행컨셉
private String request; // 요청사항
private String startDays; // 예약시작일자
private String endDays; // 예약끝일자
/* DB에는 없지만 새로 생성한 변수 */
private int reviewCount; // 숙소별 Review 개수
private String filterStatus;// 필터 조건에 만족하는지 숙소의 상태값 설정
private String detailImg1; // Attachment 테이블에 담겨있는 숙소상세이미지1
private String detailImg2; // Attachment 테이블에 담겨있는 숙소상세이미지2
private String detailImg3; // Attachment 테이블에 담겨있는 숙소상세이미지3
private String detailImg4; // Attachment 테이블에 담겨있는 숙소상세이미지4
private int days;
/* Member테이블 + Partner테이블 */
private String paPofile; // 프로필사진 변경이름
private String partnerIntro;// 파트너소개
private String paName; // 파트너 이름
private String paAccountName; //은행명
private String paAccountNum; //계좌번호
private String phone; //전화번호
/* 리뷰 관련 컬럼들 */
private int reNo; // 리뷰번호
private String userName;
private String reTitle; // 리뷰제목
private String reContent; // 리뷰내용
private Date reviewDate; // 리뷰작성일
private int score; // 평점
private String reply; // 답글내용
private Date replyDate; // 답글작성일
private String replyStatus; // 답글 상태
private String age; // 연령대
/* DB에는 없지만 새로 생성한 변수 */
private String usOriginName; //댓글단회원 프로필사진 원본이름
private String usChangeName; //댓글단회원 프로필사진 변경이름
private String region; //지역 표시 ex)서울특별시 강남구
ArrayList<Board> reviewList; // Review테이블
private String statusString; //에러 막으려고 만듬
private String tripStartDate; // 예약시작일
private String tripEndDate; // 예약시작일
}
| 5,154 | 0.709179 | 0.704361 | 134 | 28.432837 | 15.226866 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.738806 | false | false | 11 |
79d7b52c162ef0925085df53e9a26d769fcb0521 | 27,848,567,958,918 | 020328b5413a2431b89c663fbcf8ce9dc6c9e4c6 | /PresupuestoMaestro/src/java/ppm/contable/proyecto/control/PronosticoMateriaPrimaController.java | d5e10688980c664cc9127850e80c3ba79da3ff64 | [] | no_license | pacifi/presupuestosContables | https://github.com/pacifi/presupuestosContables | ce65469a1d341cbdb6dd92a6c6d3d713821c2f18 | 6501f8582d2184e01d04b71982867a73e96f5673 | refs/heads/master | 2016-08-06T17:10:01.020000 | 2013-07-01T16:50:57 | 2013-07-01T16:50:57 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ppm.contable.proyecto.control;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import ppm.contable.proyecto.modelo.ModeloPresupuestoMateriaPrima;
import ppm.contable.proyecto.modelo.ModelosPresupuestoVenta;
import ppm.contable.proyecto.modelo.PpmProducto;
import ppm.contable.proyecto.servicio.ProductoServicio;
/**
*
* @author PacifiNote
*/
@Controller
public class PronosticoMateriaPrimaController {
@Autowired
public ProductoServicio productoServicio;
public ModeloPresupuestoMateriaPrima materiaPrima;
@RequestMapping(value = "presupuestoMateriaPrima", method = RequestMethod.GET)
public ModelAndView Presupuesto(HttpServletRequest request) {
//el id proyecto tiene que venir por session
int idProyecto = 2;
for (int i = 0; i < productoServicio.listarProductodeProyecto(idProyecto).size(); i++) {
for (int j = 0; j < 12; j++) {
}
}
return null;
}
}
| UTF-8 | Java | 1,516 | java | PronosticoMateriaPrimaController.java | Java | [
{
"context": ".servicio.ProductoServicio;\r\n\r\n/**\r\n *\r\n * @author PacifiNote\r\n */\r\n@Controller\r\npublic class PronosticoMateria",
"end": 861,
"score": 0.9611607193946838,
"start": 851,
"tag": "USERNAME",
"value": "PacifiNote"
}
] | null | [] | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ppm.contable.proyecto.control;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import ppm.contable.proyecto.modelo.ModeloPresupuestoMateriaPrima;
import ppm.contable.proyecto.modelo.ModelosPresupuestoVenta;
import ppm.contable.proyecto.modelo.PpmProducto;
import ppm.contable.proyecto.servicio.ProductoServicio;
/**
*
* @author PacifiNote
*/
@Controller
public class PronosticoMateriaPrimaController {
@Autowired
public ProductoServicio productoServicio;
public ModeloPresupuestoMateriaPrima materiaPrima;
@RequestMapping(value = "presupuestoMateriaPrima", method = RequestMethod.GET)
public ModelAndView Presupuesto(HttpServletRequest request) {
//el id proyecto tiene que venir por session
int idProyecto = 2;
for (int i = 0; i < productoServicio.listarProductodeProyecto(idProyecto).size(); i++) {
for (int j = 0; j < 12; j++) {
}
}
return null;
}
}
| 1,516 | 0.722955 | 0.719657 | 49 | 28.938776 | 25.982262 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.530612 | false | false | 10 |
4102cb5dadf2472e116c33562afb4763e5e485b2 | 27,693,949,173,411 | 6cb834eb7dc024f325a19f45c5ca453e76f16bc6 | /src/main/java/io/unioncoder/uniontab/UTab.java | 4a8f87a56910810b90c917fdddfe3b872f827c95 | [] | no_license | K1r0v/UnionTab | https://github.com/K1r0v/UnionTab | cf66f083798ce0deb22c2065a568f441576eee1d | 0e2eba8932957631b1cf953502a902b4e5207e66 | refs/heads/main | 2023-01-13T18:55:11.255000 | 2020-11-20T22:57:03 | 2020-11-20T22:57:03 | 314,688,803 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package io.unioncoder.uniontab;
import io.unioncoder.uniontab.utill.CFGManager;
import io.unioncoder.uniontab.utill.EventListener;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.config.Configuration;
public class UTab extends Plugin {
private static UTab instance;
public void onEnable() {
CFGManager.saveDefaultConfig();
getProxy().getPluginManager().registerListener(this, (Listener) new EventListener());
}
public UTab() {
instance = this;
}
public static UTab getInstance() {
return instance;
}
public Configuration getConfig() {
return CFGManager.getConfig();
}
}
| UTF-8 | Java | 711 | java | UTab.java | Java | [] | null | [] | package io.unioncoder.uniontab;
import io.unioncoder.uniontab.utill.CFGManager;
import io.unioncoder.uniontab.utill.EventListener;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.config.Configuration;
public class UTab extends Plugin {
private static UTab instance;
public void onEnable() {
CFGManager.saveDefaultConfig();
getProxy().getPluginManager().registerListener(this, (Listener) new EventListener());
}
public UTab() {
instance = this;
}
public static UTab getInstance() {
return instance;
}
public Configuration getConfig() {
return CFGManager.getConfig();
}
}
| 711 | 0.701828 | 0.697609 | 26 | 26.346153 | 21.691795 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 10 |
8efc3c418a1042aba75c23cd9848dcac7e024191 | 8,229,157,359,588 | 284a6ea8bb7ced39c81811f92ed06313c37adf6b | /src/binary_tress/HeightOfTree.java | b116ee845ce13e59c3e429ba2cfb5afdcca9bcf7 | [] | no_license | amitnihalani/Data-Structures-Algorithms | https://github.com/amitnihalani/Data-Structures-Algorithms | ff9218c262ae2599e9c052da7614cf5d5a2d4463 | 3cdf8b94f87b282480483b4ae9366e6a3360a1b6 | refs/heads/master | 2021-01-10T13:44:26.219000 | 2016-01-16T01:35:48 | 2016-01-16T01:35:48 | 44,152,455 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package binary_tress;
import java.util.LinkedList;
import java.util.Queue;
public class HeightOfTree {
public static void main(String[] args) {
BinaryNode root = BinaryTree.generateRandomBinaryTree();
System.out.println("\nOriginal Tree\n");
root.left.left.left = new BinaryNode(10);
root.left.left.left.right = new BinaryNode(15);
LevelOrderTraversal.printLevelOrderTraversal(root);
System.out.println("\n \nHeight of tree found using RECURSION is: " + heightOfTree(root));
System.out.println("\n \nHeight of tree found using LEVEL ORDER TRAVERSAL is: " + heightOfTreeUsingLevelOrder(root));
}
// private static int heightOfTree(BinaryNode root) {
//
// if(root==null) {
// return 0;
// }
//
// int left = heightOfTree(root.left);
// int right = heightOfTree(root.right);
// int max = (left>right? left:right);
// // height of left/right subtree + 1 for the node itself
// return max+1;
// }
private static int heightOfTree(BinaryNode root) {
if(root == null) {
return 0;
}
return Math.max(heightOfTree(root.left), heightOfTree(root.right)) + 1;
}
private static int heightOfTreeUsingLevelOrder(BinaryNode root) {
Queue<BinaryNode> q = new LinkedList<BinaryNode>();
int level=1;
// return if root is null
if(root == null){
return 0;
}// else add root to the queue
q.add(root);
q.add(null);
while(!q.isEmpty()) {
BinaryNode node = q.poll();
if(node!=null){
if(node.right!=null) {
q.add(node.right);
}
if(node.left!=null) {
q.add(node.left);
}
} else {
if(!q.isEmpty()){
q.add(null);
level++;
}
}
}
return level;
}
}
| UTF-8 | Java | 1,675 | java | HeightOfTree.java | Java | [] | null | [] | package binary_tress;
import java.util.LinkedList;
import java.util.Queue;
public class HeightOfTree {
public static void main(String[] args) {
BinaryNode root = BinaryTree.generateRandomBinaryTree();
System.out.println("\nOriginal Tree\n");
root.left.left.left = new BinaryNode(10);
root.left.left.left.right = new BinaryNode(15);
LevelOrderTraversal.printLevelOrderTraversal(root);
System.out.println("\n \nHeight of tree found using RECURSION is: " + heightOfTree(root));
System.out.println("\n \nHeight of tree found using LEVEL ORDER TRAVERSAL is: " + heightOfTreeUsingLevelOrder(root));
}
// private static int heightOfTree(BinaryNode root) {
//
// if(root==null) {
// return 0;
// }
//
// int left = heightOfTree(root.left);
// int right = heightOfTree(root.right);
// int max = (left>right? left:right);
// // height of left/right subtree + 1 for the node itself
// return max+1;
// }
private static int heightOfTree(BinaryNode root) {
if(root == null) {
return 0;
}
return Math.max(heightOfTree(root.left), heightOfTree(root.right)) + 1;
}
private static int heightOfTreeUsingLevelOrder(BinaryNode root) {
Queue<BinaryNode> q = new LinkedList<BinaryNode>();
int level=1;
// return if root is null
if(root == null){
return 0;
}// else add root to the queue
q.add(root);
q.add(null);
while(!q.isEmpty()) {
BinaryNode node = q.poll();
if(node!=null){
if(node.right!=null) {
q.add(node.right);
}
if(node.left!=null) {
q.add(node.left);
}
} else {
if(!q.isEmpty()){
q.add(null);
level++;
}
}
}
return level;
}
}
| 1,675 | 0.644776 | 0.638209 | 69 | 23.275362 | 23.672821 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.695652 | false | false | 10 |
062c59c37437a6ff74c0fab22d9f3bf41c8c0210 | 19,439,021,988,505 | 5d76b555a3614ab0f156bcad357e45c94d121e2d | /src-v2/com/fasterxml/jackson/databind/cfg/DeserializerFactoryConfig.java | 8fa47d7ce05e54a7bb6eece2adc38f04eeca8a85 | [] | no_license | BinSlashBash/xcrumby | https://github.com/BinSlashBash/xcrumby | 8e09282387e2e82d12957d22fa1bb0322f6e6227 | 5b8b1cc8537ae1cfb59448d37b6efca01dded347 | refs/heads/master | 2016-09-01T05:58:46.144000 | 2016-02-15T13:23:25 | 2016-02-15T13:23:25 | 51,755,603 | 5 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Decompiled with CFR 0_110.
*/
package com.fasterxml.jackson.databind.cfg;
import com.fasterxml.jackson.databind.AbstractTypeResolver;
import com.fasterxml.jackson.databind.deser.BeanDeserializerModifier;
import com.fasterxml.jackson.databind.deser.Deserializers;
import com.fasterxml.jackson.databind.deser.KeyDeserializers;
import com.fasterxml.jackson.databind.deser.ValueInstantiators;
import com.fasterxml.jackson.databind.deser.std.StdKeyDeserializers;
import com.fasterxml.jackson.databind.util.ArrayBuilders;
import com.fasterxml.jackson.databind.util.ArrayIterator;
import java.io.Serializable;
public class DeserializerFactoryConfig
implements Serializable {
protected static final KeyDeserializers[] DEFAULT_KEY_DESERIALIZERS;
protected static final AbstractTypeResolver[] NO_ABSTRACT_TYPE_RESOLVERS;
protected static final Deserializers[] NO_DESERIALIZERS;
protected static final BeanDeserializerModifier[] NO_MODIFIERS;
protected static final ValueInstantiators[] NO_VALUE_INSTANTIATORS;
private static final long serialVersionUID = 3683541151102256824L;
protected final AbstractTypeResolver[] _abstractTypeResolvers;
protected final Deserializers[] _additionalDeserializers;
protected final KeyDeserializers[] _additionalKeyDeserializers;
protected final BeanDeserializerModifier[] _modifiers;
protected final ValueInstantiators[] _valueInstantiators;
static {
NO_DESERIALIZERS = new Deserializers[0];
NO_MODIFIERS = new BeanDeserializerModifier[0];
NO_ABSTRACT_TYPE_RESOLVERS = new AbstractTypeResolver[0];
NO_VALUE_INSTANTIATORS = new ValueInstantiators[0];
DEFAULT_KEY_DESERIALIZERS = new KeyDeserializers[]{new StdKeyDeserializers()};
}
public DeserializerFactoryConfig() {
this(null, null, null, null, null);
}
protected DeserializerFactoryConfig(Deserializers[] arrdeserializers, KeyDeserializers[] arrkeyDeserializers, BeanDeserializerModifier[] arrbeanDeserializerModifier, AbstractTypeResolver[] arrabstractTypeResolver, ValueInstantiators[] arrvalueInstantiators) {
Deserializers[] arrdeserializers2 = arrdeserializers;
if (arrdeserializers == null) {
arrdeserializers2 = NO_DESERIALIZERS;
}
this._additionalDeserializers = arrdeserializers2;
arrdeserializers = arrkeyDeserializers;
if (arrkeyDeserializers == null) {
arrdeserializers = DEFAULT_KEY_DESERIALIZERS;
}
this._additionalKeyDeserializers = arrdeserializers;
arrdeserializers = arrbeanDeserializerModifier;
if (arrbeanDeserializerModifier == null) {
arrdeserializers = NO_MODIFIERS;
}
this._modifiers = arrdeserializers;
arrdeserializers = arrabstractTypeResolver;
if (arrabstractTypeResolver == null) {
arrdeserializers = NO_ABSTRACT_TYPE_RESOLVERS;
}
this._abstractTypeResolvers = arrdeserializers;
arrdeserializers = arrvalueInstantiators;
if (arrvalueInstantiators == null) {
arrdeserializers = NO_VALUE_INSTANTIATORS;
}
this._valueInstantiators = arrdeserializers;
}
public Iterable<AbstractTypeResolver> abstractTypeResolvers() {
return new ArrayIterator<AbstractTypeResolver>(this._abstractTypeResolvers);
}
public Iterable<BeanDeserializerModifier> deserializerModifiers() {
return new ArrayIterator<BeanDeserializerModifier>(this._modifiers);
}
public Iterable<Deserializers> deserializers() {
return new ArrayIterator<Deserializers>(this._additionalDeserializers);
}
public boolean hasAbstractTypeResolvers() {
if (this._abstractTypeResolvers.length > 0) {
return true;
}
return false;
}
public boolean hasDeserializerModifiers() {
if (this._modifiers.length > 0) {
return true;
}
return false;
}
public boolean hasDeserializers() {
if (this._additionalDeserializers.length > 0) {
return true;
}
return false;
}
public boolean hasKeyDeserializers() {
if (this._additionalKeyDeserializers.length > 0) {
return true;
}
return false;
}
public boolean hasValueInstantiators() {
if (this._valueInstantiators.length > 0) {
return true;
}
return false;
}
public Iterable<KeyDeserializers> keyDeserializers() {
return new ArrayIterator<KeyDeserializers>(this._additionalKeyDeserializers);
}
public Iterable<ValueInstantiators> valueInstantiators() {
return new ArrayIterator<ValueInstantiators>(this._valueInstantiators);
}
public DeserializerFactoryConfig withAbstractTypeResolver(AbstractTypeResolver arrabstractTypeResolver) {
if (arrabstractTypeResolver == null) {
throw new IllegalArgumentException("Can not pass null resolver");
}
arrabstractTypeResolver = ArrayBuilders.insertInListNoDup(this._abstractTypeResolvers, arrabstractTypeResolver);
return new DeserializerFactoryConfig(this._additionalDeserializers, this._additionalKeyDeserializers, this._modifiers, arrabstractTypeResolver, this._valueInstantiators);
}
public DeserializerFactoryConfig withAdditionalDeserializers(Deserializers deserializers) {
if (deserializers == null) {
throw new IllegalArgumentException("Can not pass null Deserializers");
}
return new DeserializerFactoryConfig(ArrayBuilders.insertInListNoDup(this._additionalDeserializers, deserializers), this._additionalKeyDeserializers, this._modifiers, this._abstractTypeResolvers, this._valueInstantiators);
}
public DeserializerFactoryConfig withAdditionalKeyDeserializers(KeyDeserializers arrkeyDeserializers) {
if (arrkeyDeserializers == null) {
throw new IllegalArgumentException("Can not pass null KeyDeserializers");
}
arrkeyDeserializers = ArrayBuilders.insertInListNoDup(this._additionalKeyDeserializers, arrkeyDeserializers);
return new DeserializerFactoryConfig(this._additionalDeserializers, arrkeyDeserializers, this._modifiers, this._abstractTypeResolvers, this._valueInstantiators);
}
public DeserializerFactoryConfig withDeserializerModifier(BeanDeserializerModifier arrbeanDeserializerModifier) {
if (arrbeanDeserializerModifier == null) {
throw new IllegalArgumentException("Can not pass null modifier");
}
arrbeanDeserializerModifier = ArrayBuilders.insertInListNoDup(this._modifiers, arrbeanDeserializerModifier);
return new DeserializerFactoryConfig(this._additionalDeserializers, this._additionalKeyDeserializers, arrbeanDeserializerModifier, this._abstractTypeResolvers, this._valueInstantiators);
}
public DeserializerFactoryConfig withValueInstantiators(ValueInstantiators arrvalueInstantiators) {
if (arrvalueInstantiators == null) {
throw new IllegalArgumentException("Can not pass null resolver");
}
arrvalueInstantiators = ArrayBuilders.insertInListNoDup(this._valueInstantiators, arrvalueInstantiators);
return new DeserializerFactoryConfig(this._additionalDeserializers, this._additionalKeyDeserializers, this._modifiers, this._abstractTypeResolvers, arrvalueInstantiators);
}
}
| UTF-8 | Java | 7,442 | java | DeserializerFactoryConfig.java | Java | [] | null | [] | /*
* Decompiled with CFR 0_110.
*/
package com.fasterxml.jackson.databind.cfg;
import com.fasterxml.jackson.databind.AbstractTypeResolver;
import com.fasterxml.jackson.databind.deser.BeanDeserializerModifier;
import com.fasterxml.jackson.databind.deser.Deserializers;
import com.fasterxml.jackson.databind.deser.KeyDeserializers;
import com.fasterxml.jackson.databind.deser.ValueInstantiators;
import com.fasterxml.jackson.databind.deser.std.StdKeyDeserializers;
import com.fasterxml.jackson.databind.util.ArrayBuilders;
import com.fasterxml.jackson.databind.util.ArrayIterator;
import java.io.Serializable;
public class DeserializerFactoryConfig
implements Serializable {
protected static final KeyDeserializers[] DEFAULT_KEY_DESERIALIZERS;
protected static final AbstractTypeResolver[] NO_ABSTRACT_TYPE_RESOLVERS;
protected static final Deserializers[] NO_DESERIALIZERS;
protected static final BeanDeserializerModifier[] NO_MODIFIERS;
protected static final ValueInstantiators[] NO_VALUE_INSTANTIATORS;
private static final long serialVersionUID = 3683541151102256824L;
protected final AbstractTypeResolver[] _abstractTypeResolvers;
protected final Deserializers[] _additionalDeserializers;
protected final KeyDeserializers[] _additionalKeyDeserializers;
protected final BeanDeserializerModifier[] _modifiers;
protected final ValueInstantiators[] _valueInstantiators;
static {
NO_DESERIALIZERS = new Deserializers[0];
NO_MODIFIERS = new BeanDeserializerModifier[0];
NO_ABSTRACT_TYPE_RESOLVERS = new AbstractTypeResolver[0];
NO_VALUE_INSTANTIATORS = new ValueInstantiators[0];
DEFAULT_KEY_DESERIALIZERS = new KeyDeserializers[]{new StdKeyDeserializers()};
}
public DeserializerFactoryConfig() {
this(null, null, null, null, null);
}
protected DeserializerFactoryConfig(Deserializers[] arrdeserializers, KeyDeserializers[] arrkeyDeserializers, BeanDeserializerModifier[] arrbeanDeserializerModifier, AbstractTypeResolver[] arrabstractTypeResolver, ValueInstantiators[] arrvalueInstantiators) {
Deserializers[] arrdeserializers2 = arrdeserializers;
if (arrdeserializers == null) {
arrdeserializers2 = NO_DESERIALIZERS;
}
this._additionalDeserializers = arrdeserializers2;
arrdeserializers = arrkeyDeserializers;
if (arrkeyDeserializers == null) {
arrdeserializers = DEFAULT_KEY_DESERIALIZERS;
}
this._additionalKeyDeserializers = arrdeserializers;
arrdeserializers = arrbeanDeserializerModifier;
if (arrbeanDeserializerModifier == null) {
arrdeserializers = NO_MODIFIERS;
}
this._modifiers = arrdeserializers;
arrdeserializers = arrabstractTypeResolver;
if (arrabstractTypeResolver == null) {
arrdeserializers = NO_ABSTRACT_TYPE_RESOLVERS;
}
this._abstractTypeResolvers = arrdeserializers;
arrdeserializers = arrvalueInstantiators;
if (arrvalueInstantiators == null) {
arrdeserializers = NO_VALUE_INSTANTIATORS;
}
this._valueInstantiators = arrdeserializers;
}
public Iterable<AbstractTypeResolver> abstractTypeResolvers() {
return new ArrayIterator<AbstractTypeResolver>(this._abstractTypeResolvers);
}
public Iterable<BeanDeserializerModifier> deserializerModifiers() {
return new ArrayIterator<BeanDeserializerModifier>(this._modifiers);
}
public Iterable<Deserializers> deserializers() {
return new ArrayIterator<Deserializers>(this._additionalDeserializers);
}
public boolean hasAbstractTypeResolvers() {
if (this._abstractTypeResolvers.length > 0) {
return true;
}
return false;
}
public boolean hasDeserializerModifiers() {
if (this._modifiers.length > 0) {
return true;
}
return false;
}
public boolean hasDeserializers() {
if (this._additionalDeserializers.length > 0) {
return true;
}
return false;
}
public boolean hasKeyDeserializers() {
if (this._additionalKeyDeserializers.length > 0) {
return true;
}
return false;
}
public boolean hasValueInstantiators() {
if (this._valueInstantiators.length > 0) {
return true;
}
return false;
}
public Iterable<KeyDeserializers> keyDeserializers() {
return new ArrayIterator<KeyDeserializers>(this._additionalKeyDeserializers);
}
public Iterable<ValueInstantiators> valueInstantiators() {
return new ArrayIterator<ValueInstantiators>(this._valueInstantiators);
}
public DeserializerFactoryConfig withAbstractTypeResolver(AbstractTypeResolver arrabstractTypeResolver) {
if (arrabstractTypeResolver == null) {
throw new IllegalArgumentException("Can not pass null resolver");
}
arrabstractTypeResolver = ArrayBuilders.insertInListNoDup(this._abstractTypeResolvers, arrabstractTypeResolver);
return new DeserializerFactoryConfig(this._additionalDeserializers, this._additionalKeyDeserializers, this._modifiers, arrabstractTypeResolver, this._valueInstantiators);
}
public DeserializerFactoryConfig withAdditionalDeserializers(Deserializers deserializers) {
if (deserializers == null) {
throw new IllegalArgumentException("Can not pass null Deserializers");
}
return new DeserializerFactoryConfig(ArrayBuilders.insertInListNoDup(this._additionalDeserializers, deserializers), this._additionalKeyDeserializers, this._modifiers, this._abstractTypeResolvers, this._valueInstantiators);
}
public DeserializerFactoryConfig withAdditionalKeyDeserializers(KeyDeserializers arrkeyDeserializers) {
if (arrkeyDeserializers == null) {
throw new IllegalArgumentException("Can not pass null KeyDeserializers");
}
arrkeyDeserializers = ArrayBuilders.insertInListNoDup(this._additionalKeyDeserializers, arrkeyDeserializers);
return new DeserializerFactoryConfig(this._additionalDeserializers, arrkeyDeserializers, this._modifiers, this._abstractTypeResolvers, this._valueInstantiators);
}
public DeserializerFactoryConfig withDeserializerModifier(BeanDeserializerModifier arrbeanDeserializerModifier) {
if (arrbeanDeserializerModifier == null) {
throw new IllegalArgumentException("Can not pass null modifier");
}
arrbeanDeserializerModifier = ArrayBuilders.insertInListNoDup(this._modifiers, arrbeanDeserializerModifier);
return new DeserializerFactoryConfig(this._additionalDeserializers, this._additionalKeyDeserializers, arrbeanDeserializerModifier, this._abstractTypeResolvers, this._valueInstantiators);
}
public DeserializerFactoryConfig withValueInstantiators(ValueInstantiators arrvalueInstantiators) {
if (arrvalueInstantiators == null) {
throw new IllegalArgumentException("Can not pass null resolver");
}
arrvalueInstantiators = ArrayBuilders.insertInListNoDup(this._valueInstantiators, arrvalueInstantiators);
return new DeserializerFactoryConfig(this._additionalDeserializers, this._additionalKeyDeserializers, this._modifiers, this._abstractTypeResolvers, arrvalueInstantiators);
}
}
| 7,442 | 0.73663 | 0.731927 | 163 | 44.650307 | 44.452019 | 263 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.638037 | false | false | 10 |
4820625420c9383228d30537cfbacb98d1b1f1d1 | 26,800,595,997,837 | 1e177830d56a9e098d8411cf65e0c06360179069 | /src/tw/edu/chit/struts/action/course/ajax/shMember.java | 2b47d408bd71b6c005fbfecb37904476e46f5c57 | [] | no_license | bellmit/CIS | https://github.com/bellmit/CIS | fa2133517133393eb763f481ffb1dfadb32bd4f6 | c50a6aa66e3e772716bf4c1e908b38e8212fd31f | refs/heads/master | 2023-06-02T23:01:46.137000 | 2021-06-16T06:16:57 | 2021-06-16T06:16:57 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package tw.edu.chit.struts.action.course.ajax;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import tw.edu.chit.service.CourseManager;
/**
* 處理empl、dempl的混合自動完成
* @author JOHN
*
*/
public class shMember extends HttpServlet{
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
WebApplicationContext ctx=WebApplicationContextUtils.getRequiredWebApplicationContext(this.getServletContext());
CourseManager manager=(CourseManager) ctx.getBean("courseManager");
String tmp;
List members=new ArrayList();
Map map;
String type=request.getParameter("type");
if(type.equals("s")){
String stNameNo=request.getParameter("stNameNo");
String ClassNo=request.getParameter("Cidno")+request.getParameter("Sidno")+
request.getParameter("Didno")+request.getParameter("Grade")+request.getParameter("ClassNo");
if(!stNameNo.equals("")){
members.addAll(manager.ezGetBy("SELECT c.ClassName as uname, s.student_name as cname, s.Email FROM stmd s, Class c WHERE (s.student_no LIKE'%"+stNameNo+"%' " +
"OR s.student_name LIKE'%"+stNameNo+"%') AND c.ClassNo=s.depart_class AND s.Email IS NOT NULL LIMIT 500"));
}else{
members.addAll(manager.ezGetBy("SELECT c.ClassName as uname, s.student_name as cname, s.Email FROM stmd s, Class c WHERE " +
"s.depart_class LIKE'"+ClassNo+"%' AND c.ClassNo=s.depart_class AND s.Email IS NOT NULL LIMIT 500"));
}
}
//查詢教職員
if(type.equals("e")){
String group=request.getParameter("group");
String myGroup=request.getParameter("myGroup");
String cname=request.getParameter("cname");
String sname=request.getParameter("sname");
String unit=request.getParameter("unit");
String category=request.getParameter("category");
String Tutor=request.getParameter("Tutor");
String pcode=request.getParameter("pcode");
String Director=request.getParameter("Director");
if(!group.equals("")){
tmp=tmp=manager.ezGetString("SELECT members FROM TxtGroup WHERE Oid="+group);
map=manager.analyseEmpl(tmp);
members.addAll((List)map.get("empls"));
}
if(!myGroup.equals("")){
tmp=tmp=manager.ezGetString("SELECT members FROM TxtGroup WHERE Oid="+myGroup);
map=manager.analyseEmpl(tmp);
members.addAll((List)map.get("empls"));
}
if(!cname.equals("")){
members.addAll(manager.ezGetBy("SELECT e.idno, e.cname, e.Email, c.name as uname FROM empl e LEFT OUTER JOIN CodeEmpl c ON e.unit=c.idno AND " +
"(c.category='UnitTeach' OR c.category='Unit') WHERE e.cname LIKE'%"+cname+"%' AND Email!='' AND Email IS NOT NULL"));
}
if(!sname.equals("")){
members.addAll(manager.ezGetBy("SELECT e.idno, e.cname, e.Email, c.name as uname FROM empl e LEFT OUTER JOIN CodeEmpl c ON e.unit=c.idno AND " +
"(c.category='UnitTeach' OR c.category='Unit') WHERE e.sname LIKE'%"+sname+"%' AND Email!='' AND Email IS NOT NULL"));
}
if(!unit.equals("")){
members.addAll(manager.ezGetBy("SELECT e.idno, e.cname, e.Email, c.name as uname FROM empl e LEFT OUTER JOIN CodeEmpl c ON e.unit=c.idno AND " +
"(c.category='UnitTeach' OR c.category='Unit') WHERE e.unit='"+unit+"' AND Email!='' AND Email IS NOT NULL"));
}
if(!category.equals("")){
members.addAll(manager.ezGetBy("SELECT e.idno, e.cname, e.Email, c.name as uname FROM empl e LEFT OUTER JOIN CodeEmpl c ON e.unit=c.idno AND " +
"(c.category='UnitTeach' OR c.category='Unit') WHERE e.category='"+category+"' AND Email!='' AND Email IS NOT NULL"));
}
if(!Tutor.equals("")){
members.addAll(manager.ezGetBy("SELECT e.idno, e.cname, e.Email, c.name as uname FROM empl e LEFT OUTER JOIN CodeEmpl c ON e.unit=c.idno AND " +
"(c.category='UnitTeach' OR c.category='Unit') WHERE e.Tutor='"+Tutor+"' AND Email!='' AND Email IS NOT NULL"));
}
if(!pcode.equals("")){
members.addAll(manager.ezGetBy("SELECT e.idno, e.cname, e.Email, c.name as uname FROM empl e LEFT OUTER JOIN CodeEmpl c ON e.unit=c.idno AND " +
"(c.category='UnitTeach' OR c.category='Unit') WHERE e.pcode='"+pcode+"' AND Email!='' AND Email IS NOT NULL"));
}
if(!Director.equals("")){
members.addAll(manager.ezGetBy("SELECT e.idno, e.cname, e.Email, c.name as uname FROM empl e LEFT OUTER JOIN CodeEmpl c ON e.unit=c.idno AND " +
"(c.category='UnitTeach' OR c.category='Unit') WHERE e.Director='"+Director+"' AND Email!='' AND Email IS NOT NULL"));
}
}
response.setContentType("text/xml; charset=UTF-8");
PrintWriter out=response.getWriter();
out.println("<pront>");
if(members.size()>0){
for(int i=0; i<members.size(); i++){
out.println("<name>"+((Map)members.get(i)).get("cname")+"</name>");
out.println("<email>"+((Map)members.get(i)).get("Email")+"</email>");
out.println("<uname>"+((Map)members.get(i)).get("uname")+"</uname>");
}
}else{
out.println("<name>查無名稱</name>");
out.println("<email>無對應電子郵件</email>");
out.println("<email>無對應單位</email>");
}
out.println("</pront>");
out.close();
}
}
| UTF-8 | Java | 5,549 | java | shMember.java | Java | [
{
"context": "rseManager;\n\n/**\n * 處理empl、dempl的混合自動完成\n * @author JOHN\n *\n */\npublic class shMember extends HttpServlet{",
"end": 573,
"score": 0.7311167120933533,
"start": 569,
"tag": "NAME",
"value": "JOHN"
}
] | null | [] | package tw.edu.chit.struts.action.course.ajax;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import tw.edu.chit.service.CourseManager;
/**
* 處理empl、dempl的混合自動完成
* @author JOHN
*
*/
public class shMember extends HttpServlet{
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
WebApplicationContext ctx=WebApplicationContextUtils.getRequiredWebApplicationContext(this.getServletContext());
CourseManager manager=(CourseManager) ctx.getBean("courseManager");
String tmp;
List members=new ArrayList();
Map map;
String type=request.getParameter("type");
if(type.equals("s")){
String stNameNo=request.getParameter("stNameNo");
String ClassNo=request.getParameter("Cidno")+request.getParameter("Sidno")+
request.getParameter("Didno")+request.getParameter("Grade")+request.getParameter("ClassNo");
if(!stNameNo.equals("")){
members.addAll(manager.ezGetBy("SELECT c.ClassName as uname, s.student_name as cname, s.Email FROM stmd s, Class c WHERE (s.student_no LIKE'%"+stNameNo+"%' " +
"OR s.student_name LIKE'%"+stNameNo+"%') AND c.ClassNo=s.depart_class AND s.Email IS NOT NULL LIMIT 500"));
}else{
members.addAll(manager.ezGetBy("SELECT c.ClassName as uname, s.student_name as cname, s.Email FROM stmd s, Class c WHERE " +
"s.depart_class LIKE'"+ClassNo+"%' AND c.ClassNo=s.depart_class AND s.Email IS NOT NULL LIMIT 500"));
}
}
//查詢教職員
if(type.equals("e")){
String group=request.getParameter("group");
String myGroup=request.getParameter("myGroup");
String cname=request.getParameter("cname");
String sname=request.getParameter("sname");
String unit=request.getParameter("unit");
String category=request.getParameter("category");
String Tutor=request.getParameter("Tutor");
String pcode=request.getParameter("pcode");
String Director=request.getParameter("Director");
if(!group.equals("")){
tmp=tmp=manager.ezGetString("SELECT members FROM TxtGroup WHERE Oid="+group);
map=manager.analyseEmpl(tmp);
members.addAll((List)map.get("empls"));
}
if(!myGroup.equals("")){
tmp=tmp=manager.ezGetString("SELECT members FROM TxtGroup WHERE Oid="+myGroup);
map=manager.analyseEmpl(tmp);
members.addAll((List)map.get("empls"));
}
if(!cname.equals("")){
members.addAll(manager.ezGetBy("SELECT e.idno, e.cname, e.Email, c.name as uname FROM empl e LEFT OUTER JOIN CodeEmpl c ON e.unit=c.idno AND " +
"(c.category='UnitTeach' OR c.category='Unit') WHERE e.cname LIKE'%"+cname+"%' AND Email!='' AND Email IS NOT NULL"));
}
if(!sname.equals("")){
members.addAll(manager.ezGetBy("SELECT e.idno, e.cname, e.Email, c.name as uname FROM empl e LEFT OUTER JOIN CodeEmpl c ON e.unit=c.idno AND " +
"(c.category='UnitTeach' OR c.category='Unit') WHERE e.sname LIKE'%"+sname+"%' AND Email!='' AND Email IS NOT NULL"));
}
if(!unit.equals("")){
members.addAll(manager.ezGetBy("SELECT e.idno, e.cname, e.Email, c.name as uname FROM empl e LEFT OUTER JOIN CodeEmpl c ON e.unit=c.idno AND " +
"(c.category='UnitTeach' OR c.category='Unit') WHERE e.unit='"+unit+"' AND Email!='' AND Email IS NOT NULL"));
}
if(!category.equals("")){
members.addAll(manager.ezGetBy("SELECT e.idno, e.cname, e.Email, c.name as uname FROM empl e LEFT OUTER JOIN CodeEmpl c ON e.unit=c.idno AND " +
"(c.category='UnitTeach' OR c.category='Unit') WHERE e.category='"+category+"' AND Email!='' AND Email IS NOT NULL"));
}
if(!Tutor.equals("")){
members.addAll(manager.ezGetBy("SELECT e.idno, e.cname, e.Email, c.name as uname FROM empl e LEFT OUTER JOIN CodeEmpl c ON e.unit=c.idno AND " +
"(c.category='UnitTeach' OR c.category='Unit') WHERE e.Tutor='"+Tutor+"' AND Email!='' AND Email IS NOT NULL"));
}
if(!pcode.equals("")){
members.addAll(manager.ezGetBy("SELECT e.idno, e.cname, e.Email, c.name as uname FROM empl e LEFT OUTER JOIN CodeEmpl c ON e.unit=c.idno AND " +
"(c.category='UnitTeach' OR c.category='Unit') WHERE e.pcode='"+pcode+"' AND Email!='' AND Email IS NOT NULL"));
}
if(!Director.equals("")){
members.addAll(manager.ezGetBy("SELECT e.idno, e.cname, e.Email, c.name as uname FROM empl e LEFT OUTER JOIN CodeEmpl c ON e.unit=c.idno AND " +
"(c.category='UnitTeach' OR c.category='Unit') WHERE e.Director='"+Director+"' AND Email!='' AND Email IS NOT NULL"));
}
}
response.setContentType("text/xml; charset=UTF-8");
PrintWriter out=response.getWriter();
out.println("<pront>");
if(members.size()>0){
for(int i=0; i<members.size(); i++){
out.println("<name>"+((Map)members.get(i)).get("cname")+"</name>");
out.println("<email>"+((Map)members.get(i)).get("Email")+"</email>");
out.println("<uname>"+((Map)members.get(i)).get("uname")+"</uname>");
}
}else{
out.println("<name>查無名稱</name>");
out.println("<email>無對應電子郵件</email>");
out.println("<email>無對應單位</email>");
}
out.println("</pront>");
out.close();
}
}
| 5,549 | 0.683798 | 0.682158 | 128 | 41.867188 | 44.364853 | 163 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.320313 | false | false | 10 |
74031b77d36d15c507728e444a4b71a42922d598 | 39,393,440,053,284 | 0354b95c8f07e450358c52266bd89cde4c2551f3 | /YoOffer/src/main/java/edu/pezzati/yo/offer/exception/InvalidOffer.java | c6f03a5b2b6fde0bed2512a94e5f9da99deff1dd | [] | no_license | fpezzati/Yomoka | https://github.com/fpezzati/Yomoka | aeb826b8c57b371825ef27c6e4e2088050ef02d7 | e8a8e2a4dc25eaa83724f9b6c72c2e05afbce157 | refs/heads/master | 2021-01-12T09:54:55.358000 | 2017-04-12T06:58:28 | 2017-04-12T06:58:28 | 76,297,422 | 5 | 7 | null | null | null | null | null | null | null | null | null | null | null | null | null | package edu.pezzati.yo.offer.exception;
public class InvalidOffer extends OfferException {
private static final long serialVersionUID = -6928662464387518361L;
public InvalidOffer(String message) {
super(message);
}
}
| UTF-8 | Java | 233 | java | InvalidOffer.java | Java | [] | null | [] | package edu.pezzati.yo.offer.exception;
public class InvalidOffer extends OfferException {
private static final long serialVersionUID = -6928662464387518361L;
public InvalidOffer(String message) {
super(message);
}
}
| 233 | 0.763949 | 0.682403 | 10 | 22.299999 | 24.601017 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 10 |
8a7214dc00880864b2dce1e843b3f01cbe480d1c | 38,439,957,323,109 | 1b87bbb52f8e84be06b777b570ad04863a5408dc | /AsteroidsGame/Congratulator.java | b74e4cb8db223165461ee38ef594f709afdcffaa | [] | no_license | rami-alkhooli/Asteroids_Game_SS20 | https://github.com/rami-alkhooli/Asteroids_Game_SS20 | 07f70a09b194dacd990ce2731ac1b821a572afd5 | d13eeec33712b4f0a6b29be68d387146f5630b82 | refs/heads/master | 2022-11-28T12:20:03.826000 | 2020-08-02T18:17:23 | 2020-08-02T18:17:23 | 250,512,457 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | public class Congratulator
{
private boolean won;
/**
* The constructor.
**/
public Congratulator() {
won = false;
}
/**
* This method sets the state of the game to won.
**/
public void winGame() {
won = true;
}
/**
* This method resets the state of the game.
**/
public void restartGame() {
won = false;
}
/**
* This method is used to notify the game and change the gui.
**/
public boolean isGameWon() {
return won;
}
}
| UTF-8 | Java | 489 | java | Congratulator.java | Java | [] | null | [] | public class Congratulator
{
private boolean won;
/**
* The constructor.
**/
public Congratulator() {
won = false;
}
/**
* This method sets the state of the game to won.
**/
public void winGame() {
won = true;
}
/**
* This method resets the state of the game.
**/
public void restartGame() {
won = false;
}
/**
* This method is used to notify the game and change the gui.
**/
public boolean isGameWon() {
return won;
}
}
| 489 | 0.574642 | 0.574642 | 32 | 14.28125 | 15.468182 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.15625 | false | false | 10 |
24e5d224cf91bf5ed73301e53dea77bc4ed563ba | 38,474,317,060,558 | 60c10267890c162620201da931184981553b3ff7 | /platform/lang-api/src/com/intellij/psi/PsiIncludeManager.java | df4075c67a3b3ba805dd223f0c4d60971be424d4 | [
"Apache-2.0"
] | permissive | soucod/jdksoucod-ideasc-2010 | https://github.com/soucod/jdksoucod-ideasc-2010 | 83ece81ecc27c7a9666a999c5166c0d544e59b63 | ec263374d9cee8080e7200130b65fa4889969f98 | refs/heads/master | 2020-12-02T20:25:59.866000 | 2020-01-02T17:42:14 | 2020-01-02T17:42:14 | 231,110,230 | 0 | 0 | Apache-2.0 | false | 2020-11-16T02:42:20 | 2019-12-31T15:26:43 | 2020-01-05T15:44:45 | 2020-11-16T02:42:10 | 164,990 | 0 | 0 | 1 | Java | false | false | /*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.psi;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.pom.event.PomModelEvent;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* @author mike
*
* @deprecated use {@link com.intellij.psi.impl.include.FileIncludeManager} instead
*/
public interface PsiIncludeManager {
ExtensionPointName<PsiIncludeHandler> EP_NAME = new ExtensionPointName<PsiIncludeHandler>("com.intellij.psi.includeHandler");
@NotNull
PsiFile[] getIncludingFiles(@NotNull PsiFile file);
void includeProcessed(@NotNull PsiElement includeDirective);
interface PsiIncludeHandler {
boolean shouldCheckFile(@NotNull VirtualFile psiFile);
IncludeInfo[] findIncludes(PsiFile psiFile);
void includeChanged(final PsiElement includeDirective, final PsiFile targetFile, final PomModelEvent event);
}
final class IncludeInfo {
public static final IncludeInfo[] EMPTY_ARRAY = new IncludeInfo[0];
public @Nullable final PsiFile targetFile;
public @Nullable final PsiElement includeDirective;
public @NotNull final String[] possibleTargetFileNames;
public @NotNull final PsiIncludeHandler handler;
public IncludeInfo(@Nullable final PsiFile targetFile,
@Nullable final PsiElement includeDirective,
String[] possibleTargetFileNames, final PsiIncludeHandler handler) {
this.targetFile = targetFile;
this.includeDirective = includeDirective;
this.possibleTargetFileNames = possibleTargetFileNames;
this.handler = handler;
}
}
}
| UTF-8 | Java | 2,254 | java | PsiIncludeManager.java | Java | [
{
"context": "rg.jetbrains.annotations.Nullable;\n\n/**\n * @author mike\n *\n * @deprecated use {@link com.intellij.psi.imp",
"end": 883,
"score": 0.9990233182907104,
"start": 879,
"tag": "USERNAME",
"value": "mike"
}
] | null | [] | /*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.psi;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.pom.event.PomModelEvent;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* @author mike
*
* @deprecated use {@link com.intellij.psi.impl.include.FileIncludeManager} instead
*/
public interface PsiIncludeManager {
ExtensionPointName<PsiIncludeHandler> EP_NAME = new ExtensionPointName<PsiIncludeHandler>("com.intellij.psi.includeHandler");
@NotNull
PsiFile[] getIncludingFiles(@NotNull PsiFile file);
void includeProcessed(@NotNull PsiElement includeDirective);
interface PsiIncludeHandler {
boolean shouldCheckFile(@NotNull VirtualFile psiFile);
IncludeInfo[] findIncludes(PsiFile psiFile);
void includeChanged(final PsiElement includeDirective, final PsiFile targetFile, final PomModelEvent event);
}
final class IncludeInfo {
public static final IncludeInfo[] EMPTY_ARRAY = new IncludeInfo[0];
public @Nullable final PsiFile targetFile;
public @Nullable final PsiElement includeDirective;
public @NotNull final String[] possibleTargetFileNames;
public @NotNull final PsiIncludeHandler handler;
public IncludeInfo(@Nullable final PsiFile targetFile,
@Nullable final PsiElement includeDirective,
String[] possibleTargetFileNames, final PsiIncludeHandler handler) {
this.targetFile = targetFile;
this.includeDirective = includeDirective;
this.possibleTargetFileNames = possibleTargetFileNames;
this.handler = handler;
}
}
}
| 2,254 | 0.756433 | 0.750665 | 61 | 35.950821 | 31.242271 | 127 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.508197 | false | false | 10 |
74fca57bd27882df123e6121ef90cb7144e605d1 | 34,179,349,796,909 | f29c89a6749489a0c3056ab42851a39e0b81186f | /src/main/java/com/qianfeng/controller/RightController.java | 2069e10297d9baad11803f50f617540b590f94a7 | [] | no_license | doyouself88/CRM | https://github.com/doyouself88/CRM | f050fbd2f51ffc7c85a79e8b8fb552ba667069e6 | fd407e4ce226d267000fb19333acc0e65b4f3274 | refs/heads/master | 2022-12-23T08:09:17.285000 | 2019-05-28T03:22:23 | 2019-05-28T03:22:23 | 188,939,389 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.qianfeng.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.qianfeng.service.SysRightService;
import com.qianfeng.vo.JsonBean;
import com.qianfeng.vo.VTreeInfo;
/**
* @author 张毅
*
* @date 2019年5月22日下午3:09:54
*/
@Controller
@RequestMapping("/right")
@ResponseBody
public class RightController {
@Autowired
private SysRightService sysRightService;
@RequestMapping("/tree.do")
public JsonBean findTreeNodes(int roleId) {
List<VTreeInfo> list = sysRightService.findTreeNode(roleId);
return new JsonBean(1, list);
}
}
| UTF-8 | Java | 801 | java | RightController.java | Java | [
{
"context": "import com.qianfeng.vo.VTreeInfo;\n\n/**\n * @author 张毅\n *\n * @date 2019年5月22日下午3:09:54\n */\n@Controller\n@",
"end": 426,
"score": 0.9838373064994812,
"start": 424,
"tag": "NAME",
"value": "张毅"
}
] | null | [] | package com.qianfeng.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.qianfeng.service.SysRightService;
import com.qianfeng.vo.JsonBean;
import com.qianfeng.vo.VTreeInfo;
/**
* @author 张毅
*
* @date 2019年5月22日下午3:09:54
*/
@Controller
@RequestMapping("/right")
@ResponseBody
public class RightController {
@Autowired
private SysRightService sysRightService;
@RequestMapping("/tree.do")
public JsonBean findTreeNodes(int roleId) {
List<VTreeInfo> list = sysRightService.findTreeNode(roleId);
return new JsonBean(1, list);
}
}
| 801 | 0.78399 | 0.767471 | 36 | 20.861111 | 20.891457 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.805556 | false | false | 10 |
f8a965eace3146f397181351ef189d7d2d9eb273 | 35,983,236,052,595 | 97e42e3d5ac022da689f991cfac5df97830ce492 | /app/src/test/java/com/unb/bikex/model/UserPreferencesModelTest.java | 3759e017d899cf15e3a56a30fe5fcbfebbe669f2 | [] | no_license | charlesbts/BikeX-Android | https://github.com/charlesbts/BikeX-Android | e0ebc636863c6aae0b681dd404dc4d8dc57888fc | c5694fe8d87706eb12924dbd256e8995a19ab260 | refs/heads/master | 2021-01-10T13:35:14.912000 | 2015-12-04T05:17:33 | 2015-12-04T05:17:33 | 47,382,500 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.unb.bikex.model;
import com.unb.bikex.application.BikeXApp;
import com.unb.bikex.model.bike.BikeModel;
import com.unb.bikex.model.userpreferences.UserPreferencesModel;
import com.unb.bikex.sharedpreferences.UserSharedPreferences;
import com.unb.bikex.wireless.IBluetoothSetup;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.internal.matchers.Null;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
/**
* Created by Charles on 10/24/2015.
*/
public class UserPreferencesModelTest {
UserPreferencesModel userPreferencesModel;
@Mock
UserSharedPreferences userSharedPreferences;
@Mock
IBluetoothSetup iBluetoothSetup;
@Before
public void setUp() throws Exception{
MockitoAnnotations.initMocks(this);
userPreferencesModel = new UserPreferencesModel(userSharedPreferences, iBluetoothSetup);
assertNotNull(userPreferencesModel);
}
@Test(expected = IllegalArgumentException.class)
public void setWheelSize0TestException(){
userPreferencesModel.setWheelSize(0);
}
@Test(expected = IllegalArgumentException.class)
public void setWheelSize17TestException(){
userPreferencesModel.setWheelSize(17);
}
@Test(expected = IllegalArgumentException.class)
public void setWheelSize34TestException(){
userPreferencesModel.setWheelSize(34);
}
@Test(expected = IllegalArgumentException.class)
public void setWheelSize99TestException(){
userPreferencesModel.setWheelSize(99);
}
@Test(expected = IllegalStateException.class)
public void getBluetoothDeviceListTestException(){
Mockito.when(iBluetoothSetup.enable()).thenReturn("Algo");
userPreferencesModel.getBluetoothDeviceList();
}
@Test
public void getBluetoothDeviceListTest(){
List<String> pairedDevicesMock = new ArrayList<>();
pairedDevicesMock.add(0, "Bt1");
pairedDevicesMock.add(1, "Bt2");
pairedDevicesMock.add(2, "Bt3");
Mockito.when(iBluetoothSetup.enable()).thenReturn(null);
Mockito.when(iBluetoothSetup.getPairedDeviceList()).thenReturn(pairedDevicesMock);
assertEquals(pairedDevicesMock, userPreferencesModel.getBluetoothDeviceList());
}
@After
public void tearDown(){
userPreferencesModel = null;
}
}
| UTF-8 | Java | 2,552 | java | UserPreferencesModelTest.java | Java | [
{
"context": "org.junit.Assert.assertNotNull;\n\n/**\n * Created by Charles on 10/24/2015.\n */\npublic class UserPreferencesMo",
"end": 668,
"score": 0.9996510148048401,
"start": 661,
"tag": "NAME",
"value": "Charles"
}
] | null | [] | package com.unb.bikex.model;
import com.unb.bikex.application.BikeXApp;
import com.unb.bikex.model.bike.BikeModel;
import com.unb.bikex.model.userpreferences.UserPreferencesModel;
import com.unb.bikex.sharedpreferences.UserSharedPreferences;
import com.unb.bikex.wireless.IBluetoothSetup;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.internal.matchers.Null;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
/**
* Created by Charles on 10/24/2015.
*/
public class UserPreferencesModelTest {
UserPreferencesModel userPreferencesModel;
@Mock
UserSharedPreferences userSharedPreferences;
@Mock
IBluetoothSetup iBluetoothSetup;
@Before
public void setUp() throws Exception{
MockitoAnnotations.initMocks(this);
userPreferencesModel = new UserPreferencesModel(userSharedPreferences, iBluetoothSetup);
assertNotNull(userPreferencesModel);
}
@Test(expected = IllegalArgumentException.class)
public void setWheelSize0TestException(){
userPreferencesModel.setWheelSize(0);
}
@Test(expected = IllegalArgumentException.class)
public void setWheelSize17TestException(){
userPreferencesModel.setWheelSize(17);
}
@Test(expected = IllegalArgumentException.class)
public void setWheelSize34TestException(){
userPreferencesModel.setWheelSize(34);
}
@Test(expected = IllegalArgumentException.class)
public void setWheelSize99TestException(){
userPreferencesModel.setWheelSize(99);
}
@Test(expected = IllegalStateException.class)
public void getBluetoothDeviceListTestException(){
Mockito.when(iBluetoothSetup.enable()).thenReturn("Algo");
userPreferencesModel.getBluetoothDeviceList();
}
@Test
public void getBluetoothDeviceListTest(){
List<String> pairedDevicesMock = new ArrayList<>();
pairedDevicesMock.add(0, "Bt1");
pairedDevicesMock.add(1, "Bt2");
pairedDevicesMock.add(2, "Bt3");
Mockito.when(iBluetoothSetup.enable()).thenReturn(null);
Mockito.when(iBluetoothSetup.getPairedDeviceList()).thenReturn(pairedDevicesMock);
assertEquals(pairedDevicesMock, userPreferencesModel.getBluetoothDeviceList());
}
@After
public void tearDown(){
userPreferencesModel = null;
}
}
| 2,552 | 0.74373 | 0.732759 | 82 | 30.121952 | 24.008327 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.512195 | false | false | 10 |
c7aede0d5b2253efc6162e5b1e73446950230eaa | 38,860,864,146,522 | b33a10b480a3c7df14407a9ab48e72fc5067d183 | /src/hu/sztomi/trainschedule/view/dialogs/AddRouteDialog.java | 55a47bbcad6c8ab424a4f3e94b38f446b041e6b6 | [] | no_license | TamasSzekeres/AAR_KotProg | https://github.com/TamasSzekeres/AAR_KotProg | 78ce634d119dca70f1dcc859bff4294380957999 | 797ed65e53f3a0916911fe51fc45e4d4b949af8c | refs/heads/master | 2016-09-06T09:17:54.471000 | 2015-08-19T07:45:25 | 2015-08-19T07:45:25 | 41,020,273 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package hu.sztomi.trainschedule.view.dialogs;
import hu.sztomi.trainschedule.controller.TrainScheduleController;
import hu.sztomi.trainschedule.model.bean.Price;
import hu.sztomi.trainschedule.model.bean.Route;
import hu.sztomi.trainschedule.model.bean.Station;
import hu.sztomi.trainschedule.view.Labels;
import hu.sztomi.trainschedule.view.TrainScheduleGUI;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
public class AddRouteDialog extends JDialog implements ActionListener {
private static final long serialVersionUID = -4026951751796855398L;
private TrainScheduleGUI gui;
private JComboBox<String> initStationCombo = new JComboBox<String>();
private JComboBox<String> destStationCombo = new JComboBox<String>();
private JComboBox<Integer> kmCombo = new JComboBox<Integer>();
private JCheckBox addTicketChecker = new JCheckBox();
private JButton okButton = new JButton(Labels.ok);
private JButton cancelButton = new JButton(Labels.cancel);
public AddRouteDialog(TrainScheduleGUI gui, boolean modal) {
super(gui.getWindow(), modal);
this.gui = gui;
setTitle(Labels.add_route);
JPanel settingPanel = createSettingPanel();
JPanel buttonPanel = createButtonPanel();
JPanel dialogPanel = createDialogPanel(settingPanel, buttonPanel);
getContentPane().add(dialogPanel);
pack();
setLocationRelativeTo(gui.getWindow());
setVisible(true);
}
private JPanel createSettingPanel() {
// Fill ComboBox Items
List<Station> stations = gui.getController().getStations();
for (Station station : stations) {
initStationCombo.addItem(station.getName());
destStationCombo.addItem(station.getName());
}
List<Price> prices = gui.getController().getPrices();
for (Price price : prices) {
kmCombo.addItem(price.getKm());
}
destStationCombo.setSelectedIndex(1);
JPanel settingPanel = new JPanel();
settingPanel.setLayout(new GridLayout(0, 2, 3, 10));
settingPanel.add(new JLabel(Labels.initial_station_label, SwingConstants.RIGHT));
settingPanel.add(initStationCombo);
settingPanel.add(new JLabel(Labels.destination_station_label, SwingConstants.RIGHT));
settingPanel.add(destStationCombo);
settingPanel.add(new JLabel(Labels.km_label, SwingConstants.RIGHT));
settingPanel.add(kmCombo);
settingPanel.add(new JLabel(Labels.add_ticket_label, SwingConstants.RIGHT));
settingPanel.add(addTicketChecker);
return settingPanel;
}
private JPanel createButtonPanel() {
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
buttonPanel.add(okButton);
okButton.addActionListener(this);
buttonPanel.add(cancelButton);
cancelButton.addActionListener(this);
return buttonPanel;
}
private JPanel createDialogPanel(JPanel settingPanel, JPanel buttonPanel) {
JPanel dialogPanel = new JPanel();
dialogPanel.setLayout(new BorderLayout());
dialogPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
dialogPanel.add(settingPanel, BorderLayout.CENTER);
dialogPanel.add(buttonPanel, BorderLayout.SOUTH);
return dialogPanel;
}
@Override
public void actionPerformed(ActionEvent e) {
if (okButton == e.getSource()) {
TrainScheduleController controller = gui.getController();
Route route = new Route();
route.setInitialStation(controller.getStationId(
initStationCombo.getSelectedItem().toString()));
route.setDestinationStation(controller.getStationId(
destStationCombo.getSelectedItem().toString()));
if (route.getInitialStation() == route.getDestinationStation()) {
JOptionPane.showMessageDialog(
gui.getWindow(),
Labels.same_stations_error,
Labels.error,
JOptionPane.ERROR_MESSAGE);
return;
}
route.setKm((int)kmCombo.getSelectedItem());
route.setAddTicket(addTicketChecker.isSelected());
if (!controller.addRoute(route)) {
JOptionPane.showMessageDialog(
gui.getWindow(),
Labels.route_exists,
Labels.error,
JOptionPane.ERROR_MESSAGE);
return;
} else {
setVisible(false);
}
} else if (cancelButton == e.getSource()) {
this.setVisible(false);
}
}
}
| UTF-8 | Java | 4,887 | java | AddRouteDialog.java | Java | [] | null | [] | package hu.sztomi.trainschedule.view.dialogs;
import hu.sztomi.trainschedule.controller.TrainScheduleController;
import hu.sztomi.trainschedule.model.bean.Price;
import hu.sztomi.trainschedule.model.bean.Route;
import hu.sztomi.trainschedule.model.bean.Station;
import hu.sztomi.trainschedule.view.Labels;
import hu.sztomi.trainschedule.view.TrainScheduleGUI;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
public class AddRouteDialog extends JDialog implements ActionListener {
private static final long serialVersionUID = -4026951751796855398L;
private TrainScheduleGUI gui;
private JComboBox<String> initStationCombo = new JComboBox<String>();
private JComboBox<String> destStationCombo = new JComboBox<String>();
private JComboBox<Integer> kmCombo = new JComboBox<Integer>();
private JCheckBox addTicketChecker = new JCheckBox();
private JButton okButton = new JButton(Labels.ok);
private JButton cancelButton = new JButton(Labels.cancel);
public AddRouteDialog(TrainScheduleGUI gui, boolean modal) {
super(gui.getWindow(), modal);
this.gui = gui;
setTitle(Labels.add_route);
JPanel settingPanel = createSettingPanel();
JPanel buttonPanel = createButtonPanel();
JPanel dialogPanel = createDialogPanel(settingPanel, buttonPanel);
getContentPane().add(dialogPanel);
pack();
setLocationRelativeTo(gui.getWindow());
setVisible(true);
}
private JPanel createSettingPanel() {
// Fill ComboBox Items
List<Station> stations = gui.getController().getStations();
for (Station station : stations) {
initStationCombo.addItem(station.getName());
destStationCombo.addItem(station.getName());
}
List<Price> prices = gui.getController().getPrices();
for (Price price : prices) {
kmCombo.addItem(price.getKm());
}
destStationCombo.setSelectedIndex(1);
JPanel settingPanel = new JPanel();
settingPanel.setLayout(new GridLayout(0, 2, 3, 10));
settingPanel.add(new JLabel(Labels.initial_station_label, SwingConstants.RIGHT));
settingPanel.add(initStationCombo);
settingPanel.add(new JLabel(Labels.destination_station_label, SwingConstants.RIGHT));
settingPanel.add(destStationCombo);
settingPanel.add(new JLabel(Labels.km_label, SwingConstants.RIGHT));
settingPanel.add(kmCombo);
settingPanel.add(new JLabel(Labels.add_ticket_label, SwingConstants.RIGHT));
settingPanel.add(addTicketChecker);
return settingPanel;
}
private JPanel createButtonPanel() {
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
buttonPanel.add(okButton);
okButton.addActionListener(this);
buttonPanel.add(cancelButton);
cancelButton.addActionListener(this);
return buttonPanel;
}
private JPanel createDialogPanel(JPanel settingPanel, JPanel buttonPanel) {
JPanel dialogPanel = new JPanel();
dialogPanel.setLayout(new BorderLayout());
dialogPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
dialogPanel.add(settingPanel, BorderLayout.CENTER);
dialogPanel.add(buttonPanel, BorderLayout.SOUTH);
return dialogPanel;
}
@Override
public void actionPerformed(ActionEvent e) {
if (okButton == e.getSource()) {
TrainScheduleController controller = gui.getController();
Route route = new Route();
route.setInitialStation(controller.getStationId(
initStationCombo.getSelectedItem().toString()));
route.setDestinationStation(controller.getStationId(
destStationCombo.getSelectedItem().toString()));
if (route.getInitialStation() == route.getDestinationStation()) {
JOptionPane.showMessageDialog(
gui.getWindow(),
Labels.same_stations_error,
Labels.error,
JOptionPane.ERROR_MESSAGE);
return;
}
route.setKm((int)kmCombo.getSelectedItem());
route.setAddTicket(addTicketChecker.isSelected());
if (!controller.addRoute(route)) {
JOptionPane.showMessageDialog(
gui.getWindow(),
Labels.route_exists,
Labels.error,
JOptionPane.ERROR_MESSAGE);
return;
} else {
setVisible(false);
}
} else if (cancelButton == e.getSource()) {
this.setVisible(false);
}
}
}
| 4,887 | 0.704318 | 0.697565 | 145 | 32.703449 | 23.756559 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.655172 | false | false | 10 |
c6abb063cfef094f217003bd8889f2e608c30823 | 38,860,864,146,500 | 38ba2d79615bfc624ea3cf5d0edb059885d915f9 | /src/test/java/com/android/tools/r8/naming/CovariantReturnTypeInSubInterfaceTest.java | 39747f02c7815570ccd5c80c98521a51e0ee960c | [
"BSD-3-Clause",
"MIT",
"Apache-2.0"
] | permissive | facebookexperimental/r8 | https://github.com/facebookexperimental/r8 | 13182fee86ca6cd61a8fc606f507674732710771 | 5fd5989c478e7f2a052656aec2ef909d74646a27 | refs/heads/buck | 2023-03-04T10:40:02.130000 | 2019-08-30T20:28:19 | 2020-07-21T13:29:50 | 191,259,201 | 5 | 3 | NOASSERTION | false | 2020-06-08T16:27:05 | 2019-06-10T23:24:32 | 2020-05-09T14:41:52 | 2020-06-06T10:28:17 | 40,070 | 0 | 2 | 0 | Java | false | false | // Copyright (c) 2018, the R8 project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
package com.android.tools.r8.naming;
import static com.android.tools.r8.utils.codeinspector.Matchers.isRenamed;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import com.android.tools.r8.OutputMode;
import com.android.tools.r8.TestBase;
import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.ToolHelper.ProcessResult;
import com.android.tools.r8.VmTestRunner;
import com.android.tools.r8.utils.AndroidApp;
import com.android.tools.r8.utils.codeinspector.ClassSubject;
import com.android.tools.r8.utils.codeinspector.CodeInspector;
import com.android.tools.r8.utils.codeinspector.MethodSubject;
import com.google.common.collect.ImmutableList;
import java.nio.file.Path;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
interface SuperInterface {
Super foo();
}
interface SubInterface extends SuperInterface {
@Override
Sub foo();
}
class Super {
protected int bar() {
return 0;
}
}
class Sub extends Super {
@Override
protected int bar() {
return 1;
}
}
class SuperImplementer implements SuperInterface {
@Override
public Super foo() {
return new Sub();
}
}
class SubImplementer extends SuperImplementer implements SubInterface {
@Override
public Sub foo() {
return (Sub) super.foo();
}
}
class TestMain {
public static void main(String[] args) {
SubImplementer subImplementer = new SubImplementer();
Super sup = subImplementer.foo();
System.out.print(sup.bar());
}
}
@RunWith(VmTestRunner.class)
public class CovariantReturnTypeInSubInterfaceTest extends TestBase {
private void test(boolean overloadAggressively) throws Exception {
String mainName = TestMain.class.getCanonicalName();
String aggressive =
overloadAggressively ? "-overloadaggressively" : "# Not overload aggressively";
List<String> config = ImmutableList.of(
"-printmapping",
aggressive,
"-keep class " + mainName + " {",
" public void main(...);",
"}",
"-keep,allowobfuscation class **.Super* {",
" <methods>;",
"}",
"-keep,allowobfuscation class **.Sub* {",
" <methods>;",
"}"
);
AndroidApp app = readClasses(
SuperInterface.class,
SubInterface.class,
Super.class,
Sub.class,
SuperImplementer.class,
SubImplementer.class,
TestMain.class
);
AndroidApp processedApp =
compileWithR8(app, String.join(System.lineSeparator(), config), options -> {
options.enableInlining = false;
});
CodeInspector inspector = new CodeInspector(processedApp);
ClassSubject superInterface = inspector.clazz(SuperInterface.class);
assertThat(superInterface, isRenamed());
MethodSubject foo1 = superInterface.method(
Super.class.getCanonicalName(), "foo", ImmutableList.of());
assertThat(foo1, isRenamed());
ClassSubject subInterface = inspector.clazz(SubInterface.class);
assertThat(subInterface, isRenamed());
MethodSubject foo2 = subInterface.method(
Sub.class.getCanonicalName(), "foo", ImmutableList.of());
assertThat(foo2, isRenamed());
assertEquals(foo1.getFinalName(), foo2.getFinalName());
ProcessResult javaResult = ToolHelper.runJava(ToolHelper.getClassPathForTests(), mainName);
assertEquals(0, javaResult.exitCode);
Path outDex = temp.getRoot().toPath().resolve("dex.zip");
processedApp.writeToZip(outDex, OutputMode.DexIndexed);
ProcessResult artResult = ToolHelper.runArtNoVerificationErrorsRaw(outDex.toString(), mainName);
assertEquals(0, artResult.exitCode);
assertEquals(javaResult.stdout, artResult.stdout);
}
@Test
public void test_notAggressively() throws Exception {
test(false);
}
@Test
public void test_aggressively() throws Exception {
test(true);
}
}
| UTF-8 | Java | 4,121 | java | CovariantReturnTypeInSubInterfaceTest.java | Java | [] | null | [] | // Copyright (c) 2018, the R8 project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
package com.android.tools.r8.naming;
import static com.android.tools.r8.utils.codeinspector.Matchers.isRenamed;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import com.android.tools.r8.OutputMode;
import com.android.tools.r8.TestBase;
import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.ToolHelper.ProcessResult;
import com.android.tools.r8.VmTestRunner;
import com.android.tools.r8.utils.AndroidApp;
import com.android.tools.r8.utils.codeinspector.ClassSubject;
import com.android.tools.r8.utils.codeinspector.CodeInspector;
import com.android.tools.r8.utils.codeinspector.MethodSubject;
import com.google.common.collect.ImmutableList;
import java.nio.file.Path;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
interface SuperInterface {
Super foo();
}
interface SubInterface extends SuperInterface {
@Override
Sub foo();
}
class Super {
protected int bar() {
return 0;
}
}
class Sub extends Super {
@Override
protected int bar() {
return 1;
}
}
class SuperImplementer implements SuperInterface {
@Override
public Super foo() {
return new Sub();
}
}
class SubImplementer extends SuperImplementer implements SubInterface {
@Override
public Sub foo() {
return (Sub) super.foo();
}
}
class TestMain {
public static void main(String[] args) {
SubImplementer subImplementer = new SubImplementer();
Super sup = subImplementer.foo();
System.out.print(sup.bar());
}
}
@RunWith(VmTestRunner.class)
public class CovariantReturnTypeInSubInterfaceTest extends TestBase {
private void test(boolean overloadAggressively) throws Exception {
String mainName = TestMain.class.getCanonicalName();
String aggressive =
overloadAggressively ? "-overloadaggressively" : "# Not overload aggressively";
List<String> config = ImmutableList.of(
"-printmapping",
aggressive,
"-keep class " + mainName + " {",
" public void main(...);",
"}",
"-keep,allowobfuscation class **.Super* {",
" <methods>;",
"}",
"-keep,allowobfuscation class **.Sub* {",
" <methods>;",
"}"
);
AndroidApp app = readClasses(
SuperInterface.class,
SubInterface.class,
Super.class,
Sub.class,
SuperImplementer.class,
SubImplementer.class,
TestMain.class
);
AndroidApp processedApp =
compileWithR8(app, String.join(System.lineSeparator(), config), options -> {
options.enableInlining = false;
});
CodeInspector inspector = new CodeInspector(processedApp);
ClassSubject superInterface = inspector.clazz(SuperInterface.class);
assertThat(superInterface, isRenamed());
MethodSubject foo1 = superInterface.method(
Super.class.getCanonicalName(), "foo", ImmutableList.of());
assertThat(foo1, isRenamed());
ClassSubject subInterface = inspector.clazz(SubInterface.class);
assertThat(subInterface, isRenamed());
MethodSubject foo2 = subInterface.method(
Sub.class.getCanonicalName(), "foo", ImmutableList.of());
assertThat(foo2, isRenamed());
assertEquals(foo1.getFinalName(), foo2.getFinalName());
ProcessResult javaResult = ToolHelper.runJava(ToolHelper.getClassPathForTests(), mainName);
assertEquals(0, javaResult.exitCode);
Path outDex = temp.getRoot().toPath().resolve("dex.zip");
processedApp.writeToZip(outDex, OutputMode.DexIndexed);
ProcessResult artResult = ToolHelper.runArtNoVerificationErrorsRaw(outDex.toString(), mainName);
assertEquals(0, artResult.exitCode);
assertEquals(javaResult.stdout, artResult.stdout);
}
@Test
public void test_notAggressively() throws Exception {
test(false);
}
@Test
public void test_aggressively() throws Exception {
test(true);
}
}
| 4,121 | 0.708566 | 0.702014 | 134 | 29.753731 | 24.746305 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.686567 | false | false | 10 |
49edb43225dff63589b460ec4937b2db58f99492 | 39,711,267,619,049 | 30bac6897a352a14168a947dbb89021d6dd1c0e8 | /src/main/java/baseball/v3/PlayResult.java | 667756c58ba644da86407e0a20b47036a6ea818a | [] | no_license | backseok/java-baseball-playground | https://github.com/backseok/java-baseball-playground | e22a6227093dfa2f28b9a7aa42b14d321e9359e5 | b635680247ea797b6c94c7c3584c19f3b70daba4 | refs/heads/main | 2023-09-05T17:19:16.851000 | 2021-11-23T14:01:58 | 2021-11-23T14:01:58 | 424,055,623 | 0 | 0 | null | true | 2021-11-03T01:40:14 | 2021-11-03T01:40:14 | 2021-09-18T09:55:25 | 2021-10-26T11:02:15 | 57 | 0 | 0 | 0 | null | false | false | package baseball.v3;
import static baseball.v3.BallStatus.*;
public class PlayResult {
private int strike;
private int ball;
public void addScore(BallStatus status) {
if (status.isStrike()) {
strike++;
}
if (status.isBall()) {
ball++;
}
}
public boolean isNothing() {
return strike == 0 && ball == 0;
}
public boolean isGameEnd() {
return strike == 3;
}
public int getStrike() {
return strike;
}
public int getBall() {
return ball;
}
public boolean noStrike() {
return strike == 0;
}
public boolean noBall() {
return ball == 0;
}
}
| UTF-8 | Java | 709 | java | PlayResult.java | Java | [] | null | [] | package baseball.v3;
import static baseball.v3.BallStatus.*;
public class PlayResult {
private int strike;
private int ball;
public void addScore(BallStatus status) {
if (status.isStrike()) {
strike++;
}
if (status.isBall()) {
ball++;
}
}
public boolean isNothing() {
return strike == 0 && ball == 0;
}
public boolean isGameEnd() {
return strike == 3;
}
public int getStrike() {
return strike;
}
public int getBall() {
return ball;
}
public boolean noStrike() {
return strike == 0;
}
public boolean noBall() {
return ball == 0;
}
}
| 709 | 0.520451 | 0.510578 | 41 | 16.292683 | 13.613559 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.292683 | false | false | 10 |
677e43c4b7b305361391b27dae237ac0847d8d9c | 19,902,878,498,600 | 0450eadc56a963cb02e11fcf7181ac40649112fc | /src/test/java/com/cucumber/automation/mobile/android/pages/SpeakersPage.java | 9ba443b6eb2c28fd2d3810f9168692f2b220b215 | [] | no_license | anandswarupv/BDDUsingCucumber | https://github.com/anandswarupv/BDDUsingCucumber | 2ca7e3d3962c38fdd461fe765fff9afbd7a711f8 | 24e6fd49e61edb8e08f3b4ece75811f1d2e140c8 | refs/heads/master | 2020-05-18T04:25:23.878000 | 2014-10-18T03:54:46 | 2014-10-18T03:54:46 | 25,386,571 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.cucumber.automation.mobile.android.pages;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.ExpectedConditions;
import com.cucumber.automation.utils.DriverFactory;
public class SpeakersPage extends DriverFactory{
// All the locators for Speaker page will be defined here
By title = By.id("com.xebia.eventsapp:id/action_bar_custom_title");
By SpeakersList = By.className("android.widget.RelativeLayout");
// All the behavior of Speaker page will be defined here in functions
public void verifySpeakersPage()
{
waitVar.until(ExpectedConditions.presenceOfElementLocated(title));
assertEquals("Speakers",driver.findElement(title).getText());
assertTrue(driver.findElements(SpeakersList).size()>=0);
}
}
| UTF-8 | Java | 904 | java | SpeakersPage.java | Java | [] | null | [] | package com.cucumber.automation.mobile.android.pages;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.ExpectedConditions;
import com.cucumber.automation.utils.DriverFactory;
public class SpeakersPage extends DriverFactory{
// All the locators for Speaker page will be defined here
By title = By.id("com.xebia.eventsapp:id/action_bar_custom_title");
By SpeakersList = By.className("android.widget.RelativeLayout");
// All the behavior of Speaker page will be defined here in functions
public void verifySpeakersPage()
{
waitVar.until(ExpectedConditions.presenceOfElementLocated(title));
assertEquals("Speakers",driver.findElement(title).getText());
assertTrue(driver.findElements(SpeakersList).size()>=0);
}
}
| 904 | 0.736726 | 0.735619 | 26 | 32.76923 | 28.831484 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.576923 | false | false | 10 |
480091f42a70ab90d065c3ea298e53355f8f1735 | 9,775,345,623,707 | 8264cce3fac456543351b598b716b153a0855ab3 | /target/classes/cn/youfull/trimhelp/service/impl/UserServiceImpl.java | a3bf67ba5b0646af06abaf635ac31afb52bf1dcb | [
"Apache-2.0"
] | permissive | yousiri6677/trimhelp-springboot | https://github.com/yousiri6677/trimhelp-springboot | 6f12456368ef1c0d3595ad740c7f40da7aead0ce | 8a71d7d0a597ed41fe9aa73c0e8a94fa5a9ef64b | refs/heads/master | 2022-06-23T07:11:36.125000 | 2020-08-12T07:18:34 | 2020-08-12T07:18:34 | 248,176,802 | 2 | 0 | Apache-2.0 | false | 2022-06-17T03:04:14 | 2020-03-18T08:30:19 | 2021-05-24T10:28:27 | 2022-06-17T03:04:11 | 6,951 | 1 | 0 | 2 | CSS | false | false | package cn.youfull.trimhelp.service.impl;
import cn.youfull.trimhelp.entity.Demand;
import cn.youfull.trimhelp.entity.DemandEx;
import cn.youfull.trimhelp.entity.User;
import cn.youfull.trimhelp.entity.UserEx;
import cn.youfull.trimhelp.mapper.DemandMapper;
import cn.youfull.trimhelp.mapper.UserMapper;
import cn.youfull.trimhelp.service.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.LinkedList;
import java.util.List;
@Service
@Slf4j
@EnableCaching
public class UserServiceImpl implements UserService {
@Resource
private UserMapper userMapper;
@Autowired
private DemandService demandService;
@Autowired
private VieListService vieListService;
@Autowired
private CompanyService companyService;
@Autowired
private UserTypeService userTypeService;
@Override
public User loginByAccountAndPassWord(String account, String passWord) {
QueryWrapper<User> qw = new QueryWrapper<>();
qw.eq("account",account);
qw.eq("passWord",passWord);
User user = userMapper.selectOne(qw);
return user;
}
@Override
public int addUser(User user) {
user.setUserState(0);
user.setUserTypeId(4);
user.setUserName(user.getAccount());
user.setIdNumber("241242142141");
int count = userMapper.insert(user);
return count;
}
@Override
public User selectUserById(long id) {
return userMapper.selectById(id);
}
@Override
public UserEx getPersonalDemandByUserId(long id) throws IllegalAccessException, InstantiationException {
User user = userMapper.selectById(id);
UserEx userEx = new UserEx();
BeanUtils.copyProperties(user,userEx);
/* QueryWrapper<Demand> wrapper = new QueryWrapper<>();
wrapper.eq("releaseId", id);
List<Demand> demands = demandMapper.selectList(wrapper);
DemandEx demandEx = null;
List<DemandEx> demandExes = new LinkedList<>();
for (Demand demand : demands) {
demandEx = new DemandEx();
BeanUtils.copyProperties(demand, demandEx);
//通过demandId查询竞标列表
//demandEx.setVieListExes(vieListService.selectVieListByDemandId(demandEx.getId()));
demandExes.add(demandEx);
}*/
userEx.setDemandExes(demandService.selectDemandsByReleaseId(id));
log.info("============!!!!!!!!!!"+userEx.getUserTypeId());
if (userTypeService.selectUserTypeByUserId(userEx.getUserTypeId()).getUserType().equals("公司")){
userEx.setCompanyinfoEx(companyService.selectCompanyInfoByUserId(id));
log.info("============!!!!!!!!!!"+userEx.getCompanyinfoEx());
}
return userEx;
}
}
| UTF-8 | Java | 3,071 | java | UserServiceImpl.java | Java | [] | null | [] | package cn.youfull.trimhelp.service.impl;
import cn.youfull.trimhelp.entity.Demand;
import cn.youfull.trimhelp.entity.DemandEx;
import cn.youfull.trimhelp.entity.User;
import cn.youfull.trimhelp.entity.UserEx;
import cn.youfull.trimhelp.mapper.DemandMapper;
import cn.youfull.trimhelp.mapper.UserMapper;
import cn.youfull.trimhelp.service.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.LinkedList;
import java.util.List;
@Service
@Slf4j
@EnableCaching
public class UserServiceImpl implements UserService {
@Resource
private UserMapper userMapper;
@Autowired
private DemandService demandService;
@Autowired
private VieListService vieListService;
@Autowired
private CompanyService companyService;
@Autowired
private UserTypeService userTypeService;
@Override
public User loginByAccountAndPassWord(String account, String passWord) {
QueryWrapper<User> qw = new QueryWrapper<>();
qw.eq("account",account);
qw.eq("passWord",passWord);
User user = userMapper.selectOne(qw);
return user;
}
@Override
public int addUser(User user) {
user.setUserState(0);
user.setUserTypeId(4);
user.setUserName(user.getAccount());
user.setIdNumber("241242142141");
int count = userMapper.insert(user);
return count;
}
@Override
public User selectUserById(long id) {
return userMapper.selectById(id);
}
@Override
public UserEx getPersonalDemandByUserId(long id) throws IllegalAccessException, InstantiationException {
User user = userMapper.selectById(id);
UserEx userEx = new UserEx();
BeanUtils.copyProperties(user,userEx);
/* QueryWrapper<Demand> wrapper = new QueryWrapper<>();
wrapper.eq("releaseId", id);
List<Demand> demands = demandMapper.selectList(wrapper);
DemandEx demandEx = null;
List<DemandEx> demandExes = new LinkedList<>();
for (Demand demand : demands) {
demandEx = new DemandEx();
BeanUtils.copyProperties(demand, demandEx);
//通过demandId查询竞标列表
//demandEx.setVieListExes(vieListService.selectVieListByDemandId(demandEx.getId()));
demandExes.add(demandEx);
}*/
userEx.setDemandExes(demandService.selectDemandsByReleaseId(id));
log.info("============!!!!!!!!!!"+userEx.getUserTypeId());
if (userTypeService.selectUserTypeByUserId(userEx.getUserTypeId()).getUserType().equals("公司")){
userEx.setCompanyinfoEx(companyService.selectCompanyInfoByUserId(id));
log.info("============!!!!!!!!!!"+userEx.getCompanyinfoEx());
}
return userEx;
}
}
| 3,071 | 0.694199 | 0.688627 | 91 | 32.527473 | 24.954174 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.637363 | false | false | 10 |
3afeb06a8dc101b564dce3e718cb60f5ce4c2795 | 17,368,847,788,799 | 9e3899167d86bbb85c054d1a4e05877aef4781ad | /src/com/tmathmeyer/sexpr/tokens/TokenTree.java | 8f5a0d3b7d114e39b0fdf61b49e0d34b847620f2 | [] | no_license | tmathmeyer/jisp | https://github.com/tmathmeyer/jisp | db556e0fe11d597a8d94da9706673bb7869cbe94 | 07687b4a1c068b263fa4ab9959d7c583b76be5e5 | refs/heads/master | 2020-06-04T19:24:16.288000 | 2014-06-06T21:43:29 | 2014-06-06T21:43:29 | 20,342,979 | 0 | 0 | null | false | 2015-11-13T22:38:12 | 2014-05-30T21:25:44 | 2014-06-06T21:43:29 | 2015-11-13T20:26:37 | 488 | 0 | 0 | 0 | Java | null | null | package com.tmathmeyer.sexpr.tokens;
import java.util.Map;
import com.tmathmeyer.sexpr.context.Func;
public interface TokenTree
{
TokenTree add(Token t, int depth);
TokenTree lock();
Object eval(Map<String, Func> context) throws Exception;
void print(int i);
String getExpr();
}
| UTF-8 | Java | 303 | java | TokenTree.java | Java | [] | null | [] | package com.tmathmeyer.sexpr.tokens;
import java.util.Map;
import com.tmathmeyer.sexpr.context.Func;
public interface TokenTree
{
TokenTree add(Token t, int depth);
TokenTree lock();
Object eval(Map<String, Func> context) throws Exception;
void print(int i);
String getExpr();
}
| 303 | 0.716172 | 0.716172 | 15 | 19.200001 | 18.214279 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false | 10 |
42e01b26523afaf551d67c7179ca49eae61c16bc | 27,212,912,850,009 | d5daf7521193342152fd752306ae894c6aa7e61c | /test/torsete/util/stream/BaseSpliteratorTest.java | 77ab9c1435534a2460417beb360f10e3978c9f77 | [] | no_license | torsete/Eb42305 | https://github.com/torsete/Eb42305 | 3c04b46b72a0975065c6f3798bc3baef7c9ec97b | c96f4000b2f2a6d668c650da056b12e4b22b2fe2 | refs/heads/master | 2021-01-21T11:08:24.647000 | 2018-06-10T18:09:07 | 2018-06-10T18:09:07 | 91,726,616 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package torsete.util.stream;
import org.junit.Test;
import java.util.stream.Stream;
import static org.junit.Assert.*;
/**
* Created by Torsten on 22.05.2017.
*/
public class BaseSpliteratorTest {
@Test
public void testDemo() {
char[] chars = {'a', 'b', 'c'};
int[] i = new int[1];
Stream stream = new BaseSpliterator<Character>()
.setNextSupplier(() -> chars[i[0]++])
.setIsLastSupplier(() -> i[0] == chars.length)
.stream();
StringBuilder sb = new StringBuilder();
stream.forEach(c -> sb.append(c));
assertEquals("abc", sb.toString());
}
@Test
public void testOnClose1() {
char[] chars = {'a', 'b', 'c'};
boolean[] onCloseDone = {false};
int[] i = new int[1];
Stream stream = new BaseSpliterator<Character>()
.setNextSupplier(() -> chars[i[0]++])
.setIsLastSupplier(() -> i[0] == chars.length)
.stream(() -> {
onCloseDone[0] = true;
});
StringBuilder sb = new StringBuilder();
stream.forEach(c -> sb.append(c));
assertEquals("abc", sb.toString());
assertTrue(onCloseDone[0]);
}
@Test
public void testOnClose2() {
char[] chars = {'a', 'b', 'c'};
boolean[] onCloseDone = {false};
int[] i = new int[1];
Stream stream = new BaseSpliterator<Character>()
.setNextSupplier(() -> chars[i[0]++])
.setIsLastSupplier(() -> i[0] == chars.length)
.setOnClose(() -> {
onCloseDone[0] = true;
})
.stream();
StringBuilder sb = new StringBuilder();
stream.forEach(c -> sb.append(c));
assertEquals("abc", sb.toString());
assertTrue(onCloseDone[0]);
}
@Test
public void testOnClose3() {
char[] chars = {'a', 'b', 'c'};
boolean[] onCloseDone0 = {false};
boolean[] onCloseDone1 = {false};
int[] i = new int[1];
Stream stream = new BaseSpliterator<Character>()
.setNextSupplier(() -> chars[i[0]++])
.setIsLastSupplier(() -> i[0] == chars.length)
.setOnClose(() -> {
onCloseDone0[0] = true;
})
.stream(() -> {
onCloseDone1[0] = true;
});
StringBuilder sb = new StringBuilder();
stream.forEach(c -> sb.append(c));
assertEquals("abc", sb.toString());
assertFalse(onCloseDone0[0]);
assertTrue(onCloseDone1[0]);
}
}
| UTF-8 | Java | 2,676 | java | BaseSpliteratorTest.java | Java | [
{
"context": "port static org.junit.Assert.*;\n\n/**\n * Created by Torsten on 22.05.2017.\n */\npublic class BaseSpliteratorTe",
"end": 147,
"score": 0.9995992183685303,
"start": 140,
"tag": "NAME",
"value": "Torsten"
}
] | null | [] | package torsete.util.stream;
import org.junit.Test;
import java.util.stream.Stream;
import static org.junit.Assert.*;
/**
* Created by Torsten on 22.05.2017.
*/
public class BaseSpliteratorTest {
@Test
public void testDemo() {
char[] chars = {'a', 'b', 'c'};
int[] i = new int[1];
Stream stream = new BaseSpliterator<Character>()
.setNextSupplier(() -> chars[i[0]++])
.setIsLastSupplier(() -> i[0] == chars.length)
.stream();
StringBuilder sb = new StringBuilder();
stream.forEach(c -> sb.append(c));
assertEquals("abc", sb.toString());
}
@Test
public void testOnClose1() {
char[] chars = {'a', 'b', 'c'};
boolean[] onCloseDone = {false};
int[] i = new int[1];
Stream stream = new BaseSpliterator<Character>()
.setNextSupplier(() -> chars[i[0]++])
.setIsLastSupplier(() -> i[0] == chars.length)
.stream(() -> {
onCloseDone[0] = true;
});
StringBuilder sb = new StringBuilder();
stream.forEach(c -> sb.append(c));
assertEquals("abc", sb.toString());
assertTrue(onCloseDone[0]);
}
@Test
public void testOnClose2() {
char[] chars = {'a', 'b', 'c'};
boolean[] onCloseDone = {false};
int[] i = new int[1];
Stream stream = new BaseSpliterator<Character>()
.setNextSupplier(() -> chars[i[0]++])
.setIsLastSupplier(() -> i[0] == chars.length)
.setOnClose(() -> {
onCloseDone[0] = true;
})
.stream();
StringBuilder sb = new StringBuilder();
stream.forEach(c -> sb.append(c));
assertEquals("abc", sb.toString());
assertTrue(onCloseDone[0]);
}
@Test
public void testOnClose3() {
char[] chars = {'a', 'b', 'c'};
boolean[] onCloseDone0 = {false};
boolean[] onCloseDone1 = {false};
int[] i = new int[1];
Stream stream = new BaseSpliterator<Character>()
.setNextSupplier(() -> chars[i[0]++])
.setIsLastSupplier(() -> i[0] == chars.length)
.setOnClose(() -> {
onCloseDone0[0] = true;
})
.stream(() -> {
onCloseDone1[0] = true;
});
StringBuilder sb = new StringBuilder();
stream.forEach(c -> sb.append(c));
assertEquals("abc", sb.toString());
assertFalse(onCloseDone0[0]);
assertTrue(onCloseDone1[0]);
}
}
| 2,676 | 0.492152 | 0.478326 | 88 | 29.40909 | 19.023691 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.590909 | false | false | 10 |
b99bd8b908f2dd69156ee515be070be02d03b51f | 24,996,709,717,944 | 249de24bff9dfd08e0d2562bf726388205bbb49a | /DeepSpaceEndeavorDSE/src/abilities/GunShipAbil.java | 76e0a003ff4b22c5f1c9985b33f2f81781f7701e | [
"MIT"
] | permissive | YoungMaker/Deep-Space-Endeavor-Game | https://github.com/YoungMaker/Deep-Space-Endeavor-Game | b7415f37a1ed41ef6f3444be7ab15f9200115bc9 | 12a58a01afe1aa04f5c9d5d3e34080287f2a7cf9 | refs/heads/master | 2021-01-10T14:42:30.073000 | 2018-04-23T21:41:10 | 2018-04-23T21:41:10 | 51,712,745 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package abilities;
import mech.GameSys;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.state.StateBasedGame;
import abilities.util.interpolation;
import entity.Enemy;
import entity.Ship;
import entity.GunShip;
public class GunShipAbil extends Ability { //ability for enemy 2, a regular gunship
long lastUpdate0 = 0;
long lastUpdate = 0;
float speed = 0.100f;
long thresh = 2068;
public GunShipAbil(AbilTypes id, long thresh) {
super(id);
this.thresh = thresh;
}
@Override
public void update(GameContainer gc, StateBasedGame sb, int delta) {
if(GameSys.getMills() - lastUpdate > thresh) { //if interval
lastUpdate = GameSys.getMills(); //reset interval
if(owner instanceof Enemy) { //if the owner of this is an enemy
((Enemy)owner).fire(); //cast the owner and fire it!
}
else{
((Ship) owner).fireBullet();
}
}
}
}
| UTF-8 | Java | 894 | java | GunShipAbil.java | Java | [] | null | [] | package abilities;
import mech.GameSys;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.state.StateBasedGame;
import abilities.util.interpolation;
import entity.Enemy;
import entity.Ship;
import entity.GunShip;
public class GunShipAbil extends Ability { //ability for enemy 2, a regular gunship
long lastUpdate0 = 0;
long lastUpdate = 0;
float speed = 0.100f;
long thresh = 2068;
public GunShipAbil(AbilTypes id, long thresh) {
super(id);
this.thresh = thresh;
}
@Override
public void update(GameContainer gc, StateBasedGame sb, int delta) {
if(GameSys.getMills() - lastUpdate > thresh) { //if interval
lastUpdate = GameSys.getMills(); //reset interval
if(owner instanceof Enemy) { //if the owner of this is an enemy
((Enemy)owner).fire(); //cast the owner and fire it!
}
else{
((Ship) owner).fireBullet();
}
}
}
}
| 894 | 0.702461 | 0.689038 | 37 | 23.162163 | 23.126577 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.054054 | false | false | 10 |
34fdb0cbc5b6789ffc6d169ff4f9eb488193567a | 5,231,270,228,574 | e86d948c58e663877bcbc067e6f79f16f6ccdcaf | /Hackaton_Soumya/src/test/java/com/opencart/tests/CouponCodetest.java | 6e156bad04a71210939d865e7360fd1cc6ba4bf4 | [] | no_license | TamilSelvan25/Hackaton_Team_G_Integration | https://github.com/TamilSelvan25/Hackaton_Team_G_Integration | f8a8b7791c43699a9b5db84540e390cca04bc2db | d0962732a80706282201c35abb3c4246066fef9a | refs/heads/master | 2023-04-10T06:18:55.262000 | 2021-04-25T10:35:41 | 2021-04-25T10:35:41 | 360,789,219 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.opencart.tests;
public class CouponCodetest {
}
| UTF-8 | Java | 67 | java | CouponCodetest.java | Java | [] | null | [] | package com.opencart.tests;
public class CouponCodetest {
}
| 67 | 0.716418 | 0.716418 | 5 | 11.4 | 13.573503 | 29 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false | 10 |
064c85a596c213341bfe3c2769e882556dcc0890 | 23,459,111,399,002 | f6a7b4a2ac5bace48f52a1057d5194bd7343baf0 | /core/src/xtdb/api/tx/TransactionOperation.java | e339508a6424366abec7772a951e18645e5d4142 | [
"MIT"
] | permissive | SINHASantos/crux | https://github.com/SINHASantos/crux | 40357a31d7128e91636d0f13d6990be125372f62 | 41f5b67aa7a9eeee8f6eb191367c95c182bb9900 | refs/heads/master | 2023-09-04T01:22:53.595000 | 2023-08-31T14:08:02 | 2023-08-31T14:08:02 | 211,470,319 | 0 | 0 | MIT | true | 2023-09-12T17:34:06 | 2019-09-28T08:39:07 | 2022-12-11T09:42:12 | 2023-09-12T17:34:03 | 28,369 | 0 | 0 | 0 | Clojure | false | false | package xtdb.api.tx;
import clojure.lang.Keyword;
import java.util.List;
public abstract class TransactionOperation {
public interface Visitor<E> {
E visit(PutOperation operation);
E visit(DeleteOperation operation);
E visit(EvictOperation operation);
E visit(MatchOperation operation);
E visit(InvokeFunctionOperation operation);
}
public abstract <E> E accept(Visitor<E> visitor);
}
| UTF-8 | Java | 442 | java | TransactionOperation.java | Java | [] | null | [] | package xtdb.api.tx;
import clojure.lang.Keyword;
import java.util.List;
public abstract class TransactionOperation {
public interface Visitor<E> {
E visit(PutOperation operation);
E visit(DeleteOperation operation);
E visit(EvictOperation operation);
E visit(MatchOperation operation);
E visit(InvokeFunctionOperation operation);
}
public abstract <E> E accept(Visitor<E> visitor);
}
| 442 | 0.701357 | 0.701357 | 18 | 23.555555 | 19.886406 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false | 10 |
9ad6efc8fb0f1056b25fbed802185f6f02bf3102 | 28,209,345,209,556 | 62c9c8cd3b7d89d796da4f0b7bab8f41ab8f91ea | /src/test/java/base/BaseTests.java | 12a930bd963e67f11344098f5db920f708cc0b4b | [] | no_license | DieroKreator/webdriver_java | https://github.com/DieroKreator/webdriver_java | 7e76e2a32025c1abf13a87d8f4cf8943c6241229 | ecb43b72a95aacaf290991bac1dcb29dd4d1c524 | refs/heads/master | 2023-01-03T07:03:33.507000 | 2020-10-22T18:31:52 | 2020-10-22T18:31:52 | 291,851,590 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package base;
import com.google.common.io.Files;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.openqa.selenium.Cookie;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.events.EventFiringWebDriver;
import org.testng.ITestResult;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import pages.HomePage;
import utils.CookieManager;
import utils.EventReporter;
import utils.WindowManager;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
public class BaseTests {
private EventFiringWebDriver driver;
protected HomePage homePage;
@BeforeClass
public void setUp(){
System.setProperty("webdriver.chrome.driver", "resources/chromedriver");
driver = new EventFiringWebDriver(new ChromeDriver(getChromeOptions()));
driver.register(new EventReporter());
// driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); //be careful of doing this cause it is at project level
goHome();
setCookie();
homePage = new HomePage(driver);
//Return only one web element
// WebElement inputLink = driver.findElement(By.linkText("Inputs"));
// inputLink.click();
//Return list of elements
// List<WebElement> links = driver.findElements(By.tagName("a"));
// System.out.println(links.size());
//Count how many links on page
// driver.findElement(By.linkText("Shifting Content")).click();
// driver.findElement(By.linkText("Example 1: Menu Element")).click();
// List<WebElement> menuItems = driver.findElements(By.tagName("li"));
// System.out.println("Number of items: " + menuItems.size());
// System.out.println(driver.getTitle());
}
@BeforeMethod
public void goHome(){
driver.get("https://the-internet.herokuapp.com/");
homePage = new HomePage(driver);
}
@AfterClass
public void tearDown() {
driver.quit();
}
@AfterMethod
public void recordFailure(ITestResult result){
if(ITestResult.FAILURE == result.getStatus())
{
var camera = (TakesScreenshot) driver;
File screenshot = camera.getScreenshotAs(OutputType.FILE);
try {
Files.move(screenshot, new File("resources/screenshots/" + result.getName() + ".png"));
} catch (IOException e) {
e.printStackTrace();
}
}
}
public WindowManager getWindowManager(){
return new WindowManager(driver);
}
private ChromeOptions getChromeOptions(){
ChromeOptions options = new ChromeOptions();
options.addArguments("disable-infobars");
// options.setHeadless(true);
return options;
}
private void setCookie(){
Cookie cookie = new Cookie.Builder("tau", "123")
.domain("the-internet.herokuapp.com")
.build();
driver.manage().addCookie(cookie);
}
public CookieManager getCookieManager(){
return new CookieManager(driver);
}
}
| UTF-8 | Java | 3,325 | java | BaseTests.java | Java | [] | null | [] | package base;
import com.google.common.io.Files;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.openqa.selenium.Cookie;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.events.EventFiringWebDriver;
import org.testng.ITestResult;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import pages.HomePage;
import utils.CookieManager;
import utils.EventReporter;
import utils.WindowManager;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
public class BaseTests {
private EventFiringWebDriver driver;
protected HomePage homePage;
@BeforeClass
public void setUp(){
System.setProperty("webdriver.chrome.driver", "resources/chromedriver");
driver = new EventFiringWebDriver(new ChromeDriver(getChromeOptions()));
driver.register(new EventReporter());
// driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); //be careful of doing this cause it is at project level
goHome();
setCookie();
homePage = new HomePage(driver);
//Return only one web element
// WebElement inputLink = driver.findElement(By.linkText("Inputs"));
// inputLink.click();
//Return list of elements
// List<WebElement> links = driver.findElements(By.tagName("a"));
// System.out.println(links.size());
//Count how many links on page
// driver.findElement(By.linkText("Shifting Content")).click();
// driver.findElement(By.linkText("Example 1: Menu Element")).click();
// List<WebElement> menuItems = driver.findElements(By.tagName("li"));
// System.out.println("Number of items: " + menuItems.size());
// System.out.println(driver.getTitle());
}
@BeforeMethod
public void goHome(){
driver.get("https://the-internet.herokuapp.com/");
homePage = new HomePage(driver);
}
@AfterClass
public void tearDown() {
driver.quit();
}
@AfterMethod
public void recordFailure(ITestResult result){
if(ITestResult.FAILURE == result.getStatus())
{
var camera = (TakesScreenshot) driver;
File screenshot = camera.getScreenshotAs(OutputType.FILE);
try {
Files.move(screenshot, new File("resources/screenshots/" + result.getName() + ".png"));
} catch (IOException e) {
e.printStackTrace();
}
}
}
public WindowManager getWindowManager(){
return new WindowManager(driver);
}
private ChromeOptions getChromeOptions(){
ChromeOptions options = new ChromeOptions();
options.addArguments("disable-infobars");
// options.setHeadless(true);
return options;
}
private void setCookie(){
Cookie cookie = new Cookie.Builder("tau", "123")
.domain("the-internet.herokuapp.com")
.build();
driver.manage().addCookie(cookie);
}
public CookieManager getCookieManager(){
return new CookieManager(driver);
}
}
| 3,325 | 0.66406 | 0.662256 | 105 | 30.666666 | 25.296967 | 130 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.552381 | false | false | 10 |
586af72db04b75db0ad7bb466609d122b0aced80 | 5,549,097,758,945 | aaade41b0627568803aba2d9d91a1273a75b24d1 | /webtest/src/action/deleteDo.java | 82a89b33ba92b45dfe3ab64e9f7308e80cc43824 | [] | no_license | zrc1708/Javaweb_study | https://github.com/zrc1708/Javaweb_study | ad9b6084d17c068151e3b494f28e4d91e6122401 | d16e927960abe522415a6ff88a7969ca0c33ba01 | refs/heads/master | 2020-09-18T20:37:14.680000 | 2019-11-26T11:56:48 | 2019-11-26T11:56:48 | 224,181,064 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package action;
import entity.User;
import impdao.ImpUserDao;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class LoginDo
*/
@WebServlet("/deleteDo")
public class deleteDo extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public deleteDo() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append("Served at: ").append(request.getContextPath());
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
//首先取出用户名 密码
//解决乱码
response.setContentType("text/html;charset=utf-8");
request.setCharacterEncoding("UTF-8");
int id = Integer.parseInt(request.getParameter("id"));
// String name = request.getParameter("name");
// String pwd = request.getParameter("pwd");
// System.out.println(name+pwd);
// 向数据库删除符合用户名和密码的词条
// User u= new User(name,pwd);
ImpUserDao imp=new ImpUserDao();
boolean f = imp.deleteUser(id);
if(f) {
//定向跳到成功页面
response.sendRedirect("success.jsp");
}else {
response.sendRedirect("error.jsp");
}
}
} | UTF-8 | Java | 2,044 | java | deleteDo.java | Java | [] | null | [] | package action;
import entity.User;
import impdao.ImpUserDao;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class LoginDo
*/
@WebServlet("/deleteDo")
public class deleteDo extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public deleteDo() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append("Served at: ").append(request.getContextPath());
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
//首先取出用户名 密码
//解决乱码
response.setContentType("text/html;charset=utf-8");
request.setCharacterEncoding("UTF-8");
int id = Integer.parseInt(request.getParameter("id"));
// String name = request.getParameter("name");
// String pwd = request.getParameter("pwd");
// System.out.println(name+pwd);
// 向数据库删除符合用户名和密码的词条
// User u= new User(name,pwd);
ImpUserDao imp=new ImpUserDao();
boolean f = imp.deleteUser(id);
if(f) {
//定向跳到成功页面
response.sendRedirect("success.jsp");
}else {
response.sendRedirect("error.jsp");
}
}
} | 2,044 | 0.670732 | 0.669207 | 70 | 27.128571 | 27.976992 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.457143 | false | false | 10 |
e6e8ed955373c9963041059a5ee8adbb043c85c0 | 15,676,630,634,646 | 3f78ab0131c64f37245c9bd0cfb4adc98e573d1e | /Lab4/House.java | 9c1de112c1785befc2f0a547d0d315027a975068 | [] | no_license | dtlancaster/labs-beginner | https://github.com/dtlancaster/labs-beginner | 1149dafd7ea0f0df6d487400b4e9de70d5eb6ba1 | f44ed16736d48d2a97661cf030eb44c1692855ec | refs/heads/master | 2023-03-09T07:26:44.100000 | 2021-02-26T03:27:29 | 2021-02-26T03:27:29 | 342,445,130 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* Write a description of class House here.
*
* @author Dylan Lancaster
* @version 10/02/2019
*/
public class House
{
private Square wall;
private Triangle roof;
private Square window;
/**
* House constructor.
*/
public House()
{
wall = new Square();
wall.changeSize(100);
wall.moveVertical(150);
wall.moveHorizontal(40);
wall.makeVisible();
roof = new Triangle();
roof.changeColor("black");
roof.changeSize(50, 140);
roof.moveVertical(135);
roof.moveHorizontal(100);
roof.makeVisible();
window = new Square();
window.changeColor("blue");
window.moveVertical(170);
window.moveHorizontal(50);
window.makeVisible();
}
/**
* main method.
*
* @param args not used
*/
public static void main(String[] args)
{
House house = new House();
}
/**
* Change roof color.
*
* @param newColor new color to use
*/
public void changeRoofColor(String newColor)
{
roof.changeColor(newColor);
}
/**
* Change wall color.
*
* @param newColor new color to use
*/
public void changeWallColor(String newColor)
{
wall.changeColor(newColor);
}
/**
* Change window color.
*
* @param newColor new color to use
*/
public void changeWindowColor(String newColor)
{
window.changeColor(newColor);
}
/**
* Move entire house horizontally.
*
* @param x amount to move
*/
public void moveHorizontal(int x)
{
wall.moveHorizontal(x);
roof.moveHorizontal(x);
window.moveHorizontal(x);
}
/**
* Move entire house vertically.
*
* @param y amount to move
*/
public void moveVertical(int y)
{
wall.moveVertical(y);
roof.moveVertical(y);
window.moveVertical(y);
}
/**
* Make the house invisible.
*/
public void makeInvisible()
{
wall.makeInvisible();
roof.makeInvisible();
window.makeInvisible();
}
/**
* Make the house visible.
*/
public void makeVisible()
{
wall.makeVisible();
roof.makeVisible();
window.makeVisible();
}
}
| UTF-8 | Java | 2,420 | java | House.java | Java | [
{
"context": " a description of class House here.\n * \n * @author Dylan Lancaster\n * @version 10/02/2019\n */\npublic class House\n{\n ",
"end": 79,
"score": 0.9998419284820557,
"start": 64,
"tag": "NAME",
"value": "Dylan Lancaster"
}
] | null | [] |
/**
* Write a description of class House here.
*
* @author <NAME>
* @version 10/02/2019
*/
public class House
{
private Square wall;
private Triangle roof;
private Square window;
/**
* House constructor.
*/
public House()
{
wall = new Square();
wall.changeSize(100);
wall.moveVertical(150);
wall.moveHorizontal(40);
wall.makeVisible();
roof = new Triangle();
roof.changeColor("black");
roof.changeSize(50, 140);
roof.moveVertical(135);
roof.moveHorizontal(100);
roof.makeVisible();
window = new Square();
window.changeColor("blue");
window.moveVertical(170);
window.moveHorizontal(50);
window.makeVisible();
}
/**
* main method.
*
* @param args not used
*/
public static void main(String[] args)
{
House house = new House();
}
/**
* Change roof color.
*
* @param newColor new color to use
*/
public void changeRoofColor(String newColor)
{
roof.changeColor(newColor);
}
/**
* Change wall color.
*
* @param newColor new color to use
*/
public void changeWallColor(String newColor)
{
wall.changeColor(newColor);
}
/**
* Change window color.
*
* @param newColor new color to use
*/
public void changeWindowColor(String newColor)
{
window.changeColor(newColor);
}
/**
* Move entire house horizontally.
*
* @param x amount to move
*/
public void moveHorizontal(int x)
{
wall.moveHorizontal(x);
roof.moveHorizontal(x);
window.moveHorizontal(x);
}
/**
* Move entire house vertically.
*
* @param y amount to move
*/
public void moveVertical(int y)
{
wall.moveVertical(y);
roof.moveVertical(y);
window.moveVertical(y);
}
/**
* Make the house invisible.
*/
public void makeInvisible()
{
wall.makeInvisible();
roof.makeInvisible();
window.makeInvisible();
}
/**
* Make the house visible.
*/
public void makeVisible()
{
wall.makeVisible();
roof.makeVisible();
window.makeVisible();
}
}
| 2,411 | 0.529752 | 0.516529 | 121 | 18.991735 | 13.75794 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.297521 | false | false | 10 |
bc3b1b268372a8f53fa555ffa991e5917c063928 | 4,501,125,780,730 | 4b042e3fe1bd2292e343364b3305e821facfaa3c | /bobas.businessobjectscommon/src/main/java/org/colorcoding/ibas/bobas/approval/ApprovalException.java | 68743c6ff79ce00051811de9401cdd96d6ea7fa5 | [
"MIT"
] | permissive | NiurenZhu/ibas-framework-0.1.1 | https://github.com/NiurenZhu/ibas-framework-0.1.1 | 90cd36886e36c431763a2db847d53be154882017 | 4c48e437abceacebf11925c96b5b9e87de247f25 | refs/heads/master | 2021-01-17T22:41:58.867000 | 2017-07-11T03:33:04 | 2017-07-11T03:33:04 | 84,201,432 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.colorcoding.ibas.bobas.approval;
/**
* 审批流程异常
* @author Niuren.Zhu
*
*/
public class ApprovalException extends Exception {
/**
*
*/
private static final long serialVersionUID = 2929830967934745503L;
public ApprovalException() {
super();
}
public ApprovalException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
public ApprovalException(String message, Throwable cause) {
super(message, cause);
}
public ApprovalException(String message) {
super(message);
}
public ApprovalException(Throwable cause) {
super(cause);
}
}
| UTF-8 | Java | 689 | java | ApprovalException.java | Java | [
{
"context": "ing.ibas.bobas.approval;\n\n/**\n * 审批流程异常\n * @author Niuren.Zhu\n *\n */\npublic class ApprovalException extends Exc",
"end": 81,
"score": 0.9998366236686707,
"start": 71,
"tag": "NAME",
"value": "Niuren.Zhu"
}
] | null | [] | package org.colorcoding.ibas.bobas.approval;
/**
* 审批流程异常
* @author Niuren.Zhu
*
*/
public class ApprovalException extends Exception {
/**
*
*/
private static final long serialVersionUID = 2929830967934745503L;
public ApprovalException() {
super();
}
public ApprovalException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
public ApprovalException(String message, Throwable cause) {
super(message, cause);
}
public ApprovalException(String message) {
super(message);
}
public ApprovalException(Throwable cause) {
super(cause);
}
}
| 689 | 0.741507 | 0.713442 | 35 | 18.342857 | 26.388247 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.114286 | false | false | 10 |
4312188be9a8d5ed44272fe29be41622a6108fd2 | 27,410,481,344,812 | 02789b8bb19f8ada27fdc629400c48bdbe647427 | /livekitapplication/src/main/java/cn/leancloud/livekitapplication/LCLKLoginActivity.java | 33cdb1498be39d7173b85a95a3f860dd55c96484 | [] | no_license | OfficialKeen/LeanCloudLiveKit-Android | https://github.com/OfficialKeen/LeanCloudLiveKit-Android | 02c26f374628d9126f3ce51021292a64870d2f44 | 87f221305384f4e895f22949186b245532ee76b1 | refs/heads/master | 2020-04-19T19:25:22.529000 | 2018-07-29T09:13:06 | 2018-07-29T09:13:06 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package cn.leancloud.livekitapplication;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import com.avos.avoscloud.im.v2.AVIMClient;
import com.avos.avoscloud.im.v2.AVIMException;
import com.avos.avoscloud.im.v2.callback.AVIMClientCallback;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.leancloud.leancloudlivekit.LCLiveKit;
/**
* Created by wli on 16/8/5.
* 登陆页面
*/
public class LCLKLoginActivity extends AppCompatActivity {
@BindView(R.id.activity_login_et_username)
EditText nameView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.lclk_login_activity);
ButterKnife.bind(this);
}
@OnClick(R.id.activity_login_btn_login)
public void onLoginClick(View view) {
String clientId = nameView.getText().toString();
if (TextUtils.isEmpty(clientId.trim())) {
Toast.makeText(this, "不能为空", Toast.LENGTH_SHORT).show();
return;
}
// 打开 LeanCloud 实时通讯
LCLiveKit.getInstance().open(clientId, new AVIMClientCallback() {
@Override
public void done(AVIMClient avimClient, AVIMException e) {
if (null == e) {
finish();
Intent intent = new Intent(LCLKLoginActivity.this, LCLKLiveRoomListActivity.class);
startActivity(intent);
} else {
Toast.makeText(LCLKLoginActivity.this, e.toString(), Toast.LENGTH_SHORT).show();
}
}
});
}
}
| UTF-8 | Java | 1,701 | java | LCLKLoginActivity.java | Java | [
{
"context": "oud.leancloudlivekit.LCLiveKit;\n\n/**\n * Created by wli on 16/8/5.\n * 登陆页面\n */\npublic class LCLKLoginActi",
"end": 579,
"score": 0.99964839220047,
"start": 576,
"tag": "USERNAME",
"value": "wli"
}
] | null | [] | package cn.leancloud.livekitapplication;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import com.avos.avoscloud.im.v2.AVIMClient;
import com.avos.avoscloud.im.v2.AVIMException;
import com.avos.avoscloud.im.v2.callback.AVIMClientCallback;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.leancloud.leancloudlivekit.LCLiveKit;
/**
* Created by wli on 16/8/5.
* 登陆页面
*/
public class LCLKLoginActivity extends AppCompatActivity {
@BindView(R.id.activity_login_et_username)
EditText nameView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.lclk_login_activity);
ButterKnife.bind(this);
}
@OnClick(R.id.activity_login_btn_login)
public void onLoginClick(View view) {
String clientId = nameView.getText().toString();
if (TextUtils.isEmpty(clientId.trim())) {
Toast.makeText(this, "不能为空", Toast.LENGTH_SHORT).show();
return;
}
// 打开 LeanCloud 实时通讯
LCLiveKit.getInstance().open(clientId, new AVIMClientCallback() {
@Override
public void done(AVIMClient avimClient, AVIMException e) {
if (null == e) {
finish();
Intent intent = new Intent(LCLKLoginActivity.this, LCLKLiveRoomListActivity.class);
startActivity(intent);
} else {
Toast.makeText(LCLKLoginActivity.this, e.toString(), Toast.LENGTH_SHORT).show();
}
}
});
}
}
| 1,701 | 0.719068 | 0.714286 | 58 | 27.844828 | 23.121717 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.586207 | false | false | 10 |
6e0e1f789280146e50477a9dff568ee7135aba4e | 8,229,157,392,002 | da8bc537d84f33729c06bf2bd03628e46f2a1f31 | /src/test/java/com/lostvip/test/upload/TestFileFormUpload.java | 53ea72af95e1049a7f930e0d1eb6c7ae4d5bc3fa | [] | no_license | jlimingyang/springboot-author | https://github.com/jlimingyang/springboot-author | 01479e42fcea757168fce13f7c639abe875fe780 | d76d30e04ed279ec617c7c21e3df98b98e204ce5 | refs/heads/master | 2021-07-06T10:12:40.758000 | 2017-08-01T01:04:09 | 2017-08-01T01:04:09 | 105,093,626 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.lostvip.test.upload;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.activation.MimetypesFileTypeMap;
import com.lostad.app.security.util.SignUtil;
/**
* java通过模拟post方式提交表单实现图片上传功能实例
* 其他文件类型可以传入 contentType 实现
* @author zdz8207
* {@link http://www.cnblogs.com/zdz8207/}
* @version 1.0
*/
public class TestFileFormUpload {
public static void main(String[] args) {
String url = "http://localhost:9002/his/apiOpen/fileUploadApi/data";
String path = "G:\\Ecg.zip";
Map<String, String> textMap = new HashMap<String, String>();//表单域
Map<String, String> fileMap = new HashMap<String, String>();//文件域
Map<String, String> headerMap = new HashMap<String, String>();//header头数据
String params = "doctorId=520401199112263448patientId=520401199112263448typeCode=lb";
String sign = SignUtil.signMD5(params,"1234");
//header
headerMap.put("appId","hly_app");
headerMap.put("signType","MD5");
headerMap.put("sign", sign);
//form input 可以设置多个input的name,value
textMap.put("patientId", "520401199112263448");
textMap.put("doctorId", "520401199112263448");
textMap.put("typeCode", "lb");
//file 设置file的name,路径
fileMap.put("file1", path);//文件不参与生成签名
//String ret = formUpload(url,textMap,headerMap,"file1",path);
String ret = formUploadMult(url, textMap, fileMap, headerMap);
//(String urlStr, Map<String, String> params,Map<String, String> fileMap,Map<String, String> headerMap)
System.out.println(ret);
}
/**
* 多上传文件
* @param urlStr
* @param textMap
* @param fileMap
* @param contentType 没有传入文件类型默认采用application/octet-stream
* contentType非空采用filename匹配默认的图片类型
* @return 返回response数据
*/
public static String formUploadMult(String urlStr, Map<String, String> params,Map<String, String> fileMap,Map<String, String> headerMap) {
String res = "";
HttpURLConnection conn = null;
String BOUNDARY = "---------------------------3s3f35df7569gv89";
try {
URL url = new URL(urlStr);
conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(5000);
conn.setReadTimeout(30000);
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);
conn.setRequestMethod("POST");
conn.setRequestProperty("Connection", "Keep-Alive");
conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.6)");
conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + BOUNDARY);
//设置必要的header信息
//============header===========================================
if (headerMap != null) {//header对象
StringBuffer strBuf = new StringBuffer();
Iterator iter = headerMap.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
String name = (String) entry.getKey();
String value = (String) entry.getValue();
conn.setRequestProperty(name,value);
}
}
OutputStream out = new DataOutputStream(conn.getOutputStream());
//============input===========================================
if (params != null) {//表单内容
StringBuilder sb = new StringBuilder();
if(params!=null){
for (Map.Entry<String, String> entry : params.entrySet()) {//构建表单字段内容
sb.append("--");
sb.append(BOUNDARY);
sb.append("\r\n");
sb.append("Content-Disposition: form-data; name=\""+ entry.getKey() + "\"\r\n\r\n");
sb.append(entry.getValue());
sb.append("\r\n");
}
}
System.out.println(sb.toString());
out.write(sb.toString().getBytes());
}
//============file===========================================
if (fileMap != null) {//多个文件
Iterator iter = fileMap.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
String inputName = (String) entry.getKey();
String inputValue = (String) entry.getValue();
if (inputValue == null) {
continue;
}
File file = new File(inputValue);
//没有传入文件类型,同时根据文件获取不到类型,默认采用application/octet-stream
String contentType = new MimetypesFileTypeMap().getContentType(file);
if (contentType == null || "".equals(contentType)) {
contentType = "application/octet-stream";
}
StringBuffer strBuf = new StringBuffer();
strBuf.append("--").append(BOUNDARY).append("\r\n");
strBuf.append("Content-Disposition: form-data; name=\"" + inputName + "\"; filename=\"" + file.getName() + "\"\r\n");
strBuf.append("Content-Type:" + contentType + "\r\n\r\n");
out.write(strBuf.toString().getBytes());
DataInputStream in = new DataInputStream(new FileInputStream(file));
int bytes = 0;
byte[] bufferOut = new byte[1024];
while ((bytes = in.read(bufferOut)) != -1) {
out.write(bufferOut, 0, bytes);
}
in.close();
}
}
byte[] endData = ("\r\n--" + BOUNDARY + "--\r\n").getBytes();
System.out.println("\r\n--" + BOUNDARY + "--\r\n");
out.write(endData);
out.flush();
out.close();
// 读取返回数据
StringBuffer strBuf = new StringBuffer();
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line = null;
while ((line = reader.readLine()) != null) {
strBuf.append(line).append("\n");
}
res = strBuf.toString();
reader.close();
reader = null;
} catch (Exception e) {
System.out.println("发送POST请求出错。" + urlStr);
e.printStackTrace();
} finally {
if (conn != null) {
conn.disconnect();
conn = null;
}
}
return res;
}
} | UTF-8 | Java | 7,578 | java | TestFileFormUpload.java | Java | [
{
"context": "图片上传功能实例\r\n * 其他文件类型可以传入 contentType 实现\r\n * @author zdz8207\r\n * {@link http://www.cnblogs.com/zdz8207/}\r\n * @",
"end": 579,
"score": 0.9997294545173645,
"start": 572,
"tag": "USERNAME",
"value": "zdz8207"
},
{
"context": "@author zdz8207\r\n * {@link http://www.cnblogs.com/zdz8207/}\r\n * @version 1.0\r\n */\r\npublic class TestFileFor",
"end": 621,
"score": 0.9488161206245422,
"start": 614,
"tag": "USERNAME",
"value": "zdz8207"
}
] | null | [] | package com.lostvip.test.upload;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.activation.MimetypesFileTypeMap;
import com.lostad.app.security.util.SignUtil;
/**
* java通过模拟post方式提交表单实现图片上传功能实例
* 其他文件类型可以传入 contentType 实现
* @author zdz8207
* {@link http://www.cnblogs.com/zdz8207/}
* @version 1.0
*/
public class TestFileFormUpload {
public static void main(String[] args) {
String url = "http://localhost:9002/his/apiOpen/fileUploadApi/data";
String path = "G:\\Ecg.zip";
Map<String, String> textMap = new HashMap<String, String>();//表单域
Map<String, String> fileMap = new HashMap<String, String>();//文件域
Map<String, String> headerMap = new HashMap<String, String>();//header头数据
String params = "doctorId=520401199112263448patientId=520401199112263448typeCode=lb";
String sign = SignUtil.signMD5(params,"1234");
//header
headerMap.put("appId","hly_app");
headerMap.put("signType","MD5");
headerMap.put("sign", sign);
//form input 可以设置多个input的name,value
textMap.put("patientId", "520401199112263448");
textMap.put("doctorId", "520401199112263448");
textMap.put("typeCode", "lb");
//file 设置file的name,路径
fileMap.put("file1", path);//文件不参与生成签名
//String ret = formUpload(url,textMap,headerMap,"file1",path);
String ret = formUploadMult(url, textMap, fileMap, headerMap);
//(String urlStr, Map<String, String> params,Map<String, String> fileMap,Map<String, String> headerMap)
System.out.println(ret);
}
/**
* 多上传文件
* @param urlStr
* @param textMap
* @param fileMap
* @param contentType 没有传入文件类型默认采用application/octet-stream
* contentType非空采用filename匹配默认的图片类型
* @return 返回response数据
*/
public static String formUploadMult(String urlStr, Map<String, String> params,Map<String, String> fileMap,Map<String, String> headerMap) {
String res = "";
HttpURLConnection conn = null;
String BOUNDARY = "---------------------------3s3f35df7569gv89";
try {
URL url = new URL(urlStr);
conn = (HttpURLConnection) url.openConnection();
conn.setConnectTimeout(5000);
conn.setReadTimeout(30000);
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);
conn.setRequestMethod("POST");
conn.setRequestProperty("Connection", "Keep-Alive");
conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.6)");
conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + BOUNDARY);
//设置必要的header信息
//============header===========================================
if (headerMap != null) {//header对象
StringBuffer strBuf = new StringBuffer();
Iterator iter = headerMap.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
String name = (String) entry.getKey();
String value = (String) entry.getValue();
conn.setRequestProperty(name,value);
}
}
OutputStream out = new DataOutputStream(conn.getOutputStream());
//============input===========================================
if (params != null) {//表单内容
StringBuilder sb = new StringBuilder();
if(params!=null){
for (Map.Entry<String, String> entry : params.entrySet()) {//构建表单字段内容
sb.append("--");
sb.append(BOUNDARY);
sb.append("\r\n");
sb.append("Content-Disposition: form-data; name=\""+ entry.getKey() + "\"\r\n\r\n");
sb.append(entry.getValue());
sb.append("\r\n");
}
}
System.out.println(sb.toString());
out.write(sb.toString().getBytes());
}
//============file===========================================
if (fileMap != null) {//多个文件
Iterator iter = fileMap.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
String inputName = (String) entry.getKey();
String inputValue = (String) entry.getValue();
if (inputValue == null) {
continue;
}
File file = new File(inputValue);
//没有传入文件类型,同时根据文件获取不到类型,默认采用application/octet-stream
String contentType = new MimetypesFileTypeMap().getContentType(file);
if (contentType == null || "".equals(contentType)) {
contentType = "application/octet-stream";
}
StringBuffer strBuf = new StringBuffer();
strBuf.append("--").append(BOUNDARY).append("\r\n");
strBuf.append("Content-Disposition: form-data; name=\"" + inputName + "\"; filename=\"" + file.getName() + "\"\r\n");
strBuf.append("Content-Type:" + contentType + "\r\n\r\n");
out.write(strBuf.toString().getBytes());
DataInputStream in = new DataInputStream(new FileInputStream(file));
int bytes = 0;
byte[] bufferOut = new byte[1024];
while ((bytes = in.read(bufferOut)) != -1) {
out.write(bufferOut, 0, bytes);
}
in.close();
}
}
byte[] endData = ("\r\n--" + BOUNDARY + "--\r\n").getBytes();
System.out.println("\r\n--" + BOUNDARY + "--\r\n");
out.write(endData);
out.flush();
out.close();
// 读取返回数据
StringBuffer strBuf = new StringBuffer();
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line = null;
while ((line = reader.readLine()) != null) {
strBuf.append(line).append("\n");
}
res = strBuf.toString();
reader.close();
reader = null;
} catch (Exception e) {
System.out.println("发送POST请求出错。" + urlStr);
e.printStackTrace();
} finally {
if (conn != null) {
conn.disconnect();
conn = null;
}
}
return res;
}
} | 7,578 | 0.514475 | 0.496829 | 167 | 41.4491 | 26.898937 | 142 | false | false | 0 | 0 | 0 | 0 | 66 | 0.009098 | 1.005988 | false | false | 10 |
3aada0678430f1e9abf7b7571d6b97c08d5546ab | 8,229,157,391,077 | 7c904809830a2a05634675c8405c24a8b1415da0 | /app/src/main/java/com/zju/campustour/view/activity/RegisterInfoOneActivity.java | 07381dddf0f523e39ba05686f8ba655f14dd630d | [] | no_license | luohl364218/Showyou | https://github.com/luohl364218/Showyou | 4ebe174a36b20576f02b6ce3f7cdde88e2ff93e0 | 7a3a12fda3ceabc38420b7badd62dc0183fc814e | refs/heads/master | 2020-03-13T06:44:18.729000 | 2018-04-25T13:55:06 | 2018-04-25T13:55:06 | 131,010,729 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.zju.campustour.view.activity;
import android.Manifest;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.parse.ParseUser;
import com.tbruyelle.rxpermissions2.RxPermissions;
import com.yalantis.ucrop.UCrop;
import com.zhihu.matisse.Matisse;
import com.zhihu.matisse.MimeType;
import com.zhihu.matisse.engine.impl.GlideEngine;
import com.zhihu.matisse.filter.Filter;
import com.zju.campustour.R;
import com.zju.campustour.model.common.Constants;
import com.zju.campustour.model.util.SharePreferenceManager;
import com.zju.campustour.model.chatting.utils.HandleResponseCode;
import com.zju.campustour.presenter.listener.MyTextWatch;
import com.zju.campustour.presenter.protocal.event.UserPictureUploadDone;
import com.zju.campustour.view.widget.ClearEditText;
import com.zju.campustour.view.widget.GifSizeFilter;
import com.zju.campustour.view.widget.GradeSelectDialog;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.jpush.im.android.api.JMessageClient;
import cn.jpush.im.android.api.model.UserInfo;
import cn.jpush.im.api.BasicCallback;
import de.hdodenhof.circleimageview.CircleImageView;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
import okhttp3.Call;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import static com.zju.campustour.model.common.Constants.User_isVerified;
@Deprecated
public class RegisterInfoOneActivity extends BaseActivity{
@BindView(R.id.register_info_one_toolbar)
Toolbar mToolbar;
@BindView(R.id.regist_user_img)
CircleImageView userImg;
@BindView(R.id.real_name)
ClearEditText realName;
@BindView(R.id.user_grade)
TextView userGrade;
@BindView(R.id.user_email_addr)
ClearEditText userEmail;
@BindView(R.id.user_sex_type)
RadioGroup userSexType;
@BindView(R.id.user_short_desc)
ClearEditText userShortDesc;
@BindView(R.id.user_grade_select)
RelativeLayout userGradeSelect;
@BindView(R.id.btn_one_next)
Button btnNext;
@BindView(R.id.user_info_update_title_1)
TextView title;
private boolean isRealNameNotNull = false;
private boolean isUserShortDesc = false;
private Context mContext = this;
private boolean isImgSet = false;
//注册以后要将当前用户自动登录
//private UserInfoOpPresenterImpl userLoginImpl;
//拿到用户的年级层次
private int gradeId;
//当前用户
String userName;
String password;
String phoneNum;
ParseUser currentUser;
//是否是编辑模式
private boolean isEditMode = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register_info_one);
ButterKnife.bind(this);
EventBus.getDefault().register(this);
Intent mIntent = getIntent();
userName = mIntent.getStringExtra("userName");
password = mIntent.getStringExtra("password");
phoneNum = mIntent.getStringExtra("phone");
isEditMode = mIntent.getBooleanExtra("isEditMode",false);
currentUser = ParseUser.getCurrentUser();
if (currentUser == null)
return;
initOriginalView();
initView();
}
@Deprecated
private void initOriginalView() {
try{
/*该方法在版本1.2以后已经废弃*/
if (currentUser != null && isEditMode){
title.setText("信息修改 1/2");
realName.setText(currentUser.getString("realname"));
isImgSet = true;
isRealNameNotNull = true;
userEmail.setText(currentUser.getString("emailAddr"));
userGrade.setText(currentUser.getString("grade"));
userSexType.check(currentUser.getInt("sex") == 0 ? R.id.select_male : R.id.select_female);
userShortDesc.setText(currentUser.getString("shortDescription"));
isUserShortDesc = true;
gradeId = currentUser.getInt("gradeId");
btnNext.setEnabled(true);
}
else {
userSexType.check(R.id.select_male);
}
}catch (Exception e){
}
}
private void initView(){
//让按钮随着输入内容有效而使能
realName.addTextChangedListener(new MyTextWatch() {
@Override
public void afterTextChanged(Editable s) {
isRealNameNotNull = !TextUtils.isEmpty(s.toString());
btnNext.setEnabled((isRealNameNotNull && isUserShortDesc));
}
});
userShortDesc.addTextChangedListener(new MyTextWatch() {
@Override
public void afterTextChanged(Editable s) {
isUserShortDesc = !TextUtils.isEmpty(s.toString());
btnNext.setEnabled((isRealNameNotNull && isUserShortDesc));
}
});
userGradeSelect.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
GradeSelectDialog.Builder mBuilder = new GradeSelectDialog.Builder(mContext);
mBuilder.setPositiveButtonListener(new GradeSelectDialog.Builder.OnGradeSelectClickListener() {
@Override
public void onClick(DialogInterface dialog, String grade, int gradeIndex) {
dialog.dismiss();
userGrade.setText(grade);
gradeId = gradeIndex ;
}
});
GradeSelectDialog dialog = mBuilder.create();
dialog.setCancelable(false);
dialog.show();
}
});
}
@OnClick(R.id.btn_one_next)
protected void updateUserInfo(){
if (!isImgSet) {
showToast("请选择头像");
return;
}
String userRealName = realName.getText().toString().trim();
if (TextUtils.isEmpty(userRealName)) {
showToast("请输入真实姓名");
return;
}
String grade = userGrade.getText().toString().trim();
if ("点击选择".equals(grade)){
showToast("请选择你的学历");
return;
}
String email = userEmail.getText().toString().trim();
int userSex = userSexType.getCheckedRadioButtonId() == R.id.select_male ? 0:1;
String shortDesc = userShortDesc.getText().toString().trim();
if (TextUtils.isEmpty(shortDesc)) {
showToast("请用一句话完成自我介绍");
return;
}
currentUser.put("realname",userRealName);
currentUser.put("phoneNum",phoneNum);
currentUser.put("emailAddr",email);
currentUser.put("grade",grade);
currentUser.put("sex",userSex);
currentUser.put(User_isVerified,false);
currentUser.put("shortDescription",shortDesc);
currentUser.put("gradeId",gradeId);
//上传极光 用户性别 个性签名
try {
UserInfo myUserInfo = JMessageClient.getMyInfo();
myUserInfo.setGender(userSex == 1 ? UserInfo.Gender.female : UserInfo.Gender.male);
JMessageClient.updateMyInfo(UserInfo.Field.gender, myUserInfo, new BasicCallback() {
@Override
public void gotResult(final int status, final String desc) {
if (status != 0) {
HandleResponseCode.onHandle(mContext, status, false);
}
}
});
myUserInfo.setSignature(shortDesc);
JMessageClient.updateMyInfo(UserInfo.Field.signature, myUserInfo, new BasicCallback() {
@Override
public void gotResult(final int status, final String desc) {
if (status != 0) {
HandleResponseCode.onHandle(mContext, status, false);
}
}
});
}catch (Exception e){
}
currentUser.saveInBackground();
Intent mIntent = new Intent(this, RegisterInfoTwoActivity.class);
mIntent.putExtra("gradeId",gradeId);
mIntent.putExtra("isEditMode",isEditMode);
startActivity(mIntent);
}
@OnClick(R.id.regist_user_img)
public void chooseUserImg(){
/*Intent mIntent = new Intent(this, RegisterInfoOneActivity.class);
mIntent.putExtra("isEditMode",true);
startActivity(mIntent);*/
RxPermissions rxPermissions = new RxPermissions(this);
rxPermissions.request(Manifest.permission.WRITE_EXTERNAL_STORAGE)
.subscribe(new Observer<Boolean>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(Boolean aBoolean) {
if (aBoolean) {
Matisse.from(RegisterInfoOneActivity.this)
.choose(MimeType.ofAll(), false)
.countable(true)
.maxSelectable(1)
.addFilter(new GifSizeFilter(320, 320, 5 * Filter.K * Filter.K))
.gridExpectedSize(
getResources().getDimensionPixelSize(R.dimen.grid_expected_size))
.restrictOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
.thumbnailScale(0.85f)
.imageEngine(new GlideEngine())
.forResult(Constants.REQUEST_CODE_CHOOSE);
} else {
showToast("权限请求被拒绝");
}
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case Constants.REQUEST_CODE_CHOOSE:
if (data == null)
break;
List<Uri> mUriList = Matisse.obtainResult(data);
Uri mUri = mUriList.get(0);
String[] filePathColumn = {MediaStore.Images.Media.DATA};
Cursor cursor = getContentResolver().query(mUri,
filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
final String picturePath = cursor.getString(columnIndex);
cursor.close();
startCrop(picturePath);
break;
case UCrop.REQUEST_CROP:
if (data == null)
break;
Uri croppedFileUri = UCrop.getOutput(data);
if (croppedFileUri != null) {
imageUpLoad(croppedFileUri.getPath());
}
break;
default:
}
}
private void startCrop(String url) {
Uri sourceUri = Uri.fromFile(new File(url));
//裁剪后保存到文件中
Date mDate = new Date();
Uri destinationUri = Uri.fromFile(new File(getCacheDir(),mDate.getTime()+"_showyou.jpeg"));
UCrop.of(sourceUri, destinationUri).withAspectRatio(1, 1).withMaxResultSize(800, 800).start(this);
}
public void imageUpLoad(String localPath) {
MediaType MEDIA_TYPE_PNG = MediaType.parse("image/jpeg");
OkHttpClient client = new OkHttpClient();
String suffix = localPath.substring(localPath.lastIndexOf("."));
MultipartBody.Builder builder = new MultipartBody.Builder().setType(MultipartBody.FORM);
File f = new File(localPath);
//上传极光聊天头像
JMessageClient.updateUserAvatar(f,null);
builder.addFormDataPart("file", f.getName(), RequestBody.create(MEDIA_TYPE_PNG, f));
Date mDate = new Date();
String uriSuffix = currentUser.getObjectId()+suffix+mDate.getTime();
final MultipartBody requestBody = builder.addFormDataPart("name",uriSuffix).build();
//构建请求
final Request request = new Request.Builder()
.url("http://119.23.248.205:8080")//地址
.post(requestBody)//添加请求体
.build();
client.newCall(request).enqueue(new okhttp3.Callback() {
@Override
public void onFailure(Call call, IOException e) {
runOnUiThread(new Thread(new Runnable() {
@Override
public void run() {
showToast("同学,不好意思,照片上传失败啦");
}
}));
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if (response.code() == 500){
runOnUiThread(new Thread(new Runnable() {
@Override
public void run() {
showToast("同学,照片太大,上传失败啦");
}
}));
}
else {
runOnUiThread(new Thread(new Runnable() {
@Override
public void run() {
showToast("报告同学,照片上传成功");
String imgUri = "http://119.23.248.205:8080/pictures/" + uriSuffix;
EventBus.getDefault().post(new UserPictureUploadDone(imgUri, localPath));
}
}));
}
}
});
}
@Subscribe(threadMode = ThreadMode.MAIN) //在ui线程执行
public void onPictureUploadDoneEvent(UserPictureUploadDone event) {
currentUser = ParseUser.getCurrentUser();
if (event != null && currentUser != null){
try{
SharePreferenceManager.putString(this,Constants.DB_USERIMG,event.getLocalImgUrl());
currentUser.put("mImgUrl",event.getCloudImgUrl());
currentUser.saveInBackground();
Uri mUri = Uri.fromFile(new File(event.getLocalImgUrl()));
isImgSet = true;
Glide.with(this).load(mUri).into(userImg);
}catch (Exception e){
}
}
}
@Override
protected void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}
}
| UTF-8 | Java | 15,880 | java | RegisterInfoOneActivity.java | Java | [
{
"context": "层次\n private int gradeId;\n\n //当前用户\n String userName;\n String password;\n String phoneNum;\n Pa",
"end": 3257,
"score": 0.9684467315673828,
"start": 3249,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "ent();\n userName = mIntent.getStringExtra(\"userName\");\n password = mIntent.getStringExtra(\"pas",
"end": 3727,
"score": 0.9996147751808167,
"start": 3719,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "ew Request.Builder()\n .url(\"http://119.23.248.205:8080\")//地址\n .post(requ",
"end": 13256,
"score": 0.7707935571670532,
"start": 13254,
"tag": "IP_ADDRESS",
"value": "11"
},
{
"context": "uest.Builder()\n .url(\"http://119.23.248.205:8080\")//地址\n .post(requestBod",
"end": 13262,
"score": 0.644279420375824,
"start": 13261,
"tag": "IP_ADDRESS",
"value": "2"
},
{
"context": " String imgUri = \"http://119.23.248.205:8080/pictures/\" + uriSuffix;\n ",
"end": 14441,
"score": 0.9989923238754272,
"start": 14427,
"tag": "IP_ADDRESS",
"value": "119.23.248.205"
}
] | null | [] | package com.zju.campustour.view.activity;
import android.Manifest;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.parse.ParseUser;
import com.tbruyelle.rxpermissions2.RxPermissions;
import com.yalantis.ucrop.UCrop;
import com.zhihu.matisse.Matisse;
import com.zhihu.matisse.MimeType;
import com.zhihu.matisse.engine.impl.GlideEngine;
import com.zhihu.matisse.filter.Filter;
import com.zju.campustour.R;
import com.zju.campustour.model.common.Constants;
import com.zju.campustour.model.util.SharePreferenceManager;
import com.zju.campustour.model.chatting.utils.HandleResponseCode;
import com.zju.campustour.presenter.listener.MyTextWatch;
import com.zju.campustour.presenter.protocal.event.UserPictureUploadDone;
import com.zju.campustour.view.widget.ClearEditText;
import com.zju.campustour.view.widget.GifSizeFilter;
import com.zju.campustour.view.widget.GradeSelectDialog;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.jpush.im.android.api.JMessageClient;
import cn.jpush.im.android.api.model.UserInfo;
import cn.jpush.im.api.BasicCallback;
import de.hdodenhof.circleimageview.CircleImageView;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
import okhttp3.Call;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import static com.zju.campustour.model.common.Constants.User_isVerified;
@Deprecated
public class RegisterInfoOneActivity extends BaseActivity{
@BindView(R.id.register_info_one_toolbar)
Toolbar mToolbar;
@BindView(R.id.regist_user_img)
CircleImageView userImg;
@BindView(R.id.real_name)
ClearEditText realName;
@BindView(R.id.user_grade)
TextView userGrade;
@BindView(R.id.user_email_addr)
ClearEditText userEmail;
@BindView(R.id.user_sex_type)
RadioGroup userSexType;
@BindView(R.id.user_short_desc)
ClearEditText userShortDesc;
@BindView(R.id.user_grade_select)
RelativeLayout userGradeSelect;
@BindView(R.id.btn_one_next)
Button btnNext;
@BindView(R.id.user_info_update_title_1)
TextView title;
private boolean isRealNameNotNull = false;
private boolean isUserShortDesc = false;
private Context mContext = this;
private boolean isImgSet = false;
//注册以后要将当前用户自动登录
//private UserInfoOpPresenterImpl userLoginImpl;
//拿到用户的年级层次
private int gradeId;
//当前用户
String userName;
String password;
String phoneNum;
ParseUser currentUser;
//是否是编辑模式
private boolean isEditMode = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register_info_one);
ButterKnife.bind(this);
EventBus.getDefault().register(this);
Intent mIntent = getIntent();
userName = mIntent.getStringExtra("userName");
password = mIntent.getStringExtra("password");
phoneNum = mIntent.getStringExtra("phone");
isEditMode = mIntent.getBooleanExtra("isEditMode",false);
currentUser = ParseUser.getCurrentUser();
if (currentUser == null)
return;
initOriginalView();
initView();
}
@Deprecated
private void initOriginalView() {
try{
/*该方法在版本1.2以后已经废弃*/
if (currentUser != null && isEditMode){
title.setText("信息修改 1/2");
realName.setText(currentUser.getString("realname"));
isImgSet = true;
isRealNameNotNull = true;
userEmail.setText(currentUser.getString("emailAddr"));
userGrade.setText(currentUser.getString("grade"));
userSexType.check(currentUser.getInt("sex") == 0 ? R.id.select_male : R.id.select_female);
userShortDesc.setText(currentUser.getString("shortDescription"));
isUserShortDesc = true;
gradeId = currentUser.getInt("gradeId");
btnNext.setEnabled(true);
}
else {
userSexType.check(R.id.select_male);
}
}catch (Exception e){
}
}
private void initView(){
//让按钮随着输入内容有效而使能
realName.addTextChangedListener(new MyTextWatch() {
@Override
public void afterTextChanged(Editable s) {
isRealNameNotNull = !TextUtils.isEmpty(s.toString());
btnNext.setEnabled((isRealNameNotNull && isUserShortDesc));
}
});
userShortDesc.addTextChangedListener(new MyTextWatch() {
@Override
public void afterTextChanged(Editable s) {
isUserShortDesc = !TextUtils.isEmpty(s.toString());
btnNext.setEnabled((isRealNameNotNull && isUserShortDesc));
}
});
userGradeSelect.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
GradeSelectDialog.Builder mBuilder = new GradeSelectDialog.Builder(mContext);
mBuilder.setPositiveButtonListener(new GradeSelectDialog.Builder.OnGradeSelectClickListener() {
@Override
public void onClick(DialogInterface dialog, String grade, int gradeIndex) {
dialog.dismiss();
userGrade.setText(grade);
gradeId = gradeIndex ;
}
});
GradeSelectDialog dialog = mBuilder.create();
dialog.setCancelable(false);
dialog.show();
}
});
}
@OnClick(R.id.btn_one_next)
protected void updateUserInfo(){
if (!isImgSet) {
showToast("请选择头像");
return;
}
String userRealName = realName.getText().toString().trim();
if (TextUtils.isEmpty(userRealName)) {
showToast("请输入真实姓名");
return;
}
String grade = userGrade.getText().toString().trim();
if ("点击选择".equals(grade)){
showToast("请选择你的学历");
return;
}
String email = userEmail.getText().toString().trim();
int userSex = userSexType.getCheckedRadioButtonId() == R.id.select_male ? 0:1;
String shortDesc = userShortDesc.getText().toString().trim();
if (TextUtils.isEmpty(shortDesc)) {
showToast("请用一句话完成自我介绍");
return;
}
currentUser.put("realname",userRealName);
currentUser.put("phoneNum",phoneNum);
currentUser.put("emailAddr",email);
currentUser.put("grade",grade);
currentUser.put("sex",userSex);
currentUser.put(User_isVerified,false);
currentUser.put("shortDescription",shortDesc);
currentUser.put("gradeId",gradeId);
//上传极光 用户性别 个性签名
try {
UserInfo myUserInfo = JMessageClient.getMyInfo();
myUserInfo.setGender(userSex == 1 ? UserInfo.Gender.female : UserInfo.Gender.male);
JMessageClient.updateMyInfo(UserInfo.Field.gender, myUserInfo, new BasicCallback() {
@Override
public void gotResult(final int status, final String desc) {
if (status != 0) {
HandleResponseCode.onHandle(mContext, status, false);
}
}
});
myUserInfo.setSignature(shortDesc);
JMessageClient.updateMyInfo(UserInfo.Field.signature, myUserInfo, new BasicCallback() {
@Override
public void gotResult(final int status, final String desc) {
if (status != 0) {
HandleResponseCode.onHandle(mContext, status, false);
}
}
});
}catch (Exception e){
}
currentUser.saveInBackground();
Intent mIntent = new Intent(this, RegisterInfoTwoActivity.class);
mIntent.putExtra("gradeId",gradeId);
mIntent.putExtra("isEditMode",isEditMode);
startActivity(mIntent);
}
@OnClick(R.id.regist_user_img)
public void chooseUserImg(){
/*Intent mIntent = new Intent(this, RegisterInfoOneActivity.class);
mIntent.putExtra("isEditMode",true);
startActivity(mIntent);*/
RxPermissions rxPermissions = new RxPermissions(this);
rxPermissions.request(Manifest.permission.WRITE_EXTERNAL_STORAGE)
.subscribe(new Observer<Boolean>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(Boolean aBoolean) {
if (aBoolean) {
Matisse.from(RegisterInfoOneActivity.this)
.choose(MimeType.ofAll(), false)
.countable(true)
.maxSelectable(1)
.addFilter(new GifSizeFilter(320, 320, 5 * Filter.K * Filter.K))
.gridExpectedSize(
getResources().getDimensionPixelSize(R.dimen.grid_expected_size))
.restrictOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
.thumbnailScale(0.85f)
.imageEngine(new GlideEngine())
.forResult(Constants.REQUEST_CODE_CHOOSE);
} else {
showToast("权限请求被拒绝");
}
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case Constants.REQUEST_CODE_CHOOSE:
if (data == null)
break;
List<Uri> mUriList = Matisse.obtainResult(data);
Uri mUri = mUriList.get(0);
String[] filePathColumn = {MediaStore.Images.Media.DATA};
Cursor cursor = getContentResolver().query(mUri,
filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
final String picturePath = cursor.getString(columnIndex);
cursor.close();
startCrop(picturePath);
break;
case UCrop.REQUEST_CROP:
if (data == null)
break;
Uri croppedFileUri = UCrop.getOutput(data);
if (croppedFileUri != null) {
imageUpLoad(croppedFileUri.getPath());
}
break;
default:
}
}
private void startCrop(String url) {
Uri sourceUri = Uri.fromFile(new File(url));
//裁剪后保存到文件中
Date mDate = new Date();
Uri destinationUri = Uri.fromFile(new File(getCacheDir(),mDate.getTime()+"_showyou.jpeg"));
UCrop.of(sourceUri, destinationUri).withAspectRatio(1, 1).withMaxResultSize(800, 800).start(this);
}
public void imageUpLoad(String localPath) {
MediaType MEDIA_TYPE_PNG = MediaType.parse("image/jpeg");
OkHttpClient client = new OkHttpClient();
String suffix = localPath.substring(localPath.lastIndexOf("."));
MultipartBody.Builder builder = new MultipartBody.Builder().setType(MultipartBody.FORM);
File f = new File(localPath);
//上传极光聊天头像
JMessageClient.updateUserAvatar(f,null);
builder.addFormDataPart("file", f.getName(), RequestBody.create(MEDIA_TYPE_PNG, f));
Date mDate = new Date();
String uriSuffix = currentUser.getObjectId()+suffix+mDate.getTime();
final MultipartBody requestBody = builder.addFormDataPart("name",uriSuffix).build();
//构建请求
final Request request = new Request.Builder()
.url("http://119.23.248.205:8080")//地址
.post(requestBody)//添加请求体
.build();
client.newCall(request).enqueue(new okhttp3.Callback() {
@Override
public void onFailure(Call call, IOException e) {
runOnUiThread(new Thread(new Runnable() {
@Override
public void run() {
showToast("同学,不好意思,照片上传失败啦");
}
}));
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if (response.code() == 500){
runOnUiThread(new Thread(new Runnable() {
@Override
public void run() {
showToast("同学,照片太大,上传失败啦");
}
}));
}
else {
runOnUiThread(new Thread(new Runnable() {
@Override
public void run() {
showToast("报告同学,照片上传成功");
String imgUri = "http://192.168.127.12:8080/pictures/" + uriSuffix;
EventBus.getDefault().post(new UserPictureUploadDone(imgUri, localPath));
}
}));
}
}
});
}
@Subscribe(threadMode = ThreadMode.MAIN) //在ui线程执行
public void onPictureUploadDoneEvent(UserPictureUploadDone event) {
currentUser = ParseUser.getCurrentUser();
if (event != null && currentUser != null){
try{
SharePreferenceManager.putString(this,Constants.DB_USERIMG,event.getLocalImgUrl());
currentUser.put("mImgUrl",event.getCloudImgUrl());
currentUser.saveInBackground();
Uri mUri = Uri.fromFile(new File(event.getLocalImgUrl()));
isImgSet = true;
Glide.with(this).load(mUri).into(userImg);
}catch (Exception e){
}
}
}
@Override
protected void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}
}
| 15,880 | 0.583022 | 0.578183 | 449 | 33.525612 | 25.698092 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.57461 | false | false | 10 |
ebc981d00c501baf9f09e2886af1f6c8ffd02bf0 | 8,229,157,394,305 | f39b33257a1219aae04923ffc9865ebdd9455b5b | /netty.study/src/main/java/netty/study/TelnetClient.java | 1373fca4b09f2fe6049d0988aa61abb724a5afae | [] | no_license | saytokang/NettyStudy | https://github.com/saytokang/NettyStudy | 55eb883364e1acc1031ab562f5a3a22e86f04130 | 40ecd8a54d87cfdf053ec615ad31de72d84b8685 | refs/heads/master | 2020-05-29T17:09:53.566000 | 2015-10-18T09:09:49 | 2015-10-18T09:09:49 | 44,472,015 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package netty.study;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.string.StringEncoder;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;
public class TelnetClient {
public static void main(String[] args) throws InterruptedException {
EventLoopGroup group = new NioEventLoopGroup();
try {
Bootstrap b = new Bootstrap();
b.group(group)
.channel(NioSocketChannel.class)
.handler(new ChannelInitializer<SocketChannel>() {
@Override
protected void initChannel(SocketChannel ch)
throws Exception {
// TODO Auto-generated method stub
ChannelPipeline pipeline = ch.pipeline();
pipeline.addLast("0", new LoggingHandler(LogLevel.INFO));
pipeline.addLast("4", new StringEncoder());
pipeline.addLast("5", new ClientHandler());
}
});
ChannelFuture f = b.connect("localhost", 8000).sync();
} finally {
group.shutdownGracefully();
}
}
}
| UTF-8 | Java | 1,290 | java | TelnetClient.java | Java | [] | null | [] | package netty.study;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.string.StringEncoder;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;
public class TelnetClient {
public static void main(String[] args) throws InterruptedException {
EventLoopGroup group = new NioEventLoopGroup();
try {
Bootstrap b = new Bootstrap();
b.group(group)
.channel(NioSocketChannel.class)
.handler(new ChannelInitializer<SocketChannel>() {
@Override
protected void initChannel(SocketChannel ch)
throws Exception {
// TODO Auto-generated method stub
ChannelPipeline pipeline = ch.pipeline();
pipeline.addLast("0", new LoggingHandler(LogLevel.INFO));
pipeline.addLast("4", new StringEncoder());
pipeline.addLast("5", new ClientHandler());
}
});
ChannelFuture f = b.connect("localhost", 8000).sync();
} finally {
group.shutdownGracefully();
}
}
}
| 1,290 | 0.74031 | 0.734884 | 39 | 32.076923 | 20.058102 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3 | false | false | 10 |
b3f9561bdd2fecb9105d1618fca8479edb9942f2 | 12,249,246,753,294 | 8872ddc67919a6a13f3622fb691fb408b3e36bbd | /src/main/java/com/park/model/Page.java | b986795e3b649858e2bd17bd79674d71127ff178 | [] | no_license | ruoxingzpc/Park | https://github.com/ruoxingzpc/Park | 96cc67d5f2fa846c32ebf186d5a91db87a7b789c | 279de10620e2d0482030d7f63918b92eb190bbaa | refs/heads/master | 2019-08-03T07:41:01.631000 | 2019-04-25T15:56:38 | 2019-04-25T15:56:38 | 37,262,378 | 1 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.park.model;
public class Page {
private int id;
private String description;
private String uri;
private String pageKey;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getDescription() {
return description;
}
public void setDescription(String desc) {
this.description = desc;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getPageKey() {
return pageKey;
}
public void setPageKey(String pageKey) {
this.pageKey = pageKey;
}
}
| UTF-8 | Java | 608 | java | Page.java | Java | [] | null | [] | package com.park.model;
public class Page {
private int id;
private String description;
private String uri;
private String pageKey;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getDescription() {
return description;
}
public void setDescription(String desc) {
this.description = desc;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getPageKey() {
return pageKey;
}
public void setPageKey(String pageKey) {
this.pageKey = pageKey;
}
}
| 608 | 0.657895 | 0.657895 | 49 | 11.408163 | 12.574542 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.285714 | false | false | 10 |
ae4ca8d7f925afa5446a136bac02620ac4c4ca1a | 12,249,246,753,192 | 46779c873e0a909fa6a714f3e46e8cf9f29964a4 | /监控平台/trunk/schedule/com-tyyd-ywpt-schedule-biz/src/main/java/com/tyyd/ywpt/schedule/baseline/strategy/oracle/OracleDirectCompareBaseLineMetaDataCalStrategyImpl.java | 97ea867431a5330a70a97f805fa8cfa937016a78 | [] | no_license | LQXMan/red-alert-analyze | https://github.com/LQXMan/red-alert-analyze | 50f0cf666fc432034c4ad55c0dd1e26fd02cd2fc | b012be7666b1eb968bec02214d516d33cbd851d7 | refs/heads/master | 2020-05-20T01:47:21.892000 | 2019-01-10T03:56:21 | 2019-01-10T03:56:21 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* @Title: OracleDirectCompareBaseLineMetaDataCalStrategyImpl.java
* @Package com.tyyd.ywpt.schedule.baseline.strategy.oracle
* @Description:
* @author wangyu
* @date 2015-3-10 下午6:25:18
* @CopyRight 天翼阅读
* @version V1.0
*/
package com.tyyd.ywpt.schedule.baseline.strategy.oracle;
import javax.annotation.Resource;
import com.tyyd.ywpt.dao.baseline.BaseLineRecordDAO;
import com.tyyd.ywpt.schedule.baseline.strategy.BaseLineMetaDataCalStrategyManager;
/**
* @author wangyu
*
*/
public class OracleDirectCompareBaseLineMetaDataCalStrategyImpl implements
BaseLineMetaDataCalStrategyManager {
@Resource
private BaseLineRecordDAO baseLineRecordDAO;
@Override
public void calMetaData(String monitorId, String quotaId) {
baseLineRecordDAO.saveOracleDirectCompareBaseLine(monitorId, quotaId);
}
}
| UTF-8 | Java | 842 | java | OracleDirectCompareBaseLineMetaDataCalStrategyImpl.java | Java | [
{
"context": "eline.strategy.oracle \n* @Description: \n* @author wangyu \n* @date 2015-3-10 下午6:25:18 \n* @CopyRight 天翼阅读",
"end": 168,
"score": 0.9462166428565979,
"start": 162,
"tag": "USERNAME",
"value": "wangyu"
},
{
"context": "aseLineMetaDataCalStrategyManager;\n\n/**\n * @author wangyu\n *\n */\npublic class OracleDirectCompareBaseLineMe",
"end": 493,
"score": 0.9899370074272156,
"start": 487,
"tag": "USERNAME",
"value": "wangyu"
}
] | null | [] | /**
* @Title: OracleDirectCompareBaseLineMetaDataCalStrategyImpl.java
* @Package com.tyyd.ywpt.schedule.baseline.strategy.oracle
* @Description:
* @author wangyu
* @date 2015-3-10 下午6:25:18
* @CopyRight 天翼阅读
* @version V1.0
*/
package com.tyyd.ywpt.schedule.baseline.strategy.oracle;
import javax.annotation.Resource;
import com.tyyd.ywpt.dao.baseline.BaseLineRecordDAO;
import com.tyyd.ywpt.schedule.baseline.strategy.BaseLineMetaDataCalStrategyManager;
/**
* @author wangyu
*
*/
public class OracleDirectCompareBaseLineMetaDataCalStrategyImpl implements
BaseLineMetaDataCalStrategyManager {
@Resource
private BaseLineRecordDAO baseLineRecordDAO;
@Override
public void calMetaData(String monitorId, String quotaId) {
baseLineRecordDAO.saveOracleDirectCompareBaseLine(monitorId, quotaId);
}
}
| 842 | 0.789157 | 0.772289 | 34 | 23.411764 | 26.208572 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.588235 | false | false | 10 |
51904eecee477989e7e2d4120ffd8a37f4fba6af | 7,387,343,780,640 | bfa51e374acbd71a6526347a368c1bc5f562c8d0 | /app/src/main/java/com/music/ui/activity/user/SetActivity.java | 86e74086e1d667daace58408f0bc225ac244362f | [] | no_license | liqiang2199/crazymusic | https://github.com/liqiang2199/crazymusic | 0e4d9c798b0a77cede41cddb29f5c733a2f6b1cc | 48c059b15fcad299faac743761fca8cb27fd85c8 | refs/heads/master | 2021-05-09T21:30:10.643000 | 2018-03-13T15:35:57 | 2018-03-13T15:35:57 | 118,728,445 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.music.ui.activity.user;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.TextView;
import com.music.R;
import com.music.common.Constants;
import com.music.ui.activity.BaseActivity;
import com.music.ui.dialog.DialogCommonTip;
import com.music.utils.CacheUtil;
import com.music.utils.UtilsTools;
import com.music.utils.XActionUtil;
import org.greenrobot.eventbus.EventBus;
import org.xutils.common.util.LogUtil;
import ch.ielse.view.SwitchView;
/**
* 设置
*/
public class SetActivity extends BaseActivity implements CompoundButton.OnCheckedChangeListener
,DialogCommonTip.DialogOnClickSubmit{
private SwitchView switchButton;
private TextView tvVersionUpdate;
private TextView tvTermsOfTheAgreement;
private TextView tvClearCache;
private TextView tvSignOut;
private TextView tv_account_manage;//账号管理
private TextView tv_version_update;//版本号
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_set);
super.onCreate(savedInstanceState);
initView();
}
@SuppressLint({"SetTextI18n", "CutPasteId"})
private void initView() {
switchButton = (SwitchView) findViewById(R.id.switchButton);
tvVersionUpdate = (TextView) findViewById(R.id.tv_version_update);
tvTermsOfTheAgreement = (TextView) findViewById(R.id.tv_terms_of_the_agreement);
tvClearCache = (TextView) findViewById(R.id.tv_clear_cache);
tvSignOut = (TextView) findViewById(R.id.tv_sign_out);
tv_account_manage = (TextView) findViewById(R.id.tv_account_manage);
tv_version_update = (TextView) findViewById(R.id.tv_version_update);
tv_version_update.setText("v"+getLocalVersionName());
tvVersionUpdate.setOnClickListener(this);
tvTermsOfTheAgreement.setOnClickListener(this);
tvClearCache.setOnClickListener(this);
tv_account_manage.setOnClickListener(this);
//
if (UtilsTools.isStringNull(UtilsTools.getReadCacheUtilData(Constants.TOKEN))){
tvSignOut.setOnClickListener(null);
tvSignOut.setVisibility(View.GONE);
}else{
tvSignOut.setOnClickListener(this);
tvSignOut.setVisibility(View.VISIBLE);
}
Width_Height();
}
@Override
public void onClick(View v) {
super.onClick(v);
switch (v.getId()) {
case R.id.tv_sign_out:
//退出登录
DialogCommonTip dialogCommonTip = new DialogCommonTip(mContext,R.style.ScreenDialogStyle,width,height);
dialogCommonTip.setDialogTitle("确定退出登录?").setDialogCancel("取消")
.setDialogSubmit("确定").setDialogOnClick(this).show();
break;
case R.id.tv_account_manage:
//账号管理
startActivity(new Intent(mContext,UserAccountBindActivity.class));
break;
}
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
}
@Override
public void onDialogClickSubmit() {
Intent intent = new Intent();
intent.putExtra("isBack", true);
XActionUtil.action().appStartActivity(intent, XActionUtil.LOGIN);
//退出登录后清空所有 保存
CacheUtil.deleteAll();
finish();
}
@Override
public void onDialogClickCancel() {
}
/**
* 获取本地软件版本号名称
*/
private String getLocalVersionName() {
String localVersion = "";
try {
PackageInfo packageInfo = getApplicationContext()
.getPackageManager()
.getPackageInfo(getPackageName(), 0);
localVersion = packageInfo.versionName;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return localVersion;
}
}
| UTF-8 | Java | 4,218 | java | SetActivity.java | Java | [] | null | [] | package com.music.ui.activity.user;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.TextView;
import com.music.R;
import com.music.common.Constants;
import com.music.ui.activity.BaseActivity;
import com.music.ui.dialog.DialogCommonTip;
import com.music.utils.CacheUtil;
import com.music.utils.UtilsTools;
import com.music.utils.XActionUtil;
import org.greenrobot.eventbus.EventBus;
import org.xutils.common.util.LogUtil;
import ch.ielse.view.SwitchView;
/**
* 设置
*/
public class SetActivity extends BaseActivity implements CompoundButton.OnCheckedChangeListener
,DialogCommonTip.DialogOnClickSubmit{
private SwitchView switchButton;
private TextView tvVersionUpdate;
private TextView tvTermsOfTheAgreement;
private TextView tvClearCache;
private TextView tvSignOut;
private TextView tv_account_manage;//账号管理
private TextView tv_version_update;//版本号
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_set);
super.onCreate(savedInstanceState);
initView();
}
@SuppressLint({"SetTextI18n", "CutPasteId"})
private void initView() {
switchButton = (SwitchView) findViewById(R.id.switchButton);
tvVersionUpdate = (TextView) findViewById(R.id.tv_version_update);
tvTermsOfTheAgreement = (TextView) findViewById(R.id.tv_terms_of_the_agreement);
tvClearCache = (TextView) findViewById(R.id.tv_clear_cache);
tvSignOut = (TextView) findViewById(R.id.tv_sign_out);
tv_account_manage = (TextView) findViewById(R.id.tv_account_manage);
tv_version_update = (TextView) findViewById(R.id.tv_version_update);
tv_version_update.setText("v"+getLocalVersionName());
tvVersionUpdate.setOnClickListener(this);
tvTermsOfTheAgreement.setOnClickListener(this);
tvClearCache.setOnClickListener(this);
tv_account_manage.setOnClickListener(this);
//
if (UtilsTools.isStringNull(UtilsTools.getReadCacheUtilData(Constants.TOKEN))){
tvSignOut.setOnClickListener(null);
tvSignOut.setVisibility(View.GONE);
}else{
tvSignOut.setOnClickListener(this);
tvSignOut.setVisibility(View.VISIBLE);
}
Width_Height();
}
@Override
public void onClick(View v) {
super.onClick(v);
switch (v.getId()) {
case R.id.tv_sign_out:
//退出登录
DialogCommonTip dialogCommonTip = new DialogCommonTip(mContext,R.style.ScreenDialogStyle,width,height);
dialogCommonTip.setDialogTitle("确定退出登录?").setDialogCancel("取消")
.setDialogSubmit("确定").setDialogOnClick(this).show();
break;
case R.id.tv_account_manage:
//账号管理
startActivity(new Intent(mContext,UserAccountBindActivity.class));
break;
}
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
}
@Override
public void onDialogClickSubmit() {
Intent intent = new Intent();
intent.putExtra("isBack", true);
XActionUtil.action().appStartActivity(intent, XActionUtil.LOGIN);
//退出登录后清空所有 保存
CacheUtil.deleteAll();
finish();
}
@Override
public void onDialogClickCancel() {
}
/**
* 获取本地软件版本号名称
*/
private String getLocalVersionName() {
String localVersion = "";
try {
PackageInfo packageInfo = getApplicationContext()
.getPackageManager()
.getPackageInfo(getPackageName(), 0);
localVersion = packageInfo.versionName;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return localVersion;
}
}
| 4,218 | 0.669257 | 0.668528 | 126 | 31.682539 | 25.063301 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.579365 | false | false | 10 |
5252c1aac089203c2e97b20b994b83dabdcd9831 | 13,829,794,694,605 | 7b9e40b834a8a0a5533c1fae1e5a8dab64885e20 | /src/main/java/io/muserver/NettyRequestParameters.java | 6ede17018a15441df792bdd8aacd2511e4b91a9f | [
"MIT"
] | permissive | lanlvyip/mu-server | https://github.com/lanlvyip/mu-server | ac69a5025669ab5a1062365e23b9472db76d6425 | d7cc219a2243164b914496a6d327a5c98457c3fa | refs/heads/master | 2023-01-06T08:41:09.538000 | 2020-10-25T15:24:01 | 2020-10-25T15:24:01 | 284,998,653 | 0 | 0 | MIT | true | 2020-08-04T14:06:16 | 2020-08-04T14:06:15 | 2020-08-02T05:37:22 | 2020-08-03T07:54:58 | 4,196 | 0 | 0 | 0 | null | false | false | package io.muserver;
import io.netty.handler.codec.http.QueryStringDecoder;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import static java.util.Collections.emptyList;
class NettyRequestParameters implements RequestParameters {
private final QueryStringDecoder decoder;
NettyRequestParameters(QueryStringDecoder decoder) {
Mutils.notNull("decoder", decoder);
this.decoder = decoder;
}
@Override
public Map<String, List<String>> all() {
return decoder.parameters();
}
@Override
public String get(String name) {
return get(name, null);
}
@Override
public String get(String name, String defaultValue) {
List<String> values = decoder.parameters().get(name);
if (values == null) {
return defaultValue;
}
return values.get(0);
}
@Override
public int getInt(String name, int defaultValue) {
try {
String stringVal = get(name, null);
if (stringVal == null) {
return defaultValue;
}
return Integer.parseInt(stringVal, 10);
} catch (NumberFormatException e) {
return defaultValue;
}
}
@Override
public long getLong(String name, long defaultValue) {
try {
String stringVal = get(name, null);
if (stringVal == null) {
return defaultValue;
}
return Long.parseLong(stringVal, 10);
} catch (NumberFormatException e) {
return defaultValue;
}
}
@Override
public float getFloat(String name, float defaultValue) {
try {
String stringVal = get(name, null);
if (stringVal == null) {
return defaultValue;
}
return Float.parseFloat(stringVal);
} catch (NumberFormatException e) {
return defaultValue;
}
}
@Override
public double getDouble(String name, double defaultValue) {
try {
String stringVal = get(name, null);
if (stringVal == null) {
return defaultValue;
}
return Double.parseDouble(stringVal);
} catch (NumberFormatException e) {
return defaultValue;
}
}
@Override
public boolean getBoolean(String name) {
String val = get(name, "").toLowerCase();
return isTruthy(val);
}
static boolean isTruthy(String val) {
switch (val) {
case "true":
case "on":
case "yes":
case "1":
return true;
default:
return false;
}
}
@Override
public List<String> getAll(String name) {
List<String> values = decoder.parameters().get(name);
if (values == null) {
return emptyList();
}
return values;
}
@Override
public boolean contains(String name) {
return decoder.parameters().containsKey(name);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
NettyRequestParameters that = (NettyRequestParameters) o;
return Objects.equals(decoder.parameters(), that.decoder.parameters());
}
@Override
public int hashCode() {
return Objects.hash(decoder.parameters());
}
@Override
public String toString() {
String s = decoder.toString();
int qm = s.indexOf('?');
return qm == -1 ? s : s.substring(qm + 1);
}
}
| UTF-8 | Java | 3,682 | java | NettyRequestParameters.java | Java | [] | null | [] | package io.muserver;
import io.netty.handler.codec.http.QueryStringDecoder;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import static java.util.Collections.emptyList;
class NettyRequestParameters implements RequestParameters {
private final QueryStringDecoder decoder;
NettyRequestParameters(QueryStringDecoder decoder) {
Mutils.notNull("decoder", decoder);
this.decoder = decoder;
}
@Override
public Map<String, List<String>> all() {
return decoder.parameters();
}
@Override
public String get(String name) {
return get(name, null);
}
@Override
public String get(String name, String defaultValue) {
List<String> values = decoder.parameters().get(name);
if (values == null) {
return defaultValue;
}
return values.get(0);
}
@Override
public int getInt(String name, int defaultValue) {
try {
String stringVal = get(name, null);
if (stringVal == null) {
return defaultValue;
}
return Integer.parseInt(stringVal, 10);
} catch (NumberFormatException e) {
return defaultValue;
}
}
@Override
public long getLong(String name, long defaultValue) {
try {
String stringVal = get(name, null);
if (stringVal == null) {
return defaultValue;
}
return Long.parseLong(stringVal, 10);
} catch (NumberFormatException e) {
return defaultValue;
}
}
@Override
public float getFloat(String name, float defaultValue) {
try {
String stringVal = get(name, null);
if (stringVal == null) {
return defaultValue;
}
return Float.parseFloat(stringVal);
} catch (NumberFormatException e) {
return defaultValue;
}
}
@Override
public double getDouble(String name, double defaultValue) {
try {
String stringVal = get(name, null);
if (stringVal == null) {
return defaultValue;
}
return Double.parseDouble(stringVal);
} catch (NumberFormatException e) {
return defaultValue;
}
}
@Override
public boolean getBoolean(String name) {
String val = get(name, "").toLowerCase();
return isTruthy(val);
}
static boolean isTruthy(String val) {
switch (val) {
case "true":
case "on":
case "yes":
case "1":
return true;
default:
return false;
}
}
@Override
public List<String> getAll(String name) {
List<String> values = decoder.parameters().get(name);
if (values == null) {
return emptyList();
}
return values;
}
@Override
public boolean contains(String name) {
return decoder.parameters().containsKey(name);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
NettyRequestParameters that = (NettyRequestParameters) o;
return Objects.equals(decoder.parameters(), that.decoder.parameters());
}
@Override
public int hashCode() {
return Objects.hash(decoder.parameters());
}
@Override
public String toString() {
String s = decoder.toString();
int qm = s.indexOf('?');
return qm == -1 ? s : s.substring(qm + 1);
}
}
| 3,682 | 0.560022 | 0.557849 | 142 | 24.929577 | 19.591837 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.450704 | false | false | 10 |
9f59537202c017a6d6fd4e321c2051b739404390 | 27,453,430,993,714 | 5a076617e29016fe75d6421d235f22cc79f8f157 | /Android 新浪微博客户端源码/src/com/weibo/android/logic/MainService.java | 026ad2de6b439363a6a9f518211e9b18d2bb483d | [] | no_license | dddddttttt/androidsourcecodes | https://github.com/dddddttttt/androidsourcecodes | 516b8c79cae7f4fa71b97a2a470eab52844e1334 | 3d13ab72163bbeed2ef226a476e29ca79766ea0b | refs/heads/master | 2020-08-17T01:38:54.095000 | 2018-04-08T15:17:24 | 2018-04-08T15:17:24 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.weibo.android.logic;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.ArrayList;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.util.Log;
import com.weibo.android.IWeiboActivity;
import com.weibo.android.Paging;
import com.weibo.net.Weibo;
import com.weibo.net.WeiboException;
public class MainService extends Service implements Runnable,IService{
private static ArrayList<IWeiboActivity> allActivity=new ArrayList<IWeiboActivity>();
private static ArrayList<Task> allTasks=new ArrayList<Task>();
public static boolean isRun=false;
public static void newTask(Task t){
allTasks.add(t);
}
public static void addActivity(IWeiboActivity iw){
allActivity.add(iw);
}
public static void removeActivity(IWeiboActivity iw){
allActivity.remove(iw);
}
public static IWeiboActivity getActivityByName(String name){
for(IWeiboActivity iw:allActivity){
if(iw.getClass().getName().indexOf(name)>=0){
return iw;
}
}
return null;
}
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
isRun=true;
new Thread(this).start();
Log.e("=============================", "MainService onCreate()");
}
@Override
public void onDestroy() {
// TODO Auto-generated method stub
isRun=false;
super.onDestroy();
}
@Override
public void run() {
// TODO Auto-generated method stub
while(isRun){
try{
if(allTasks.size()>0)
{
//执行任务
doTask(allTasks.get(0));
}else{
try{
Thread.sleep(2000);}catch(Exception e){}
//Log.e("=============================", "MainService doing ");
}
}catch(Exception e){
if(allTasks.size()>0)
allTasks.remove(allTasks.get(0));
Log.d("error","------------------"+e);
}
}
}
private Handler handler=new Handler(){
@Override
public void handleMessage(Message msg) {
// TODO Auto-generated method stub
super.handleMessage(msg);
switch (msg.what) {
case Task.HOMEREFRESH:
MainService.getActivityByName("HomeActivity").refresh(msg.obj);
break;
case Task.LOGIN:
break;
case Task.MYCONTACT://个人资料
MainService.getActivityByName("MyContactActivity")
.refresh(msg.obj);
break;
case Task.MSGACTIVITY:
/*MainService.getActivityByName("MsgActivity")
.refresh(msg.obj);*/
break;
case Task.NEWWEIBO:
MainService.getActivityByName("NewWeiboActivity").refresh(msg.obj);
break;
case Task.VIEWWEIBO:
MainService.getActivityByName("ViewWeiBoActivity").refresh(msg.obj);
break;
default:
break;
}
}
};
private void doTask(Task task) {
// TODO Auto-generated method stub
Message msg=handler.obtainMessage();
msg.what=task.getTaskId();
switch (task.getTaskId()) {
case Task.HOMEREFRESH:
try {
String result = Weibo.getInstance().getPublicTimeline(task.getCtx(),new Paging(1,10));
Log.v("result",result);
msg.obj=result;
} catch (WeiboException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
break;
case Task.LOGIN://登录
break;
case Task.MYCONTACT://个人资料
try {
String mycontactJson = Weibo.getInstance().showUser(task.getCtx(),Weibo.getInstance().getUid());
msg.obj=mycontactJson;
Log.v("return user detail", mycontactJson);
} catch (WeiboException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
break;
case Task.MSGACTIVITY://信息
/* preferences = getSharedPreferences("ss",
Context.MODE_PRIVATE);
token = preferences.getString("token", "");
tokenSecret=preferences.getString("tokenSecret", "");
weibo=OAuthConstant.getInstance().getWeibo();
weibo.setToken(token,tokenSecret);
try {
User user=weibo.showUser(preferences.getString("userId", ""));
msg.obj=user;
} catch (WeiboException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}*/
break;
case Task.NEWWEIBO:
try {
String content=task.getTaskParams().get("msg").toString();
Weibo.getInstance().updateStatus(task.getCtx(),content);
msg.obj="发表微博成功";
} catch (WeiboException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
break;
case Task.VIEWWEIBO:
try {
String weiboid=task.getTaskParams().get("weiboid").toString();
String returnStatus = Weibo.getInstance().showStatus(task.getCtx(),weiboid);
msg.obj=returnStatus;
} catch (WeiboException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
break;
default:
break;
}
allTasks.remove(task);
//通知主线程更新UI
handler.sendMessage(msg);
}
@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
@Override
public void destory() {
// TODO Auto-generated method stub
stopSelf();
}
}
| UTF-8 | Java | 5,832 | java | MainService.java | Java | [] | null | [] | package com.weibo.android.logic;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.ArrayList;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.util.Log;
import com.weibo.android.IWeiboActivity;
import com.weibo.android.Paging;
import com.weibo.net.Weibo;
import com.weibo.net.WeiboException;
public class MainService extends Service implements Runnable,IService{
private static ArrayList<IWeiboActivity> allActivity=new ArrayList<IWeiboActivity>();
private static ArrayList<Task> allTasks=new ArrayList<Task>();
public static boolean isRun=false;
public static void newTask(Task t){
allTasks.add(t);
}
public static void addActivity(IWeiboActivity iw){
allActivity.add(iw);
}
public static void removeActivity(IWeiboActivity iw){
allActivity.remove(iw);
}
public static IWeiboActivity getActivityByName(String name){
for(IWeiboActivity iw:allActivity){
if(iw.getClass().getName().indexOf(name)>=0){
return iw;
}
}
return null;
}
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
isRun=true;
new Thread(this).start();
Log.e("=============================", "MainService onCreate()");
}
@Override
public void onDestroy() {
// TODO Auto-generated method stub
isRun=false;
super.onDestroy();
}
@Override
public void run() {
// TODO Auto-generated method stub
while(isRun){
try{
if(allTasks.size()>0)
{
//执行任务
doTask(allTasks.get(0));
}else{
try{
Thread.sleep(2000);}catch(Exception e){}
//Log.e("=============================", "MainService doing ");
}
}catch(Exception e){
if(allTasks.size()>0)
allTasks.remove(allTasks.get(0));
Log.d("error","------------------"+e);
}
}
}
private Handler handler=new Handler(){
@Override
public void handleMessage(Message msg) {
// TODO Auto-generated method stub
super.handleMessage(msg);
switch (msg.what) {
case Task.HOMEREFRESH:
MainService.getActivityByName("HomeActivity").refresh(msg.obj);
break;
case Task.LOGIN:
break;
case Task.MYCONTACT://个人资料
MainService.getActivityByName("MyContactActivity")
.refresh(msg.obj);
break;
case Task.MSGACTIVITY:
/*MainService.getActivityByName("MsgActivity")
.refresh(msg.obj);*/
break;
case Task.NEWWEIBO:
MainService.getActivityByName("NewWeiboActivity").refresh(msg.obj);
break;
case Task.VIEWWEIBO:
MainService.getActivityByName("ViewWeiBoActivity").refresh(msg.obj);
break;
default:
break;
}
}
};
private void doTask(Task task) {
// TODO Auto-generated method stub
Message msg=handler.obtainMessage();
msg.what=task.getTaskId();
switch (task.getTaskId()) {
case Task.HOMEREFRESH:
try {
String result = Weibo.getInstance().getPublicTimeline(task.getCtx(),new Paging(1,10));
Log.v("result",result);
msg.obj=result;
} catch (WeiboException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
break;
case Task.LOGIN://登录
break;
case Task.MYCONTACT://个人资料
try {
String mycontactJson = Weibo.getInstance().showUser(task.getCtx(),Weibo.getInstance().getUid());
msg.obj=mycontactJson;
Log.v("return user detail", mycontactJson);
} catch (WeiboException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
break;
case Task.MSGACTIVITY://信息
/* preferences = getSharedPreferences("ss",
Context.MODE_PRIVATE);
token = preferences.getString("token", "");
tokenSecret=preferences.getString("tokenSecret", "");
weibo=OAuthConstant.getInstance().getWeibo();
weibo.setToken(token,tokenSecret);
try {
User user=weibo.showUser(preferences.getString("userId", ""));
msg.obj=user;
} catch (WeiboException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}*/
break;
case Task.NEWWEIBO:
try {
String content=task.getTaskParams().get("msg").toString();
Weibo.getInstance().updateStatus(task.getCtx(),content);
msg.obj="发表微博成功";
} catch (WeiboException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
break;
case Task.VIEWWEIBO:
try {
String weiboid=task.getTaskParams().get("weiboid").toString();
String returnStatus = Weibo.getInstance().showStatus(task.getCtx(),weiboid);
msg.obj=returnStatus;
} catch (WeiboException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
break;
default:
break;
}
allTasks.remove(task);
//通知主线程更新UI
handler.sendMessage(msg);
}
@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
@Override
public void destory() {
// TODO Auto-generated method stub
stopSelf();
}
}
| 5,832 | 0.670073 | 0.667994 | 221 | 25.126698 | 19.32579 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.882353 | false | false | 10 |
ba853477a00a429717e9e0694437e325d22f59df | 27,453,430,994,206 | 03c7dba8775d0c9f0da1b20eb74fe51a15b727ce | /project/loginForm.java | ffec976c6c8e9bf016874476574f55feb45de12b | [] | no_license | ShubhamGupta944/Java | https://github.com/ShubhamGupta944/Java | f3290c01ff7aa4f64232cb60f21dcfef9a15d021 | 75ab5369acf83ad62708abd1aceda12972b18c3d | refs/heads/master | 2023-02-26T09:05:36.409000 | 2021-02-07T08:12:27 | 2021-02-07T08:12:27 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package project;
import java.util.*;
class login {
String a, b;
Scanner scan = new Scanner(System.in);
void l1() {
System.out.println("login form");
System.out.println("please enter your username");
a = scan.nextLine();
System.out.println("please enter your password");
b = scan.nextLine();
scan.close();
}
}
class login2 extends login {
void l2() {
System.out.println(a);
System.out.println(b);
final String username = "ketan", password = "hr05m1252";
if(a.equals(username) && b.equals(password)){
System.out.println("yay! you loged in..");
}else {
System.out.println("please check your username and password");
}
}
}
class loginForm {
public static void main(final String[] args) {
final login2 l3 = new login2();
l3.l1();
l3.l2();
}
} | UTF-8 | Java | 940 | java | loginForm.java | Java | [
{
"context": "out.println(b);\n\n final String username = \"ketan\", password = \"hr05m1252\";\n\n if(a.equals(us",
"end": 535,
"score": 0.9992645978927612,
"start": 530,
"tag": "USERNAME",
"value": "ketan"
},
{
"context": " final String username = \"ketan\", password = \"hr05m1252\";\n\n if(a.equals(username) && b.equals(pass",
"end": 559,
"score": 0.9992358684539795,
"start": 550,
"tag": "PASSWORD",
"value": "hr05m1252"
}
] | null | [] | package project;
import java.util.*;
class login {
String a, b;
Scanner scan = new Scanner(System.in);
void l1() {
System.out.println("login form");
System.out.println("please enter your username");
a = scan.nextLine();
System.out.println("please enter your password");
b = scan.nextLine();
scan.close();
}
}
class login2 extends login {
void l2() {
System.out.println(a);
System.out.println(b);
final String username = "ketan", password = "<PASSWORD>";
if(a.equals(username) && b.equals(password)){
System.out.println("yay! you loged in..");
}else {
System.out.println("please check your username and password");
}
}
}
class loginForm {
public static void main(final String[] args) {
final login2 l3 = new login2();
l3.l1();
l3.l2();
}
} | 941 | 0.55 | 0.532979 | 57 | 15.508772 | 20.013262 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.350877 | false | false | 10 |
3abedc61c892d9f50732073b1bceb79691cd6560 | 3,582,002,744,621 | f88abc29dd46eacebe51c504cee7343494186a89 | /src/main/java/org/custom/items/CharacterInventory.java | 1fae9337705aad19ff4557694058e4818a59ff4a | [] | no_license | ChazyTheBest/CustomItems | https://github.com/ChazyTheBest/CustomItems | 569408832b1a15c0bc55033bcdbe35aa0ff8ddc9 | 9475b1d3b3aa14604102fcaf781e9019552d7975 | refs/heads/master | 2022-04-18T03:35:33.470000 | 2020-04-23T02:46:16 | 2020-04-23T02:46:16 | 255,992,499 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.custom.items;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
public class CharacterInventory
{
private final Properties entries = new Properties();
private final Map<String, ItemTemplate> slots = new HashMap<>(), slotsCopy = new HashMap<>();
public void getEntries(String name) throws Exception
{
try
{
FileManager.loadFile("offset.conf", entries);
FileManager.loadFile(name, entries);
}
catch (Exception e)
{
StringBuilder msg = new StringBuilder("The file ").append(name).append(" may be missing.\n\n")
.append("More information is detailed below, if you can't solve this problem please contact chazy :)\n\n")
.append(e.getMessage());
throw new Exception(msg.toString());
}
}
public boolean checkSlot(String slotName)
{
return slots.containsKey(slotName);
}
public ItemTemplate getSlot(String slotName)
{
return slots.get(slotName);
}
public ItemTemplate getSlotCopy(String slotName)
{
return slotsCopy.get(slotName);
}
public void setSlot(String slotName) throws Exception
{
slots.put(slotName, populateSlot(slotName));
slotsCopy.put(slotName, new ItemTemplate());
}
private ItemTemplate populateSlot(String slotName) throws Exception
{
ItemTemplate item = new ItemTemplate(entries.getProperty(slotName));
item.populateItem();
return item;
}
}
| UTF-8 | Java | 1,624 | java | CharacterInventory.java | Java | [] | null | [] | package org.custom.items;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
public class CharacterInventory
{
private final Properties entries = new Properties();
private final Map<String, ItemTemplate> slots = new HashMap<>(), slotsCopy = new HashMap<>();
public void getEntries(String name) throws Exception
{
try
{
FileManager.loadFile("offset.conf", entries);
FileManager.loadFile(name, entries);
}
catch (Exception e)
{
StringBuilder msg = new StringBuilder("The file ").append(name).append(" may be missing.\n\n")
.append("More information is detailed below, if you can't solve this problem please contact chazy :)\n\n")
.append(e.getMessage());
throw new Exception(msg.toString());
}
}
public boolean checkSlot(String slotName)
{
return slots.containsKey(slotName);
}
public ItemTemplate getSlot(String slotName)
{
return slots.get(slotName);
}
public ItemTemplate getSlotCopy(String slotName)
{
return slotsCopy.get(slotName);
}
public void setSlot(String slotName) throws Exception
{
slots.put(slotName, populateSlot(slotName));
slotsCopy.put(slotName, new ItemTemplate());
}
private ItemTemplate populateSlot(String slotName) throws Exception
{
ItemTemplate item = new ItemTemplate(entries.getProperty(slotName));
item.populateItem();
return item;
}
}
| 1,624 | 0.616379 | 0.616379 | 58 | 27 | 31.058899 | 148 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.431034 | false | false | 10 |
a31f7c8552c6edb83aebbc435ff7f9fc0ea01e7a | 1,425,929,175,136 | bfc8eb5eccc353489557b0a4cd7d572e8bb174b6 | /introduccionJava/ejercicios/NumCifras.java | 02f21c926f4a4fc21e8afca3c1fca3a620e30a65 | [
"MIT"
] | permissive | djharo/Programacion | https://github.com/djharo/Programacion | dfdae4f1102054b9ccd76b3a234859d888112dd0 | 0216f37f45251c3482fe26f119d7071c1b0b1663 | refs/heads/master | 2020-08-29T17:21:30.112000 | 2019-10-22T22:20:47 | 2019-10-22T22:20:47 | 218,109,206 | 1 | 0 | MIT | true | 2019-10-28T17:42:37 | 2019-10-28T17:42:36 | 2019-10-28T17:42:34 | 2019-10-22T22:20:57 | 24,751 | 0 | 0 | 0 | null | false | false | import utilidades.Entrada;
public class NumCifras {
public static void main(String[] args) {
int numero;
do {
System.out.print("Introduce un número mayor que cero: ");
numero = Entrada.entero();
} while (numero <= 0);
int cifras = 0;
//Si cambiamos el while por este comentado,
//while (numero / (int)Math.pow(10,cifras) != 0) {
//podriamos evitar la sentencia numero /= 10 y así no modificar numero
while (numero != 0) {
numero /= 10;
cifras++;
}
System.out.println("Tiene " + cifras + " cifras");
}
}
| UTF-8 | Java | 629 | java | NumCifras.java | Java | [] | null | [] | import utilidades.Entrada;
public class NumCifras {
public static void main(String[] args) {
int numero;
do {
System.out.print("Introduce un número mayor que cero: ");
numero = Entrada.entero();
} while (numero <= 0);
int cifras = 0;
//Si cambiamos el while por este comentado,
//while (numero / (int)Math.pow(10,cifras) != 0) {
//podriamos evitar la sentencia numero /= 10 y así no modificar numero
while (numero != 0) {
numero /= 10;
cifras++;
}
System.out.println("Tiene " + cifras + " cifras");
}
}
| 629 | 0.551834 | 0.535885 | 22 | 27.5 | 22.628923 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.818182 | false | false | 10 |
25be60a9b285002a70eb33aad9dea9094c8d11ee | 10,685,878,633,128 | 81cc5257e26c10caef21cc8ec5969dc2207af5e3 | /src/main/java/pl/szyjkowski/githubapi/service/GitHubUserRepositoryService.java | 1180c9f8c497846486d28d80c32a60d82642e2b7 | [] | no_license | szyjkowski/Allegro-Software-Engineer-zad3 | https://github.com/szyjkowski/Allegro-Software-Engineer-zad3 | 653320758f1f4c9d3fbcf9a56a3551ad73080997 | c013b23082d45575459027ffa6a3a455c8805820 | refs/heads/master | 2023-04-03T14:58:11.606000 | 2021-04-25T17:11:21 | 2021-04-25T17:11:21 | 361,472,800 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pl.szyjkowski.githubapi.service;
import org.springframework.stereotype.Service;
import pl.szyjkowski.githubapi.Constants;
import pl.szyjkowski.githubapi.model.GitHubUserRepository;
@Service
public class GitHubUserRepositoryService implements Constants {
public String getCountOfUserStars(GitHubUserRepository[] githubUserRepository) {
int countOfStars = 0;
for (GitHubUserRepository repository : githubUserRepository) {
countOfStars += repository.getCountOfStars();
}
String countOfStarsString = "Count of stars form all user repositories = " +
countOfStars + ".";
return checkUserHasRepository(githubUserRepository, countOfStarsString);
}
public String getListRepository(GitHubUserRepository[] githubUserRepository) {
String listOutput = "";
for (GitHubUserRepository repository : githubUserRepository) {
listOutput += " Repository name: " + repository.getName() +
" has " + repository.getCountOfStars() + " stars. <br/>";
}
return checkUserHasRepository(githubUserRepository, listOutput);
}
private static String checkUserHasRepository(GitHubUserRepository[] githubUserRepository, String output) {
if (githubUserRepository.length != 0) {
return output;
} else {
return USER_HAS_NO_REPOSITORY;
}
}
}
| UTF-8 | Java | 1,421 | java | GitHubUserRepositoryService.java | Java | [] | null | [] | package pl.szyjkowski.githubapi.service;
import org.springframework.stereotype.Service;
import pl.szyjkowski.githubapi.Constants;
import pl.szyjkowski.githubapi.model.GitHubUserRepository;
@Service
public class GitHubUserRepositoryService implements Constants {
public String getCountOfUserStars(GitHubUserRepository[] githubUserRepository) {
int countOfStars = 0;
for (GitHubUserRepository repository : githubUserRepository) {
countOfStars += repository.getCountOfStars();
}
String countOfStarsString = "Count of stars form all user repositories = " +
countOfStars + ".";
return checkUserHasRepository(githubUserRepository, countOfStarsString);
}
public String getListRepository(GitHubUserRepository[] githubUserRepository) {
String listOutput = "";
for (GitHubUserRepository repository : githubUserRepository) {
listOutput += " Repository name: " + repository.getName() +
" has " + repository.getCountOfStars() + " stars. <br/>";
}
return checkUserHasRepository(githubUserRepository, listOutput);
}
private static String checkUserHasRepository(GitHubUserRepository[] githubUserRepository, String output) {
if (githubUserRepository.length != 0) {
return output;
} else {
return USER_HAS_NO_REPOSITORY;
}
}
}
| 1,421 | 0.687544 | 0.686137 | 38 | 36.36842 | 32.168488 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.421053 | false | false | 10 |
12ddf6001ca0a365ec891844ba0d7f173ea2e8a5 | 26,474,178,462,218 | a96dae33ae3516141d2f611a233e0fe3bef0f463 | /src/main/java/am/david/securityapp/service/UserServiceImpl.java | a9cd019a56d709b672e5926c4b96942a0df8a985 | [] | no_license | heros79/TaskMLab | https://github.com/heros79/TaskMLab | 0d3141739e42fe0abfc212fabbdb77757b555f53 | 8553c42a41cd063ba5cb9444dd6caa99a4818c99 | refs/heads/master | 2020-12-30T13:59:44.959000 | 2017-05-29T07:43:36 | 2017-05-29T07:43:36 | 91,268,246 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package am.david.securityapp.service;
import am.david.securityapp.dao.RoleDao;
import am.david.securityapp.dao.UserDao;
import am.david.securityapp.model.Role;
import am.david.securityapp.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
/**
* Implementation of {@link UserService} Interface
* Created by David Karchikyan on 5/14/2017.
*/
@Service("User")
@Transactional
public class UserServiceImpl implements UserService {
@Autowired
private UserDao userDao;
@Autowired
private RoleDao roleDao;
@Autowired
private BCryptPasswordEncoder bCryptPasswordEncoder;
@Autowired
private SecurityServiceImpl securityService;
public UserServiceImpl() {
}
@Override
public void save(User user) {
user.setPassword(bCryptPasswordEncoder.encode(user.getPassword()));
int userRank = new Random().nextInt(100);
user.setUserRank(user.getUserRank() + userRank);
Set<Role> roles = new HashSet<>();
roles.add(roleDao.getOne(1L));
user.setRoles(roles);
userDao.save(user);
}
@Override
public User findByUserName(String userName) {
return userDao.findByUserName(userName);
}
@Override
public List<User> getRankList() {
List<User> list = new LinkedList<>();
list.addAll(userDao.findAll());
return list;
}
}
| UTF-8 | Java | 1,598 | java | UserServiceImpl.java | Java | [
{
"context": "ion of {@link UserService} Interface\n * Created by David Karchikyan on 5/14/2017.\n */\n\n@Service(\"User\")\n@Transactiona",
"end": 557,
"score": 0.9998348355293274,
"start": 541,
"tag": "NAME",
"value": "David Karchikyan"
}
] | null | [] | package am.david.securityapp.service;
import am.david.securityapp.dao.RoleDao;
import am.david.securityapp.dao.UserDao;
import am.david.securityapp.model.Role;
import am.david.securityapp.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
/**
* Implementation of {@link UserService} Interface
* Created by <NAME> on 5/14/2017.
*/
@Service("User")
@Transactional
public class UserServiceImpl implements UserService {
@Autowired
private UserDao userDao;
@Autowired
private RoleDao roleDao;
@Autowired
private BCryptPasswordEncoder bCryptPasswordEncoder;
@Autowired
private SecurityServiceImpl securityService;
public UserServiceImpl() {
}
@Override
public void save(User user) {
user.setPassword(bCryptPasswordEncoder.encode(user.getPassword()));
int userRank = new Random().nextInt(100);
user.setUserRank(user.getUserRank() + userRank);
Set<Role> roles = new HashSet<>();
roles.add(roleDao.getOne(1L));
user.setRoles(roles);
userDao.save(user);
}
@Override
public User findByUserName(String userName) {
return userDao.findByUserName(userName);
}
@Override
public List<User> getRankList() {
List<User> list = new LinkedList<>();
list.addAll(userDao.findAll());
return list;
}
}
| 1,588 | 0.711514 | 0.704631 | 63 | 24.36508 | 21.791437 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.396825 | false | false | 10 |
79fbf04f84576dcb6573ecbdb2aefc9afcc04f6f | 5,987,184,461,511 | af24ef7fbfd87bb4e063e2180d593ba382dc7e0a | /meo.campaign/src/main/java/com/asiainfo/meo/campaign/profile/app/model/entity/HotCampaignRank.java | b59327e223ca4d870a87355e588ec98d67fec186 | [] | no_license | ryansunboy/meo | https://github.com/ryansunboy/meo | b43414fcd3bffc1fe0922d4cd4d3b6f62a2f97fc | fa0efa75bd10ceef5de77f232c95252c47ccfa03 | refs/heads/master | 2021-01-15T19:23:10.474000 | 2017-08-09T15:27:59 | 2017-08-09T15:27:59 | 99,819,290 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.asiainfo.meo.campaign.profile.app.model.entity;
import java.sql.Timestamp;
import java.util.Date;
/**
* CmHotCampaignRank entity
*/
public class HotCampaignRank implements java.io.Serializable
{
private static final long serialVersionUID = 7345095863586863514L;
private long campaignId;
private Timestamp refreshDate;
private String campaignName;
private String campaignNo;
private Integer participateCount;
private String iconUrl;
private Integer categoryId;
private long partnerId;
private Integer inventory;
private Integer campaignType;
public long getCampaignId()
{
return this.campaignId;
}
public void setCampaignId(long campaignId)
{
this.campaignId = campaignId;
}
public Timestamp getRefreshDate()
{
return refreshDate;
}
public void setRefreshDate(Timestamp refreshDate)
{
this.refreshDate = refreshDate;
}
public String getCampaignName()
{
return this.campaignName;
}
public void setCampaignName(String campaignName)
{
this.campaignName = campaignName;
}
public String getCampaignNo()
{
return this.campaignNo;
}
public void setCampaignNo(String campaignNo)
{
this.campaignNo = campaignNo;
}
public Integer getParticipateCount()
{
return this.participateCount;
}
public void setParticipateCount(Integer participateCount)
{
this.participateCount = participateCount;
}
public String getIconUrl()
{
return this.iconUrl;
}
public void setIconUrl(String iconUrl)
{
this.iconUrl = iconUrl;
}
public Integer getCategoryId()
{
return this.categoryId;
}
public void setCategoryId(Integer categoryId)
{
this.categoryId = categoryId;
}
public long getPartnerId()
{
return this.partnerId;
}
public void setPartnerId(long partnerId)
{
this.partnerId = partnerId;
}
public Integer getInventory()
{
return this.inventory;
}
public void setInventory(Integer inventory)
{
this.inventory = inventory;
}
public Integer getCampaignType()
{
return this.campaignType;
}
public void setCampaignType(Integer campaignType)
{
this.campaignType = campaignType;
}
} | UTF-8 | Java | 2,669 | java | HotCampaignRank.java | Java | [] | null | [] | package com.asiainfo.meo.campaign.profile.app.model.entity;
import java.sql.Timestamp;
import java.util.Date;
/**
* CmHotCampaignRank entity
*/
public class HotCampaignRank implements java.io.Serializable
{
private static final long serialVersionUID = 7345095863586863514L;
private long campaignId;
private Timestamp refreshDate;
private String campaignName;
private String campaignNo;
private Integer participateCount;
private String iconUrl;
private Integer categoryId;
private long partnerId;
private Integer inventory;
private Integer campaignType;
public long getCampaignId()
{
return this.campaignId;
}
public void setCampaignId(long campaignId)
{
this.campaignId = campaignId;
}
public Timestamp getRefreshDate()
{
return refreshDate;
}
public void setRefreshDate(Timestamp refreshDate)
{
this.refreshDate = refreshDate;
}
public String getCampaignName()
{
return this.campaignName;
}
public void setCampaignName(String campaignName)
{
this.campaignName = campaignName;
}
public String getCampaignNo()
{
return this.campaignNo;
}
public void setCampaignNo(String campaignNo)
{
this.campaignNo = campaignNo;
}
public Integer getParticipateCount()
{
return this.participateCount;
}
public void setParticipateCount(Integer participateCount)
{
this.participateCount = participateCount;
}
public String getIconUrl()
{
return this.iconUrl;
}
public void setIconUrl(String iconUrl)
{
this.iconUrl = iconUrl;
}
public Integer getCategoryId()
{
return this.categoryId;
}
public void setCategoryId(Integer categoryId)
{
this.categoryId = categoryId;
}
public long getPartnerId()
{
return this.partnerId;
}
public void setPartnerId(long partnerId)
{
this.partnerId = partnerId;
}
public Integer getInventory()
{
return this.inventory;
}
public void setInventory(Integer inventory)
{
this.inventory = inventory;
}
public Integer getCampaignType()
{
return this.campaignType;
}
public void setCampaignType(Integer campaignType)
{
this.campaignType = campaignType;
}
} | 2,669 | 0.592731 | 0.585613 | 135 | 18.777779 | 18.465048 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.251852 | false | false | 10 |
c3d70a70309e3bd37dce33f67329f6b010133568 | 19,963,008,024,205 | 6ccf5c2a5494850151090f68b568760f3c161ff2 | /src/main/java/com/ibm/sdet/newapp/pagewebelements/PageWebElement.java | a6af168b4ed8e54c4e08b41056482183c0c6e0a3 | [] | no_license | VishalSolanki1/SDET_IBM_Assignment | https://github.com/VishalSolanki1/SDET_IBM_Assignment | df1036b24c1a5cbcfa4b953b6e284c2b0c401b34 | ec9e2784339770e302a8bd0326ecd941b1290073 | refs/heads/master | 2023-05-02T11:09:00.088000 | 2021-05-16T13:17:45 | 2021-05-16T13:17:45 | 367,883,732 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ibm.sdet.newapp.pagewebelements;
public class PageWebElement {
public static final String APPLICATION_URL = "http://elearningm1.upskills.in/";
// IDs
public static final String USERNAME = "login";
public static final String PASSWORD = "password";
public static final String LOGIN_BUTTON = "form-login_submitAuth";
public static final String SUBJECT_LINE = "compose_message_title";
public static final String SEND_MESSAGE_BUTTON = "compose_message_compose";
public static final String FIRST_NAME_TEXT_BOX = "registration_firstname";
public static final String LAST_NAME_TEXT_BOX = "registration_lastname";
public static final String EMAIL_TEXT_BOX = "registration_email";
public static final String USERNAME_TEXT_BOX = "username";
public static final String PASSWORD_TEXT_BOX = "pass1";
public static final String CONFIRM_PASSWORD_TEXT_BOX = "pass2";
public static final String REGISTER_BUTTON = "registration_submit";
//Xpath
public static final String ACTUAL_CONFIRMATION_MESSAGE = "/html/body/main/section/div/div[2]/div[1]/div/article/div/p[1]";
public static final String ACTUAL_MAIL_SENT_CONFIRM_MESSAGE = "/html/body/main/section/div/div[2]/div/div[1]";
public static final String USER_IMAGE = "//*[@id=\"user_image_block\"]/div/a/img";
public static final String USER_EMAIL = "//*[@id=\"sn-avatar-one\"]/div/ul/li[2]/a/div";
public static final String REGISTRATION_CONFIRM_MESSAGE = "/html/body/main/section/div/div[2]/div/p[1]";
public static final String SEND_TO_TEXT_BOX = "//*[@id=\"compose_message\"]/fieldset/div[1]/div[1]/span/span[1]/span/ul/li/input";
public static final String SELECT_EMAIL_ID = "//*[@id=\"select2-compose_message_users-results\"]/li[2]";
public static final String MESSAGE = "/html/body";
public static final String USER_PROFILE_EMAIL_ID = "//*[@id=\"navbar\"]//ul[2]/li[2]/ul/li[1]/div/p";
public static final String USER_PROFILE_IMAGE = "//*[@id=\"navbar\"]/ul[2]/li[2]/a/img";
//Tags
public static final String MESSAGE_TEXT_BOX = "/html/body";
//Links
public static final String SIGN_UP_LINK = "Sign up!";
}
| UTF-8 | Java | 2,101 | java | PageWebElement.java | Java | [
{
"context": "\t\n\t// IDs\n\tpublic static final String USERNAME = \"login\";\n\tpublic static final String PASSWORD = \"passwor",
"end": 214,
"score": 0.9972562789916992,
"start": 209,
"tag": "USERNAME",
"value": "login"
},
{
"context": " \"login\";\n\tpublic static final String PASSWORD = \"password\"; \n\tpublic static final String LOGIN_BUTTON = \"fo",
"end": 265,
"score": 0.9992725253105164,
"start": 257,
"tag": "PASSWORD",
"value": "password"
},
{
"context": "\n\tpublic static final String USERNAME_TEXT_BOX = \"username\";\n\tpublic static final String PASSWORD_TEXT_BOX =",
"end": 757,
"score": 0.9955715537071228,
"start": 749,
"tag": "USERNAME",
"value": "username"
},
{
"context": "\n\tpublic static final String PASSWORD_TEXT_BOX = \"pass1\";\n\tpublic static final String CONFIRM_PASSWORD_TE",
"end": 814,
"score": 0.9991246461868286,
"start": 809,
"tag": "PASSWORD",
"value": "pass1"
},
{
"context": " static final String CONFIRM_PASSWORD_TEXT_BOX = \"pass2\";\n\tpublic static final String REGISTER_BUTTON = \"",
"end": 879,
"score": 0.9990949034690857,
"start": 874,
"tag": "PASSWORD",
"value": "pass2"
}
] | null | [] | package com.ibm.sdet.newapp.pagewebelements;
public class PageWebElement {
public static final String APPLICATION_URL = "http://elearningm1.upskills.in/";
// IDs
public static final String USERNAME = "login";
public static final String PASSWORD = "<PASSWORD>";
public static final String LOGIN_BUTTON = "form-login_submitAuth";
public static final String SUBJECT_LINE = "compose_message_title";
public static final String SEND_MESSAGE_BUTTON = "compose_message_compose";
public static final String FIRST_NAME_TEXT_BOX = "registration_firstname";
public static final String LAST_NAME_TEXT_BOX = "registration_lastname";
public static final String EMAIL_TEXT_BOX = "registration_email";
public static final String USERNAME_TEXT_BOX = "username";
public static final String PASSWORD_TEXT_BOX = "<PASSWORD>";
public static final String CONFIRM_PASSWORD_TEXT_BOX = "<PASSWORD>";
public static final String REGISTER_BUTTON = "registration_submit";
//Xpath
public static final String ACTUAL_CONFIRMATION_MESSAGE = "/html/body/main/section/div/div[2]/div[1]/div/article/div/p[1]";
public static final String ACTUAL_MAIL_SENT_CONFIRM_MESSAGE = "/html/body/main/section/div/div[2]/div/div[1]";
public static final String USER_IMAGE = "//*[@id=\"user_image_block\"]/div/a/img";
public static final String USER_EMAIL = "//*[@id=\"sn-avatar-one\"]/div/ul/li[2]/a/div";
public static final String REGISTRATION_CONFIRM_MESSAGE = "/html/body/main/section/div/div[2]/div/p[1]";
public static final String SEND_TO_TEXT_BOX = "//*[@id=\"compose_message\"]/fieldset/div[1]/div[1]/span/span[1]/span/ul/li/input";
public static final String SELECT_EMAIL_ID = "//*[@id=\"select2-compose_message_users-results\"]/li[2]";
public static final String MESSAGE = "/html/body";
public static final String USER_PROFILE_EMAIL_ID = "//*[@id=\"navbar\"]//ul[2]/li[2]/ul/li[1]/div/p";
public static final String USER_PROFILE_IMAGE = "//*[@id=\"navbar\"]/ul[2]/li[2]/a/img";
//Tags
public static final String MESSAGE_TEXT_BOX = "/html/body";
//Links
public static final String SIGN_UP_LINK = "Sign up!";
}
| 2,113 | 0.725369 | 0.715374 | 38 | 54.289474 | 38.71278 | 131 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.552632 | false | false | 10 |
d75f3918c186687d4eacc7b9bc4c10aab5d0f9a8 | 19,533,511,327,233 | afa5a00be2979b873f850371185fabe375bbe078 | /src/main/java/io/cuber/service/util/DomainUtil.java | 2ae6623c35f0a8544aa95c64ca6f762f46232581 | [] | no_license | devcolibri/cuber-taxi | https://github.com/devcolibri/cuber-taxi | 039a195255474fc2a813d3fa99dd0bcb7d9b467b | 63b1bf281e0327b38ad4651033e1095cae3e91ea | refs/heads/master | 2019-05-17T00:50:48.256000 | 2017-04-04T18:11:47 | 2017-04-04T18:11:47 | 83,127,506 | 0 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null | package io.cuber.service.util;
import io.cuber.service.domain.TaxiWorker;
import io.cuber.service.domain.User;
public class DomainUtil {
private static final String DIVIDER = ";";
public static <T> String toCSV(T t) {
StringBuilder sb = new StringBuilder();
if (t instanceof TaxiWorker) {
TaxiWorker taxiWorker = (TaxiWorker) t;
sb.append(taxiWorker.getId());
sb.append(DIVIDER);
sb.append(taxiWorker.getName());
sb.append(DIVIDER);
sb.append(taxiWorker.getPhoneNumber());
sb.append(DIVIDER);
sb.append(taxiWorker.getCity());
sb.append(DIVIDER);
sb.append(taxiWorker.getNumberCar());
sb.append(DIVIDER);
sb.append(taxiWorker.getType());
return sb.toString();
}
if (t instanceof User) {
User user = (User) t;
sb.append(user.getId());
sb.append(DIVIDER);
sb.append(user.getName());
sb.append(DIVIDER);
sb.append(user.getPhoneNumber());
sb.append(DIVIDER);
sb.append(user.getCity());
return sb.toString();
}
// TODO need more
throw new IllegalArgumentException("I don't know this type: " + t.getClass());
}
}
| UTF-8 | Java | 1,348 | java | DomainUtil.java | Java | [] | null | [] | package io.cuber.service.util;
import io.cuber.service.domain.TaxiWorker;
import io.cuber.service.domain.User;
public class DomainUtil {
private static final String DIVIDER = ";";
public static <T> String toCSV(T t) {
StringBuilder sb = new StringBuilder();
if (t instanceof TaxiWorker) {
TaxiWorker taxiWorker = (TaxiWorker) t;
sb.append(taxiWorker.getId());
sb.append(DIVIDER);
sb.append(taxiWorker.getName());
sb.append(DIVIDER);
sb.append(taxiWorker.getPhoneNumber());
sb.append(DIVIDER);
sb.append(taxiWorker.getCity());
sb.append(DIVIDER);
sb.append(taxiWorker.getNumberCar());
sb.append(DIVIDER);
sb.append(taxiWorker.getType());
return sb.toString();
}
if (t instanceof User) {
User user = (User) t;
sb.append(user.getId());
sb.append(DIVIDER);
sb.append(user.getName());
sb.append(DIVIDER);
sb.append(user.getPhoneNumber());
sb.append(DIVIDER);
sb.append(user.getCity());
return sb.toString();
}
// TODO need more
throw new IllegalArgumentException("I don't know this type: " + t.getClass());
}
}
| 1,348 | 0.554154 | 0.554154 | 47 | 27.680851 | 19.347996 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.617021 | false | false | 10 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.