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
7e544a8bfcebcb122920191437e10e4221feaa89
8,143,258,001,740
e4072ac72cc187c0850d7b4f12b16385b7f3821c
/src/main/java/com/j/mybootdemo/controller/Annotations.java
b28c035acf360f56cc4d627282d2ef7d3bcc4e7c
[]
no_license
jaypatel8110/MyBootDemo
https://github.com/jaypatel8110/MyBootDemo
47f6dc9c5d11a1d6e7bb479849ee12c3caef72be
6dfdcf4e149f96fca94c82892e64dc36d5a715b9
refs/heads/master
2022-12-23T07:25:22.946000
2020-10-11T04:24:12
2020-10-11T04:24:12
301,579,355
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.j.mybootdemo.controller; import com.j.mybootdemo.models.Dbsettings; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/api") public class Annotations { @Value("${my.test:Default hello world}") private String getHelloWorld; @Autowired private Dbsettings dbsettings; @RequestMapping("/hello") public String getGetHelloWorld() { return getHelloWorld; } @RequestMapping("/greet") public String getGreetings() { return dbsettings.getConnection(); } }
UTF-8
Java
754
java
Annotations.java
Java
[]
null
[]
package com.j.mybootdemo.controller; import com.j.mybootdemo.models.Dbsettings; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/api") public class Annotations { @Value("${my.test:Default hello world}") private String getHelloWorld; @Autowired private Dbsettings dbsettings; @RequestMapping("/hello") public String getGetHelloWorld() { return getHelloWorld; } @RequestMapping("/greet") public String getGreetings() { return dbsettings.getConnection(); } }
754
0.748011
0.748011
31
23.32258
21.128466
62
false
false
0
0
0
0
0
0
0.322581
false
false
2
e0eb6affeeb8151c968041774f8c8627194be8ad
27,797,028,371,784
be6d6164905b97be3a7e9b889fa699523045550e
/SkipTheGas/app/src/main/java/com/example/skipthegas/PaymentActivity.java
a11a0ba9f6c39be7508ca218d1705ff5b22094c0
[ "Apache-2.0" ]
permissive
zeeem/SkipTheGas
https://github.com/zeeem/SkipTheGas
c778c4e9e85b8974721bba6166a804a50b5ae0c4
0a3235ec4966808c630a3ed24aea4e554902fbe1
refs/heads/master
2021-03-20T21:10:49.769000
2020-03-14T05:31:02
2020-03-14T05:31:02
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.skipthegas; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; /** * This a class that governs the payment screen, where a QR code is generated for payment transfer */ public class PaymentActivity extends AppCompatActivity { /** * onCreate method for PaymentActivity class * @param savedInstanceState */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.payment_layout); } }
UTF-8
Java
545
java
PaymentActivity.java
Java
[]
null
[]
package com.example.skipthegas; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; /** * This a class that governs the payment screen, where a QR code is generated for payment transfer */ public class PaymentActivity extends AppCompatActivity { /** * onCreate method for PaymentActivity class * @param savedInstanceState */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.payment_layout); } }
545
0.72844
0.72844
21
24.952381
26.261463
98
false
false
0
0
0
0
0
0
0.285714
false
false
2
d9017a71184630e399238b2054fab29e5ccdb9d6
14,697,378,104,508
83c997acad0fb6dea81987de22682917ce86615c
/src/main/java/eu/mihosoft/visoline/Path_float.java
9bb2a4a990c2bdd50981b4bb2a78c9b5f2ef5e5e
[ "BSD-2-Clause" ]
permissive
carrino/VIsoline
https://github.com/carrino/VIsoline
70bfdd88974b45b58d2fb490420464b1b1aecc1a
2d655c46551e4fc7d1857221d6d27abc7c4abc97
refs/heads/master
2021-05-06T08:29:12.532000
2018-02-05T22:54:02
2018-02-05T22:54:02
114,028,136
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package eu.mihosoft.visoline; public class Path_float { private final float isoValue; private final java.util.List<java.util.List<Vector2d>> contours; private java.util.List<Vector2d> vertices; private final BSpline optimizer = new BSpline(); public Path_float(float isoValue) { contours = new java.util.ArrayList<>(); vertices = new java.util.ArrayList<>(); contours.add(vertices); this.isoValue = isoValue; } public int getNumberOfContours() { return contours.size(); } public java.util.List<Vector2d> getContour(int i) { return contours.get(i); } public void moveTo(double x, double y) { moveTo(new Vector2d(x, y)); } public void moveTo(Vector2d p) { breakContour(); vertices.add(p); } public void lineTo(Vector2d p) { vertices.add(p); } public void lineTo(double x, double y) { lineTo(new Vector2d(x, y)); } public void breakContour() { if (!vertices.isEmpty()) { vertices = new java.util.ArrayList<>(); contours.add(vertices); } } public float getIsoValue() { return isoValue; } public boolean isEmpty() { return contours.isEmpty() || contours.stream().allMatch(verts -> verts.isEmpty()); } }
UTF-8
Java
1,359
java
Path_float.java
Java
[]
null
[]
package eu.mihosoft.visoline; public class Path_float { private final float isoValue; private final java.util.List<java.util.List<Vector2d>> contours; private java.util.List<Vector2d> vertices; private final BSpline optimizer = new BSpline(); public Path_float(float isoValue) { contours = new java.util.ArrayList<>(); vertices = new java.util.ArrayList<>(); contours.add(vertices); this.isoValue = isoValue; } public int getNumberOfContours() { return contours.size(); } public java.util.List<Vector2d> getContour(int i) { return contours.get(i); } public void moveTo(double x, double y) { moveTo(new Vector2d(x, y)); } public void moveTo(Vector2d p) { breakContour(); vertices.add(p); } public void lineTo(Vector2d p) { vertices.add(p); } public void lineTo(double x, double y) { lineTo(new Vector2d(x, y)); } public void breakContour() { if (!vertices.isEmpty()) { vertices = new java.util.ArrayList<>(); contours.add(vertices); } } public float getIsoValue() { return isoValue; } public boolean isEmpty() { return contours.isEmpty() || contours.stream().allMatch(verts -> verts.isEmpty()); } }
1,359
0.594555
0.589404
61
21.278688
20.868151
90
false
false
0
0
0
0
0
0
0.42623
false
false
2
1fdc2abec9be62541f644856ddb0c50da9d356ea
6,889,127,609,372
6d96aeba7c7f2df302fb4b8c6fafb55b0884a751
/src/test/java/org/apache/platypus/server/grpc/ReplicationTestFailureScenarios.java
505b80c674d042b72e36cbd651eb0e5ceed682a9
[ "Apache-2.0" ]
permissive
karthikalle/platypus
https://github.com/karthikalle/platypus
458fcd72c5772ca808e1053e68fab94ac47a7ae6
ccc76f3ba2a676f6f554be7572568b7ac8283ada
refs/heads/master
2020-12-22T14:18:23.625000
2020-01-28T00:47:50
2020-01-28T00:47:50
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.apache.platypus.server.grpc; import io.grpc.testing.GrpcCleanupRule; import org.apache.platypus.server.luceneserver.GlobalState; import org.apache.platypus.server.luceneserver.ShardState; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; import static org.apache.platypus.server.grpc.GrpcServer.rmDir; import static org.apache.platypus.server.grpc.LuceneServerTest.RETRIEVED_VALUES; import static org.apache.platypus.server.grpc.LuceneServerTest.checkHits; import static org.apache.platypus.server.luceneserver.IndexState.BASE_BACKUP_PATH; import static org.apache.platypus.server.luceneserver.IndexState.BASE_STATE_BACKUP_PATH; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; @RunWith(JUnit4.class) public class ReplicationTestFailureScenarios { public static final String TEST_INDEX = "test_index"; /** * This rule manages automatic graceful shutdown for the registered servers and channels at the * end of test. */ @Rule public final GrpcCleanupRule grpcCleanup = new GrpcCleanupRule(); /** * This rule ensure the temporary folder which maintains stateDir are cleaned up after each test */ @Rule public final TemporaryFolder folder = new TemporaryFolder(); private GrpcServer luceneServerPrimary; private GrpcServer replicationServerPrimary; private GrpcServer luceneServerSecondary; private GrpcServer replicationServerSecondary; @After public void tearDown() throws IOException { luceneServerPrimary.getGlobalState().close(); luceneServerSecondary.getGlobalState().close(); rmDir(Paths.get(luceneServerPrimary.getRootDirName())); rmDir(Paths.get(luceneServerSecondary.getRootDirName())); rmDir(BASE_STATE_BACKUP_PATH); rmDir(BASE_BACKUP_PATH); } @Before public void setUp() throws IOException { BASE_BACKUP_PATH.toFile().mkdir(); BASE_STATE_BACKUP_PATH.toFile().mkdir(); startPrimaryServer(null); startSecondaryServer(); } public void startPrimaryServer(Path stateDir) throws IOException { //set up primary servers String nodeNamePrimary = "serverPrimary"; String rootDirNamePrimary = "serverPrimaryRootDirName"; rmDir(Paths.get(folder.getRoot().toString(), rootDirNamePrimary)); String testIndex = TEST_INDEX; GlobalState globalStatePrimary; if (stateDir == null) { Path rootDirPrimary = folder.newFolder(rootDirNamePrimary).toPath(); globalStatePrimary = new GlobalState(nodeNamePrimary, rootDirPrimary, "localhost", 9900, 9001); } else { globalStatePrimary = new GlobalState(nodeNamePrimary, stateDir, "localhost", 9900, 9001); } luceneServerPrimary = new GrpcServer(grpcCleanup, folder, false, globalStatePrimary, nodeNamePrimary, testIndex, globalStatePrimary.getPort()); replicationServerPrimary = new GrpcServer(grpcCleanup, folder, true, globalStatePrimary, nodeNamePrimary, testIndex, 9001); } public void startSecondaryServer() throws IOException { //set up secondary servers String nodeNameSecondary = "serverSecondary"; String rootDirNameSecondary = "serverSecondaryRootDirName"; rmDir(Paths.get(folder.getRoot().toString(), rootDirNameSecondary)); Path rootDirSecondary = folder.newFolder(rootDirNameSecondary).toPath(); String testIndex = TEST_INDEX; GlobalState globalStateSecondary = new GlobalState(nodeNameSecondary, rootDirSecondary, "localhost", 9902, 9003); luceneServerSecondary = new GrpcServer(grpcCleanup, folder, false, globalStateSecondary, nodeNameSecondary, testIndex, globalStateSecondary.getPort()); replicationServerSecondary = new GrpcServer(grpcCleanup, folder, true, globalStateSecondary, nodeNameSecondary, testIndex, 9003); } public void shutdownPrimaryServer() throws IOException { luceneServerPrimary.getGlobalState().close(); rmDir(Paths.get(luceneServerPrimary.getRootDirName())); luceneServerPrimary.shutdown(); replicationServerPrimary.shutdown(); } public void shutdownSecondaryServer() throws IOException { luceneServerSecondary.getGlobalState().close(); rmDir(Paths.get(luceneServerSecondary.getRootDirName())); luceneServerSecondary.shutdown(); replicationServerSecondary.shutdown(); } @Test public void replicaStoppedWhenPrimaryIndexing() throws IOException, InterruptedException { //startIndex Primary GrpcServer.TestServer testServerPrimary = new GrpcServer.TestServer(luceneServerPrimary, true, Mode.PRIMARY); //startIndex replica GrpcServer.TestServer testServerReplica = new GrpcServer.TestServer(luceneServerSecondary, true, Mode.REPLICA); //add 2 docs to primary testServerPrimary.addDocuments(); //refresh (also sends NRTPoint to replicas) luceneServerPrimary.getBlockingStub().refresh(RefreshRequest.newBuilder().setIndexName(TEST_INDEX).build()); //stop replica instance shutdownSecondaryServer(); //add 2 docs to primary testServerPrimary.addDocuments(); //re-start replica instance from a fresh index state i.e. empty index dir startSecondaryServer(); //startIndex replica testServerReplica = new GrpcServer.TestServer(luceneServerSecondary, true, Mode.REPLICA); //add 2 more docs (6 total now), annoying, sendNRTPoint gets called from primary only upon a flush i.e. an index operation testServerPrimary.addDocuments(); // publish new NRT point (retrieve the current searcher version on primary) publishNRTAndValidateSearchResults(6); } @Test public void primaryStoppedAndRestartedWithNoPreviousIndex() throws IOException, InterruptedException { //startIndex Primary GrpcServer.TestServer testServerPrimary = new GrpcServer.TestServer(luceneServerPrimary, true, Mode.PRIMARY); //startIndex replica GrpcServer.TestServer testServerReplica = new GrpcServer.TestServer(luceneServerSecondary, true, Mode.REPLICA); //add 2 docs to primary testServerPrimary.addDocuments(); //add 2 docs to primary testServerPrimary.addDocuments(); //both primary and replica should have 4 docs publishNRTAndValidateSearchResults(4); //commit primary luceneServerPrimary.getBlockingStub().commit(CommitRequest.newBuilder().setIndexName(TEST_INDEX).build()); //commit secondary luceneServerSecondary.getBlockingStub().commit(CommitRequest.newBuilder().setIndexName(TEST_INDEX).build()); //non-graceful primary shutdown (i.e. blow away index directory) shutdownPrimaryServer(); //start primary again with new empty index directory startPrimaryServer(null); //startIndex Primary with primaryGen = 1 testServerPrimary = new GrpcServer.TestServer(luceneServerPrimary, true, Mode.PRIMARY, 1); //stop and restart secondary to connect to "new" primary gracefullRestartSecondary(); //add 2 docs to primary testServerPrimary.addDocuments(); //both primary and secondary have only 2 docs now (replica has fewer docs than before as expected) publishNRTAndValidateSearchResults(2); } @Test public void primaryStoppedAndRestartedWithPreviousLocalIndex() throws IOException, InterruptedException { //startIndex primary GrpcServer.TestServer testServerPrimary = new GrpcServer.TestServer(luceneServerPrimary, true, Mode.PRIMARY); //startIndex replica GrpcServer.TestServer testServerReplica = new GrpcServer.TestServer(luceneServerSecondary, true, Mode.REPLICA); //add 2 docs to primary testServerPrimary.addDocuments(); //both primary and replica should have 2 docs publishNRTAndValidateSearchResults(2); //commit primary luceneServerPrimary.getBlockingStub().commit(CommitRequest.newBuilder().setIndexName(TEST_INDEX).build()); //commit metadata state for secondary luceneServerSecondary.getBlockingStub().commit(CommitRequest.newBuilder().setIndexName(TEST_INDEX).build()); //gracefully stop and restart primary gracefullRestartPrimary(1); //stop and restart secondary to connect to "new" primary gracefullRestartSecondary(); //add 2 docs to primary testServerPrimary.addDocuments(); publishNRTAndValidateSearchResults(4); } @Test public void primaryDurabilityBasic() throws IOException, InterruptedException { //startIndex primary GrpcServer.TestServer testServerPrimary = new GrpcServer.TestServer(luceneServerPrimary, true, Mode.PRIMARY); //add 2 docs to primary testServerPrimary.addDocuments(); //commit primary luceneServerPrimary.getBlockingStub().commit(CommitRequest.newBuilder().setIndexName(TEST_INDEX).build()); //non-graceful primary shutdown (i.e. blow away index directory) shutdownPrimaryServer(); //start primary again with latest commit point Path stateDir = BASE_STATE_BACKUP_PATH.resolve("0").resolve("4"); startPrimaryServer(stateDir); //startIndex Primary with primaryGen = 1 testServerPrimary = new GrpcServer.TestServer(luceneServerPrimary, true, Mode.PRIMARY, 1, true); //add 2 docs to primary testServerPrimary.addDocuments(); // publish new NRT point (retrieve the current searcher version on primary) SearcherVersion searcherVersionPrimary = replicationServerPrimary.getReplicationServerBlockingStub().writeNRTPoint( IndexName.newBuilder().setIndexName(TEST_INDEX).build()); // primary should show numDocs hits now SearchResponse searchResponsePrimary = luceneServerPrimary.getBlockingStub().search(SearchRequest.newBuilder() .setIndexName(luceneServerPrimary.getTestIndex()) .setStartHit(0) .setTopHits(10) .setVersion(searcherVersionPrimary.getVersion()) .addAllRetrieveFields(RETRIEVED_VALUES) .build()); validateSearchResults(4, searchResponsePrimary); } @Test public void primaryDurabilitySyncWithReplica() throws IOException, InterruptedException { //startIndex primary GrpcServer.TestServer testServerPrimary = new GrpcServer.TestServer(luceneServerPrimary, true, Mode.PRIMARY); //startIndex replica GrpcServer.TestServer testServerReplica = new GrpcServer.TestServer(luceneServerSecondary, true, Mode.REPLICA); //add 2 docs to primary testServerPrimary.addDocuments(); //both primary and replica should have 2 docs publishNRTAndValidateSearchResults(2); //commit primary (with 2 docs) luceneServerPrimary.getBlockingStub().commit(CommitRequest.newBuilder().setIndexName(TEST_INDEX).build()); //commit metadata state for secondary luceneServerSecondary.getBlockingStub().commit(CommitRequest.newBuilder().setIndexName(TEST_INDEX).build()); //add 4 more docs to primary but dont commit, NRT is at 8 docs but commit point at 2 docs testServerPrimary.addDocuments(); testServerPrimary.addDocuments(); testServerPrimary.addDocuments(); publishNRTAndValidateSearchResults(8); File latestBackup = ShardState.remoteStateExists(BASE_STATE_BACKUP_PATH); assertNotEquals(null, latestBackup); //non-graceful primary shutdown (i.e. blow away index directory and stateDir) shutdownPrimaryServer(); //start primary again, download data from latest commit point startPrimaryServer(latestBackup.toPath()); //startIndex Primary with primaryGen = 1 testServerPrimary = new GrpcServer.TestServer(luceneServerPrimary, true, Mode.PRIMARY, 1, true); //stop and restart secondary to connect to "new" primary gracefullRestartSecondary(); //add 2 more docs to primary testServerPrimary.addDocuments(); publishNRTAndValidateSearchResults(4); } @Test public void primaryDurabilityWithMultipleCommits() throws IOException, InterruptedException { //startIndex primary GrpcServer.TestServer testServerPrimary = new GrpcServer.TestServer(luceneServerPrimary, true, Mode.PRIMARY); for (int i = 0; i < 5; i++){ //add 2 docs to primary testServerPrimary.addDocuments(); testServerPrimary.addDocuments(); //commit primary luceneServerPrimary.getBlockingStub().commit(CommitRequest.newBuilder().setIndexName(TEST_INDEX).build()); } File latestBackup = ShardState.remoteStateExists(BASE_STATE_BACKUP_PATH); assertNotEquals(null, latestBackup); //non-graceful primary shutdown (i.e. blow away index directory) shutdownPrimaryServer(); //start primary again, download data from latest commit point startPrimaryServer(latestBackup.toPath()); //startIndex Primary with primaryGen = 1 testServerPrimary = new GrpcServer.TestServer(luceneServerPrimary, true, Mode.PRIMARY, 1, true); //add 2 docs to primary testServerPrimary.addDocuments(); // publish new NRT point (retrieve the current searcher version on primary) SearcherVersion searcherVersionPrimary = replicationServerPrimary.getReplicationServerBlockingStub().writeNRTPoint( IndexName.newBuilder().setIndexName(TEST_INDEX).build()); // primary should show numDocs hits now SearchResponse searchResponsePrimary = luceneServerPrimary.getBlockingStub().search(SearchRequest.newBuilder() .setIndexName(luceneServerPrimary.getTestIndex()) .setStartHit(0) .setTopHits(22) .setVersion(searcherVersionPrimary.getVersion()) .addAllRetrieveFields(RETRIEVED_VALUES) .build()); validateSearchResults(22, searchResponsePrimary); } private void gracefullRestartSecondary() { luceneServerSecondary.getBlockingStub().stopIndex(StopIndexRequest.newBuilder() .setIndexName(TEST_INDEX) .build()); luceneServerSecondary.getBlockingStub().startIndex(StartIndexRequest.newBuilder() .setIndexName(TEST_INDEX) .setMode(Mode.REPLICA) .setPrimaryAddress("localhost") .setPort(9001) //primary port for replication server .build()); } private void gracefullRestartPrimary(int primaryGen) { luceneServerPrimary.getBlockingStub().stopIndex(StopIndexRequest.newBuilder().setIndexName(TEST_INDEX).build()); luceneServerPrimary.getBlockingStub().startIndex(StartIndexRequest.newBuilder() .setIndexName(TEST_INDEX) .setMode(Mode.PRIMARY) .setPrimaryGen(primaryGen) .build()); } private void publishNRTAndValidateSearchResults(int numDocs) { // publish new NRT point (retrieve the current searcher version on primary) SearcherVersion searcherVersionPrimary = replicationServerPrimary.getReplicationServerBlockingStub().writeNRTPoint( IndexName.newBuilder().setIndexName(TEST_INDEX).build()); // primary should show numDocs hits now SearchResponse searchResponsePrimary = luceneServerPrimary.getBlockingStub().search(SearchRequest.newBuilder() .setIndexName(luceneServerPrimary.getTestIndex()) .setStartHit(0) .setTopHits(10) .setVersion(searcherVersionPrimary.getVersion()) .addAllRetrieveFields(RETRIEVED_VALUES) .build()); // replica should also have numDocs hits SearchResponse searchResponseSecondary = luceneServerSecondary.getBlockingStub().search(SearchRequest.newBuilder() .setIndexName(luceneServerSecondary.getTestIndex()) .setStartHit(0) .setTopHits(10) .setVersion(searcherVersionPrimary.getVersion()) .addAllRetrieveFields(RETRIEVED_VALUES) .build()); validateSearchResults(numDocs, searchResponsePrimary); validateSearchResults(numDocs, searchResponseSecondary); } public static void validateSearchResults(int numHitsExpected, SearchResponse searchResponse) { assertEquals(numHitsExpected, searchResponse.getTotalHits()); assertEquals(numHitsExpected, searchResponse.getHitsList().size()); SearchResponse.Hit firstHit = searchResponse.getHits(0); checkHits(firstHit); SearchResponse.Hit secondHit = searchResponse.getHits(1); checkHits(secondHit); } }
UTF-8
Java
17,335
java
ReplicationTestFailureScenarios.java
Java
[]
null
[]
package org.apache.platypus.server.grpc; import io.grpc.testing.GrpcCleanupRule; import org.apache.platypus.server.luceneserver.GlobalState; import org.apache.platypus.server.luceneserver.ShardState; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; import static org.apache.platypus.server.grpc.GrpcServer.rmDir; import static org.apache.platypus.server.grpc.LuceneServerTest.RETRIEVED_VALUES; import static org.apache.platypus.server.grpc.LuceneServerTest.checkHits; import static org.apache.platypus.server.luceneserver.IndexState.BASE_BACKUP_PATH; import static org.apache.platypus.server.luceneserver.IndexState.BASE_STATE_BACKUP_PATH; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; @RunWith(JUnit4.class) public class ReplicationTestFailureScenarios { public static final String TEST_INDEX = "test_index"; /** * This rule manages automatic graceful shutdown for the registered servers and channels at the * end of test. */ @Rule public final GrpcCleanupRule grpcCleanup = new GrpcCleanupRule(); /** * This rule ensure the temporary folder which maintains stateDir are cleaned up after each test */ @Rule public final TemporaryFolder folder = new TemporaryFolder(); private GrpcServer luceneServerPrimary; private GrpcServer replicationServerPrimary; private GrpcServer luceneServerSecondary; private GrpcServer replicationServerSecondary; @After public void tearDown() throws IOException { luceneServerPrimary.getGlobalState().close(); luceneServerSecondary.getGlobalState().close(); rmDir(Paths.get(luceneServerPrimary.getRootDirName())); rmDir(Paths.get(luceneServerSecondary.getRootDirName())); rmDir(BASE_STATE_BACKUP_PATH); rmDir(BASE_BACKUP_PATH); } @Before public void setUp() throws IOException { BASE_BACKUP_PATH.toFile().mkdir(); BASE_STATE_BACKUP_PATH.toFile().mkdir(); startPrimaryServer(null); startSecondaryServer(); } public void startPrimaryServer(Path stateDir) throws IOException { //set up primary servers String nodeNamePrimary = "serverPrimary"; String rootDirNamePrimary = "serverPrimaryRootDirName"; rmDir(Paths.get(folder.getRoot().toString(), rootDirNamePrimary)); String testIndex = TEST_INDEX; GlobalState globalStatePrimary; if (stateDir == null) { Path rootDirPrimary = folder.newFolder(rootDirNamePrimary).toPath(); globalStatePrimary = new GlobalState(nodeNamePrimary, rootDirPrimary, "localhost", 9900, 9001); } else { globalStatePrimary = new GlobalState(nodeNamePrimary, stateDir, "localhost", 9900, 9001); } luceneServerPrimary = new GrpcServer(grpcCleanup, folder, false, globalStatePrimary, nodeNamePrimary, testIndex, globalStatePrimary.getPort()); replicationServerPrimary = new GrpcServer(grpcCleanup, folder, true, globalStatePrimary, nodeNamePrimary, testIndex, 9001); } public void startSecondaryServer() throws IOException { //set up secondary servers String nodeNameSecondary = "serverSecondary"; String rootDirNameSecondary = "serverSecondaryRootDirName"; rmDir(Paths.get(folder.getRoot().toString(), rootDirNameSecondary)); Path rootDirSecondary = folder.newFolder(rootDirNameSecondary).toPath(); String testIndex = TEST_INDEX; GlobalState globalStateSecondary = new GlobalState(nodeNameSecondary, rootDirSecondary, "localhost", 9902, 9003); luceneServerSecondary = new GrpcServer(grpcCleanup, folder, false, globalStateSecondary, nodeNameSecondary, testIndex, globalStateSecondary.getPort()); replicationServerSecondary = new GrpcServer(grpcCleanup, folder, true, globalStateSecondary, nodeNameSecondary, testIndex, 9003); } public void shutdownPrimaryServer() throws IOException { luceneServerPrimary.getGlobalState().close(); rmDir(Paths.get(luceneServerPrimary.getRootDirName())); luceneServerPrimary.shutdown(); replicationServerPrimary.shutdown(); } public void shutdownSecondaryServer() throws IOException { luceneServerSecondary.getGlobalState().close(); rmDir(Paths.get(luceneServerSecondary.getRootDirName())); luceneServerSecondary.shutdown(); replicationServerSecondary.shutdown(); } @Test public void replicaStoppedWhenPrimaryIndexing() throws IOException, InterruptedException { //startIndex Primary GrpcServer.TestServer testServerPrimary = new GrpcServer.TestServer(luceneServerPrimary, true, Mode.PRIMARY); //startIndex replica GrpcServer.TestServer testServerReplica = new GrpcServer.TestServer(luceneServerSecondary, true, Mode.REPLICA); //add 2 docs to primary testServerPrimary.addDocuments(); //refresh (also sends NRTPoint to replicas) luceneServerPrimary.getBlockingStub().refresh(RefreshRequest.newBuilder().setIndexName(TEST_INDEX).build()); //stop replica instance shutdownSecondaryServer(); //add 2 docs to primary testServerPrimary.addDocuments(); //re-start replica instance from a fresh index state i.e. empty index dir startSecondaryServer(); //startIndex replica testServerReplica = new GrpcServer.TestServer(luceneServerSecondary, true, Mode.REPLICA); //add 2 more docs (6 total now), annoying, sendNRTPoint gets called from primary only upon a flush i.e. an index operation testServerPrimary.addDocuments(); // publish new NRT point (retrieve the current searcher version on primary) publishNRTAndValidateSearchResults(6); } @Test public void primaryStoppedAndRestartedWithNoPreviousIndex() throws IOException, InterruptedException { //startIndex Primary GrpcServer.TestServer testServerPrimary = new GrpcServer.TestServer(luceneServerPrimary, true, Mode.PRIMARY); //startIndex replica GrpcServer.TestServer testServerReplica = new GrpcServer.TestServer(luceneServerSecondary, true, Mode.REPLICA); //add 2 docs to primary testServerPrimary.addDocuments(); //add 2 docs to primary testServerPrimary.addDocuments(); //both primary and replica should have 4 docs publishNRTAndValidateSearchResults(4); //commit primary luceneServerPrimary.getBlockingStub().commit(CommitRequest.newBuilder().setIndexName(TEST_INDEX).build()); //commit secondary luceneServerSecondary.getBlockingStub().commit(CommitRequest.newBuilder().setIndexName(TEST_INDEX).build()); //non-graceful primary shutdown (i.e. blow away index directory) shutdownPrimaryServer(); //start primary again with new empty index directory startPrimaryServer(null); //startIndex Primary with primaryGen = 1 testServerPrimary = new GrpcServer.TestServer(luceneServerPrimary, true, Mode.PRIMARY, 1); //stop and restart secondary to connect to "new" primary gracefullRestartSecondary(); //add 2 docs to primary testServerPrimary.addDocuments(); //both primary and secondary have only 2 docs now (replica has fewer docs than before as expected) publishNRTAndValidateSearchResults(2); } @Test public void primaryStoppedAndRestartedWithPreviousLocalIndex() throws IOException, InterruptedException { //startIndex primary GrpcServer.TestServer testServerPrimary = new GrpcServer.TestServer(luceneServerPrimary, true, Mode.PRIMARY); //startIndex replica GrpcServer.TestServer testServerReplica = new GrpcServer.TestServer(luceneServerSecondary, true, Mode.REPLICA); //add 2 docs to primary testServerPrimary.addDocuments(); //both primary and replica should have 2 docs publishNRTAndValidateSearchResults(2); //commit primary luceneServerPrimary.getBlockingStub().commit(CommitRequest.newBuilder().setIndexName(TEST_INDEX).build()); //commit metadata state for secondary luceneServerSecondary.getBlockingStub().commit(CommitRequest.newBuilder().setIndexName(TEST_INDEX).build()); //gracefully stop and restart primary gracefullRestartPrimary(1); //stop and restart secondary to connect to "new" primary gracefullRestartSecondary(); //add 2 docs to primary testServerPrimary.addDocuments(); publishNRTAndValidateSearchResults(4); } @Test public void primaryDurabilityBasic() throws IOException, InterruptedException { //startIndex primary GrpcServer.TestServer testServerPrimary = new GrpcServer.TestServer(luceneServerPrimary, true, Mode.PRIMARY); //add 2 docs to primary testServerPrimary.addDocuments(); //commit primary luceneServerPrimary.getBlockingStub().commit(CommitRequest.newBuilder().setIndexName(TEST_INDEX).build()); //non-graceful primary shutdown (i.e. blow away index directory) shutdownPrimaryServer(); //start primary again with latest commit point Path stateDir = BASE_STATE_BACKUP_PATH.resolve("0").resolve("4"); startPrimaryServer(stateDir); //startIndex Primary with primaryGen = 1 testServerPrimary = new GrpcServer.TestServer(luceneServerPrimary, true, Mode.PRIMARY, 1, true); //add 2 docs to primary testServerPrimary.addDocuments(); // publish new NRT point (retrieve the current searcher version on primary) SearcherVersion searcherVersionPrimary = replicationServerPrimary.getReplicationServerBlockingStub().writeNRTPoint( IndexName.newBuilder().setIndexName(TEST_INDEX).build()); // primary should show numDocs hits now SearchResponse searchResponsePrimary = luceneServerPrimary.getBlockingStub().search(SearchRequest.newBuilder() .setIndexName(luceneServerPrimary.getTestIndex()) .setStartHit(0) .setTopHits(10) .setVersion(searcherVersionPrimary.getVersion()) .addAllRetrieveFields(RETRIEVED_VALUES) .build()); validateSearchResults(4, searchResponsePrimary); } @Test public void primaryDurabilitySyncWithReplica() throws IOException, InterruptedException { //startIndex primary GrpcServer.TestServer testServerPrimary = new GrpcServer.TestServer(luceneServerPrimary, true, Mode.PRIMARY); //startIndex replica GrpcServer.TestServer testServerReplica = new GrpcServer.TestServer(luceneServerSecondary, true, Mode.REPLICA); //add 2 docs to primary testServerPrimary.addDocuments(); //both primary and replica should have 2 docs publishNRTAndValidateSearchResults(2); //commit primary (with 2 docs) luceneServerPrimary.getBlockingStub().commit(CommitRequest.newBuilder().setIndexName(TEST_INDEX).build()); //commit metadata state for secondary luceneServerSecondary.getBlockingStub().commit(CommitRequest.newBuilder().setIndexName(TEST_INDEX).build()); //add 4 more docs to primary but dont commit, NRT is at 8 docs but commit point at 2 docs testServerPrimary.addDocuments(); testServerPrimary.addDocuments(); testServerPrimary.addDocuments(); publishNRTAndValidateSearchResults(8); File latestBackup = ShardState.remoteStateExists(BASE_STATE_BACKUP_PATH); assertNotEquals(null, latestBackup); //non-graceful primary shutdown (i.e. blow away index directory and stateDir) shutdownPrimaryServer(); //start primary again, download data from latest commit point startPrimaryServer(latestBackup.toPath()); //startIndex Primary with primaryGen = 1 testServerPrimary = new GrpcServer.TestServer(luceneServerPrimary, true, Mode.PRIMARY, 1, true); //stop and restart secondary to connect to "new" primary gracefullRestartSecondary(); //add 2 more docs to primary testServerPrimary.addDocuments(); publishNRTAndValidateSearchResults(4); } @Test public void primaryDurabilityWithMultipleCommits() throws IOException, InterruptedException { //startIndex primary GrpcServer.TestServer testServerPrimary = new GrpcServer.TestServer(luceneServerPrimary, true, Mode.PRIMARY); for (int i = 0; i < 5; i++){ //add 2 docs to primary testServerPrimary.addDocuments(); testServerPrimary.addDocuments(); //commit primary luceneServerPrimary.getBlockingStub().commit(CommitRequest.newBuilder().setIndexName(TEST_INDEX).build()); } File latestBackup = ShardState.remoteStateExists(BASE_STATE_BACKUP_PATH); assertNotEquals(null, latestBackup); //non-graceful primary shutdown (i.e. blow away index directory) shutdownPrimaryServer(); //start primary again, download data from latest commit point startPrimaryServer(latestBackup.toPath()); //startIndex Primary with primaryGen = 1 testServerPrimary = new GrpcServer.TestServer(luceneServerPrimary, true, Mode.PRIMARY, 1, true); //add 2 docs to primary testServerPrimary.addDocuments(); // publish new NRT point (retrieve the current searcher version on primary) SearcherVersion searcherVersionPrimary = replicationServerPrimary.getReplicationServerBlockingStub().writeNRTPoint( IndexName.newBuilder().setIndexName(TEST_INDEX).build()); // primary should show numDocs hits now SearchResponse searchResponsePrimary = luceneServerPrimary.getBlockingStub().search(SearchRequest.newBuilder() .setIndexName(luceneServerPrimary.getTestIndex()) .setStartHit(0) .setTopHits(22) .setVersion(searcherVersionPrimary.getVersion()) .addAllRetrieveFields(RETRIEVED_VALUES) .build()); validateSearchResults(22, searchResponsePrimary); } private void gracefullRestartSecondary() { luceneServerSecondary.getBlockingStub().stopIndex(StopIndexRequest.newBuilder() .setIndexName(TEST_INDEX) .build()); luceneServerSecondary.getBlockingStub().startIndex(StartIndexRequest.newBuilder() .setIndexName(TEST_INDEX) .setMode(Mode.REPLICA) .setPrimaryAddress("localhost") .setPort(9001) //primary port for replication server .build()); } private void gracefullRestartPrimary(int primaryGen) { luceneServerPrimary.getBlockingStub().stopIndex(StopIndexRequest.newBuilder().setIndexName(TEST_INDEX).build()); luceneServerPrimary.getBlockingStub().startIndex(StartIndexRequest.newBuilder() .setIndexName(TEST_INDEX) .setMode(Mode.PRIMARY) .setPrimaryGen(primaryGen) .build()); } private void publishNRTAndValidateSearchResults(int numDocs) { // publish new NRT point (retrieve the current searcher version on primary) SearcherVersion searcherVersionPrimary = replicationServerPrimary.getReplicationServerBlockingStub().writeNRTPoint( IndexName.newBuilder().setIndexName(TEST_INDEX).build()); // primary should show numDocs hits now SearchResponse searchResponsePrimary = luceneServerPrimary.getBlockingStub().search(SearchRequest.newBuilder() .setIndexName(luceneServerPrimary.getTestIndex()) .setStartHit(0) .setTopHits(10) .setVersion(searcherVersionPrimary.getVersion()) .addAllRetrieveFields(RETRIEVED_VALUES) .build()); // replica should also have numDocs hits SearchResponse searchResponseSecondary = luceneServerSecondary.getBlockingStub().search(SearchRequest.newBuilder() .setIndexName(luceneServerSecondary.getTestIndex()) .setStartHit(0) .setTopHits(10) .setVersion(searcherVersionPrimary.getVersion()) .addAllRetrieveFields(RETRIEVED_VALUES) .build()); validateSearchResults(numDocs, searchResponsePrimary); validateSearchResults(numDocs, searchResponseSecondary); } public static void validateSearchResults(int numHitsExpected, SearchResponse searchResponse) { assertEquals(numHitsExpected, searchResponse.getTotalHits()); assertEquals(numHitsExpected, searchResponse.getHitsList().size()); SearchResponse.Hit firstHit = searchResponse.getHits(0); checkHits(firstHit); SearchResponse.Hit secondHit = searchResponse.getHits(1); checkHits(secondHit); } }
17,335
0.705567
0.699856
376
45.103722
36.072067
159
false
false
0
0
0
0
0
0
0.670213
false
false
2
e1e1111ddca124041daa2b16e3013d36f2837507
29,566,554,917,315
f617d7ed61f4d0632827ea792fdf773e9e87d6d9
/ch10/ex10-89.java
1d67b6ccbaa130236c298f8c1348bb7a54fdda7c
[]
no_license
freebz/JPA-Programming
https://github.com/freebz/JPA-Programming
e796f3d3868913775068f31d86020ded8ddd737e
a52637cba47fa46dfdab9330361d1f8f4bfe5866
refs/heads/master
2020-09-15T09:24:35.035000
2019-11-22T12:09:56
2019-11-22T12:09:56
223,409,858
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// 예제 10.89 기본 조인 QOrder order = QOrder.order; QMember member = QMember.member; QOrderItem orderItem = QOrderItem.orderItem; query.from(order) .join(order.member, member) .leftJoin(order.orderItems, orderItem) .list(order);
UTF-8
Java
250
java
ex10-89.java
Java
[]
null
[]
// 예제 10.89 기본 조인 QOrder order = QOrder.order; QMember member = QMember.member; QOrderItem orderItem = QOrderItem.orderItem; query.from(order) .join(order.member, member) .leftJoin(order.orderItems, orderItem) .list(order);
250
0.722689
0.705882
10
22.799999
14.620534
44
false
false
0
0
0
0
0
0
0.6
false
false
2
b440e18ffeed6a79be6234fc2aa1c81dce5cae37
29,566,554,916,474
4b2b84ee4f9e7ccca8f93045065ceec284f9d44e
/src/main/java/com/geekbrains/app/FormResultsServlet.java
47bd132dc3579878aaf84f43ed6903384168991c
[]
no_license
GradusovRoman/GB_4
https://github.com/GradusovRoman/GB_4
90e2e1efd238a1fc8b6970f4e00db6232c734fc7
0ffab75abd372a3a998126b307a2da1b1be2a56e
refs/heads/master
2023-07-27T11:49:34.265000
2021-08-09T06:47:58
2021-08-09T06:47:58
394,175,583
0
1
null
false
2021-08-12T09:18:31
2021-08-09T06:27:06
2021-08-09T06:48:01
2021-08-12T09:18:30
8
0
1
0
Java
false
false
package com.geekbrains.app; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; @WebServlet(name = "FormResultsServlet", urlPatterns = "/formResults.html") public class FormResultsServlet extends HttpServlet { @Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { PrintWriter out = resp.getWriter(); resp.setContentType("text/html"); String infoParam = req.getParameter("info"); out.println("<html><body><h1>" + infoParam + "</h1></body></html>"); out.close(); } }
UTF-8
Java
831
java
FormResultsServlet.java
Java
[]
null
[]
package com.geekbrains.app; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; @WebServlet(name = "FormResultsServlet", urlPatterns = "/formResults.html") public class FormResultsServlet extends HttpServlet { @Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { PrintWriter out = resp.getWriter(); resp.setContentType("text/html"); String infoParam = req.getParameter("info"); out.println("<html><body><h1>" + infoParam + "</h1></body></html>"); out.close(); } }
831
0.720818
0.718412
23
34.130436
28.389074
115
false
false
0
0
0
0
0
0
0.695652
false
false
2
d28e208b29725bf131cb0f6d84e7b6fceec86416
31,559,419,717,227
846e0dcfa4b2af31a6a3e8059729525cbcd80778
/src/main/java/com/lf/controller/reception/NewsPageCon.java
1c3dcf3887df9340f5212380a22d138f24b3c7bf
[]
no_license
LiuFei-Mopass/LF_Mechanical
https://github.com/LiuFei-Mopass/LF_Mechanical
774a177260d5e25bedaf831668bf714a7735be4c
2852faf94c4dda36c6833eea8a904258ae4b3cec
refs/heads/master
2021-01-21T10:22:24.737000
2017-03-10T01:42:53
2017-03-10T01:42:53
83,419,090
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lf.controller.reception; 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; @Controller public class NewsPageCon { @RequestMapping(value="/getNewsAll",method=RequestMethod.GET) public ModelAndView getNewsPage(Integer page){ ModelAndView mv = new ModelAndView(); //总页数 // mv.addObject("pagesize",pagesize); mv.setViewName("reception/recnews"); return mv; } }
UTF-8
Java
630
java
NewsPageCon.java
Java
[]
null
[]
package com.lf.controller.reception; 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; @Controller public class NewsPageCon { @RequestMapping(value="/getNewsAll",method=RequestMethod.GET) public ModelAndView getNewsPage(Integer page){ ModelAndView mv = new ModelAndView(); //总页数 // mv.addObject("pagesize",pagesize); mv.setViewName("reception/recnews"); return mv; } }
630
0.719551
0.719551
32
17.5
22.117584
62
false
false
0
0
0
0
0
0
1.28125
false
false
2
902a7ca445fe83aac6abccdddcf33d945e87df12
32,117,765,468,712
86505462601eae6007bef6c9f0f4eeb9fcdd1e7b
/bin/modules/b2b-commerce/b2bapprovalprocess/src/de/hybris/platform/b2b/interceptor/B2BCommentPrepareInterceptor.java
7fd3472a671e6380d4f9ee38618307ada2b2959d
[]
no_license
jp-developer0/hybrisTrail
https://github.com/jp-developer0/hybrisTrail
82165c5b91352332a3d471b3414faee47bdb6cee
a0208ffee7fee5b7f83dd982e372276492ae83d4
refs/heads/master
2020-12-03T19:53:58.652000
2020-01-02T18:02:34
2020-01-02T18:02:34
231,430,332
0
4
null
false
2020-08-05T22:46:23
2020-01-02T17:39:15
2020-01-02T19:06:34
2020-08-05T22:46:21
1,073,803
0
1
2
null
false
false
/* * Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. */ package de.hybris.platform.b2b.interceptor; import de.hybris.platform.b2b.model.B2BCommentModel; import de.hybris.platform.servicelayer.interceptor.InterceptorContext; import de.hybris.platform.servicelayer.interceptor.InterceptorException; import de.hybris.platform.servicelayer.interceptor.PrepareInterceptor; import de.hybris.platform.servicelayer.user.UserService; import java.util.Date; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Required; /** * Sets the owner and modifiedDate attribute of a {@link B2BCommentModel} */ public class B2BCommentPrepareInterceptor implements PrepareInterceptor { private static final Logger LOG = Logger.getLogger(B2BCommentPrepareInterceptor.class); private UserService userService; @Override public void onPrepare(final Object model, final InterceptorContext ctx) throws InterceptorException { if (model instanceof B2BCommentModel) { final B2BCommentModel comment = (B2BCommentModel) model; if (comment.getOwner() == null) { comment.setOwner(userService.getCurrentUser()); } comment.setModifiedDate(new Date()); if (LOG.isDebugEnabled()) { LOG.debug(String.format("Comment %s owner attribute is set to %s", comment.getCode(), comment.getOwner().getUid())); } } } @Required public void setUserService(final UserService userService) { this.userService = userService; } protected UserService getUserService() { return userService; } }
UTF-8
Java
1,612
java
B2BCommentPrepareInterceptor.java
Java
[]
null
[]
/* * Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. */ package de.hybris.platform.b2b.interceptor; import de.hybris.platform.b2b.model.B2BCommentModel; import de.hybris.platform.servicelayer.interceptor.InterceptorContext; import de.hybris.platform.servicelayer.interceptor.InterceptorException; import de.hybris.platform.servicelayer.interceptor.PrepareInterceptor; import de.hybris.platform.servicelayer.user.UserService; import java.util.Date; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Required; /** * Sets the owner and modifiedDate attribute of a {@link B2BCommentModel} */ public class B2BCommentPrepareInterceptor implements PrepareInterceptor { private static final Logger LOG = Logger.getLogger(B2BCommentPrepareInterceptor.class); private UserService userService; @Override public void onPrepare(final Object model, final InterceptorContext ctx) throws InterceptorException { if (model instanceof B2BCommentModel) { final B2BCommentModel comment = (B2BCommentModel) model; if (comment.getOwner() == null) { comment.setOwner(userService.getCurrentUser()); } comment.setModifiedDate(new Date()); if (LOG.isDebugEnabled()) { LOG.debug(String.format("Comment %s owner attribute is set to %s", comment.getCode(), comment.getOwner().getUid())); } } } @Required public void setUserService(final UserService userService) { this.userService = userService; } protected UserService getUserService() { return userService; } }
1,612
0.751861
0.743176
52
29
31.504578
120
false
false
0
0
0
0
0
0
1.442308
false
false
2
e698eef1b775ee2f061b36f43058fba07a1a12f4
29,935,922,079,919
842d5508351855397c4a0dd06ab0ecc1e5200240
/jcore-xmi-db-writer/src/main/java/de/julielab/jcore/consumer/xmi/AnnotationTableManager.java
56b44051fc7c44e49bbae72f194186c5f854566e
[]
no_license
shadowridgedev/jcore-base
https://github.com/shadowridgedev/jcore-base
40a79879128143616f57da28c57d641efe5d4669
efc68b7002d39f4d23ff0160fb027b6029a09830
refs/heads/master
2020-07-22T01:47:03.599000
2019-07-02T13:22:15
2019-07-02T13:22:15
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.julielab.jcore.consumer.xmi; import de.julielab.xmlData.cli.TableNotFoundException; import de.julielab.xmlData.dataBase.CoStoSysConnection; import de.julielab.xmlData.dataBase.DataBaseConnector; import de.julielab.xmlData.dataBase.util.CoStoSysSQLRuntimeException; import de.julielab.xmlData.dataBase.util.TableSchemaMismatchException; import org.postgresql.util.PSQLException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.*; public class AnnotationTableManager { public static final String ANNOTATION_LIST_TABLE = "_annotation_tables"; public static final String TABLE_NAME = "tablename"; private static final Logger log = LoggerFactory.getLogger(AnnotationTableManager.class); private DataBaseConnector dbc; private String documentTableSchema; private String annotationTableSchema; private Boolean storeAll; private String dbDocumentTableName; private String annotationStorageSchema; private Boolean storeBaseDocument; private List<String> obsoleteAnnotationTables; private List<String> annotationsToStore; public AnnotationTableManager(DataBaseConnector dbc, String rawDocumentTableName, List<String> annotationsToStore, String documentTableSchema, String annotationTableSchema, Boolean storeAll, Boolean storeBaseDocument, String annotationStorageSchema) throws TableSchemaMismatchException { this.dbc = dbc; this.annotationsToStore = annotationsToStore; this.documentTableSchema = documentTableSchema; this.annotationTableSchema = annotationTableSchema; this.storeAll = storeAll; this.storeBaseDocument = storeBaseDocument; this.dbDocumentTableName = getEffectiveDocumentTableName(rawDocumentTableName); this.annotationStorageSchema = annotationStorageSchema; createTable(rawDocumentTableName, documentTableSchema); for (String annotation : annotationsToStore) createTable(annotation, annotationTableSchema); createAnnotationListTable(); } /** * Normalizes table names by replacing dots "." with underscores "_" and * prepending the active data postgres schema ONLY IF the option * <tt>storeAll</tt> is set to FALSE. If <tt>storeAll</tt> is true, the * table name is returned unchanged. * * @param tableNameParameter the table name to normalize * @param storeAll whether or not the complete document XMI is supposed to be * stored * @return The normalized table name */ public String convertAnnotationTypeToTableName(String tableNameParameter, boolean storeAll) { if (storeAll || tableNameParameter.equals(dbDocumentTableName)) return getEffectiveDocumentTableName(tableNameParameter); // A table cannot be created if the name contains dots. All annotation // tables // will thus have dots replaced by underline. String effectiveTableName = tableNameParameter.contains(":") ? tableNameParameter.substring(tableNameParameter.indexOf(':') + 1) : tableNameParameter; effectiveTableName = effectiveTableName.replace(".", "_"); String schema = tableNameParameter.contains(":") ? tableNameParameter.substring(0, tableNameParameter.indexOf('.')) : annotationStorageSchema; return schema + "." + effectiveTableName; } /** * If <code>documentTableParameter</code> is not schema qualified, prependns the active data postgres schema. * * @param documentTableParameter The document table, as given in the component parameter. * @return The effective document table name. */ String getEffectiveDocumentTableName(String documentTableParameter) { // If the table is already schema qualified, accept it. if (documentTableParameter.contains(".")) return documentTableParameter; return dbc.getActiveDataPGSchema() + "." + documentTableParameter; } /** * <p> * If the base document is stored, returns the names of all annotations * tables that * <ul> * <li>are listed in the _annotation_tables</li> * <li>are not listed as additional table in the current consumer.</li> * </ul> * <p> * <p> * Otherwise does return the empty list. * </p> * <p> * The idea is that when storing the base document all annotations created * before become obsolete due invalid xmi:id references (e.g. to the sofa * the annotations are stored in). Thus, we better remove those annotations * which are all annotations that are not stored with the base document. * </p> * * @return Annotation table names that are not stored with the base document * or, if the base document is not stored, an empty list. */ List<String> getObsoleteAnnotationTableNames() { if (!storeBaseDocument) return Collections.emptyList(); if (null == obsoleteAnnotationTables) { obsoleteAnnotationTables = new ArrayList<>(); // first get the names of all annotation tables try (CoStoSysConnection conn = dbc.obtainOrReserveConnection()){ Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("SELECT " + TABLE_NAME + " FROM " + dbc.getActiveDataPGSchema() + "." + ANNOTATION_LIST_TABLE); while (rs.next()) { obsoleteAnnotationTables.add(rs.getString(1)); } } catch (SQLException e) { e.printStackTrace(); } // then remove those that are NOT obsolete from the list, leaving us // with the obsolete table names Set<String> annotationsToStoreTableNameSet = new HashSet<>(); for (String annotationTypeToStore : annotationsToStore) annotationsToStoreTableNameSet.add(convertAnnotationTypeToTableName(annotationTypeToStore, false)); Iterator<String> it = obsoleteAnnotationTables.iterator(); while (it.hasNext()) { String tablename = it.next(); if (annotationsToStoreTableNameSet.contains(tablename)) it.remove(); } } return obsoleteAnnotationTables; } void createTable(String tableName, String schema) throws TableSchemaMismatchException { String effectiveTableName = convertAnnotationTypeToTableName(tableName, storeAll); if (getEffectiveDocumentTableName(tableName).equals(dbDocumentTableName)) effectiveTableName = dbDocumentTableName; try { if (!dbc.tableExists(effectiveTableName)) { log.info("Creating table '{}' with schema '{}' (columns: {}).", effectiveTableName, schema, dbc.getFieldConfiguration(schema).getColumns()); String pgSchema = getTableSchema(effectiveTableName); if (!dbc.schemaExists(pgSchema)) dbc.createSchema(pgSchema); if (storeAll) { dbc.createTable(effectiveTableName, schema, "Created by " + XMIDBWriter.class.getName() + " on " + new Date()); } else { if (!effectiveTableName.equals(dbDocumentTableName)) { dbc.createTable(effectiveTableName, dbDocumentTableName, schema, "Created by " + XMIDBWriter.class.getName() + " on " + new Date() + " to store annotations of type\"" + tableName + "\" for the documents stored in table \"" + dbDocumentTableName + "\"."); } else { dbc.createTable(effectiveTableName, schema, "Created by " + XMIDBWriter.class.getName() + " on " + new Date() + " to store the base documents without" + " linguistic or semantic annotations." + " Those are stored in the tables named" + " after the annotation type they are" + " storing in this Postgres schema."); } } } String tableSchemaNameToCheck = effectiveTableName.equals(dbDocumentTableName) ? documentTableSchema : annotationTableSchema; dbc.checkTableDefinition(effectiveTableName, tableSchemaNameToCheck); if (!effectiveTableName.equals(dbDocumentTableName)) addAnnotationTableToList(effectiveTableName); } catch (CoStoSysSQLRuntimeException e) { log.warn( "SQLException was thrown when creating tables. Possibly it is a concurrency issue and it has been " + "tried to create the tables although they had already been created by another process " + "in the meantime. Error was: {}", e); } catch (TableNotFoundException e) { log.error("Table not found", e); } } private String getTableSchema(String effectiveTableName) { int dotIndex = effectiveTableName.indexOf('.'); if (dotIndex < 0) return null; return effectiveTableName.substring(0, dotIndex); } /** * Adds the extract string <tt>tablename</tt> to the list of annotation * table names. * * @param tablename */ void addAnnotationTableToList(String tablename) { try (CoStoSysConnection conn = dbc.obtainOrReserveConnection()){ conn.setAutoCommit(true); Statement stmt = conn.createStatement(); String template = "INSERT INTO %s VALUES('%s')"; String sql = String.format(template, dbc.getActiveDataPGSchema() + "." + ANNOTATION_LIST_TABLE, tablename); stmt.execute(sql); } catch (PSQLException e) { log.debug("Tried to add already existing annotation table to annotation list: \"{}\", ignoring.", tablename); } catch (SQLException e) { e.printStackTrace(); SQLException ne = e.getNextException(); if (null != ne) ne.printStackTrace(); } } private void createAnnotationListTable() { if (!dbc.tableExists(dbc.getActiveDataPGSchema() + "." + ANNOTATION_LIST_TABLE)) { try (CoStoSysConnection conn = dbc.obtainOrReserveConnection()){ conn.setAutoCommit(true); Statement stmt = conn.createStatement(); String sql = String.format("CREATE TABLE %s (%s text PRIMARY KEY)", dbc.getActiveDataPGSchema() + "." + ANNOTATION_LIST_TABLE, TABLE_NAME); stmt.execute(sql); } catch (SQLException e) { e.printStackTrace(); SQLException ne = e.getNextException(); if (null != ne) ne.printStackTrace(); } } } }
UTF-8
Java
11,220
java
AnnotationTableManager.java
Java
[]
null
[]
package de.julielab.jcore.consumer.xmi; import de.julielab.xmlData.cli.TableNotFoundException; import de.julielab.xmlData.dataBase.CoStoSysConnection; import de.julielab.xmlData.dataBase.DataBaseConnector; import de.julielab.xmlData.dataBase.util.CoStoSysSQLRuntimeException; import de.julielab.xmlData.dataBase.util.TableSchemaMismatchException; import org.postgresql.util.PSQLException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.*; public class AnnotationTableManager { public static final String ANNOTATION_LIST_TABLE = "_annotation_tables"; public static final String TABLE_NAME = "tablename"; private static final Logger log = LoggerFactory.getLogger(AnnotationTableManager.class); private DataBaseConnector dbc; private String documentTableSchema; private String annotationTableSchema; private Boolean storeAll; private String dbDocumentTableName; private String annotationStorageSchema; private Boolean storeBaseDocument; private List<String> obsoleteAnnotationTables; private List<String> annotationsToStore; public AnnotationTableManager(DataBaseConnector dbc, String rawDocumentTableName, List<String> annotationsToStore, String documentTableSchema, String annotationTableSchema, Boolean storeAll, Boolean storeBaseDocument, String annotationStorageSchema) throws TableSchemaMismatchException { this.dbc = dbc; this.annotationsToStore = annotationsToStore; this.documentTableSchema = documentTableSchema; this.annotationTableSchema = annotationTableSchema; this.storeAll = storeAll; this.storeBaseDocument = storeBaseDocument; this.dbDocumentTableName = getEffectiveDocumentTableName(rawDocumentTableName); this.annotationStorageSchema = annotationStorageSchema; createTable(rawDocumentTableName, documentTableSchema); for (String annotation : annotationsToStore) createTable(annotation, annotationTableSchema); createAnnotationListTable(); } /** * Normalizes table names by replacing dots "." with underscores "_" and * prepending the active data postgres schema ONLY IF the option * <tt>storeAll</tt> is set to FALSE. If <tt>storeAll</tt> is true, the * table name is returned unchanged. * * @param tableNameParameter the table name to normalize * @param storeAll whether or not the complete document XMI is supposed to be * stored * @return The normalized table name */ public String convertAnnotationTypeToTableName(String tableNameParameter, boolean storeAll) { if (storeAll || tableNameParameter.equals(dbDocumentTableName)) return getEffectiveDocumentTableName(tableNameParameter); // A table cannot be created if the name contains dots. All annotation // tables // will thus have dots replaced by underline. String effectiveTableName = tableNameParameter.contains(":") ? tableNameParameter.substring(tableNameParameter.indexOf(':') + 1) : tableNameParameter; effectiveTableName = effectiveTableName.replace(".", "_"); String schema = tableNameParameter.contains(":") ? tableNameParameter.substring(0, tableNameParameter.indexOf('.')) : annotationStorageSchema; return schema + "." + effectiveTableName; } /** * If <code>documentTableParameter</code> is not schema qualified, prependns the active data postgres schema. * * @param documentTableParameter The document table, as given in the component parameter. * @return The effective document table name. */ String getEffectiveDocumentTableName(String documentTableParameter) { // If the table is already schema qualified, accept it. if (documentTableParameter.contains(".")) return documentTableParameter; return dbc.getActiveDataPGSchema() + "." + documentTableParameter; } /** * <p> * If the base document is stored, returns the names of all annotations * tables that * <ul> * <li>are listed in the _annotation_tables</li> * <li>are not listed as additional table in the current consumer.</li> * </ul> * <p> * <p> * Otherwise does return the empty list. * </p> * <p> * The idea is that when storing the base document all annotations created * before become obsolete due invalid xmi:id references (e.g. to the sofa * the annotations are stored in). Thus, we better remove those annotations * which are all annotations that are not stored with the base document. * </p> * * @return Annotation table names that are not stored with the base document * or, if the base document is not stored, an empty list. */ List<String> getObsoleteAnnotationTableNames() { if (!storeBaseDocument) return Collections.emptyList(); if (null == obsoleteAnnotationTables) { obsoleteAnnotationTables = new ArrayList<>(); // first get the names of all annotation tables try (CoStoSysConnection conn = dbc.obtainOrReserveConnection()){ Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("SELECT " + TABLE_NAME + " FROM " + dbc.getActiveDataPGSchema() + "." + ANNOTATION_LIST_TABLE); while (rs.next()) { obsoleteAnnotationTables.add(rs.getString(1)); } } catch (SQLException e) { e.printStackTrace(); } // then remove those that are NOT obsolete from the list, leaving us // with the obsolete table names Set<String> annotationsToStoreTableNameSet = new HashSet<>(); for (String annotationTypeToStore : annotationsToStore) annotationsToStoreTableNameSet.add(convertAnnotationTypeToTableName(annotationTypeToStore, false)); Iterator<String> it = obsoleteAnnotationTables.iterator(); while (it.hasNext()) { String tablename = it.next(); if (annotationsToStoreTableNameSet.contains(tablename)) it.remove(); } } return obsoleteAnnotationTables; } void createTable(String tableName, String schema) throws TableSchemaMismatchException { String effectiveTableName = convertAnnotationTypeToTableName(tableName, storeAll); if (getEffectiveDocumentTableName(tableName).equals(dbDocumentTableName)) effectiveTableName = dbDocumentTableName; try { if (!dbc.tableExists(effectiveTableName)) { log.info("Creating table '{}' with schema '{}' (columns: {}).", effectiveTableName, schema, dbc.getFieldConfiguration(schema).getColumns()); String pgSchema = getTableSchema(effectiveTableName); if (!dbc.schemaExists(pgSchema)) dbc.createSchema(pgSchema); if (storeAll) { dbc.createTable(effectiveTableName, schema, "Created by " + XMIDBWriter.class.getName() + " on " + new Date()); } else { if (!effectiveTableName.equals(dbDocumentTableName)) { dbc.createTable(effectiveTableName, dbDocumentTableName, schema, "Created by " + XMIDBWriter.class.getName() + " on " + new Date() + " to store annotations of type\"" + tableName + "\" for the documents stored in table \"" + dbDocumentTableName + "\"."); } else { dbc.createTable(effectiveTableName, schema, "Created by " + XMIDBWriter.class.getName() + " on " + new Date() + " to store the base documents without" + " linguistic or semantic annotations." + " Those are stored in the tables named" + " after the annotation type they are" + " storing in this Postgres schema."); } } } String tableSchemaNameToCheck = effectiveTableName.equals(dbDocumentTableName) ? documentTableSchema : annotationTableSchema; dbc.checkTableDefinition(effectiveTableName, tableSchemaNameToCheck); if (!effectiveTableName.equals(dbDocumentTableName)) addAnnotationTableToList(effectiveTableName); } catch (CoStoSysSQLRuntimeException e) { log.warn( "SQLException was thrown when creating tables. Possibly it is a concurrency issue and it has been " + "tried to create the tables although they had already been created by another process " + "in the meantime. Error was: {}", e); } catch (TableNotFoundException e) { log.error("Table not found", e); } } private String getTableSchema(String effectiveTableName) { int dotIndex = effectiveTableName.indexOf('.'); if (dotIndex < 0) return null; return effectiveTableName.substring(0, dotIndex); } /** * Adds the extract string <tt>tablename</tt> to the list of annotation * table names. * * @param tablename */ void addAnnotationTableToList(String tablename) { try (CoStoSysConnection conn = dbc.obtainOrReserveConnection()){ conn.setAutoCommit(true); Statement stmt = conn.createStatement(); String template = "INSERT INTO %s VALUES('%s')"; String sql = String.format(template, dbc.getActiveDataPGSchema() + "." + ANNOTATION_LIST_TABLE, tablename); stmt.execute(sql); } catch (PSQLException e) { log.debug("Tried to add already existing annotation table to annotation list: \"{}\", ignoring.", tablename); } catch (SQLException e) { e.printStackTrace(); SQLException ne = e.getNextException(); if (null != ne) ne.printStackTrace(); } } private void createAnnotationListTable() { if (!dbc.tableExists(dbc.getActiveDataPGSchema() + "." + ANNOTATION_LIST_TABLE)) { try (CoStoSysConnection conn = dbc.obtainOrReserveConnection()){ conn.setAutoCommit(true); Statement stmt = conn.createStatement(); String sql = String.format("CREATE TABLE %s (%s text PRIMARY KEY)", dbc.getActiveDataPGSchema() + "." + ANNOTATION_LIST_TABLE, TABLE_NAME); stmt.execute(sql); } catch (SQLException e) { e.printStackTrace(); SQLException ne = e.getNextException(); if (null != ne) ne.printStackTrace(); } } } }
11,220
0.631462
0.630838
238
46.142857
35.523525
206
false
false
0
0
0
0
0
0
0.558824
false
false
2
d0816c61ba9a4ecf3576619a6fce57c8797ccfd6
19,026,705,162,620
01545678f1e231de5b7e23635be11d29c0c7eb68
/java/src/com/ibm/streamsx/topology/internal/context/streams/AnalyticsServiceStreamsContext.java
aa95a9fa64c661db140f443a6468532102d785ef
[ "Apache-2.0" ]
permissive
IBMStreams/streamsx.topology
https://github.com/IBMStreams/streamsx.topology
0bcb108836dd3a06905a99276de27bf3b73467e7
20d5179d77524c04ba178f694f7d1eb84ac881c4
refs/heads/develop
2022-08-02T15:24:31.808000
2022-07-24T18:34:46
2022-07-24T18:34:46
36,458,001
32
54
Apache-2.0
false
2021-02-01T12:28:19
2015-05-28T18:30:13
2021-01-27T10:21:16
2021-02-01T12:28:19
53,197
28
43
4
Java
false
false
/* # Licensed Materials - Property of IBM # Copyright IBM Corp. 2015 */ package com.ibm.streamsx.topology.internal.context.streams; import static com.ibm.streamsx.topology.internal.context.remote.DeployKeys.deploy; import static com.ibm.streamsx.topology.internal.context.remote.DeployKeys.keepArtifacts; import static com.ibm.streamsx.topology.internal.context.remote.RemoteBuildAndSubmitRemoteContext.streamingAnalyticServiceFromDeploy; import static com.ibm.streamsx.topology.internal.streaminganalytics.VcapServices.getVCAPService; import java.io.File; import java.io.IOException; import java.math.BigInteger; import java.util.concurrent.Future; import com.google.gson.JsonObject; import com.ibm.streamsx.rest.ActiveVersion; import com.ibm.streamsx.rest.Instance; import com.ibm.streamsx.rest.Job; import com.ibm.streamsx.rest.Result; import com.ibm.streamsx.rest.StreamingAnalyticsService; import com.ibm.streamsx.topology.context.remote.RemoteContext; import com.ibm.streamsx.topology.internal.context.remote.DeployKeys; import com.ibm.streamsx.topology.internal.context.remote.RemoteContexts; import com.ibm.streamsx.topology.internal.context.remote.SubmissionResultsKeys; import com.ibm.streamsx.topology.internal.context.service.RemoteStreamingAnalyticsServiceStreamsContext; import com.ibm.streamsx.topology.internal.gson.GsonUtilities; import com.ibm.streamsx.topology.internal.process.CompletedFuture; public class AnalyticsServiceStreamsContext extends BundleUserStreamsContext<BigInteger> { private final Type type; public AnalyticsServiceStreamsContext(Type type) { super(false); this.type = type; } @Override public Type getType() { return type; } @Override protected Future<BigInteger> action(AppEntity entity) throws Exception { if (useRemoteBuild(entity, AnalyticsServiceStreamsContext::getSasServiceBase)) { RemoteStreamingAnalyticsServiceStreamsContext rc = new RemoteStreamingAnalyticsServiceStreamsContext(); return rc.submit(entity.submission); } return super.action(entity); } /** * Get the SAS OS version base. */ private static int getSasServiceBase(AppEntity entity) { // Need to interrogate the service to figure out // the os version of the service. StreamingAnalyticsService sas; try { sas = sas(entity); Instance instance = sas.getInstance(); ActiveVersion ver = instance.getActiveVersion(); // Compare base versions, ir it doesn't exactly match the // service force remote build. return Integer.valueOf(ver.getMinimumOSBaseVersion()); } catch (IOException e) { ; } return -1; } @Override Future<BigInteger> invoke(AppEntity entity, File bundle) throws Exception { try { BigInteger jobId = submitJobToService(bundle, entity); return new CompletedFuture<BigInteger>(jobId); } finally { if (!keepArtifacts(entity.submission)) bundle.delete(); } } /** * Verify we have a valid Streaming Analytic service * information before we attempt anything. */ @Override protected void preSubmit(AppEntity entity) { try { if (entity.submission != null) getVCAPService(deploy(entity.submission)); } catch (IOException e) { throw new IllegalArgumentException(e); } } /** * Get the connection to the service and check it is running. */ private static StreamingAnalyticsService sas(AppEntity entity) throws IOException { StreamingAnalyticsService sas = (StreamingAnalyticsService) entity.getSavedObject(StreamingAnalyticsService.class); if (sas == null) { JsonObject deploy = deploy(entity.submission); sas = entity.saveObject(StreamingAnalyticsService.class, streamingAnalyticServiceFromDeploy(deploy)); RemoteContexts.checkServiceRunning(sas); } return sas; } private BigInteger submitJobToService(File bundle, AppEntity entity) throws IOException { final JsonObject submission = entity.submission; JsonObject deploy = deploy(submission); JsonObject jco = DeployKeys.copyJobConfigOverlays(deploy); final StreamingAnalyticsService sas = sas(entity); Result<Job, JsonObject> submitResult = sas.submitJob(bundle, jco); final JsonObject submissionResult = GsonUtilities.objectCreate(submission, RemoteContext.SUBMISSION_RESULTS); GsonUtilities.addAll(submissionResult, submitResult.getRawResult()); // Ensure job id is in a known place regardless of version final String jobId = submitResult.getId(); GsonUtilities.addToObject(submissionResult, SubmissionResultsKeys.JOB_ID, jobId); return new BigInteger(jobId); } }
UTF-8
Java
5,230
java
AnalyticsServiceStreamsContext.java
Java
[]
null
[]
/* # Licensed Materials - Property of IBM # Copyright IBM Corp. 2015 */ package com.ibm.streamsx.topology.internal.context.streams; import static com.ibm.streamsx.topology.internal.context.remote.DeployKeys.deploy; import static com.ibm.streamsx.topology.internal.context.remote.DeployKeys.keepArtifacts; import static com.ibm.streamsx.topology.internal.context.remote.RemoteBuildAndSubmitRemoteContext.streamingAnalyticServiceFromDeploy; import static com.ibm.streamsx.topology.internal.streaminganalytics.VcapServices.getVCAPService; import java.io.File; import java.io.IOException; import java.math.BigInteger; import java.util.concurrent.Future; import com.google.gson.JsonObject; import com.ibm.streamsx.rest.ActiveVersion; import com.ibm.streamsx.rest.Instance; import com.ibm.streamsx.rest.Job; import com.ibm.streamsx.rest.Result; import com.ibm.streamsx.rest.StreamingAnalyticsService; import com.ibm.streamsx.topology.context.remote.RemoteContext; import com.ibm.streamsx.topology.internal.context.remote.DeployKeys; import com.ibm.streamsx.topology.internal.context.remote.RemoteContexts; import com.ibm.streamsx.topology.internal.context.remote.SubmissionResultsKeys; import com.ibm.streamsx.topology.internal.context.service.RemoteStreamingAnalyticsServiceStreamsContext; import com.ibm.streamsx.topology.internal.gson.GsonUtilities; import com.ibm.streamsx.topology.internal.process.CompletedFuture; public class AnalyticsServiceStreamsContext extends BundleUserStreamsContext<BigInteger> { private final Type type; public AnalyticsServiceStreamsContext(Type type) { super(false); this.type = type; } @Override public Type getType() { return type; } @Override protected Future<BigInteger> action(AppEntity entity) throws Exception { if (useRemoteBuild(entity, AnalyticsServiceStreamsContext::getSasServiceBase)) { RemoteStreamingAnalyticsServiceStreamsContext rc = new RemoteStreamingAnalyticsServiceStreamsContext(); return rc.submit(entity.submission); } return super.action(entity); } /** * Get the SAS OS version base. */ private static int getSasServiceBase(AppEntity entity) { // Need to interrogate the service to figure out // the os version of the service. StreamingAnalyticsService sas; try { sas = sas(entity); Instance instance = sas.getInstance(); ActiveVersion ver = instance.getActiveVersion(); // Compare base versions, ir it doesn't exactly match the // service force remote build. return Integer.valueOf(ver.getMinimumOSBaseVersion()); } catch (IOException e) { ; } return -1; } @Override Future<BigInteger> invoke(AppEntity entity, File bundle) throws Exception { try { BigInteger jobId = submitJobToService(bundle, entity); return new CompletedFuture<BigInteger>(jobId); } finally { if (!keepArtifacts(entity.submission)) bundle.delete(); } } /** * Verify we have a valid Streaming Analytic service * information before we attempt anything. */ @Override protected void preSubmit(AppEntity entity) { try { if (entity.submission != null) getVCAPService(deploy(entity.submission)); } catch (IOException e) { throw new IllegalArgumentException(e); } } /** * Get the connection to the service and check it is running. */ private static StreamingAnalyticsService sas(AppEntity entity) throws IOException { StreamingAnalyticsService sas = (StreamingAnalyticsService) entity.getSavedObject(StreamingAnalyticsService.class); if (sas == null) { JsonObject deploy = deploy(entity.submission); sas = entity.saveObject(StreamingAnalyticsService.class, streamingAnalyticServiceFromDeploy(deploy)); RemoteContexts.checkServiceRunning(sas); } return sas; } private BigInteger submitJobToService(File bundle, AppEntity entity) throws IOException { final JsonObject submission = entity.submission; JsonObject deploy = deploy(submission); JsonObject jco = DeployKeys.copyJobConfigOverlays(deploy); final StreamingAnalyticsService sas = sas(entity); Result<Job, JsonObject> submitResult = sas.submitJob(bundle, jco); final JsonObject submissionResult = GsonUtilities.objectCreate(submission, RemoteContext.SUBMISSION_RESULTS); GsonUtilities.addAll(submissionResult, submitResult.getRawResult()); // Ensure job id is in a known place regardless of version final String jobId = submitResult.getId(); GsonUtilities.addToObject(submissionResult, SubmissionResultsKeys.JOB_ID, jobId); return new BigInteger(jobId); } }
5,230
0.677438
0.676482
144
35.319443
30.392263
133
false
false
0
0
0
0
0
0
0.472222
false
false
2
ec7237bef6a8352234609211f08715af92aa460e
19,997,367,748,272
48da887dc524dea063e505d70c55e5ca1c716b50
/app-apis/app-dto/src/main/java/com/hupu/smart/app/api/dto/player/GetPlayerRecordIndexRespFootball.java
da43bf8eeb709bdbe3e6870674a89a2c3e4cd2bc
[]
no_license
ziyerachel/el-game
https://github.com/ziyerachel/el-game
a78814844c37a2309a7527627a5b5508100528a8
8bf304b5fdded996e0012f84c8d018ec7f63603f
refs/heads/master
2018-01-13T15:38:29.028000
2017-03-14T08:26:51
2017-03-14T08:26:51
82,893,269
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hupu.smart.app.api.dto.player; import com.hupu.smart.app.api.dto.video.bean.GameVideoDTO; import java.util.List; /** * Created by panda on 2015/11/18 0018. */ public class GetPlayerRecordIndexRespFootball { private FootballCareerSum footballCareerSum; private Integer teamsCount; private Integer gamesCountUnEnd; private Integer gamesCountEnd; private Integer videoCount; private List<GameVideoDTO> videoList; public static class FootballCareerSum { private Integer playingTimeSum=0; private Integer winRondaSum=0; private Integer loseRondaSum=0; private Integer goalSum=0; private Integer shootingOnSum=0; private Integer assistSum=0; private Integer shootingSum=0; private Integer passBallSum=0; private String shootingGoalRateSum=""; private String interceptOkRate=""; private Integer firstGoOnSum=0; private Integer goOnSum=0; public Integer getGoalSum() { return goalSum; } public void setGoalSum(Integer goalSum) { this.goalSum = goalSum; } public Integer getPlayingTimeSum() { return playingTimeSum; } public void setPlayingTimeSum(Integer playingTimeSum) { this.playingTimeSum = playingTimeSum; } public Integer getWinRondaSum() { return winRondaSum; } public void setWinRondaSum(Integer winRondaSum) { this.winRondaSum = winRondaSum; } public Integer getLoseRondaSum() { return loseRondaSum; } public void setLoseRondaSum(Integer loseRondaSum) { this.loseRondaSum = loseRondaSum; } public Integer getShootingOnSum() { return shootingOnSum; } public void setShootingOnSum(Integer shootingOnSum) { this.shootingOnSum = shootingOnSum; } public Integer getAssistSum() { return assistSum; } public void setAssistSum(Integer assistSum) { this.assistSum = assistSum; } public Integer getShootingSum() { return shootingSum; } public void setShootingSum(Integer shootingSum) { this.shootingSum = shootingSum; } public Integer getPassBallSum() { return passBallSum; } public void setPassBallSum(Integer passBallSum) { this.passBallSum = passBallSum; } public String getShootingGoalRateSum() { return shootingGoalRateSum; } public void setShootingGoalRateSum(String shootingGoalRateSum) { this.shootingGoalRateSum = shootingGoalRateSum; } public String getInterceptOkRate() { return interceptOkRate; } public void setInterceptOkRate(String interceptOkRate) { this.interceptOkRate = interceptOkRate; } public Integer getFirstGoOnSum() { return firstGoOnSum; } public void setFirstGoOnSum(Integer firstGoOnSum) { this.firstGoOnSum = firstGoOnSum; } public Integer getGoOnSum() { return goOnSum; } public void setGoOnSum(Integer goOnSum) { this.goOnSum = goOnSum; } } public FootballCareerSum getFootballCareerSum() { return footballCareerSum; } public void setFootballCareerSum(FootballCareerSum footballCareerSum) { this.footballCareerSum = footballCareerSum; } public List<GameVideoDTO> getVideoList() { return videoList; } public void setVideoList(List<GameVideoDTO> videoList) { this.videoList = videoList; } public Integer getVideoCount() { return videoCount; } public void setVideoCount(Integer videoCount) { this.videoCount = videoCount; } public Integer getTeamsCount() { return teamsCount; } public void setTeamsCount(Integer teamsCount) { this.teamsCount = teamsCount; } public Integer getGamesCountUnEnd() { return gamesCountUnEnd; } public void setGamesCountUnEnd(Integer gamesCountUnEnd) { this.gamesCountUnEnd = gamesCountUnEnd; } public Integer getGamesCountEnd() { return gamesCountEnd; } public void setGamesCountEnd(Integer gamesCountEnd) { this.gamesCountEnd = gamesCountEnd; } }
UTF-8
Java
4,548
java
GetPlayerRecordIndexRespFootball.java
Java
[ { "context": "deoDTO;\n\nimport java.util.List;\n\n/**\n * Created by panda on 2015/11/18 0018.\n */\npublic class GetPlayerRec", "end": 151, "score": 0.9984777569770813, "start": 146, "tag": "USERNAME", "value": "panda" } ]
null
[]
package com.hupu.smart.app.api.dto.player; import com.hupu.smart.app.api.dto.video.bean.GameVideoDTO; import java.util.List; /** * Created by panda on 2015/11/18 0018. */ public class GetPlayerRecordIndexRespFootball { private FootballCareerSum footballCareerSum; private Integer teamsCount; private Integer gamesCountUnEnd; private Integer gamesCountEnd; private Integer videoCount; private List<GameVideoDTO> videoList; public static class FootballCareerSum { private Integer playingTimeSum=0; private Integer winRondaSum=0; private Integer loseRondaSum=0; private Integer goalSum=0; private Integer shootingOnSum=0; private Integer assistSum=0; private Integer shootingSum=0; private Integer passBallSum=0; private String shootingGoalRateSum=""; private String interceptOkRate=""; private Integer firstGoOnSum=0; private Integer goOnSum=0; public Integer getGoalSum() { return goalSum; } public void setGoalSum(Integer goalSum) { this.goalSum = goalSum; } public Integer getPlayingTimeSum() { return playingTimeSum; } public void setPlayingTimeSum(Integer playingTimeSum) { this.playingTimeSum = playingTimeSum; } public Integer getWinRondaSum() { return winRondaSum; } public void setWinRondaSum(Integer winRondaSum) { this.winRondaSum = winRondaSum; } public Integer getLoseRondaSum() { return loseRondaSum; } public void setLoseRondaSum(Integer loseRondaSum) { this.loseRondaSum = loseRondaSum; } public Integer getShootingOnSum() { return shootingOnSum; } public void setShootingOnSum(Integer shootingOnSum) { this.shootingOnSum = shootingOnSum; } public Integer getAssistSum() { return assistSum; } public void setAssistSum(Integer assistSum) { this.assistSum = assistSum; } public Integer getShootingSum() { return shootingSum; } public void setShootingSum(Integer shootingSum) { this.shootingSum = shootingSum; } public Integer getPassBallSum() { return passBallSum; } public void setPassBallSum(Integer passBallSum) { this.passBallSum = passBallSum; } public String getShootingGoalRateSum() { return shootingGoalRateSum; } public void setShootingGoalRateSum(String shootingGoalRateSum) { this.shootingGoalRateSum = shootingGoalRateSum; } public String getInterceptOkRate() { return interceptOkRate; } public void setInterceptOkRate(String interceptOkRate) { this.interceptOkRate = interceptOkRate; } public Integer getFirstGoOnSum() { return firstGoOnSum; } public void setFirstGoOnSum(Integer firstGoOnSum) { this.firstGoOnSum = firstGoOnSum; } public Integer getGoOnSum() { return goOnSum; } public void setGoOnSum(Integer goOnSum) { this.goOnSum = goOnSum; } } public FootballCareerSum getFootballCareerSum() { return footballCareerSum; } public void setFootballCareerSum(FootballCareerSum footballCareerSum) { this.footballCareerSum = footballCareerSum; } public List<GameVideoDTO> getVideoList() { return videoList; } public void setVideoList(List<GameVideoDTO> videoList) { this.videoList = videoList; } public Integer getVideoCount() { return videoCount; } public void setVideoCount(Integer videoCount) { this.videoCount = videoCount; } public Integer getTeamsCount() { return teamsCount; } public void setTeamsCount(Integer teamsCount) { this.teamsCount = teamsCount; } public Integer getGamesCountUnEnd() { return gamesCountUnEnd; } public void setGamesCountUnEnd(Integer gamesCountUnEnd) { this.gamesCountUnEnd = gamesCountUnEnd; } public Integer getGamesCountEnd() { return gamesCountEnd; } public void setGamesCountEnd(Integer gamesCountEnd) { this.gamesCountEnd = gamesCountEnd; } }
4,548
0.626869
0.622032
183
23.852459
21.180593
75
false
false
0
0
0
0
0
0
0.311475
false
false
2
436666b0f70cc9a6006ab3eb28a443d5997ea0ce
19,997,367,745,267
ab010707f4fd9d0d10b81d90ba58da9d6c40cff4
/src/main/java/com/conference/builder/EventBuildDirector.java
58ed266c97195e766840d69699fe8d1d2506cb9c
[]
no_license
stefan-cross/DPA
https://github.com/stefan-cross/DPA
3928412747fea4e8e5485de0665981aeffff8ab3
3ea8bb2d73069410f80bc7b1823567ed9cdcffe7
refs/heads/master
2021-01-19T22:32:52.491000
2014-07-20T19:56:14
2014-07-20T19:56:14
21,627,810
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package main.java.com.conference.builder; /** * Created with IntelliJ IDEA. * User: stefancross * Date: 19/07/2014 * Time: 13:21 */ public class EventBuildDirector { public Event buildEvent(String name, String location, EventBuilder builder){ builder.name(name); builder.location(location); return builder.getEvent(); } }
UTF-8
Java
360
java
EventBuildDirector.java
Java
[ { "context": "lder;\n\n/**\n * Created with IntelliJ IDEA.\n * User: stefancross\n * Date: 19/07/2014\n * Time: 13:21\n */\npublic cla", "end": 98, "score": 0.9991875886917114, "start": 87, "tag": "USERNAME", "value": "stefancross" } ]
null
[]
package main.java.com.conference.builder; /** * Created with IntelliJ IDEA. * User: stefancross * Date: 19/07/2014 * Time: 13:21 */ public class EventBuildDirector { public Event buildEvent(String name, String location, EventBuilder builder){ builder.name(name); builder.location(location); return builder.getEvent(); } }
360
0.680556
0.647222
15
23
20.405882
80
false
false
0
0
0
0
0
0
0.4
false
false
2
09a862366b87da46e2d58e1734104d54cd696009
8,907,762,172,082
10c7c1d1a16fe738637aaf021b632c58157f0c0d
/src/javaForChildren/HomeWork/TemperatureConverter.java
60d62c93b76e6abc0461a21d24ada1fd5bb36e2a
[]
no_license
ArtemMakovskyy/JavaFromChildren
https://github.com/ArtemMakovskyy/JavaFromChildren
d3d76d5ad4b0f37837c2626f077fb24a1e46234f
6da5f56fac9d9dd67f9fd116daa1b75e9159ebe5
refs/heads/master
2023-08-28T23:21:08.660000
2021-10-24T14:33:36
2021-10-24T14:33:36
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package javaForChildren.HomeWork; public class TemperatureConverter { int temperature; char convertTo; public String convertTemp (int temperature,char convertTo){ this.temperature = temperature; this.convertTo = convertTo; if(this.convertTo == 'C'| this.convertTo == 'c'){ return temperature+", "+convertTo; }else if (this.convertTo == 'F'| this.convertTo == 'f'){ } return ((temperature-32)/1.8)+", "+" по цельсию"; } }
UTF-8
Java
512
java
TemperatureConverter.java
Java
[]
null
[]
package javaForChildren.HomeWork; public class TemperatureConverter { int temperature; char convertTo; public String convertTemp (int temperature,char convertTo){ this.temperature = temperature; this.convertTo = convertTo; if(this.convertTo == 'C'| this.convertTo == 'c'){ return temperature+", "+convertTo; }else if (this.convertTo == 'F'| this.convertTo == 'f'){ } return ((temperature-32)/1.8)+", "+" по цельсию"; } }
512
0.60835
0.600398
20
24.15
24.462778
66
false
false
0
0
0
0
0
0
0.6
false
false
2
725d3fd9b1100101d189519b67f96bed57022848
8,907,762,173,999
86704205006f332578f2e13f74c5733996b990c1
/src/eaPanel.java
efd5fe5c921c9f2061490dfc75e60613a0b0c1c6
[]
no_license
nzulhilmi/Excel-Automation0.0
https://github.com/nzulhilmi/Excel-Automation0.0
db350efc08d511b819b56b2a9b5dbfaf5e676f19
e355f9da5f16cfba3da4751a61c64f366fcdd711
refs/heads/master
2021-01-16T21:41:38.531000
2017-08-29T09:45:33
2017-08-29T09:45:33
100,244,136
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Font; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.JTextPane; import javax.swing.SwingConstants; /** * Panel class for the GUI of Excel-Automation software. * This is where the components of the GUI are programmed. * @author Nik Zulhilmi Nik Fuaad * */ public class eaPanel extends JPanel { //Text Fields private static JTextField TAMsTextField; private static JTextField file1TextField; private static JTextField file2TextField; private static JTextField columnsTextField; private static JTextField outputNameTextField; //Buttons private JButton infoButton; private JButton extractButton; private JButton closeButton; //Labels private JLabel TAMLabel; private JLabel fileLabel; private JLabel columnsLabel; private JLabel outputNameLabel; //Strings private static String TAMsString = ""; private static String file1String = "C:/Users/t-ninikf/Downloads/ExcelSheets/HanimBook.xlsx"; private static String file2String = "C:/Users/t-ninikf/Downloads/ExcelSheets/Book2.xlsx"; private static String columnsString = ""; private static String outputNameString = "output"; //Dialogs private static JDialog infoDialog = new JDialog(); private static JDialog finishDialog = new JDialog(); private static JDialog fileErrorDialog = new JDialog(); private static JDialog inputErrorDialog = new JDialog(); //Others private static boolean logFileBoolean = false; private static JCheckBox logCheckBox; private static List<String> columns = new ArrayList<String>(Arrays.asList( "TAM", "SSR", "Organization Name", "Contract Title", "Contract Number", "Schedule Name", "Value", "TPID", "Service Name", "Start Date", "End Date")); private static List<String> TAMs = new ArrayList<String>(Arrays.asList( "abusmt", "alea", "amazahar", "colee", "easonlau", "taufiqo", "tuchong", "mseng", "gurushr", "huzaidim", "iansu", "jhew", "kansiva", "kkphoon", "nabinti", "paerun", "sivask", "superuma")); public eaPanel() { //GUI for TAMs TAMLabel = new JLabel("TAMs:"); TAMLabel.setFont(new Font("Serif", Font.BOLD, 28)); TAMLabel.setBounds(100, 20, 300, 30); TAMsString += TAMs.get(0); for(int i = 1; i < TAMs.size(); i++) { TAMsString += ", "; TAMsString += TAMs.get(i); } TAMsTextField = new JTextField(); TAMsTextField.setFont(new Font("Arial", Font.PLAIN, 24)); TAMsTextField.setBounds(50, 60, 700, 50); TAMsTextField.setText(TAMsString); TAMsTextField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //set TAMs list TAMsString = TAMsTextField.getText(); } }); //GUI for Files fileLabel = new JLabel("Excel files: "); fileLabel.setFont(new Font("Serif", Font.BOLD, 28)); fileLabel.setBounds(100, 130, 300, 30); file1TextField = new JTextField(); file1TextField.setFont(new Font("Arial", Font.PLAIN, 24)); file1TextField.setBounds(50, 170, 700, 50); file1TextField.setText(file1String); file1TextField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //set file 1 path file1String = file1TextField.getText(); } }); file2TextField = new JTextField(); file2TextField.setFont(new Font("Arial", Font.PLAIN, 24)); file2TextField.setBounds(50, 225, 700, 50); file2TextField.setText(file2String); file2TextField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //set file 2 path file2String = file2TextField.getText(); } }); //GUI for columns columnsLabel = new JLabel("Columns: "); columnsLabel.setFont(new Font("Serif", Font.BOLD, 28)); columnsLabel.setBounds(100, 290, 300, 30); columnsString += columns.get(0); for(int i = 1; i < columns.size(); i++) { columnsString += ", "; columnsString += columns.get(i); } columnsTextField = new JTextField(); columnsTextField.setFont(new Font("Arial", Font.PLAIN, 24)); columnsTextField.setBounds(50, 330, 700, 50); columnsTextField.setText(columnsString); columnsTextField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //set file 1 path columnsString = columnsTextField.getText(); } }); //GUI for output file name outputNameLabel = new JLabel("Output file name: "); outputNameLabel.setFont(new Font("Serif", Font.BOLD, 28)); outputNameLabel.setBounds(100, 400, 300, 30); outputNameTextField = new JTextField(); outputNameTextField.setFont(new Font("Arial", Font.PLAIN, 24)); outputNameTextField.setBounds(50, 440, 700, 50); outputNameTextField.setText(outputNameString); outputNameTextField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //set file 1 path outputNameString = outputNameTextField.getText(); } }); //GUI for buttons infoButton = new JButton("Info"); infoButton.setFont(new Font("Arial", Font.PLAIN, 24)); infoButton.setBounds(50, 550, 150, 50); infoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //opens info about the program if(!infoDialog.isShowing()) { createDialog(); } } }); logCheckBox = new JCheckBox("Log to text file"); logCheckBox.setSelected(false); logCheckBox.setBounds(50, 610, 120, 60); extractButton = new JButton("Extract"); extractButton.setFont(new Font("Arial", Font.PLAIN, 24)); extractButton.setBounds(200, 550, 150, 50); extractButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { TAMsString = TAMsTextField.getText(); columnsString = columnsTextField.getText(); file1String = file1TextField.getText(); file2String = file2TextField.getText(); outputNameString = outputNameTextField.getText(); //check if files are ok if(fileChecker(file1String, file2String) && !checkFileOpened(file1String) && !checkFileOpened(file2String) && !checkOutputFile(outputNameString)) { //Check if check box is selected if(logCheckBox.isSelected()) { logFileBoolean = true; } else { logFileBoolean = false; } //run excel extraction extract(); } else { notifyFile(); } } }); closeButton = new JButton("Close"); closeButton.setFont(new Font("Arial", Font.PLAIN, 24)); closeButton.setBounds(350, 550, 150, 50); closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //close the program (window, frame, and panel) //frame.dispose(); System.exit(0); } }); setupPanel(); } /** * Adds all the components to the panel. */ private void setupPanel() { this.setLayout(null); this.add(TAMLabel); this.add(TAMsTextField); this.add(fileLabel); this.add(file1TextField); this.add(file2TextField); this.add(columnsLabel); this.add(columnsTextField); this.add(outputNameLabel); this.add(outputNameTextField); this.add(infoButton); this.add(extractButton); this.add(closeButton); this.add(logCheckBox); } /** * Begin extraction by calling the excelCompare main method. */ private static void extract() { try { if(stringChecker(TAMsString) && stringChecker(columnsString)) { columns = convertColumns(columnsString); TAMs = convert(TAMsString); excelCompare.main(null); } else { //print error message notifyInput(); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * To check if the string input is in the correct format. * @param s String to be checked. * @return Returns false if string is in wrong format, true otherwise. */ public static Boolean stringChecker(String s) { boolean b1 = true; s = s.replaceAll("\\s+", ""); //remove all the white spaces if(s.charAt(0) == ' ') { //check if first character is a comma b1 = false; } for (int i = 0; i < s.length() - 2; i++) { // check if there's two commas side by side if (s.charAt(i) == ',' && s.charAt(i + 1) == ',') { b1 = false; } } String temp = s.replaceAll(",", ""); //remove all the commas if(!temp.matches("[a-zA-Z]+")) { //check if there is only letters b1 = false; } return b1; } /** * Convert the string (input from the TextField) into a list. * The list is to be passed to excelCompare to perform the extraction. * @param s String from the TextField. * @return Returns a list where the string is separated by commas. */ public static List<String> convert(String s) { s = s.replaceAll("\\s+", ""); //remove all the white spaces List<String> split = Arrays.asList(s.split(",")); //split string into elements separated by ',' return split; } /** * Same as convert, but for columns. This is because the column names might contain more than one word. * Hence removing white spaces will cause problems. We don't want problems. * @param s String from the TextField. * @return Return a list where the elements are separated by commas. * Any remaining white spaces at the front/end of the elements will be removed. */ public static List<String> convertColumns(String s) { List<String> split = Arrays.asList(s.split(",")); for(int i = 0; i < split.size(); i++) { //remove white spaces at the front/end of the string if(split.get(i).charAt(0) == ' ') { //check first character of the string split.set(i, split.get(i).substring(1)); } if(split.get(i).charAt(split.get(i).length() - 1) == ' ') { //check last character of the string split.set(i, split.get(i).substring(0, split.get(i).length() - 2)); } } return split; } /** * Check if the files exist and not a directory. * Files are to be processed. * @param f1 File to be processed. * @param f2 File to be processed. * @return Returns true if the files exist and not a directory. False otherwise. */ public static boolean fileChecker(String f1, String f2) { boolean b1 = false; File file1 = new File(f1); File file2 = new File(f2); if(file1.exists() && file2.exists() && !file1.isDirectory() && !file2.isDirectory()) { b1 = true; } return b1; } /** * Pops up a window saying there's a problem with the files. * Problem could be files don't exist or they are directories. */ public static void notifyFile() { EventQueue.invokeLater(new Runnable() { @Override public void run() { // TODO Auto-generated method stub JLabel fileErrorLabel = new JLabel("<html>Check if:" + "<br>1. Files exist" + "<br>2. Files are not directories/folders" + "<br>3. Files are closed before running the program</html>", SwingConstants.CENTER); fileErrorLabel.setFont(new Font("Arial", Font.PLAIN, 20)); fileErrorDialog.add(fileErrorLabel); fileErrorDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); fileErrorDialog.setTitle("Error: Files"); fileErrorDialog.setSize(new Dimension(400, 300)); fileErrorDialog.setVisible(true); fileErrorDialog.setLocationRelativeTo(null); fileErrorDialog.setResizable(false); } }); } /** * Pops up a window saying the inputs aren't typed in correctly. */ public static void notifyInput() { EventQueue.invokeLater(new Runnable() { @Override public void run() { // TODO Auto-generated method stub JLabel inputErrorLabel = new JLabel("Make sure you typed in the inputs correctly!", SwingConstants.CENTER); inputErrorLabel.setFont(new Font("Arial", Font.PLAIN, 20)); inputErrorDialog.add(inputErrorLabel); inputErrorDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); inputErrorDialog.setTitle("Error: Inputs"); inputErrorDialog.setSize(new Dimension(500, 300)); inputErrorDialog.setVisible(true); inputErrorDialog.setLocationRelativeTo(null); inputErrorDialog.setResizable(false); } }); } /** * Pops up a window telling the program has finished extracting. */ public static void notifyFinish() { EventQueue.invokeLater(new Runnable() { @Override public void run() { // TODO Auto-generated method stub JLabel finishLabel = new JLabel("Extraction finished!", SwingConstants.CENTER); finishLabel.setFont(new Font("Arial", Font.PLAIN, 20)); finishDialog.add(finishLabel); finishDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); finishDialog.setTitle("Complete"); finishDialog.setSize(new Dimension(300, 200)); finishDialog.setVisible(true); finishDialog.setLocationRelativeTo(null); finishDialog.setResizable(false); } }); } /** * Pops up a window where it contains all the information about the program. */ private static void createDialog() { EventQueue.invokeLater(new Runnable() { @Override public void run() { // TODO Auto-generated method stub JTextPane infoLabel = new JTextPane(); infoLabel.setContentType("text/html"); infoLabel.setText("<html><left><font size=\"6\">" + "Things to check before extracting: " + "<br>1. There is only ONE excel sheet/tab in one excel file." + "<br>2. There are only letters/alphabets in TAMs and columns fields." + "<br>3. For file path, use forward slashes '/' instead of backward '\\'." + "<br> ie. C:/Users/t-ninikf/file.exe" + "<br>4. Make sure column names are correct." + "<br>5. Output file name must be valid characters:" + "<br> No / \\ : * ? \" | < > symbols." + "<br>6. All files to be read (excel sheet from Unicorn and tracker excel sheet)" + " and output file MUST be closed before running the program." + "<br>" + "<br>Info:" + "<br>-First file path is for the Unicorn excel sheet (sheet to be" + " extracted), second is for the tracker sheet." + "<br>-Make sure to update your Java software often." + "<br>-Output file will be in the same directory where the" + " application is executed." + "<br>-Leave the 'Log to text file' box unchecked. Unless there is a problem and the program " + "needs to be debugged." + "<br>" + "<br>Source code: <a href=\"https://github.com/nzulhilmi/Excel-Automation0.0\">" + "https://github.com/nzulhilmi/Excel-Automation0.0</a>" + "<br>" + "<br>More information about the API used to create this program: " + "<a href=\"https://poi.apache.org/spreadsheet/index.html\">" + "https://poi.apache.org/spreadsheet/index.html</a>" + "<br>" + "<br>Any problems please email nzulhilmi94@gmail.com or call:" + "<br>+6011-39377179 / +44 7843132106 (Whatsapp)" + "<br>" + "<br> One of the methods might not work on Linux machines. Please do read the instructions above." + "<br>" + "<br>Visit the source code website for full documentation with Javadoc comments." + "<br>Recommended PC requirements: 4GB RAM, 2048x1536 screen resolution or better." + "<br>Runs on any OS as long as Java is installed." + "<br>" + "<br>" + "<br>by Nik" + "</font></left></html>"); //infoLabel.setFont(new Font("Arial", Font.PLAIN, 20)); infoLabel.setEditable(false); infoLabel.setMargin(new Insets(20, 20, 20, 20)); infoDialog.add(infoLabel); infoDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); infoDialog.setTitle("Info"); infoDialog.setSize(new Dimension(1100, 1100)); infoDialog.setVisible(true); infoDialog.setResizable(false); } }); } /** * Check if a file is already opened. * NOTE: This method will not work on Linux machines. Works on other platforms. * @param s The path of the file to be checked. * @return Returns true if file is already opened. */ public static boolean checkFileOpened(String s) { boolean b1 = false; File file = new File(s); //Try to rename the file with the same name File sameName = new File(s); if(file.renameTo(sameName)) { //File is closed. Do nothing } else { //File is opened b1 = true; } return b1; } /** * Check if output file exists, and if so, check if it is already opened. * @param s File name to be checked. * @return Returns true if file exists and opened, false otherwise. */ public static boolean checkOutputFile(String s) { boolean b1 = false; String name = s + ".xlsx"; File file = new File(name); if(file.exists()) { if(checkFileOpened(name)) { b1 = true; } } return b1; } //GET and SET methods public static void setTAMs(List<String> list) { TAMs = list; } public static List<String> getTAMs() { return TAMs; } public static void setFile1(String s) { file1String = s; } public static String getFile1() { return file1String; } public static void setFile2(String s) { file2String = s; } public static String getFile2() { return file2String; } public static void setColumns(List<String> list) { columns = list; } public static List<String> getColumns() { return columns; } public static void setOutputFileName(String s) { outputNameString = s; } public static String getOutputFileName() { return outputNameString; } public static boolean getLogFileBoolean() { return logFileBoolean; } }
UTF-8
Java
18,406
java
eaPanel.java
Java
[ { "context": " components of the GUI are programmed.\r\n * @author Nik Zulhilmi Nik Fuaad\r\n *\r\n */\r\npublic class eaPanel extends ", "end": 704, "score": 0.9996479153633118, "start": 692, "tag": "NAME", "value": "Nik Zulhilmi" }, { "context": "f the GUI are programmed.\r\n * @author Nik Zulhilmi Nik Fuaad\r\n *\r\n */\r\npublic class eaPanel extends JPanel {\r\n", "end": 714, "score": 0.9993045330047607, "start": 705, "tag": "NAME", "value": "Nik Fuaad" }, { "context": " TAMs = new ArrayList<String>(Arrays.asList(\r\n\t\t\t\"abusmt\", \"alea\", \"amazahar\", \"colee\",\r\n\t\t\t\"easonlau\", \"t", "end": 2266, "score": 0.7777997851371765, "start": 2260, "tag": "NAME", "value": "abusmt" }, { "context": "w ArrayList<String>(Arrays.asList(\r\n\t\t\t\"abusmt\", \"alea\", \"amazahar\", \"colee\",\r\n\t\t\t\"easonlau\", \"taufiqo\",", "end": 2274, "score": 0.9693746566772461, "start": 2270, "tag": "NAME", "value": "alea" }, { "context": "ist<String>(Arrays.asList(\r\n\t\t\t\"abusmt\", \"alea\", \"amazahar\", \"colee\",\r\n\t\t\t\"easonlau\", \"taufiqo\", \"tuchong\", ", "end": 2286, "score": 0.9881386756896973, "start": 2278, "tag": "NAME", "value": "amazahar" }, { "context": "Arrays.asList(\r\n\t\t\t\"abusmt\", \"alea\", \"amazahar\", \"colee\",\r\n\t\t\t\"easonlau\", \"taufiqo\", \"tuchong\", \"mseng\", ", "end": 2295, "score": 0.8701857328414917, "start": 2290, "tag": "NAME", "value": "colee" }, { "context": "(\r\n\t\t\t\"abusmt\", \"alea\", \"amazahar\", \"colee\",\r\n\t\t\t\"easonlau\", \"taufiqo\", \"tuchong\", \"mseng\", \"gurushr\",\r\n\t\t\t\"", "end": 2311, "score": 0.839789867401123, "start": 2303, "tag": "NAME", "value": "easonlau" }, { "context": "t\", \"alea\", \"amazahar\", \"colee\",\r\n\t\t\t\"easonlau\", \"taufiqo\", \"tuchong\", \"mseng\", \"gurushr\",\r\n\t\t\t\"huzaidim\", ", "end": 2322, "score": 0.9528394341468811, "start": 2315, "tag": "NAME", "value": "taufiqo" }, { "context": " \"amazahar\", \"colee\",\r\n\t\t\t\"easonlau\", \"taufiqo\", \"tuchong\", \"mseng\", \"gurushr\",\r\n\t\t\t\"huzaidim\", \"iansu\", \"j", "end": 2333, "score": 0.9125862717628479, "start": 2326, "tag": "NAME", "value": "tuchong" }, { "context": ", \"colee\",\r\n\t\t\t\"easonlau\", \"taufiqo\", \"tuchong\", \"mseng\", \"gurushr\",\r\n\t\t\t\"huzaidim\", \"iansu\", \"jhew\", \"ka", "end": 2342, "score": 0.8319190144538879, "start": 2337, "tag": "NAME", "value": "mseng" }, { "context": ",\r\n\t\t\t\"easonlau\", \"taufiqo\", \"tuchong\", \"mseng\", \"gurushr\",\r\n\t\t\t\"huzaidim\", \"iansu\", \"jhew\", \"kansiva\", \"kk", "end": 2353, "score": 0.7338675260543823, "start": 2346, "tag": "NAME", "value": "gurushr" }, { "context": "\", \"taufiqo\", \"tuchong\", \"mseng\", \"gurushr\",\r\n\t\t\t\"huzaidim\", \"iansu\", \"jhew\", \"kansiva\", \"kkphoon\",\r\n\t\t\t\"nab", "end": 2369, "score": 0.8946825265884399, "start": 2361, "tag": "NAME", "value": "huzaidim" }, { "context": ", \"tuchong\", \"mseng\", \"gurushr\",\r\n\t\t\t\"huzaidim\", \"iansu\", \"jhew\", \"kansiva\", \"kkphoon\",\r\n\t\t\t\"nabinti\", \"p", "end": 2378, "score": 0.9903126955032349, "start": 2373, "tag": "NAME", "value": "iansu" }, { "context": "g\", \"mseng\", \"gurushr\",\r\n\t\t\t\"huzaidim\", \"iansu\", \"jhew\", \"kansiva\", \"kkphoon\",\r\n\t\t\t\"nabinti\", \"paerun\", ", "end": 2386, "score": 0.9410960078239441, "start": 2382, "tag": "NAME", "value": "jhew" }, { "context": "ng\", \"gurushr\",\r\n\t\t\t\"huzaidim\", \"iansu\", \"jhew\", \"kansiva\", \"kkphoon\",\r\n\t\t\t\"nabinti\", \"paerun\", \"sivask\", \"", "end": 2397, "score": 0.9904904365539551, "start": 2390, "tag": "NAME", "value": "kansiva" }, { "context": "hr\",\r\n\t\t\t\"huzaidim\", \"iansu\", \"jhew\", \"kansiva\", \"kkphoon\",\r\n\t\t\t\"nabinti\", \"paerun\", \"sivask\", \"superuma\"))", "end": 2408, "score": 0.7161095142364502, "start": 2401, "tag": "USERNAME", "value": "kkphoon" }, { "context": "dim\", \"iansu\", \"jhew\", \"kansiva\", \"kkphoon\",\r\n\t\t\t\"nabinti\", \"paerun\", \"sivask\", \"superuma\"));\r\n\t\r\n\tpublic e", "end": 2423, "score": 0.9922601580619812, "start": 2416, "tag": "NAME", "value": "nabinti" }, { "context": "u\", \"jhew\", \"kansiva\", \"kkphoon\",\r\n\t\t\t\"nabinti\", \"paerun\", \"sivask\", \"superuma\"));\r\n\t\r\n\tpublic eaPanel() {", "end": 2433, "score": 0.9709854125976562, "start": 2427, "tag": "NAME", "value": "paerun" }, { "context": ", \"kansiva\", \"kkphoon\",\r\n\t\t\t\"nabinti\", \"paerun\", \"sivask\", \"superuma\"));\r\n\t\r\n\tpublic eaPanel() {\r\n\t\t//GUI ", "end": 2443, "score": 0.8213748335838318, "start": 2437, "tag": "NAME", "value": "sivask" }, { "context": "kphoon\",\r\n\t\t\t\"nabinti\", \"paerun\", \"sivask\", \"superuma\"));\r\n\t\r\n\tpublic eaPanel() {\r\n\t\t//GUI for TAMs\r\n\t\t", "end": 2455, "score": 0.6070281863212585, "start": 2452, "tag": "NAME", "value": "uma" }, { "context": "\t+ \"<br>Source code: <a href=\\\"https://github.com/nzulhilmi/Excel-Automation0.0\\\">\"\r\n\t\t\t\t\t\t+ \"https://github.", "end": 15192, "score": 0.9021061658859253, "start": 15183, "tag": "USERNAME", "value": "nzulhilmi" }, { "context": "el-Automation0.0\\\">\"\r\n\t\t\t\t\t\t+ \"https://github.com/nzulhilmi/Excel-Automation0.0</a>\"\r\n\t\t\t\t\t\t+ \"<br>\"\r\n\t\t\t\t\t\t+", "end": 15255, "score": 0.9910205602645874, "start": 15246, "tag": "USERNAME", "value": "nzulhilmi" }, { "context": "\t\t+ \"<br>\"\r\n\t\t\t\t\t\t+ \"<br>Any problems please email nzulhilmi94@gmail.com or call:\"\r\n\t\t\t\t\t\t+ \"<br>+6011-39377179 / +44 7843", "end": 15581, "score": 0.9999256134033203, "start": 15560, "tag": "EMAIL", "value": "nzulhilmi94@gmail.com" }, { "context": "\"\r\n\t\t\t\t\t\t+ \"<br>\"\r\n\t\t\t\t\t\t+ \"<br>\"\r\n\t\t\t\t\t\t+ \"<br>by Nik\"\r\n\t\t\t\t\t\t+ \"</font></left></html>\");\r\n\t\t\t\t//infoLa", "end": 16085, "score": 0.9738881587982178, "start": 16082, "tag": "NAME", "value": "Nik" } ]
null
[]
import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Font; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.JTextPane; import javax.swing.SwingConstants; /** * Panel class for the GUI of Excel-Automation software. * This is where the components of the GUI are programmed. * @author <NAME> <NAME> * */ public class eaPanel extends JPanel { //Text Fields private static JTextField TAMsTextField; private static JTextField file1TextField; private static JTextField file2TextField; private static JTextField columnsTextField; private static JTextField outputNameTextField; //Buttons private JButton infoButton; private JButton extractButton; private JButton closeButton; //Labels private JLabel TAMLabel; private JLabel fileLabel; private JLabel columnsLabel; private JLabel outputNameLabel; //Strings private static String TAMsString = ""; private static String file1String = "C:/Users/t-ninikf/Downloads/ExcelSheets/HanimBook.xlsx"; private static String file2String = "C:/Users/t-ninikf/Downloads/ExcelSheets/Book2.xlsx"; private static String columnsString = ""; private static String outputNameString = "output"; //Dialogs private static JDialog infoDialog = new JDialog(); private static JDialog finishDialog = new JDialog(); private static JDialog fileErrorDialog = new JDialog(); private static JDialog inputErrorDialog = new JDialog(); //Others private static boolean logFileBoolean = false; private static JCheckBox logCheckBox; private static List<String> columns = new ArrayList<String>(Arrays.asList( "TAM", "SSR", "Organization Name", "Contract Title", "Contract Number", "Schedule Name", "Value", "TPID", "Service Name", "Start Date", "End Date")); private static List<String> TAMs = new ArrayList<String>(Arrays.asList( "abusmt", "alea", "amazahar", "colee", "easonlau", "taufiqo", "tuchong", "mseng", "gurushr", "huzaidim", "iansu", "jhew", "kansiva", "kkphoon", "nabinti", "paerun", "sivask", "superuma")); public eaPanel() { //GUI for TAMs TAMLabel = new JLabel("TAMs:"); TAMLabel.setFont(new Font("Serif", Font.BOLD, 28)); TAMLabel.setBounds(100, 20, 300, 30); TAMsString += TAMs.get(0); for(int i = 1; i < TAMs.size(); i++) { TAMsString += ", "; TAMsString += TAMs.get(i); } TAMsTextField = new JTextField(); TAMsTextField.setFont(new Font("Arial", Font.PLAIN, 24)); TAMsTextField.setBounds(50, 60, 700, 50); TAMsTextField.setText(TAMsString); TAMsTextField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //set TAMs list TAMsString = TAMsTextField.getText(); } }); //GUI for Files fileLabel = new JLabel("Excel files: "); fileLabel.setFont(new Font("Serif", Font.BOLD, 28)); fileLabel.setBounds(100, 130, 300, 30); file1TextField = new JTextField(); file1TextField.setFont(new Font("Arial", Font.PLAIN, 24)); file1TextField.setBounds(50, 170, 700, 50); file1TextField.setText(file1String); file1TextField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //set file 1 path file1String = file1TextField.getText(); } }); file2TextField = new JTextField(); file2TextField.setFont(new Font("Arial", Font.PLAIN, 24)); file2TextField.setBounds(50, 225, 700, 50); file2TextField.setText(file2String); file2TextField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //set file 2 path file2String = file2TextField.getText(); } }); //GUI for columns columnsLabel = new JLabel("Columns: "); columnsLabel.setFont(new Font("Serif", Font.BOLD, 28)); columnsLabel.setBounds(100, 290, 300, 30); columnsString += columns.get(0); for(int i = 1; i < columns.size(); i++) { columnsString += ", "; columnsString += columns.get(i); } columnsTextField = new JTextField(); columnsTextField.setFont(new Font("Arial", Font.PLAIN, 24)); columnsTextField.setBounds(50, 330, 700, 50); columnsTextField.setText(columnsString); columnsTextField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //set file 1 path columnsString = columnsTextField.getText(); } }); //GUI for output file name outputNameLabel = new JLabel("Output file name: "); outputNameLabel.setFont(new Font("Serif", Font.BOLD, 28)); outputNameLabel.setBounds(100, 400, 300, 30); outputNameTextField = new JTextField(); outputNameTextField.setFont(new Font("Arial", Font.PLAIN, 24)); outputNameTextField.setBounds(50, 440, 700, 50); outputNameTextField.setText(outputNameString); outputNameTextField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //set file 1 path outputNameString = outputNameTextField.getText(); } }); //GUI for buttons infoButton = new JButton("Info"); infoButton.setFont(new Font("Arial", Font.PLAIN, 24)); infoButton.setBounds(50, 550, 150, 50); infoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //opens info about the program if(!infoDialog.isShowing()) { createDialog(); } } }); logCheckBox = new JCheckBox("Log to text file"); logCheckBox.setSelected(false); logCheckBox.setBounds(50, 610, 120, 60); extractButton = new JButton("Extract"); extractButton.setFont(new Font("Arial", Font.PLAIN, 24)); extractButton.setBounds(200, 550, 150, 50); extractButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { TAMsString = TAMsTextField.getText(); columnsString = columnsTextField.getText(); file1String = file1TextField.getText(); file2String = file2TextField.getText(); outputNameString = outputNameTextField.getText(); //check if files are ok if(fileChecker(file1String, file2String) && !checkFileOpened(file1String) && !checkFileOpened(file2String) && !checkOutputFile(outputNameString)) { //Check if check box is selected if(logCheckBox.isSelected()) { logFileBoolean = true; } else { logFileBoolean = false; } //run excel extraction extract(); } else { notifyFile(); } } }); closeButton = new JButton("Close"); closeButton.setFont(new Font("Arial", Font.PLAIN, 24)); closeButton.setBounds(350, 550, 150, 50); closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //close the program (window, frame, and panel) //frame.dispose(); System.exit(0); } }); setupPanel(); } /** * Adds all the components to the panel. */ private void setupPanel() { this.setLayout(null); this.add(TAMLabel); this.add(TAMsTextField); this.add(fileLabel); this.add(file1TextField); this.add(file2TextField); this.add(columnsLabel); this.add(columnsTextField); this.add(outputNameLabel); this.add(outputNameTextField); this.add(infoButton); this.add(extractButton); this.add(closeButton); this.add(logCheckBox); } /** * Begin extraction by calling the excelCompare main method. */ private static void extract() { try { if(stringChecker(TAMsString) && stringChecker(columnsString)) { columns = convertColumns(columnsString); TAMs = convert(TAMsString); excelCompare.main(null); } else { //print error message notifyInput(); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * To check if the string input is in the correct format. * @param s String to be checked. * @return Returns false if string is in wrong format, true otherwise. */ public static Boolean stringChecker(String s) { boolean b1 = true; s = s.replaceAll("\\s+", ""); //remove all the white spaces if(s.charAt(0) == ' ') { //check if first character is a comma b1 = false; } for (int i = 0; i < s.length() - 2; i++) { // check if there's two commas side by side if (s.charAt(i) == ',' && s.charAt(i + 1) == ',') { b1 = false; } } String temp = s.replaceAll(",", ""); //remove all the commas if(!temp.matches("[a-zA-Z]+")) { //check if there is only letters b1 = false; } return b1; } /** * Convert the string (input from the TextField) into a list. * The list is to be passed to excelCompare to perform the extraction. * @param s String from the TextField. * @return Returns a list where the string is separated by commas. */ public static List<String> convert(String s) { s = s.replaceAll("\\s+", ""); //remove all the white spaces List<String> split = Arrays.asList(s.split(",")); //split string into elements separated by ',' return split; } /** * Same as convert, but for columns. This is because the column names might contain more than one word. * Hence removing white spaces will cause problems. We don't want problems. * @param s String from the TextField. * @return Return a list where the elements are separated by commas. * Any remaining white spaces at the front/end of the elements will be removed. */ public static List<String> convertColumns(String s) { List<String> split = Arrays.asList(s.split(",")); for(int i = 0; i < split.size(); i++) { //remove white spaces at the front/end of the string if(split.get(i).charAt(0) == ' ') { //check first character of the string split.set(i, split.get(i).substring(1)); } if(split.get(i).charAt(split.get(i).length() - 1) == ' ') { //check last character of the string split.set(i, split.get(i).substring(0, split.get(i).length() - 2)); } } return split; } /** * Check if the files exist and not a directory. * Files are to be processed. * @param f1 File to be processed. * @param f2 File to be processed. * @return Returns true if the files exist and not a directory. False otherwise. */ public static boolean fileChecker(String f1, String f2) { boolean b1 = false; File file1 = new File(f1); File file2 = new File(f2); if(file1.exists() && file2.exists() && !file1.isDirectory() && !file2.isDirectory()) { b1 = true; } return b1; } /** * Pops up a window saying there's a problem with the files. * Problem could be files don't exist or they are directories. */ public static void notifyFile() { EventQueue.invokeLater(new Runnable() { @Override public void run() { // TODO Auto-generated method stub JLabel fileErrorLabel = new JLabel("<html>Check if:" + "<br>1. Files exist" + "<br>2. Files are not directories/folders" + "<br>3. Files are closed before running the program</html>", SwingConstants.CENTER); fileErrorLabel.setFont(new Font("Arial", Font.PLAIN, 20)); fileErrorDialog.add(fileErrorLabel); fileErrorDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); fileErrorDialog.setTitle("Error: Files"); fileErrorDialog.setSize(new Dimension(400, 300)); fileErrorDialog.setVisible(true); fileErrorDialog.setLocationRelativeTo(null); fileErrorDialog.setResizable(false); } }); } /** * Pops up a window saying the inputs aren't typed in correctly. */ public static void notifyInput() { EventQueue.invokeLater(new Runnable() { @Override public void run() { // TODO Auto-generated method stub JLabel inputErrorLabel = new JLabel("Make sure you typed in the inputs correctly!", SwingConstants.CENTER); inputErrorLabel.setFont(new Font("Arial", Font.PLAIN, 20)); inputErrorDialog.add(inputErrorLabel); inputErrorDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); inputErrorDialog.setTitle("Error: Inputs"); inputErrorDialog.setSize(new Dimension(500, 300)); inputErrorDialog.setVisible(true); inputErrorDialog.setLocationRelativeTo(null); inputErrorDialog.setResizable(false); } }); } /** * Pops up a window telling the program has finished extracting. */ public static void notifyFinish() { EventQueue.invokeLater(new Runnable() { @Override public void run() { // TODO Auto-generated method stub JLabel finishLabel = new JLabel("Extraction finished!", SwingConstants.CENTER); finishLabel.setFont(new Font("Arial", Font.PLAIN, 20)); finishDialog.add(finishLabel); finishDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); finishDialog.setTitle("Complete"); finishDialog.setSize(new Dimension(300, 200)); finishDialog.setVisible(true); finishDialog.setLocationRelativeTo(null); finishDialog.setResizable(false); } }); } /** * Pops up a window where it contains all the information about the program. */ private static void createDialog() { EventQueue.invokeLater(new Runnable() { @Override public void run() { // TODO Auto-generated method stub JTextPane infoLabel = new JTextPane(); infoLabel.setContentType("text/html"); infoLabel.setText("<html><left><font size=\"6\">" + "Things to check before extracting: " + "<br>1. There is only ONE excel sheet/tab in one excel file." + "<br>2. There are only letters/alphabets in TAMs and columns fields." + "<br>3. For file path, use forward slashes '/' instead of backward '\\'." + "<br> ie. C:/Users/t-ninikf/file.exe" + "<br>4. Make sure column names are correct." + "<br>5. Output file name must be valid characters:" + "<br> No / \\ : * ? \" | < > symbols." + "<br>6. All files to be read (excel sheet from Unicorn and tracker excel sheet)" + " and output file MUST be closed before running the program." + "<br>" + "<br>Info:" + "<br>-First file path is for the Unicorn excel sheet (sheet to be" + " extracted), second is for the tracker sheet." + "<br>-Make sure to update your Java software often." + "<br>-Output file will be in the same directory where the" + " application is executed." + "<br>-Leave the 'Log to text file' box unchecked. Unless there is a problem and the program " + "needs to be debugged." + "<br>" + "<br>Source code: <a href=\"https://github.com/nzulhilmi/Excel-Automation0.0\">" + "https://github.com/nzulhilmi/Excel-Automation0.0</a>" + "<br>" + "<br>More information about the API used to create this program: " + "<a href=\"https://poi.apache.org/spreadsheet/index.html\">" + "https://poi.apache.org/spreadsheet/index.html</a>" + "<br>" + "<br>Any problems please email <EMAIL> or call:" + "<br>+6011-39377179 / +44 7843132106 (Whatsapp)" + "<br>" + "<br> One of the methods might not work on Linux machines. Please do read the instructions above." + "<br>" + "<br>Visit the source code website for full documentation with Javadoc comments." + "<br>Recommended PC requirements: 4GB RAM, 2048x1536 screen resolution or better." + "<br>Runs on any OS as long as Java is installed." + "<br>" + "<br>" + "<br>by Nik" + "</font></left></html>"); //infoLabel.setFont(new Font("Arial", Font.PLAIN, 20)); infoLabel.setEditable(false); infoLabel.setMargin(new Insets(20, 20, 20, 20)); infoDialog.add(infoLabel); infoDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); infoDialog.setTitle("Info"); infoDialog.setSize(new Dimension(1100, 1100)); infoDialog.setVisible(true); infoDialog.setResizable(false); } }); } /** * Check if a file is already opened. * NOTE: This method will not work on Linux machines. Works on other platforms. * @param s The path of the file to be checked. * @return Returns true if file is already opened. */ public static boolean checkFileOpened(String s) { boolean b1 = false; File file = new File(s); //Try to rename the file with the same name File sameName = new File(s); if(file.renameTo(sameName)) { //File is closed. Do nothing } else { //File is opened b1 = true; } return b1; } /** * Check if output file exists, and if so, check if it is already opened. * @param s File name to be checked. * @return Returns true if file exists and opened, false otherwise. */ public static boolean checkOutputFile(String s) { boolean b1 = false; String name = s + ".xlsx"; File file = new File(name); if(file.exists()) { if(checkFileOpened(name)) { b1 = true; } } return b1; } //GET and SET methods public static void setTAMs(List<String> list) { TAMs = list; } public static List<String> getTAMs() { return TAMs; } public static void setFile1(String s) { file1String = s; } public static String getFile1() { return file1String; } public static void setFile2(String s) { file2String = s; } public static String getFile2() { return file2String; } public static void setColumns(List<String> list) { columns = list; } public static List<String> getColumns() { return columns; } public static void setOutputFileName(String s) { outputNameString = s; } public static String getOutputFileName() { return outputNameString; } public static boolean getLogFileBoolean() { return logFileBoolean; } }
18,383
0.652722
0.63463
598
28.782608
24.422621
106
false
false
0
0
0
0
0
0
3.016722
false
false
2
d77e4251069ba5caf57a4b01561ae07a1ccc85a0
38,783,554,715,886
c58ed465079a50a48996b357b8f44fa79151d1dc
/src/main/java/com/accenture/javamos/service/UserLikesFlightService.java
e2b20cc9f743e08b5dd5ac7b622459704597ad56
[ "MIT" ]
permissive
i-santos/Accenture-Grupo-JAVAMOS-Backend
https://github.com/i-santos/Accenture-Grupo-JAVAMOS-Backend
b772b0fd12a7793865afa18882ef951e3f15e274
e08e5100326bf025a565f7340d91c63c4fd53ea4
refs/heads/main
2023-01-06T01:08:01.416000
2020-11-02T05:04:30
2020-11-02T05:04:30
308,974,949
0
0
null
true
2020-10-31T21:28:06
2020-10-31T21:28:05
2020-10-30T23:19:25
2020-10-30T23:19:23
61
0
0
0
null
false
false
package com.accenture.javamos.service; import com.accenture.javamos.entity.UserLikesFlight; import com.accenture.javamos.repository.UserLikesFlightRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class UserLikesFlightService { @Autowired UserLikesFlightRepository userLikesFlightRepository; public UserLikesFlight add(UserLikesFlight userlikesFlight) { return userLikesFlightRepository.save(userlikesFlight); } }
UTF-8
Java
517
java
UserLikesFlightService.java
Java
[]
null
[]
package com.accenture.javamos.service; import com.accenture.javamos.entity.UserLikesFlight; import com.accenture.javamos.repository.UserLikesFlightRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class UserLikesFlightService { @Autowired UserLikesFlightRepository userLikesFlightRepository; public UserLikesFlight add(UserLikesFlight userlikesFlight) { return userLikesFlightRepository.save(userlikesFlight); } }
517
0.847195
0.847195
16
31.3125
25.89575
66
false
false
0
0
0
0
0
0
0.4375
false
false
2
dc445098851e0671c6ea638e3e62ad1f6a5d018c
37,065,567,791,238
3185286d5545ac936a1cf1ab6999028208d00509
/src/main/java/ru/maksimov/andrey/golos4j/socket/WebSocketClass.java
8d2c11b0972265b845216a2302a8e9a4e16f8b71
[ "MIT" ]
permissive
onixred/golos4j
https://github.com/onixred/golos4j
a614b3fe3e3d8e0736d5dc67e96b42366197a200
eeaf55f3aaeca4e091497998de88757de497ce1f
refs/heads/master
2023-04-12T23:20:20.403000
2022-03-02T05:05:13
2022-03-02T05:05:13
92,661,984
5
2
MIT
false
2023-03-31T14:52:15
2017-05-28T13:12:11
2022-03-02T04:50:18
2023-03-31T14:52:11
5,160
4
1
1
Java
false
false
package ru.maksimov.andrey.golos4j.socket; import java.io.IOException; import java.net.URI; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.java_websocket.client.WebSocketClient; import org.java_websocket.handshake.ServerHandshake; import com.fasterxml.jackson.databind.ObjectMapper; import ru.maksimov.andrey.golos4j.exception.SystemException; /** * Веб сокети клиент * * @author <a href="mailto:onixbed@gmail.com">amaksimov</a> */ public class WebSocketClass<T> extends WebSocketClient { private static final Logger LOG = LogManager.getLogger(WebSocketClass.class); private String mesasge; private Class<T> classDto; private T response = null; private SystemException systemException = null; public WebSocketClass(URI serverUri) { super(serverUri); } @Override public void onClose(int code, String reason, boolean remote) { LOG.debug("close ws uri:" + uri + " with exit code " + code + " additional info: " + reason); } @Override public void onError(Exception ex) { LOG.error("Error occured on ws uri:" + uri + ":" + ex); } @Override public void onMessage(String message) { String debugMessage = ""; if(message != null) { debugMessage = message.length() > 51?message.substring(0, 50): message; } LOG.debug("message ws uri:" + uri + " message: " + debugMessage); ObjectMapper mapper = new ObjectMapper(); try { response = mapper.readValue(message, classDto); } catch (IOException ioe) { systemException = new SystemException("Unable execute POST-request: " + ioe.getMessage(), ioe); } finally { close(); } } @Override public void onOpen(ServerHandshake handshakedata) { send(mesasge); } public String getMesasge() { return mesasge; } public void setMesasge(String mesasge) { this.mesasge = mesasge; } public T getResponse() { return response; } public SystemException getSystemException() { return systemException; } public void setClassDto(Class<T> classDto) { this.classDto = classDto; } }
UTF-8
Java
2,142
java
WebSocketClass.java
Java
[ { "context": "еб сокети клиент\r\n * \r\n * @author <a href=\"mailto:onixbed@gmail.com\">amaksimov</a>\r\n */\r\npublic class WebSocketClass<", "end": 487, "score": 0.9999284744262695, "start": 470, "tag": "EMAIL", "value": "onixbed@gmail.com" }, { "context": "* \r\n * @author <a href=\"mailto:onixbed@gmail.com\">amaksimov</a>\r\n */\r\npublic class WebSocketClass<T> extends ", "end": 498, "score": 0.9361081123352051, "start": 489, "tag": "NAME", "value": "amaksimov" } ]
null
[]
package ru.maksimov.andrey.golos4j.socket; import java.io.IOException; import java.net.URI; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.java_websocket.client.WebSocketClient; import org.java_websocket.handshake.ServerHandshake; import com.fasterxml.jackson.databind.ObjectMapper; import ru.maksimov.andrey.golos4j.exception.SystemException; /** * Веб сокети клиент * * @author <a href="mailto:<EMAIL>">amaksimov</a> */ public class WebSocketClass<T> extends WebSocketClient { private static final Logger LOG = LogManager.getLogger(WebSocketClass.class); private String mesasge; private Class<T> classDto; private T response = null; private SystemException systemException = null; public WebSocketClass(URI serverUri) { super(serverUri); } @Override public void onClose(int code, String reason, boolean remote) { LOG.debug("close ws uri:" + uri + " with exit code " + code + " additional info: " + reason); } @Override public void onError(Exception ex) { LOG.error("Error occured on ws uri:" + uri + ":" + ex); } @Override public void onMessage(String message) { String debugMessage = ""; if(message != null) { debugMessage = message.length() > 51?message.substring(0, 50): message; } LOG.debug("message ws uri:" + uri + " message: " + debugMessage); ObjectMapper mapper = new ObjectMapper(); try { response = mapper.readValue(message, classDto); } catch (IOException ioe) { systemException = new SystemException("Unable execute POST-request: " + ioe.getMessage(), ioe); } finally { close(); } } @Override public void onOpen(ServerHandshake handshakedata) { send(mesasge); } public String getMesasge() { return mesasge; } public void setMesasge(String mesasge) { this.mesasge = mesasge; } public T getResponse() { return response; } public SystemException getSystemException() { return systemException; } public void setClassDto(Class<T> classDto) { this.classDto = classDto; } }
2,132
0.692055
0.687823
85
23.023529
24.449215
98
false
false
0
0
0
0
0
0
1.317647
false
false
2
6835e9900416cfa583615e6afaf55b322e26f3b2
38,044,820,330,540
d092902b327934c66254f89e9b65d361e35947d4
/src/main/java/com/osg/vacations/entity/ApplyVacationsEntity.java
d19f6994d692e55b705d3ade2d07fec0d2da8bc5
[]
no_license
shishishiu/controlVacations
https://github.com/shishishiu/controlVacations
8eb93d4bbd0cc84f3b67effc7081de53f840bc15
afa0d210ff4626e2a22c234b502072ee07876b0c
refs/heads/master
2020-02-16T16:39:46.268000
2020-02-09T21:04:19
2020-02-09T21:04:19
125,126,014
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.osg.vacations.entity; import java.io.Serializable; import java.sql.Date; import java.sql.Timestamp; import java.util.Arrays; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Transient; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; import com.osg.vacations.entity.interf.EnumInterface; import com.osg.vacations.util.DateUtils; import com.osg.vacations.util.EnumUtils; @Entity(name = "table_apply_vacations") @Table(name = "cv_table_apply_vacations") public class ApplyVacationsEntity implements Serializable { public enum ProgrammedValue implements EnumInterface { Cd1("1", "SI"), Cd2("2", "NA, TURNO 2,3 O 4"), Cd3("3", "PT, NO DESCONTAR"), Cd4("4", "NO, DESCONTAR"); private final String cd; private final String value; ProgrammedValue(String cd, String value) { this.cd = cd; this.value = value; } public String getCode() { return cd; } public String getValue() { return value; } } public enum StatusValue implements EnumInterface { Waiting("0", "Esperando"), Authorized("1", "Autorizado"), NoAuthorized("2", "Rechazado"), WaitingCancel("3", "Esperando (Cancelación)"), // WaitingCancelHR("4", "Esperando (Cancelación RH)"), Canceled("5", "Cancelado"), // AutorizadoCancel("6", "Cancelado"), NoAuthorizedCancel("7", "Rechazado(Cancelación)"); private final String cd; private final String value; StatusValue(String cd, String value) { this.cd = cd; this.value = value; } public String getCode() { return cd; } public String getValue() { return value; } } @ManyToOne @JoinColumn(name = "userId", referencedColumnName="userId", insertable=false, updatable=false) private MemberEntity appliedMemberEntity; @ManyToOne @JoinColumn(name = "userId", referencedColumnName="userId", insertable=false, updatable=false) private UserVacationsEntity userVacationsEntity; @ManyToOne @JoinColumn(name = "authorizationUserId", referencedColumnName="userId", insertable=false, updatable=false) private MemberEntity authorizedUserEntity; @NotFound(action=NotFoundAction.IGNORE) @ManyToOne @JoinColumn(name = "authorizedHumanResourceUserId", referencedColumnName="userId", insertable=false, updatable=false) private MemberEntity authorizedHumanResourceUserEntity; @NotFound(action=NotFoundAction.IGNORE) @ManyToOne @JoinColumn(name = "statusUpdatedUserId", referencedColumnName="userId", insertable=false, updatable=false) private MemberEntity statusUpdatedUserEntity; @NotFound(action=NotFoundAction.IGNORE) @ManyToOne @JoinColumn(name = "workshiftId", referencedColumnName="workshiftId", insertable=false, updatable=false) private WorkshiftEntity workshiftEntity; @OneToMany(fetch = FetchType.LAZY, mappedBy = "applyVacationsEntity") private List<ApplyVacationsDatesEntity> applyVacationsDatesEntityList; private static final long serialVersionUID = 1667698003975566301L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int applyId; @Column(nullable = false, unique = true) private int userId; @Transient private String loginId; @Column private int workshiftId; @Transient private String workshiftValue; @Column private Date applicatedAt; @Column private int vacationDays; @Column private String planVacationDateFrom; @Column private String planVacationDateTo; @Column private double discount; @Column private int authorizationUserId; @Column(insertable = false) private Timestamp authorizedAt; @Column private int needAuthorizationHumanResource; @Column private int authorizedHumanResourceUserId; @Column(insertable = false) private Timestamp authorizedHumanResourceAt; @Column private String programmed; @Column private String planVacationDates; @Column private int status; @Transient private StatusValue statusValue; @Column(insertable = false) private Timestamp statusUpdatedAt; @Column private int statusUpdatedUserId; @Transient private ProgrammedValue programmedValue; @Transient private int balance; @Column(insertable = false) private Timestamp createdAt; @Column private int createdUserId; @Column(insertable = false) private Timestamp updatedAt; @Column private int updatedUserId; public int getApplyId() { return this.applyId; } public void setApplyId(int applyId) { this.applyId = applyId; } public String getLoginId() { return this.loginId; } public void setLoginId(String loginId) { this.loginId = loginId; } public int getUserId() { return this.userId; } public void setUserId(int userId) { this.userId = userId; } public int getWorkshiftId() { return this.workshiftId; } public void setWorkshiftId(int workshiftId) { this.workshiftId = workshiftId; } public String getWorkshiftValue() { if(this.workshiftEntity == null){ return ""; } else { return this.workshiftEntity.getWorkshiftName(); } } public void setWorkshiftValue(String workshiftValue) { this.workshiftValue = workshiftValue; } public Date getApplicatedAt() { return this.applicatedAt; } public void setApplicatedAt(Date applicatedAt) { this.applicatedAt = applicatedAt; } public int getVacationDays() { return this.vacationDays; } public void setVacationDays(int vacationDays) { this.vacationDays = vacationDays; } public String getPlanVacationDateFrom() { return this.planVacationDateFrom; } public void setPlanVacationDateFrom(String planVacationDateFrom) { this.planVacationDateFrom = planVacationDateFrom; } public String getPlanVacationDateTo() { return this.planVacationDateTo; } public void setPlanVacationDateTo(String planVacationDateTo) { this.planVacationDateTo = planVacationDateTo; } public double getDiscount() { return this.discount; } public void setDiscount(double discount) { this.discount = discount; } public int getAuthorizationUserId() { return this.authorizationUserId; } public void setAuthorizationUserId(int authorizationUserId) { this.authorizationUserId = authorizationUserId; } public void setAuthorizedAt(Timestamp authorizedAt) { this.authorizedAt = authorizedAt; } public Timestamp getAuthorizedAt() { return this.authorizedAt; } public int getNeedAuthorizationHumanResource() { return this.needAuthorizationHumanResource; } public void setNeedAuthorizationHumanResource(int needAuthorizationHumanResource) { this.needAuthorizationHumanResource = needAuthorizationHumanResource; } public int getAuthorizedHumanResourceUserId() { return this.authorizedHumanResourceUserId; } public void setAuthorizedHumanResourceUserId(int authorizedHumanResourceUserId) { this.authorizedHumanResourceUserId = authorizedHumanResourceUserId; } public void setAuthorizedHumanResourceAt(Timestamp authorizedHumanResourceAt) { this.authorizedHumanResourceAt = authorizedHumanResourceAt; } public Timestamp getAuthorizedHumanResourceAt() { return this.authorizedHumanResourceAt; } public String getProgrammed() { return this.programmed; } public void setProgrammed(String programmed) { this.programmed = programmed; } public String getProgrammedValue() { if(this.programmed.equals(ProgrammedValue.Cd1.getCode())) { return ProgrammedValue.Cd1.getValue(); } if(this.programmed.equals(ProgrammedValue.Cd2.getCode())) { return ProgrammedValue.Cd2.getValue(); } if(this.programmed.equals(ProgrammedValue.Cd3.getCode())) { return ProgrammedValue.Cd3.getValue(); } if(this.programmed.equals(ProgrammedValue.Cd4.getCode())) { return ProgrammedValue.Cd4.getValue(); } return ""; } public String getPlanVacationDates() { return this.planVacationDates; } public void setPlanVacationDates(String planVacationDates) { this.planVacationDates = planVacationDates; } public String getPlanVacationDateMin() { String[] arrstr = this.planVacationDates.split(","); Arrays.sort(arrstr); return arrstr[0]; } public String[] getPlanVacationDateArray() { String[] tmp = this.planVacationDates.split(","); Arrays.sort(tmp); String[] arrstr = new String[tmp.length]; int i=0; for (String str : tmp) { java.util.Date d = DateUtils.StringToDate(str, "yyyy-MM-dd"); String s = DateUtils.FormatDate(d, "yyyy-MM-dd (E)"); arrstr[i] = s; i++; } return arrstr; } public int getBalance() { return this.balance; } public void setBalance(int balance) { this.balance = balance; } public int getStatus() { return this.status; } public void setStatus(int status) { this.status = status; } public String getStatusValue() { return EnumUtils.valueOf(StatusValue.class, Integer.toString(this.status)).value; } public void setStatusUpdatedAt(Timestamp statusUpdatedAt) { this.statusUpdatedAt = statusUpdatedAt; } public Timestamp getStatusUpdatedAt() { return this.statusUpdatedAt; } public void setStatusUpdatedUserId(int statusUpdatedUserId) { this.statusUpdatedUserId = statusUpdatedUserId; } public int getStatusUpdatedUserId() { return this.statusUpdatedUserId; } public void setCreatedAt(Timestamp createdAt) { this.createdAt = createdAt; } public Timestamp getCreatedAt() { return this.createdAt; } public void setCreatedUserId(int createdUserId) { this.createdUserId = createdUserId; } public int getCreatedUserId() { return this.createdUserId; } public void setUpdatedAt(Timestamp updatedAt) { this.updatedAt = updatedAt; } public Timestamp getUpdatedAt() { return this.updatedAt; } public void setUpdatedUserId(int updatedUserId) { this.updatedUserId = updatedUserId; } public int getUpdatedUserId() { return this.updatedUserId; } public MemberEntity getAppliedMemberEntity() { return this.appliedMemberEntity; } public void setAppliedMemberEntity(MemberEntity appliedMemberEntity) { this.appliedMemberEntity = appliedMemberEntity; } public UserVacationsEntity getUserVacationsEntity() { return this.userVacationsEntity; } public void setUserVacationsEntity(UserVacationsEntity userVacationsEntity) { this.userVacationsEntity = userVacationsEntity; } public MemberEntity getAuthorizedUserEntity() { return this.authorizedUserEntity; } public void setAuthorizedUserEntity(MemberEntity authorizedUserEntity) { this.authorizedUserEntity = authorizedUserEntity; } public MemberEntity getStatusUpdatedUserEntity() { return this.statusUpdatedUserEntity; } public void setStatusUpdatedUserEntity(MemberEntity statusUpdatedUserEntity) { this.statusUpdatedUserEntity = statusUpdatedUserEntity; } public WorkshiftEntity getWorkshiftEntity() { return this.workshiftEntity; } public void setWorkshiftEntity(WorkshiftEntity workshiftEntity) { this.workshiftEntity = workshiftEntity; } public MemberEntity getAuthorizedHumanResourceUserEntity() { return this.authorizedHumanResourceUserEntity; } public void setAuthorizedHumanResourceUserEntity(MemberEntity authorizedHumanResourceUserEntity) { this.authorizedHumanResourceUserEntity = authorizedHumanResourceUserEntity; } public List<ApplyVacationsDatesEntity> getApplyVacationsDatesEntity() { return this.applyVacationsDatesEntityList; } public void setApplyVacationsDatesEntity(List<ApplyVacationsDatesEntity> applyVacationsDatesEntityList) { this.applyVacationsDatesEntityList = applyVacationsDatesEntityList; } }
UTF-8
Java
13,538
java
ApplyVacationsEntity.java
Java
[]
null
[]
package com.osg.vacations.entity; import java.io.Serializable; import java.sql.Date; import java.sql.Timestamp; import java.util.Arrays; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Transient; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; import com.osg.vacations.entity.interf.EnumInterface; import com.osg.vacations.util.DateUtils; import com.osg.vacations.util.EnumUtils; @Entity(name = "table_apply_vacations") @Table(name = "cv_table_apply_vacations") public class ApplyVacationsEntity implements Serializable { public enum ProgrammedValue implements EnumInterface { Cd1("1", "SI"), Cd2("2", "NA, TURNO 2,3 O 4"), Cd3("3", "PT, NO DESCONTAR"), Cd4("4", "NO, DESCONTAR"); private final String cd; private final String value; ProgrammedValue(String cd, String value) { this.cd = cd; this.value = value; } public String getCode() { return cd; } public String getValue() { return value; } } public enum StatusValue implements EnumInterface { Waiting("0", "Esperando"), Authorized("1", "Autorizado"), NoAuthorized("2", "Rechazado"), WaitingCancel("3", "Esperando (Cancelación)"), // WaitingCancelHR("4", "Esperando (Cancelación RH)"), Canceled("5", "Cancelado"), // AutorizadoCancel("6", "Cancelado"), NoAuthorizedCancel("7", "Rechazado(Cancelación)"); private final String cd; private final String value; StatusValue(String cd, String value) { this.cd = cd; this.value = value; } public String getCode() { return cd; } public String getValue() { return value; } } @ManyToOne @JoinColumn(name = "userId", referencedColumnName="userId", insertable=false, updatable=false) private MemberEntity appliedMemberEntity; @ManyToOne @JoinColumn(name = "userId", referencedColumnName="userId", insertable=false, updatable=false) private UserVacationsEntity userVacationsEntity; @ManyToOne @JoinColumn(name = "authorizationUserId", referencedColumnName="userId", insertable=false, updatable=false) private MemberEntity authorizedUserEntity; @NotFound(action=NotFoundAction.IGNORE) @ManyToOne @JoinColumn(name = "authorizedHumanResourceUserId", referencedColumnName="userId", insertable=false, updatable=false) private MemberEntity authorizedHumanResourceUserEntity; @NotFound(action=NotFoundAction.IGNORE) @ManyToOne @JoinColumn(name = "statusUpdatedUserId", referencedColumnName="userId", insertable=false, updatable=false) private MemberEntity statusUpdatedUserEntity; @NotFound(action=NotFoundAction.IGNORE) @ManyToOne @JoinColumn(name = "workshiftId", referencedColumnName="workshiftId", insertable=false, updatable=false) private WorkshiftEntity workshiftEntity; @OneToMany(fetch = FetchType.LAZY, mappedBy = "applyVacationsEntity") private List<ApplyVacationsDatesEntity> applyVacationsDatesEntityList; private static final long serialVersionUID = 1667698003975566301L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int applyId; @Column(nullable = false, unique = true) private int userId; @Transient private String loginId; @Column private int workshiftId; @Transient private String workshiftValue; @Column private Date applicatedAt; @Column private int vacationDays; @Column private String planVacationDateFrom; @Column private String planVacationDateTo; @Column private double discount; @Column private int authorizationUserId; @Column(insertable = false) private Timestamp authorizedAt; @Column private int needAuthorizationHumanResource; @Column private int authorizedHumanResourceUserId; @Column(insertable = false) private Timestamp authorizedHumanResourceAt; @Column private String programmed; @Column private String planVacationDates; @Column private int status; @Transient private StatusValue statusValue; @Column(insertable = false) private Timestamp statusUpdatedAt; @Column private int statusUpdatedUserId; @Transient private ProgrammedValue programmedValue; @Transient private int balance; @Column(insertable = false) private Timestamp createdAt; @Column private int createdUserId; @Column(insertable = false) private Timestamp updatedAt; @Column private int updatedUserId; public int getApplyId() { return this.applyId; } public void setApplyId(int applyId) { this.applyId = applyId; } public String getLoginId() { return this.loginId; } public void setLoginId(String loginId) { this.loginId = loginId; } public int getUserId() { return this.userId; } public void setUserId(int userId) { this.userId = userId; } public int getWorkshiftId() { return this.workshiftId; } public void setWorkshiftId(int workshiftId) { this.workshiftId = workshiftId; } public String getWorkshiftValue() { if(this.workshiftEntity == null){ return ""; } else { return this.workshiftEntity.getWorkshiftName(); } } public void setWorkshiftValue(String workshiftValue) { this.workshiftValue = workshiftValue; } public Date getApplicatedAt() { return this.applicatedAt; } public void setApplicatedAt(Date applicatedAt) { this.applicatedAt = applicatedAt; } public int getVacationDays() { return this.vacationDays; } public void setVacationDays(int vacationDays) { this.vacationDays = vacationDays; } public String getPlanVacationDateFrom() { return this.planVacationDateFrom; } public void setPlanVacationDateFrom(String planVacationDateFrom) { this.planVacationDateFrom = planVacationDateFrom; } public String getPlanVacationDateTo() { return this.planVacationDateTo; } public void setPlanVacationDateTo(String planVacationDateTo) { this.planVacationDateTo = planVacationDateTo; } public double getDiscount() { return this.discount; } public void setDiscount(double discount) { this.discount = discount; } public int getAuthorizationUserId() { return this.authorizationUserId; } public void setAuthorizationUserId(int authorizationUserId) { this.authorizationUserId = authorizationUserId; } public void setAuthorizedAt(Timestamp authorizedAt) { this.authorizedAt = authorizedAt; } public Timestamp getAuthorizedAt() { return this.authorizedAt; } public int getNeedAuthorizationHumanResource() { return this.needAuthorizationHumanResource; } public void setNeedAuthorizationHumanResource(int needAuthorizationHumanResource) { this.needAuthorizationHumanResource = needAuthorizationHumanResource; } public int getAuthorizedHumanResourceUserId() { return this.authorizedHumanResourceUserId; } public void setAuthorizedHumanResourceUserId(int authorizedHumanResourceUserId) { this.authorizedHumanResourceUserId = authorizedHumanResourceUserId; } public void setAuthorizedHumanResourceAt(Timestamp authorizedHumanResourceAt) { this.authorizedHumanResourceAt = authorizedHumanResourceAt; } public Timestamp getAuthorizedHumanResourceAt() { return this.authorizedHumanResourceAt; } public String getProgrammed() { return this.programmed; } public void setProgrammed(String programmed) { this.programmed = programmed; } public String getProgrammedValue() { if(this.programmed.equals(ProgrammedValue.Cd1.getCode())) { return ProgrammedValue.Cd1.getValue(); } if(this.programmed.equals(ProgrammedValue.Cd2.getCode())) { return ProgrammedValue.Cd2.getValue(); } if(this.programmed.equals(ProgrammedValue.Cd3.getCode())) { return ProgrammedValue.Cd3.getValue(); } if(this.programmed.equals(ProgrammedValue.Cd4.getCode())) { return ProgrammedValue.Cd4.getValue(); } return ""; } public String getPlanVacationDates() { return this.planVacationDates; } public void setPlanVacationDates(String planVacationDates) { this.planVacationDates = planVacationDates; } public String getPlanVacationDateMin() { String[] arrstr = this.planVacationDates.split(","); Arrays.sort(arrstr); return arrstr[0]; } public String[] getPlanVacationDateArray() { String[] tmp = this.planVacationDates.split(","); Arrays.sort(tmp); String[] arrstr = new String[tmp.length]; int i=0; for (String str : tmp) { java.util.Date d = DateUtils.StringToDate(str, "yyyy-MM-dd"); String s = DateUtils.FormatDate(d, "yyyy-MM-dd (E)"); arrstr[i] = s; i++; } return arrstr; } public int getBalance() { return this.balance; } public void setBalance(int balance) { this.balance = balance; } public int getStatus() { return this.status; } public void setStatus(int status) { this.status = status; } public String getStatusValue() { return EnumUtils.valueOf(StatusValue.class, Integer.toString(this.status)).value; } public void setStatusUpdatedAt(Timestamp statusUpdatedAt) { this.statusUpdatedAt = statusUpdatedAt; } public Timestamp getStatusUpdatedAt() { return this.statusUpdatedAt; } public void setStatusUpdatedUserId(int statusUpdatedUserId) { this.statusUpdatedUserId = statusUpdatedUserId; } public int getStatusUpdatedUserId() { return this.statusUpdatedUserId; } public void setCreatedAt(Timestamp createdAt) { this.createdAt = createdAt; } public Timestamp getCreatedAt() { return this.createdAt; } public void setCreatedUserId(int createdUserId) { this.createdUserId = createdUserId; } public int getCreatedUserId() { return this.createdUserId; } public void setUpdatedAt(Timestamp updatedAt) { this.updatedAt = updatedAt; } public Timestamp getUpdatedAt() { return this.updatedAt; } public void setUpdatedUserId(int updatedUserId) { this.updatedUserId = updatedUserId; } public int getUpdatedUserId() { return this.updatedUserId; } public MemberEntity getAppliedMemberEntity() { return this.appliedMemberEntity; } public void setAppliedMemberEntity(MemberEntity appliedMemberEntity) { this.appliedMemberEntity = appliedMemberEntity; } public UserVacationsEntity getUserVacationsEntity() { return this.userVacationsEntity; } public void setUserVacationsEntity(UserVacationsEntity userVacationsEntity) { this.userVacationsEntity = userVacationsEntity; } public MemberEntity getAuthorizedUserEntity() { return this.authorizedUserEntity; } public void setAuthorizedUserEntity(MemberEntity authorizedUserEntity) { this.authorizedUserEntity = authorizedUserEntity; } public MemberEntity getStatusUpdatedUserEntity() { return this.statusUpdatedUserEntity; } public void setStatusUpdatedUserEntity(MemberEntity statusUpdatedUserEntity) { this.statusUpdatedUserEntity = statusUpdatedUserEntity; } public WorkshiftEntity getWorkshiftEntity() { return this.workshiftEntity; } public void setWorkshiftEntity(WorkshiftEntity workshiftEntity) { this.workshiftEntity = workshiftEntity; } public MemberEntity getAuthorizedHumanResourceUserEntity() { return this.authorizedHumanResourceUserEntity; } public void setAuthorizedHumanResourceUserEntity(MemberEntity authorizedHumanResourceUserEntity) { this.authorizedHumanResourceUserEntity = authorizedHumanResourceUserEntity; } public List<ApplyVacationsDatesEntity> getApplyVacationsDatesEntity() { return this.applyVacationsDatesEntityList; } public void setApplyVacationsDatesEntity(List<ApplyVacationsDatesEntity> applyVacationsDatesEntityList) { this.applyVacationsDatesEntityList = applyVacationsDatesEntityList; } }
13,538
0.669228
0.665682
509
24.595285
23.901098
118
false
false
0
0
0
0
0
0
0.722986
false
false
2
40534464880f76bc75955c193f0a77e3d2405de4
38,740,605,050,174
0347477784a8ccdecf0623d8c8cbf4cf17c213b7
/app/src/main/java/com/lambdaschool/android_sprint4challenge_animatedrating/AnimatedRating.java
7d66e5ebb3dacd639f0bc54ef90cee2dd2657d44
[]
no_license
heiligbasil/Android_Sprint7Challenge_AnimatedRating
https://github.com/heiligbasil/Android_Sprint7Challenge_AnimatedRating
9ba6a6a74a836db4cd10c1273aacfb71aa92271b
692f06464c3a6e35b469e1f8e175257866dbadc2
refs/heads/master
2020-05-09T10:15:22.601000
2019-04-13T00:06:10
2019-04-13T00:06:10
181,034,396
0
0
null
true
2019-04-12T15:23:28
2019-04-12T15:23:28
2019-04-12T15:00:56
2019-04-12T15:22:39
322
0
0
0
null
false
false
package com.lambdaschool.android_sprint4challenge_animatedrating; import android.content.Context; import android.content.res.TypedArray; import android.graphics.drawable.AnimatedVectorDrawable; import android.graphics.drawable.Drawable; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import java.util.ArrayList; public class AnimatedRating extends LinearLayout { public static ArrayList<Integer> imageViewResources; public AnimatedRating(Context context) { super(context); init(null); } public AnimatedRating(Context context, @Nullable AttributeSet attrs) { super(context, attrs); init(attrs); } public AnimatedRating(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(attrs); } public AnimatedRating(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); init(attrs); } int maxRating, startRating, currentRating, symbolFilling, symbolFilled, symbolEmptying, symbolEmpty; ViewGroup inflatedViewGroup; protected void init(AttributeSet attrs) { TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.AnimatedRating); maxRating = typedArray.getInt(R.styleable.AnimatedRating_max_rating, 7); startRating = typedArray.getInt(R.styleable.AnimatedRating_start_rating, 3); symbolFilling = typedArray.getResourceId(R.styleable.AnimatedRating_symbol_filling, R.drawable.avd_line_star_fill); symbolFilled = typedArray.getResourceId(R.styleable.AnimatedRating_symbol_filled, R.drawable.avd_star_filled); symbolEmptying = typedArray.getResourceId(R.styleable.AnimatedRating_symbol_emptying, R.drawable.avd_line_star_empty); symbolEmpty = typedArray.getResourceId(R.styleable.AnimatedRating_symbol_empty, R.drawable.avd_star_empty); setCurrentRating(startRating - 1); inflatedViewGroup = (ViewGroup) inflate(getContext(), R.layout.animated_rating_group_layout, null); for (int i = 0; i < maxRating; ++i) { ImageView imageView = new ImageView(getContext(), attrs); LayoutParams layoutParams = new LayoutParams(getContext(), attrs); layoutParams.width = 100; layoutParams.height = 100; imageView.setLayoutParams(layoutParams); if (i < startRating) imageView.setImageDrawable(getResources().getDrawable(symbolFilled)); else imageView.setImageDrawable(getResources().getDrawable(symbolEmpty)); imageView.setTag(i); imageView.setOnClickListener(onClickListener); inflatedViewGroup.addView(imageView); } this.addView(inflatedViewGroup); typedArray.recycle(); } public int getCurrentRating() { return currentRating; } public void setCurrentRating(int currentRating) { this.currentRating = currentRating; } OnClickListener onClickListener = new OnClickListener() { @Override public void onClick(View v) { int ratingClicked = (int) v.getTag(); Drawable drawable = getResources().getDrawable(symbolFilled); AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) drawable; if (ratingClicked > getCurrentRating()) { // Increase rating for (int i = 0; i < maxRating; ++i) { if (i < ratingClicked && i <= getCurrentRating()) drawable = v.getResources().getDrawable(symbolFilled); else if (i < ratingClicked) drawable = v.getResources().getDrawable(symbolFilling); else if (i == ratingClicked) drawable = v.getResources().getDrawable(symbolFilling); else drawable = v.getResources().getDrawable(symbolEmpty); animatedVectorDrawable = (AnimatedVectorDrawable) drawable; ((ImageView) inflatedViewGroup.getChildAt(i)).setImageDrawable(drawable); animatedVectorDrawable.start(); } } else if (ratingClicked < getCurrentRating()) { // Decrease rating for (int i = 0; i < maxRating; ++i) { if (i < ratingClicked) drawable = v.getResources().getDrawable(symbolFilled); else if (i == ratingClicked) drawable = v.getResources().getDrawable(symbolFilled); else if (i > ratingClicked && i > getCurrentRating()) drawable = v.getResources().getDrawable(symbolEmpty); else drawable = v.getResources().getDrawable(symbolEmptying); animatedVectorDrawable = (AnimatedVectorDrawable) drawable; ((ImageView) inflatedViewGroup.getChildAt(i)).setImageDrawable(drawable); animatedVectorDrawable.start(); } } else { } setCurrentRating(ratingClicked); } }; }
UTF-8
Java
5,433
java
AnimatedRating.java
Java
[]
null
[]
package com.lambdaschool.android_sprint4challenge_animatedrating; import android.content.Context; import android.content.res.TypedArray; import android.graphics.drawable.AnimatedVectorDrawable; import android.graphics.drawable.Drawable; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import java.util.ArrayList; public class AnimatedRating extends LinearLayout { public static ArrayList<Integer> imageViewResources; public AnimatedRating(Context context) { super(context); init(null); } public AnimatedRating(Context context, @Nullable AttributeSet attrs) { super(context, attrs); init(attrs); } public AnimatedRating(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(attrs); } public AnimatedRating(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); init(attrs); } int maxRating, startRating, currentRating, symbolFilling, symbolFilled, symbolEmptying, symbolEmpty; ViewGroup inflatedViewGroup; protected void init(AttributeSet attrs) { TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.AnimatedRating); maxRating = typedArray.getInt(R.styleable.AnimatedRating_max_rating, 7); startRating = typedArray.getInt(R.styleable.AnimatedRating_start_rating, 3); symbolFilling = typedArray.getResourceId(R.styleable.AnimatedRating_symbol_filling, R.drawable.avd_line_star_fill); symbolFilled = typedArray.getResourceId(R.styleable.AnimatedRating_symbol_filled, R.drawable.avd_star_filled); symbolEmptying = typedArray.getResourceId(R.styleable.AnimatedRating_symbol_emptying, R.drawable.avd_line_star_empty); symbolEmpty = typedArray.getResourceId(R.styleable.AnimatedRating_symbol_empty, R.drawable.avd_star_empty); setCurrentRating(startRating - 1); inflatedViewGroup = (ViewGroup) inflate(getContext(), R.layout.animated_rating_group_layout, null); for (int i = 0; i < maxRating; ++i) { ImageView imageView = new ImageView(getContext(), attrs); LayoutParams layoutParams = new LayoutParams(getContext(), attrs); layoutParams.width = 100; layoutParams.height = 100; imageView.setLayoutParams(layoutParams); if (i < startRating) imageView.setImageDrawable(getResources().getDrawable(symbolFilled)); else imageView.setImageDrawable(getResources().getDrawable(symbolEmpty)); imageView.setTag(i); imageView.setOnClickListener(onClickListener); inflatedViewGroup.addView(imageView); } this.addView(inflatedViewGroup); typedArray.recycle(); } public int getCurrentRating() { return currentRating; } public void setCurrentRating(int currentRating) { this.currentRating = currentRating; } OnClickListener onClickListener = new OnClickListener() { @Override public void onClick(View v) { int ratingClicked = (int) v.getTag(); Drawable drawable = getResources().getDrawable(symbolFilled); AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) drawable; if (ratingClicked > getCurrentRating()) { // Increase rating for (int i = 0; i < maxRating; ++i) { if (i < ratingClicked && i <= getCurrentRating()) drawable = v.getResources().getDrawable(symbolFilled); else if (i < ratingClicked) drawable = v.getResources().getDrawable(symbolFilling); else if (i == ratingClicked) drawable = v.getResources().getDrawable(symbolFilling); else drawable = v.getResources().getDrawable(symbolEmpty); animatedVectorDrawable = (AnimatedVectorDrawable) drawable; ((ImageView) inflatedViewGroup.getChildAt(i)).setImageDrawable(drawable); animatedVectorDrawable.start(); } } else if (ratingClicked < getCurrentRating()) { // Decrease rating for (int i = 0; i < maxRating; ++i) { if (i < ratingClicked) drawable = v.getResources().getDrawable(symbolFilled); else if (i == ratingClicked) drawable = v.getResources().getDrawable(symbolFilled); else if (i > ratingClicked && i > getCurrentRating()) drawable = v.getResources().getDrawable(symbolEmpty); else drawable = v.getResources().getDrawable(symbolEmptying); animatedVectorDrawable = (AnimatedVectorDrawable) drawable; ((ImageView) inflatedViewGroup.getChildAt(i)).setImageDrawable(drawable); animatedVectorDrawable.start(); } } else { } setCurrentRating(ratingClicked); } }; }
5,433
0.641082
0.63869
129
41.11628
33.860092
126
false
false
0
0
0
0
0
0
0.775194
false
false
2
a52972c994f9e245cc711f8035050334979ed8f3
13,769,665,201,044
3f55e09a859b7f06e99e45201e43e05cd5c2a599
/CalendApp_7.0/src/main/java/calendApp/repository/EventRepository.java
b2c117bb8d83b18205d0873adbdcd8158da03b2b
[]
no_license
Zabamund/Interactive-Calendar-App-backend
https://github.com/Zabamund/Interactive-Calendar-App-backend
e090b013f57f4cc79f949fb9d152db06400290d1
d8e0ccf23195a1ef07b9031d68cc219f731f4129
refs/heads/master
2021-01-23T03:05:13.862000
2017-03-17T22:00:09
2017-03-17T22:00:09
86,048,639
1
0
null
true
2017-03-24T09:09:28
2017-03-24T09:09:27
2017-03-13T17:54:06
2017-03-17T22:00:32
10,272
0
0
0
null
null
null
package calendApp.repository; import java.time.LocalDate; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import calendApp.domain.Event; @Repository public interface EventRepository extends JpaRepository<Event, Long> { public Event findById(Long id); public Event findByEventName(String eventName); public void deleteById(Long id); // findAll always returns a List<T> public List<Event> findAll(); public List<Event> findAllEventsByDate(LocalDate date); }
UTF-8
Java
557
java
EventRepository.java
Java
[]
null
[]
package calendApp.repository; import java.time.LocalDate; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import calendApp.domain.Event; @Repository public interface EventRepository extends JpaRepository<Event, Long> { public Event findById(Long id); public Event findByEventName(String eventName); public void deleteById(Long id); // findAll always returns a List<T> public List<Event> findAll(); public List<Event> findAllEventsByDate(LocalDate date); }
557
0.802513
0.802513
24
22.208334
22.173519
69
false
false
0
0
0
0
0
0
0.75
false
false
2
86ba2ec1adfb4d253a07482adf4b92c84f096587
38,800,734,572,143
607017dbf92a7234b67237957b5173c8de6dabf5
/src/com/atuldwivedi/springseason/mvc/Car.java
c845339ce98bd68c083043d5e9762c4201036ca7
[]
no_license
AtulDwivedi/spring-season
https://github.com/AtulDwivedi/spring-season
8bf3062e928be73a552a4a66de412f052622dbb0
eb50e45a14a5ce6a17fd1ee9514292c06735b70d
refs/heads/master
2021-09-10T19:18:28.913000
2018-03-31T15:26:23
2018-03-31T15:26:23
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.atuldwivedi.springseason.mvc; public class Car { private String carName; private String carColor; private String countryOfOrigin; private String end; public String getCountryOfOrigin() { return countryOfOrigin; } public void setCountryOfOrigin(String countryOfOrigin) { this.countryOfOrigin = countryOfOrigin; } public String getEnd() { return end; } public void setEnd(String end) { this.end = end; } public Car() { super(); } public String getCarName() { return carName; } public void setCarName(String carName) { this.carName = carName; } public String getCarColor() { return carColor; } public void setCarColor(String carColor) { this.carColor = carColor; } }
UTF-8
Java
732
java
Car.java
Java
[]
null
[]
package com.atuldwivedi.springseason.mvc; public class Car { private String carName; private String carColor; private String countryOfOrigin; private String end; public String getCountryOfOrigin() { return countryOfOrigin; } public void setCountryOfOrigin(String countryOfOrigin) { this.countryOfOrigin = countryOfOrigin; } public String getEnd() { return end; } public void setEnd(String end) { this.end = end; } public Car() { super(); } public String getCarName() { return carName; } public void setCarName(String carName) { this.carName = carName; } public String getCarColor() { return carColor; } public void setCarColor(String carColor) { this.carColor = carColor; } }
732
0.714481
0.714481
47
14.574468
15.536839
57
false
false
0
0
0
0
0
0
1.212766
false
false
2
98c2ef0c417b9f2c8b7e581f885c7316439c6fae
39,161,511,807,958
d1c2d00078520cd556f60b7213c27856f8b3460d
/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/StructUtils.java
12cb91359cd97ddef1480205ff694537facc3971
[ "BSD-3-Clause", "MIT", "LicenseRef-scancode-protobuf", "Apache-2.0", "Python-2.0" ]
permissive
apache/beam
https://github.com/apache/beam
ed11b9e043465c720659eac20ac71b5b171bfa88
6d5048e05087ea54abc889ce402ae2a0abb9252b
refs/heads/master
2023-09-04T07:41:07.002000
2023-09-01T23:01:05
2023-09-01T23:01:05
50,904,245
7,061
4,522
Apache-2.0
false
2023-09-14T21:43:38
2016-02-02T08:00:06
2023-09-14T19:27:30
2023-09-14T21:35:23
525,191
7,133
4,038
4,241
Java
false
false
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.beam.sdk.io.gcp.spanner; import static java.util.stream.Collectors.toList; import static org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.base.Preconditions.checkNotNull; import com.google.cloud.ByteArray; import com.google.cloud.Timestamp; import com.google.cloud.spanner.Struct; import com.google.cloud.spanner.Type; import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.StreamSupport; import org.apache.beam.sdk.schemas.Schema; import org.apache.beam.sdk.values.Row; import org.checkerframework.checker.nullness.qual.Nullable; import org.joda.time.DateTime; import org.joda.time.Instant; import org.joda.time.ReadableDateTime; final class StructUtils { // It's not possible to pass nulls as values even with a field is nullable @SuppressWarnings({ "nullness" // TODO(https://github.com/apache/beam/issues/20497) }) public static Row structToBeamRow(Struct struct, Schema schema) { Map<String, @Nullable Object> structValues = schema.getFields().stream() .collect( HashMap::new, (map, field) -> map.put(field.getName(), getStructValue(struct, field)), Map::putAll); return Row.withSchema(schema).withFieldValues(structValues).build(); } public static Struct beamRowToStruct(Row row) { Struct.Builder structBuilder = Struct.newBuilder(); List<Schema.Field> fields = row.getSchema().getFields(); fields.forEach( field -> { String column = field.getName(); switch (field.getType().getTypeName()) { case ROW: @Nullable Row subRow = row.getRow(column); if (subRow == null) { structBuilder.set(column).to(beamTypeToSpannerType(field.getType()), null); } else { structBuilder .set(column) .to(beamTypeToSpannerType(field.getType()), beamRowToStruct(subRow)); } break; case ARRAY: addIterableToStructBuilder(structBuilder, row.getArray(column), field); break; case ITERABLE: addIterableToStructBuilder(structBuilder, row.getIterable(column), field); break; case FLOAT: @Nullable Float floatValue = row.getFloat(column); if (floatValue == null) { structBuilder.set(column).to((Double) null); } else { structBuilder.set(column).to(floatValue); } break; case DOUBLE: structBuilder.set(column).to(row.getDouble(column)); break; case INT16: @Nullable Short int16 = row.getInt16(column); if (int16 == null) { structBuilder.set(column).to((Long) null); } else { structBuilder.set(column).to(int16); } break; case INT32: @Nullable Integer int32 = row.getInt32(column); if (int32 == null) { structBuilder.set(column).to((Long) null); } else { structBuilder.set(column).to(int32); } break; case INT64: structBuilder.set(column).to(row.getInt64(column)); break; case DECIMAL: @Nullable BigDecimal decimal = row.getDecimal(column); // BigDecimal is not nullable if (decimal == null) { checkNotNull(decimal, "Null decimal at column " + column); } else { structBuilder.set(column).to(decimal); } break; // TODO: implement logical type date and timestamp case DATETIME: @Nullable ReadableDateTime dateTime = row.getDateTime(column); if (dateTime == null) { structBuilder.set(column).to((Timestamp) null); } else { structBuilder.set(column).to(Timestamp.parseTimestamp(dateTime.toString())); } break; case STRING: structBuilder.set(column).to(row.getString(column)); break; case BYTE: @Nullable Byte byteValue = row.getByte(column); if (byteValue == null) { structBuilder.set(column).to((Long) null); } else { structBuilder.set(column).to(byteValue); } break; case BYTES: byte @Nullable [] bytes = row.getBytes(column); if (bytes == null) { structBuilder.set(column).to((ByteArray) null); } else { structBuilder.set(column).to(ByteArray.copyFrom(bytes)); } break; case BOOLEAN: structBuilder.set(column).to(row.getBoolean(column)); break; default: throw new IllegalArgumentException( String.format( "Unsupported beam type '%s' while translating row to struct.", field.getType().getTypeName())); } }); return structBuilder.build(); } public static Type beamTypeToSpannerType(Schema.FieldType beamType) { switch (beamType.getTypeName()) { case ARRAY: case ITERABLE: Schema.@Nullable FieldType elementType = beamType.getCollectionElementType(); if (elementType == null) { throw new NullPointerException("Null element type"); } else { return Type.array(simpleBeamTypeToSpannerType(elementType)); } default: return simpleBeamTypeToSpannerType(beamType); } } private static Type simpleBeamTypeToSpannerType(Schema.FieldType beamType) { switch (beamType.getTypeName()) { case ROW: @Nullable Schema schema = beamType.getRowSchema(); if (schema == null) { throw new NullPointerException("Null schema"); } else { return Type.struct(translateRowFieldsToStructFields(schema.getFields())); } case BYTES: return Type.bytes(); case BYTE: case INT64: case INT32: case INT16: return Type.int64(); case DOUBLE: case FLOAT: return Type.float64(); case DECIMAL: return Type.numeric(); case STRING: return Type.string(); case BOOLEAN: return Type.bool(); // TODO: implement logical type date and timestamp case DATETIME: return Type.timestamp(); default: throw new IllegalArgumentException( String.format( "Unable to translate beam type %s to Spanner type", beamType.getTypeName())); } } private static Iterable<Type.StructField> translateRowFieldsToStructFields( List<Schema.Field> rowFields) { return rowFields.stream() .map(field -> Type.StructField.of(field.getName(), beamTypeToSpannerType(field.getType()))) .collect(toList()); } @SuppressWarnings("unchecked") private static void addIterableToStructBuilder( Struct.Builder structBuilder, @Nullable Iterable<Object> iterable, Schema.Field field) { String column = field.getName(); Schema.FieldType beamIterableType = field.getType().getCollectionElementType(); if (beamIterableType == null) { throw new NullPointerException("Null collection element type at field " + field.getName()); } Schema.TypeName beamIterableTypeName = beamIterableType.getTypeName(); switch (beamIterableTypeName) { case ROW: if (iterable == null) { structBuilder.set(column).toStructArray(beamTypeToSpannerType(beamIterableType), null); } else { structBuilder .set(column) .toStructArray( beamTypeToSpannerType(beamIterableType), StreamSupport.stream(iterable.spliterator(), false) .map(row -> beamRowToStruct((Row) row)) .collect(toList())); } break; case INT16: case INT32: case INT64: case BYTE: structBuilder.set(column).toInt64Array((Iterable<Long>) ((Object) iterable)); break; case FLOAT: case DOUBLE: structBuilder.set(column).toFloat64Array((Iterable<Double>) ((Object) iterable)); break; case DECIMAL: structBuilder.set(column).toNumericArray((Iterable<BigDecimal>) ((Object) iterable)); break; case BOOLEAN: structBuilder.set(column).toBoolArray((Iterable<Boolean>) ((Object) iterable)); break; case BYTES: if (iterable == null) { structBuilder.set(column).toBytesArray(null); } else { structBuilder .set(column) .toBytesArray( StreamSupport.stream(iterable.spliterator(), false) .map(bytes -> ByteArray.copyFrom((byte[]) bytes)) .collect(toList())); } break; case STRING: structBuilder.set(column).toStringArray((Iterable<String>) ((Object) iterable)); break; // TODO: implement logical date and datetime case DATETIME: if (iterable == null) { structBuilder.set(column).toTimestampArray(null); } else { structBuilder .set(column) .toTimestampArray( StreamSupport.stream(iterable.spliterator(), false) .map(timestamp -> Timestamp.parseTimestamp(timestamp.toString())) .collect(toList())); } break; default: throw new IllegalArgumentException( String.format( "Unsupported iterable type '%s' while translating row to struct.", beamIterableType.getTypeName())); } } private static @Nullable Object getStructValue(Struct struct, Schema.Field field) { String column = field.getName(); Type.Code typeCode = struct.getColumnType(column).getCode(); if (struct.isNull(column)) { return null; } switch (typeCode) { case BOOL: return struct.getBoolean(column); case BYTES: return struct.getBytes(column).toByteArray(); // TODO: implement logical datetime case TIMESTAMP: return Instant.ofEpochSecond(struct.getTimestamp(column).getSeconds()).toDateTime(); // TODO: implement logical date case DATE: return DateTime.parse(struct.getDate(column).toString()); case INT64: return struct.getLong(column); case FLOAT64: return struct.getDouble(column); case NUMERIC: return struct.getBigDecimal(column); case STRING: return struct.getString(column); case ARRAY: return getStructArrayValue( struct, struct.getColumnType(column).getArrayElementType(), field); case STRUCT: @Nullable Schema schema = field.getType().getRowSchema(); if (schema == null) { throw new NullPointerException("Null schema at field " + field.getName()); } else { return structToBeamRow(struct.getStruct(column), schema); } default: throw new RuntimeException( String.format("Unsupported spanner type %s for column %s.", typeCode, column)); } } private static @Nullable Object getStructArrayValue( Struct struct, Type arrayType, Schema.Field field) { Type.Code arrayCode = arrayType.getCode(); String column = field.getName(); if (struct.isNull(column)) { return null; } switch (arrayCode) { case BOOL: return struct.getBooleanList(column); case BYTES: return struct.getBytesList(column); // TODO: implement logical datetime case TIMESTAMP: return struct.getTimestampList(column).stream() .map(timestamp -> Instant.ofEpochSecond(timestamp.getSeconds()).toDateTime()) .collect(toList()); // TODO: implement logical date case DATE: return struct.getDateList(column).stream() .map(date -> DateTime.parse(date.toString())) .collect(toList()); case INT64: return struct.getLongList(column); case FLOAT64: return struct.getDoubleList(column); case STRING: return struct.getStringList(column); case NUMERIC: return struct.getBigDecimalList(column); case ARRAY: throw new IllegalStateException( String.format("Column %s has array of arrays which is prohibited in Spanner.", column)); case STRUCT: return struct.getStructList(column).stream() .map( structElem -> { Schema.@Nullable FieldType fieldType = field.getType().getCollectionElementType(); if (fieldType == null) { throw new NullPointerException( "Null collection element type at field " + field.getName()); } @Nullable Schema elementSchema = fieldType.getRowSchema(); if (elementSchema == null) { throw new NullPointerException( "Null schema element type at field " + field.getName()); } return structToBeamRow(structElem, elementSchema); }) .collect(toList()); default: throw new RuntimeException( String.format("Unsupported spanner array type %s for column %s.", arrayCode, column)); } } }
UTF-8
Java
14,670
java
StructUtils.java
Java
[ { "context": "nings({\n \"nullness\" // TODO(https://github.com/apache/beam/issues/20497)\n })\n public static Row struc", "end": 1712, "score": 0.9974290132522583, "start": 1706, "tag": "USERNAME", "value": "apache" } ]
null
[]
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.beam.sdk.io.gcp.spanner; import static java.util.stream.Collectors.toList; import static org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.base.Preconditions.checkNotNull; import com.google.cloud.ByteArray; import com.google.cloud.Timestamp; import com.google.cloud.spanner.Struct; import com.google.cloud.spanner.Type; import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.StreamSupport; import org.apache.beam.sdk.schemas.Schema; import org.apache.beam.sdk.values.Row; import org.checkerframework.checker.nullness.qual.Nullable; import org.joda.time.DateTime; import org.joda.time.Instant; import org.joda.time.ReadableDateTime; final class StructUtils { // It's not possible to pass nulls as values even with a field is nullable @SuppressWarnings({ "nullness" // TODO(https://github.com/apache/beam/issues/20497) }) public static Row structToBeamRow(Struct struct, Schema schema) { Map<String, @Nullable Object> structValues = schema.getFields().stream() .collect( HashMap::new, (map, field) -> map.put(field.getName(), getStructValue(struct, field)), Map::putAll); return Row.withSchema(schema).withFieldValues(structValues).build(); } public static Struct beamRowToStruct(Row row) { Struct.Builder structBuilder = Struct.newBuilder(); List<Schema.Field> fields = row.getSchema().getFields(); fields.forEach( field -> { String column = field.getName(); switch (field.getType().getTypeName()) { case ROW: @Nullable Row subRow = row.getRow(column); if (subRow == null) { structBuilder.set(column).to(beamTypeToSpannerType(field.getType()), null); } else { structBuilder .set(column) .to(beamTypeToSpannerType(field.getType()), beamRowToStruct(subRow)); } break; case ARRAY: addIterableToStructBuilder(structBuilder, row.getArray(column), field); break; case ITERABLE: addIterableToStructBuilder(structBuilder, row.getIterable(column), field); break; case FLOAT: @Nullable Float floatValue = row.getFloat(column); if (floatValue == null) { structBuilder.set(column).to((Double) null); } else { structBuilder.set(column).to(floatValue); } break; case DOUBLE: structBuilder.set(column).to(row.getDouble(column)); break; case INT16: @Nullable Short int16 = row.getInt16(column); if (int16 == null) { structBuilder.set(column).to((Long) null); } else { structBuilder.set(column).to(int16); } break; case INT32: @Nullable Integer int32 = row.getInt32(column); if (int32 == null) { structBuilder.set(column).to((Long) null); } else { structBuilder.set(column).to(int32); } break; case INT64: structBuilder.set(column).to(row.getInt64(column)); break; case DECIMAL: @Nullable BigDecimal decimal = row.getDecimal(column); // BigDecimal is not nullable if (decimal == null) { checkNotNull(decimal, "Null decimal at column " + column); } else { structBuilder.set(column).to(decimal); } break; // TODO: implement logical type date and timestamp case DATETIME: @Nullable ReadableDateTime dateTime = row.getDateTime(column); if (dateTime == null) { structBuilder.set(column).to((Timestamp) null); } else { structBuilder.set(column).to(Timestamp.parseTimestamp(dateTime.toString())); } break; case STRING: structBuilder.set(column).to(row.getString(column)); break; case BYTE: @Nullable Byte byteValue = row.getByte(column); if (byteValue == null) { structBuilder.set(column).to((Long) null); } else { structBuilder.set(column).to(byteValue); } break; case BYTES: byte @Nullable [] bytes = row.getBytes(column); if (bytes == null) { structBuilder.set(column).to((ByteArray) null); } else { structBuilder.set(column).to(ByteArray.copyFrom(bytes)); } break; case BOOLEAN: structBuilder.set(column).to(row.getBoolean(column)); break; default: throw new IllegalArgumentException( String.format( "Unsupported beam type '%s' while translating row to struct.", field.getType().getTypeName())); } }); return structBuilder.build(); } public static Type beamTypeToSpannerType(Schema.FieldType beamType) { switch (beamType.getTypeName()) { case ARRAY: case ITERABLE: Schema.@Nullable FieldType elementType = beamType.getCollectionElementType(); if (elementType == null) { throw new NullPointerException("Null element type"); } else { return Type.array(simpleBeamTypeToSpannerType(elementType)); } default: return simpleBeamTypeToSpannerType(beamType); } } private static Type simpleBeamTypeToSpannerType(Schema.FieldType beamType) { switch (beamType.getTypeName()) { case ROW: @Nullable Schema schema = beamType.getRowSchema(); if (schema == null) { throw new NullPointerException("Null schema"); } else { return Type.struct(translateRowFieldsToStructFields(schema.getFields())); } case BYTES: return Type.bytes(); case BYTE: case INT64: case INT32: case INT16: return Type.int64(); case DOUBLE: case FLOAT: return Type.float64(); case DECIMAL: return Type.numeric(); case STRING: return Type.string(); case BOOLEAN: return Type.bool(); // TODO: implement logical type date and timestamp case DATETIME: return Type.timestamp(); default: throw new IllegalArgumentException( String.format( "Unable to translate beam type %s to Spanner type", beamType.getTypeName())); } } private static Iterable<Type.StructField> translateRowFieldsToStructFields( List<Schema.Field> rowFields) { return rowFields.stream() .map(field -> Type.StructField.of(field.getName(), beamTypeToSpannerType(field.getType()))) .collect(toList()); } @SuppressWarnings("unchecked") private static void addIterableToStructBuilder( Struct.Builder structBuilder, @Nullable Iterable<Object> iterable, Schema.Field field) { String column = field.getName(); Schema.FieldType beamIterableType = field.getType().getCollectionElementType(); if (beamIterableType == null) { throw new NullPointerException("Null collection element type at field " + field.getName()); } Schema.TypeName beamIterableTypeName = beamIterableType.getTypeName(); switch (beamIterableTypeName) { case ROW: if (iterable == null) { structBuilder.set(column).toStructArray(beamTypeToSpannerType(beamIterableType), null); } else { structBuilder .set(column) .toStructArray( beamTypeToSpannerType(beamIterableType), StreamSupport.stream(iterable.spliterator(), false) .map(row -> beamRowToStruct((Row) row)) .collect(toList())); } break; case INT16: case INT32: case INT64: case BYTE: structBuilder.set(column).toInt64Array((Iterable<Long>) ((Object) iterable)); break; case FLOAT: case DOUBLE: structBuilder.set(column).toFloat64Array((Iterable<Double>) ((Object) iterable)); break; case DECIMAL: structBuilder.set(column).toNumericArray((Iterable<BigDecimal>) ((Object) iterable)); break; case BOOLEAN: structBuilder.set(column).toBoolArray((Iterable<Boolean>) ((Object) iterable)); break; case BYTES: if (iterable == null) { structBuilder.set(column).toBytesArray(null); } else { structBuilder .set(column) .toBytesArray( StreamSupport.stream(iterable.spliterator(), false) .map(bytes -> ByteArray.copyFrom((byte[]) bytes)) .collect(toList())); } break; case STRING: structBuilder.set(column).toStringArray((Iterable<String>) ((Object) iterable)); break; // TODO: implement logical date and datetime case DATETIME: if (iterable == null) { structBuilder.set(column).toTimestampArray(null); } else { structBuilder .set(column) .toTimestampArray( StreamSupport.stream(iterable.spliterator(), false) .map(timestamp -> Timestamp.parseTimestamp(timestamp.toString())) .collect(toList())); } break; default: throw new IllegalArgumentException( String.format( "Unsupported iterable type '%s' while translating row to struct.", beamIterableType.getTypeName())); } } private static @Nullable Object getStructValue(Struct struct, Schema.Field field) { String column = field.getName(); Type.Code typeCode = struct.getColumnType(column).getCode(); if (struct.isNull(column)) { return null; } switch (typeCode) { case BOOL: return struct.getBoolean(column); case BYTES: return struct.getBytes(column).toByteArray(); // TODO: implement logical datetime case TIMESTAMP: return Instant.ofEpochSecond(struct.getTimestamp(column).getSeconds()).toDateTime(); // TODO: implement logical date case DATE: return DateTime.parse(struct.getDate(column).toString()); case INT64: return struct.getLong(column); case FLOAT64: return struct.getDouble(column); case NUMERIC: return struct.getBigDecimal(column); case STRING: return struct.getString(column); case ARRAY: return getStructArrayValue( struct, struct.getColumnType(column).getArrayElementType(), field); case STRUCT: @Nullable Schema schema = field.getType().getRowSchema(); if (schema == null) { throw new NullPointerException("Null schema at field " + field.getName()); } else { return structToBeamRow(struct.getStruct(column), schema); } default: throw new RuntimeException( String.format("Unsupported spanner type %s for column %s.", typeCode, column)); } } private static @Nullable Object getStructArrayValue( Struct struct, Type arrayType, Schema.Field field) { Type.Code arrayCode = arrayType.getCode(); String column = field.getName(); if (struct.isNull(column)) { return null; } switch (arrayCode) { case BOOL: return struct.getBooleanList(column); case BYTES: return struct.getBytesList(column); // TODO: implement logical datetime case TIMESTAMP: return struct.getTimestampList(column).stream() .map(timestamp -> Instant.ofEpochSecond(timestamp.getSeconds()).toDateTime()) .collect(toList()); // TODO: implement logical date case DATE: return struct.getDateList(column).stream() .map(date -> DateTime.parse(date.toString())) .collect(toList()); case INT64: return struct.getLongList(column); case FLOAT64: return struct.getDoubleList(column); case STRING: return struct.getStringList(column); case NUMERIC: return struct.getBigDecimalList(column); case ARRAY: throw new IllegalStateException( String.format("Column %s has array of arrays which is prohibited in Spanner.", column)); case STRUCT: return struct.getStructList(column).stream() .map( structElem -> { Schema.@Nullable FieldType fieldType = field.getType().getCollectionElementType(); if (fieldType == null) { throw new NullPointerException( "Null collection element type at field " + field.getName()); } @Nullable Schema elementSchema = fieldType.getRowSchema(); if (elementSchema == null) { throw new NullPointerException( "Null schema element type at field " + field.getName()); } return structToBeamRow(structElem, elementSchema); }) .collect(toList()); default: throw new RuntimeException( String.format("Unsupported spanner array type %s for column %s.", arrayCode, column)); } } }
14,670
0.593115
0.588684
387
36.906979
25.231674
105
false
false
0
0
0
0
0
0
0.483204
false
false
2
332f602a76bcdd911d6fee8b1744f45c64e89bc8
35,046,933,180,374
ac5463b1831087543a574f5958a2b9ced2b90356
/app/src/main/java/com/example/jakub/creditcalculator/Information.java
1d6864a7039e59af9498469cbca28ef753fa82c9
[]
no_license
jkrekora/Credit-calculator
https://github.com/jkrekora/Credit-calculator
00755d6a0dcc7d3c702f2dac189e4b33d0ae2f75
50c7eaff4d3abcbeaeda3da43cc36e94637cada2
refs/heads/master
2021-01-19T06:41:16.991000
2016-06-10T00:00:20
2016-06-10T00:00:20
59,893,627
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.jakub.creditcalculator; import android.content.Intent; import android.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.TextView; public class Information extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_information); } public void howToCalculate(View view) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.accountingtools.com/credit-terms-cost-of-credit")); startActivity(intent); } public void goToUek(View view) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://uek.krakow.pl/pl/")); startActivity(intent); } }
UTF-8
Java
847
java
Information.java
Java
[ { "context": "package com.example.jakub.creditcalculator;\n\nimport android.content.Intent;", "end": 25, "score": 0.8095819354057312, "start": 20, "tag": "USERNAME", "value": "jakub" } ]
null
[]
package com.example.jakub.creditcalculator; import android.content.Intent; import android.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.TextView; public class Information extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_information); } public void howToCalculate(View view) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.accountingtools.com/credit-terms-cost-of-credit")); startActivity(intent); } public void goToUek(View view) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://uek.krakow.pl/pl/")); startActivity(intent); } }
847
0.724911
0.723731
27
30.370371
29.754736
128
false
false
0
0
0
0
0
0
0.555556
false
false
2
13f232ee38341795fc4097e7f68449d046eef3c7
37,048,387,921,732
f13dffaec88fdd52e75818b1536ede5fe4720591
/client/src/main/java/open/dolphin/helper/ComponentBoundsManager.java
d71ab5be839b7638f673cbce2cc6ecc6264f48d2
[]
no_license
pinus/OpenDolphin-1.3.0
https://github.com/pinus/OpenDolphin-1.3.0
74b728512811c0a33bcd248df2494cac7b71f952
4f2bc131e54f87a204c703ca1fbdff3ff651f64d
refs/heads/master
2022-12-21T13:47:41.698000
2022-12-19T09:41:27
2022-12-19T09:41:27
216,469,389
3
0
null
false
2022-12-07T09:47:47
2019-10-21T03:23:31
2022-01-06T05:57:20
2022-12-07T09:47:12
28,938
2
0
1
Java
false
false
package open.dolphin.helper; import open.dolphin.client.ClientContext; import open.dolphin.event.ProxyAction; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.swing.*; import java.awt.*; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.Objects; import java.util.prefs.Preferences; /** * ComponentBoundsManager. * Component の位置・サイズ変更を Listen して,リアルタイムで preference ファイルに保存する. * * @author Kazushi Minagawa * @author pns */ public class ComponentBoundsManager extends WindowAdapter implements ComponentListener { private static final Logger logger = LoggerFactory.getLogger(ComponentBoundsManager.class); private final Window target; private final Point defaultLocation; private final Dimension defaultSize; private Preferences prefs; private String key; private Timer timer; private int delay = 500; private boolean resized, moved; /** * @param component - target component * @param location - initial component location * @param size - initial component size * @param object - この object のクラス名が preference の key になる. null にすると記録されない. */ public ComponentBoundsManager(Window component, Point location, Dimension size, Object object) { target = component; defaultLocation = location; defaultSize = size; if (object != null) { prefs = Preferences.userNodeForPackage(object.getClass()); key = object.getClass().getName(); } // 初期値 component.setLocation(defaultLocation); component.setSize(defaultSize); // リスナ component.addComponentListener(this); component.addWindowListener(this); // Timer timer = new Timer(delay, new ProxyAction(this::flush)); } @Override public void componentMoved(ComponentEvent e) { if (Objects.isNull(prefs)) { return; } moved = true; timer.restart(); } @Override public void componentResized(ComponentEvent e) { if (Objects.isNull(prefs)) { return; } resized = true; timer.restart(); } private void flush() { timer.stop(); Rectangle r = target.getBounds(); if (moved) { prefs.putInt(key + "_x", r.x); prefs.putInt(key + "_y", r.y); } if (resized) { prefs.putInt(key + "_width", r.width); prefs.putInt(key + "_height", r.height); } moved = false; resized = false; logger.debug(String.format("%s loc(%d,%d) size(%d,%d)", key, r.x, r.y, r.width, r.height)); } @Override public void componentShown(ComponentEvent e) { } @Override public void componentHidden(ComponentEvent e) { } @Override public void windowClosed(WindowEvent e) { if (Objects.isNull(prefs)) { return; } Rectangle r = target.getBounds(); prefs.putInt(key + "_x", r.x); prefs.putInt(key + "_y", r.y); prefs.putInt(key + "_width", r.width); prefs.putInt(key + "_height", r.height); logger.debug(String.format("%s loc(%d,%d) size(%d,%d)", key, r.x, r.y, r.width, r.height)); } /** * Preferences に記録された Bounds に戻す. */ public void revertToPreferenceBounds() { if (prefs != null) { int x = prefs.getInt(key + "_x", defaultLocation.x); int y = prefs.getInt(key + "_y", defaultLocation.y); int width = prefs.getInt(key + "_width", defaultSize.width); int height = prefs.getInt(key + "_height", defaultSize.height); target.setBounds(x, y, width, height); } } /** * target component を画面中央に設定する. */ public void putCenter() { putCenter(ClientContext.isMac()? 3 : 2); } private void putCenter(int n) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension size = target.getSize(); int x = (screenSize.width - size.width) / 2; int y = (screenSize.height - size.height) / n; target.setBounds(x, y, size.width, size.height); } }
UTF-8
Java
4,395
java
ComponentBoundsManager.java
Java
[ { "context": "ten して,リアルタイムで preference ファイルに保存する.\n *\n * @author Kazushi Minagawa\n * @author pns\n */\npublic class ComponentBoundsMa", "end": 549, "score": 0.9998493194580078, "start": 533, "tag": "NAME", "value": "Kazushi Minagawa" }, { "context": "イルに保存する.\n *\n * @author Kazushi Minagawa\n * @author pns\n */\npublic class ComponentBoundsManager extends W", "end": 564, "score": 0.9973660707473755, "start": 561, "tag": "USERNAME", "value": "pns" }, { "context": ".getClass());\n key = object.getClass().getName();\n }\n // 初期値\n component.set", "end": 1596, "score": 0.6552660465240479, "start": 1589, "tag": "KEY", "value": "getName" } ]
null
[]
package open.dolphin.helper; import open.dolphin.client.ClientContext; import open.dolphin.event.ProxyAction; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.swing.*; import java.awt.*; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.Objects; import java.util.prefs.Preferences; /** * ComponentBoundsManager. * Component の位置・サイズ変更を Listen して,リアルタイムで preference ファイルに保存する. * * @author <NAME> * @author pns */ public class ComponentBoundsManager extends WindowAdapter implements ComponentListener { private static final Logger logger = LoggerFactory.getLogger(ComponentBoundsManager.class); private final Window target; private final Point defaultLocation; private final Dimension defaultSize; private Preferences prefs; private String key; private Timer timer; private int delay = 500; private boolean resized, moved; /** * @param component - target component * @param location - initial component location * @param size - initial component size * @param object - この object のクラス名が preference の key になる. null にすると記録されない. */ public ComponentBoundsManager(Window component, Point location, Dimension size, Object object) { target = component; defaultLocation = location; defaultSize = size; if (object != null) { prefs = Preferences.userNodeForPackage(object.getClass()); key = object.getClass().getName(); } // 初期値 component.setLocation(defaultLocation); component.setSize(defaultSize); // リスナ component.addComponentListener(this); component.addWindowListener(this); // Timer timer = new Timer(delay, new ProxyAction(this::flush)); } @Override public void componentMoved(ComponentEvent e) { if (Objects.isNull(prefs)) { return; } moved = true; timer.restart(); } @Override public void componentResized(ComponentEvent e) { if (Objects.isNull(prefs)) { return; } resized = true; timer.restart(); } private void flush() { timer.stop(); Rectangle r = target.getBounds(); if (moved) { prefs.putInt(key + "_x", r.x); prefs.putInt(key + "_y", r.y); } if (resized) { prefs.putInt(key + "_width", r.width); prefs.putInt(key + "_height", r.height); } moved = false; resized = false; logger.debug(String.format("%s loc(%d,%d) size(%d,%d)", key, r.x, r.y, r.width, r.height)); } @Override public void componentShown(ComponentEvent e) { } @Override public void componentHidden(ComponentEvent e) { } @Override public void windowClosed(WindowEvent e) { if (Objects.isNull(prefs)) { return; } Rectangle r = target.getBounds(); prefs.putInt(key + "_x", r.x); prefs.putInt(key + "_y", r.y); prefs.putInt(key + "_width", r.width); prefs.putInt(key + "_height", r.height); logger.debug(String.format("%s loc(%d,%d) size(%d,%d)", key, r.x, r.y, r.width, r.height)); } /** * Preferences に記録された Bounds に戻す. */ public void revertToPreferenceBounds() { if (prefs != null) { int x = prefs.getInt(key + "_x", defaultLocation.x); int y = prefs.getInt(key + "_y", defaultLocation.y); int width = prefs.getInt(key + "_width", defaultSize.width); int height = prefs.getInt(key + "_height", defaultSize.height); target.setBounds(x, y, width, height); } } /** * target component を画面中央に設定する. */ public void putCenter() { putCenter(ClientContext.isMac()? 3 : 2); } private void putCenter(int n) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension size = target.getSize(); int x = (screenSize.width - size.width) / 2; int y = (screenSize.height - size.height) / n; target.setBounds(x, y, size.width, size.height); } }
4,385
0.619137
0.617252
135
30.42963
24.008808
100
false
false
0
0
0
0
0
0
0.755556
false
false
2
46b6ee5ed91b5f3f2cd0702aa1a256c41d52ac90
7,241,314,876,654
44a100da80a01e5b3f168ed91c05f5d594cae1a0
/modules/coupon/src/main/java/org/shaolin/vogerp/coupon/dao/CouponModel.java
3733b40df5952642a80696c363ff1520ab52bb68
[]
no_license
shaolinwu/vogerp
https://github.com/shaolinwu/vogerp
f9b3421a82eb71c45ef3f1ef8f11662a644283d9
49bf718a9529c9d320adb523731d7786be1cd2fc
refs/heads/master
2021-01-24T05:59:36.117000
2018-05-24T05:02:36
2018-05-24T05:02:36
38,347,316
1
3
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.shaolin.vogerp.coupon.dao; import java.util.List; import java.util.ArrayList; import org.hibernate.Criteria; import org.hibernate.Session; import org.hibernate.criterion.Criterion; import org.hibernate.criterion.MatchMode; import org.hibernate.criterion.Restrictions; import org.hibernate.criterion.Order; import org.hibernate.criterion.Projections; import org.shaolin.bmdp.persistence.BEEntityDaoObject; import org.shaolin.bmdp.persistence.HibernateUtil; import org.shaolin.bmdp.persistence.query.operator.Operator; /** * This code is generated automatically, any change will be replaced after rebuild. */ public class CouponModel extends BEEntityDaoObject { public static final CouponModel INSTANCE = new CouponModel(); private CouponModel() { } public List<org.shaolin.vogerp.coupon.be.ICouponType> searchCouponType(org.shaolin.vogerp.coupon.be.CouponTypeImpl scObject, List<Order> orders, int offset, int count) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponTypeImpl.class, "inObject"); if (orders == null) { } else { this._addOrders(inObjectCriteria, orders); } if (scObject.getId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.id", scObject.getId())); } if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } if (scObject.getIcon() != null && scObject.getIcon().length() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.icon", scObject.getIcon())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); List result = this._list(offset, count, inObjectCriteria); return result; } public long searchCouponTypeCount(org.shaolin.vogerp.coupon.be.CouponTypeImpl scObject) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponTypeImpl.class, "inObject"); if (scObject.getId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.id", scObject.getId())); } if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } if (scObject.getIcon() != null && scObject.getIcon().length() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.icon", scObject.getIcon())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); return this._count(inObjectCriteria); } public List<org.shaolin.vogerp.coupon.be.IDiscountProduct> searchDiscountProduct(org.shaolin.vogerp.coupon.be.DiscountProductImpl scObject, List<Order> orders, int offset, int count) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.DiscountProductImpl.class, "inObject"); if (orders == null) { } else { this._addOrders(inObjectCriteria, orders); } if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } if (scObject.getId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.id", scObject.getId())); } if (scObject.getCouponTypeId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.couponTypeId", scObject.getCouponTypeId())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); List result = this._list(offset, count, inObjectCriteria); return result; } public long searchDiscountProductCount(org.shaolin.vogerp.coupon.be.DiscountProductImpl scObject) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.DiscountProductImpl.class, "inObject"); if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } if (scObject.getId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.id", scObject.getId())); } if (scObject.getCouponTypeId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.couponTypeId", scObject.getCouponTypeId())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); return this._count(inObjectCriteria); } public List<org.shaolin.vogerp.coupon.be.ICoupon> searchCoupon(org.shaolin.vogerp.coupon.be.CouponImpl scObject, List<Order> orders, int offset, int count) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponImpl.class, "inObject"); if (orders == null) { } else { this._addOrders(inObjectCriteria, orders); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); List result = this._list(offset, count, inObjectCriteria); return result; } public long searchCouponCount(org.shaolin.vogerp.coupon.be.CouponImpl scObject) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponImpl.class, "inObject"); inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); return this._count(inObjectCriteria); } public List<org.shaolin.vogerp.coupon.be.ICouponOperation> searchCouponOperation(org.shaolin.vogerp.coupon.be.CouponOperationImpl scObject, List<Order> orders, int offset, int count) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponOperationImpl.class, "inObject"); if (orders == null) { } else { this._addOrders(inObjectCriteria, orders); } if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } if (scObject.getPhoneNum() != null && scObject.getPhoneNum().length() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.phoneNum", scObject.getPhoneNum())); } if (scObject.getOpenId() != null && scObject.getOpenId().length() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.openId", scObject.getOpenId())); } if (scObject.getType() != null && scObject.getType().length() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.type", scObject.getType())); } if (scObject.getOperateDate() != null) { inObjectCriteria.add(createCriterion(Operator.GREATER_THAN, "inObject.operateDate", scObject.getOperateDate())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); List result = this._list(offset, count, inObjectCriteria); return result; } public long searchCouponOperationCount(org.shaolin.vogerp.coupon.be.CouponOperationImpl scObject) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponOperationImpl.class, "inObject"); if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } if (scObject.getPhoneNum() != null && scObject.getPhoneNum().length() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.phoneNum", scObject.getPhoneNum())); } if (scObject.getOpenId() != null && scObject.getOpenId().length() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.openId", scObject.getOpenId())); } if (scObject.getType() != null && scObject.getType().length() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.type", scObject.getType())); } if (scObject.getOperateDate() != null) { inObjectCriteria.add(createCriterion(Operator.GREATER_THAN, "inObject.operateDate", scObject.getOperateDate())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); return this._count(inObjectCriteria); } public List<org.shaolin.vogerp.coupon.be.ICouponSystem> searchCouponSystem(org.shaolin.vogerp.coupon.be.CouponSystemImpl scObject, List<Order> orders, int offset, int count) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponSystemImpl.class, "inObject"); if (orders == null) { } else { this._addOrders(inObjectCriteria, orders); } if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); List result = this._list(offset, count, inObjectCriteria); return result; } public long searchCouponSystemCount(org.shaolin.vogerp.coupon.be.CouponSystemImpl scObject) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponSystemImpl.class, "inObject"); if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); return this._count(inObjectCriteria); } public List<org.shaolin.vogerp.coupon.be.ICouponUserInfo> searchCouponUserInfo(org.shaolin.vogerp.coupon.be.CouponUserInfoImpl scObject, List<Order> orders, int offset, int count) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponUserInfoImpl.class, "inObject"); if (orders == null) { } else { this._addOrders(inObjectCriteria, orders); } if (scObject.getId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.id", scObject.getId())); } if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); List result = this._list(offset, count, inObjectCriteria); return result; } public long searchCouponUserInfoCount(org.shaolin.vogerp.coupon.be.CouponUserInfoImpl scObject) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponUserInfoImpl.class, "inObject"); if (scObject.getId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.id", scObject.getId())); } if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); return this._count(inObjectCriteria); } public List<org.shaolin.vogerp.coupon.be.ICoupon> searchEffectedCoupon(org.shaolin.vogerp.coupon.be.CouponImpl scObject, List<Order> orders, int offset, int count) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponImpl.class, "inObject"); if (orders == null) { } else { this._addOrders(inObjectCriteria, orders); } if (scObject.getId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.id", scObject.getId())); } if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } if (scObject.getSerialNumber() != null && scObject.getSerialNumber().length() > 0) { inObjectCriteria.add(createCriterion(Operator.START_WITH_RIGHT, "inObject.serialNumber", scObject.getSerialNumber())); } if (scObject.getExpiredDate() != null) { inObjectCriteria.add(createCriterion(Operator.GREATER_THAN_OR_EQUALS, "inObject.expiredDate", scObject.getExpiredDate())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); List result = this._list(offset, count, inObjectCriteria); return result; } public long searchEffectedCouponCount(org.shaolin.vogerp.coupon.be.CouponImpl scObject) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponImpl.class, "inObject"); if (scObject.getId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.id", scObject.getId())); } if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } if (scObject.getSerialNumber() != null && scObject.getSerialNumber().length() > 0) { inObjectCriteria.add(createCriterion(Operator.START_WITH_RIGHT, "inObject.serialNumber", scObject.getSerialNumber())); } if (scObject.getExpiredDate() != null) { inObjectCriteria.add(createCriterion(Operator.GREATER_THAN_OR_EQUALS, "inObject.expiredDate", scObject.getExpiredDate())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); return this._count(inObjectCriteria); } public List<org.shaolin.vogerp.coupon.be.ICoupon> searchCouponByOpenIdOrderByExpDate(org.shaolin.vogerp.coupon.be.CouponImpl scObject, List<Order> orders, int offset, int count) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponImpl.class, "inObject"); if (orders == null) { // add default orders. inObjectCriteria.addOrder(Order.asc("inObject.expiredDate")); } else { this._addOrders(inObjectCriteria, orders); } if (scObject.getOpenId() != null && scObject.getOpenId().length() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.openId", scObject.getOpenId())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); List result = this._list(offset, count, inObjectCriteria); return result; } public long searchCouponByOpenIdOrderByExpDateCount(org.shaolin.vogerp.coupon.be.CouponImpl scObject) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponImpl.class, "inObject"); if (scObject.getOpenId() != null && scObject.getOpenId().length() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.openId", scObject.getOpenId())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); return this._count(inObjectCriteria); } }
UTF-8
Java
16,257
java
CouponModel.java
Java
[]
null
[]
package org.shaolin.vogerp.coupon.dao; import java.util.List; import java.util.ArrayList; import org.hibernate.Criteria; import org.hibernate.Session; import org.hibernate.criterion.Criterion; import org.hibernate.criterion.MatchMode; import org.hibernate.criterion.Restrictions; import org.hibernate.criterion.Order; import org.hibernate.criterion.Projections; import org.shaolin.bmdp.persistence.BEEntityDaoObject; import org.shaolin.bmdp.persistence.HibernateUtil; import org.shaolin.bmdp.persistence.query.operator.Operator; /** * This code is generated automatically, any change will be replaced after rebuild. */ public class CouponModel extends BEEntityDaoObject { public static final CouponModel INSTANCE = new CouponModel(); private CouponModel() { } public List<org.shaolin.vogerp.coupon.be.ICouponType> searchCouponType(org.shaolin.vogerp.coupon.be.CouponTypeImpl scObject, List<Order> orders, int offset, int count) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponTypeImpl.class, "inObject"); if (orders == null) { } else { this._addOrders(inObjectCriteria, orders); } if (scObject.getId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.id", scObject.getId())); } if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } if (scObject.getIcon() != null && scObject.getIcon().length() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.icon", scObject.getIcon())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); List result = this._list(offset, count, inObjectCriteria); return result; } public long searchCouponTypeCount(org.shaolin.vogerp.coupon.be.CouponTypeImpl scObject) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponTypeImpl.class, "inObject"); if (scObject.getId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.id", scObject.getId())); } if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } if (scObject.getIcon() != null && scObject.getIcon().length() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.icon", scObject.getIcon())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); return this._count(inObjectCriteria); } public List<org.shaolin.vogerp.coupon.be.IDiscountProduct> searchDiscountProduct(org.shaolin.vogerp.coupon.be.DiscountProductImpl scObject, List<Order> orders, int offset, int count) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.DiscountProductImpl.class, "inObject"); if (orders == null) { } else { this._addOrders(inObjectCriteria, orders); } if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } if (scObject.getId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.id", scObject.getId())); } if (scObject.getCouponTypeId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.couponTypeId", scObject.getCouponTypeId())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); List result = this._list(offset, count, inObjectCriteria); return result; } public long searchDiscountProductCount(org.shaolin.vogerp.coupon.be.DiscountProductImpl scObject) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.DiscountProductImpl.class, "inObject"); if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } if (scObject.getId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.id", scObject.getId())); } if (scObject.getCouponTypeId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.couponTypeId", scObject.getCouponTypeId())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); return this._count(inObjectCriteria); } public List<org.shaolin.vogerp.coupon.be.ICoupon> searchCoupon(org.shaolin.vogerp.coupon.be.CouponImpl scObject, List<Order> orders, int offset, int count) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponImpl.class, "inObject"); if (orders == null) { } else { this._addOrders(inObjectCriteria, orders); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); List result = this._list(offset, count, inObjectCriteria); return result; } public long searchCouponCount(org.shaolin.vogerp.coupon.be.CouponImpl scObject) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponImpl.class, "inObject"); inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); return this._count(inObjectCriteria); } public List<org.shaolin.vogerp.coupon.be.ICouponOperation> searchCouponOperation(org.shaolin.vogerp.coupon.be.CouponOperationImpl scObject, List<Order> orders, int offset, int count) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponOperationImpl.class, "inObject"); if (orders == null) { } else { this._addOrders(inObjectCriteria, orders); } if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } if (scObject.getPhoneNum() != null && scObject.getPhoneNum().length() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.phoneNum", scObject.getPhoneNum())); } if (scObject.getOpenId() != null && scObject.getOpenId().length() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.openId", scObject.getOpenId())); } if (scObject.getType() != null && scObject.getType().length() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.type", scObject.getType())); } if (scObject.getOperateDate() != null) { inObjectCriteria.add(createCriterion(Operator.GREATER_THAN, "inObject.operateDate", scObject.getOperateDate())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); List result = this._list(offset, count, inObjectCriteria); return result; } public long searchCouponOperationCount(org.shaolin.vogerp.coupon.be.CouponOperationImpl scObject) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponOperationImpl.class, "inObject"); if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } if (scObject.getPhoneNum() != null && scObject.getPhoneNum().length() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.phoneNum", scObject.getPhoneNum())); } if (scObject.getOpenId() != null && scObject.getOpenId().length() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.openId", scObject.getOpenId())); } if (scObject.getType() != null && scObject.getType().length() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.type", scObject.getType())); } if (scObject.getOperateDate() != null) { inObjectCriteria.add(createCriterion(Operator.GREATER_THAN, "inObject.operateDate", scObject.getOperateDate())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); return this._count(inObjectCriteria); } public List<org.shaolin.vogerp.coupon.be.ICouponSystem> searchCouponSystem(org.shaolin.vogerp.coupon.be.CouponSystemImpl scObject, List<Order> orders, int offset, int count) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponSystemImpl.class, "inObject"); if (orders == null) { } else { this._addOrders(inObjectCriteria, orders); } if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); List result = this._list(offset, count, inObjectCriteria); return result; } public long searchCouponSystemCount(org.shaolin.vogerp.coupon.be.CouponSystemImpl scObject) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponSystemImpl.class, "inObject"); if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); return this._count(inObjectCriteria); } public List<org.shaolin.vogerp.coupon.be.ICouponUserInfo> searchCouponUserInfo(org.shaolin.vogerp.coupon.be.CouponUserInfoImpl scObject, List<Order> orders, int offset, int count) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponUserInfoImpl.class, "inObject"); if (orders == null) { } else { this._addOrders(inObjectCriteria, orders); } if (scObject.getId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.id", scObject.getId())); } if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); List result = this._list(offset, count, inObjectCriteria); return result; } public long searchCouponUserInfoCount(org.shaolin.vogerp.coupon.be.CouponUserInfoImpl scObject) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponUserInfoImpl.class, "inObject"); if (scObject.getId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.id", scObject.getId())); } if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); return this._count(inObjectCriteria); } public List<org.shaolin.vogerp.coupon.be.ICoupon> searchEffectedCoupon(org.shaolin.vogerp.coupon.be.CouponImpl scObject, List<Order> orders, int offset, int count) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponImpl.class, "inObject"); if (orders == null) { } else { this._addOrders(inObjectCriteria, orders); } if (scObject.getId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.id", scObject.getId())); } if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } if (scObject.getSerialNumber() != null && scObject.getSerialNumber().length() > 0) { inObjectCriteria.add(createCriterion(Operator.START_WITH_RIGHT, "inObject.serialNumber", scObject.getSerialNumber())); } if (scObject.getExpiredDate() != null) { inObjectCriteria.add(createCriterion(Operator.GREATER_THAN_OR_EQUALS, "inObject.expiredDate", scObject.getExpiredDate())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); List result = this._list(offset, count, inObjectCriteria); return result; } public long searchEffectedCouponCount(org.shaolin.vogerp.coupon.be.CouponImpl scObject) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponImpl.class, "inObject"); if (scObject.getId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.id", scObject.getId())); } if (scObject.getOrgId() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.orgId", scObject.getOrgId())); } if (scObject.getSerialNumber() != null && scObject.getSerialNumber().length() > 0) { inObjectCriteria.add(createCriterion(Operator.START_WITH_RIGHT, "inObject.serialNumber", scObject.getSerialNumber())); } if (scObject.getExpiredDate() != null) { inObjectCriteria.add(createCriterion(Operator.GREATER_THAN_OR_EQUALS, "inObject.expiredDate", scObject.getExpiredDate())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); return this._count(inObjectCriteria); } public List<org.shaolin.vogerp.coupon.be.ICoupon> searchCouponByOpenIdOrderByExpDate(org.shaolin.vogerp.coupon.be.CouponImpl scObject, List<Order> orders, int offset, int count) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponImpl.class, "inObject"); if (orders == null) { // add default orders. inObjectCriteria.addOrder(Order.asc("inObject.expiredDate")); } else { this._addOrders(inObjectCriteria, orders); } if (scObject.getOpenId() != null && scObject.getOpenId().length() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.openId", scObject.getOpenId())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); List result = this._list(offset, count, inObjectCriteria); return result; } public long searchCouponByOpenIdOrderByExpDateCount(org.shaolin.vogerp.coupon.be.CouponImpl scObject) { Criteria inObjectCriteria = this._createCriteria(org.shaolin.vogerp.coupon.be.CouponImpl.class, "inObject"); if (scObject.getOpenId() != null && scObject.getOpenId().length() > 0) { inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject.openId", scObject.getOpenId())); } inObjectCriteria.add(createCriterion(Operator.EQUALS, "inObject._enable", scObject.isEnabled())); return this._count(inObjectCriteria); } }
16,257
0.64729
0.645199
338
47.094673
45.319347
143
false
false
0
0
0
0
0
0
0.857988
false
false
2
94c39b110ae5909f10aac02313b132605baf486d
8,426,725,839,192
e98d1862f614c0945d0d2556b6324a708b4bd811
/Faurax/me/cupboard/command/argument/factory/ArgumentFactory.java
40cd8dfd1038fbfcb027b1346643da02cf15eecd
[]
no_license
chocopie69/Minecraft-Modifications-Codes
https://github.com/chocopie69/Minecraft-Modifications-Codes
946f7fd2b431b1e3c4272cf96d75460883468917
a843aa9163e9e508e74dad10572d68477e5e38bf
refs/heads/main
2023-08-27T08:46:06.036000
2022-06-25T14:35:06
2022-06-25T14:35:06
412,120,508
71
54
null
false
2022-01-11T15:55:25
2021-09-30T15:30:35
2022-01-10T04:52:49
2022-01-09T16:44:51
331,436
4
2
3
null
false
false
package me.cupboard.command.argument.factory; import java.lang.reflect.*; import java.util.*; import me.cupboard.command.argument.*; import java.lang.annotation.*; public abstract class ArgumentFactory { private final Map<String, Method> arguments; public ArgumentFactory() { this.arguments = new HashMap<String, Method>(); } public void load() { Method[] declaredMethods; for (int length = (declaredMethods = this.getClass().getDeclaredMethods()).length, i = 0; i < length; ++i) { final Method method = declaredMethods[i]; if (method.isAnnotationPresent(Argument.class)) { final Argument argument = method.getAnnotation(Argument.class); String[] handles; for (int length2 = (handles = argument.handles()).length, j = 0; j < length2; ++j) { final String handle = handles[j]; if (this.arguments.containsKey(handle)) { throw new UnsupportedOperationException(String.format("Overlapping arguments at %s and %s.", this.arguments.get(handle).getName(), method.getName())); } this.arguments.put(handle, method); } } } } public String getSyntax(final String command, final String argument) { final Method target = this.getMethod(argument); if (target.isAnnotationPresent(Argument.class)) { final Argument annotation = target.getAnnotation(Argument.class); return String.join(" ", command, argument, annotation.syntax()); } return "no syntax provided"; } public boolean hasArgument(final String argument) { return this.arguments.containsKey(argument); } public Method getMethod(final String argument) { if (this.arguments.containsKey(argument)) { final Method target = this.arguments.get(argument); target.setAccessible(true); return target; } return null; } }
UTF-8
Java
2,084
java
ArgumentFactory.java
Java
[]
null
[]
package me.cupboard.command.argument.factory; import java.lang.reflect.*; import java.util.*; import me.cupboard.command.argument.*; import java.lang.annotation.*; public abstract class ArgumentFactory { private final Map<String, Method> arguments; public ArgumentFactory() { this.arguments = new HashMap<String, Method>(); } public void load() { Method[] declaredMethods; for (int length = (declaredMethods = this.getClass().getDeclaredMethods()).length, i = 0; i < length; ++i) { final Method method = declaredMethods[i]; if (method.isAnnotationPresent(Argument.class)) { final Argument argument = method.getAnnotation(Argument.class); String[] handles; for (int length2 = (handles = argument.handles()).length, j = 0; j < length2; ++j) { final String handle = handles[j]; if (this.arguments.containsKey(handle)) { throw new UnsupportedOperationException(String.format("Overlapping arguments at %s and %s.", this.arguments.get(handle).getName(), method.getName())); } this.arguments.put(handle, method); } } } } public String getSyntax(final String command, final String argument) { final Method target = this.getMethod(argument); if (target.isAnnotationPresent(Argument.class)) { final Argument annotation = target.getAnnotation(Argument.class); return String.join(" ", command, argument, annotation.syntax()); } return "no syntax provided"; } public boolean hasArgument(final String argument) { return this.arguments.containsKey(argument); } public Method getMethod(final String argument) { if (this.arguments.containsKey(argument)) { final Method target = this.arguments.get(argument); target.setAccessible(true); return target; } return null; } }
2,084
0.603647
0.601727
55
36.890907
33.225769
174
false
false
0
0
0
0
0
0
0.690909
false
false
2
752fbcd453bb01613e35665b3425d5f7ab886b8b
3,599,182,600,872
a282b57888ffdf018a5a365e9816e7f514c7b96c
/app/src/main/java/com/cloudservey/Temp.java
eb14309229965a11aa0a4cbd26a458732e9c6f75
[]
no_license
aniketchinchkar1/RetailwareCloudSurvey
https://github.com/aniketchinchkar1/RetailwareCloudSurvey
bd72629f2e59dbc88fcf54464892a7ba0f9d6274
d23839697f1a84919bd88ae21038534bc9764cf6
refs/heads/master
2021-01-10T13:50:22.712000
2015-12-11T12:28:47
2015-12-11T12:29:04
47,825,623
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cloudservey; import android.app.Activity; import android.content.Intent; import android.os.Bundle; public class Temp extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_temp); Intent intent= getIntent(); String notification_message =intent.getStringExtra("notification_message"); Intent mainintent=new Intent(Temp.this,MainActivity.class); mainintent.putExtra("notification_message", notification_message); startActivity(mainintent); } }
UTF-8
Java
575
java
Temp.java
Java
[]
null
[]
package com.cloudservey; import android.app.Activity; import android.content.Intent; import android.os.Bundle; public class Temp extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_temp); Intent intent= getIntent(); String notification_message =intent.getStringExtra("notification_message"); Intent mainintent=new Intent(Temp.this,MainActivity.class); mainintent.putExtra("notification_message", notification_message); startActivity(mainintent); } }
575
0.787826
0.787826
21
26.380953
23.337027
77
false
false
0
0
0
0
0
0
1.619048
false
false
2
fb8e34344ea6ecf6bde80b0f92ae8f2a5c3f2ac9
32,856,499,814,578
e8af4dea895e499783388f40647398557f84ae0f
/src/main/java/com/cmc/dashboard/dto/UserDTO.java
6fdda44f1eda5521c438245272e174de6eeba0a2
[]
no_license
vannguyen14893/db
https://github.com/vannguyen14893/db
5f509d98320e22ab43c474f3adcd61c465b85564
2bfd7ea2af8b5416c2f5fea3f23cd88b38de4026
refs/heads/master
2022-07-16T07:04:32.316000
2019-09-20T08:35:14
2019-09-20T08:35:14
209,719,666
0
1
null
false
2022-05-20T21:10:44
2019-09-20T06:21:57
2019-09-20T08:35:41
2022-05-20T21:10:43
5,494
0
0
5
JavaScript
false
false
package com.cmc.dashboard.dto; public class UserDTO { private int id; private String userName; private String fullName; private String deliveryUnit; private String role; private String img; private LastActivityDto lastActivityDto; public UserDTO() { } public UserDTO(int id, String fullName, String deliveryUnit, String role) { this.id = id; this.fullName = fullName; this.deliveryUnit = deliveryUnit; this.role = role; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getFullName() { return fullName; } public void setFullName(String fullName) { this.fullName = fullName; } public String getDeliveryUnit() { return deliveryUnit; } public void setDeliveryUnit(String deliveryUnit) { this.deliveryUnit = deliveryUnit; } public String getRole() { return role; } public void setRole(String role) { this.role = role; } public LastActivityDto getLastActivityDto() { return lastActivityDto; } public void setLastActivityDto(LastActivityDto lastActivityDto) { this.lastActivityDto = lastActivityDto; } public String getImg() { return img; } public void setImg(String img) { this.img = img; } }
UTF-8
Java
1,347
java
UserDTO.java
Java
[ { "context": " = id;\n\t}\n\n\tpublic String getUserName() {\n\t\treturn userName;\n\t}\n\n\tpublic void setUserName(String userName) {\n", "end": 583, "score": 0.8461238145828247, "start": 575, "tag": "USERNAME", "value": "userName" }, { "context": "d setUserName(String userName) {\n\t\tthis.userName = userName;\n\t}\n\n\tpublic String getFullName() {\n\t\treturn full", "end": 659, "score": 0.9743101596832275, "start": 651, "tag": "USERNAME", "value": "userName" } ]
null
[]
package com.cmc.dashboard.dto; public class UserDTO { private int id; private String userName; private String fullName; private String deliveryUnit; private String role; private String img; private LastActivityDto lastActivityDto; public UserDTO() { } public UserDTO(int id, String fullName, String deliveryUnit, String role) { this.id = id; this.fullName = fullName; this.deliveryUnit = deliveryUnit; this.role = role; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getFullName() { return fullName; } public void setFullName(String fullName) { this.fullName = fullName; } public String getDeliveryUnit() { return deliveryUnit; } public void setDeliveryUnit(String deliveryUnit) { this.deliveryUnit = deliveryUnit; } public String getRole() { return role; } public void setRole(String role) { this.role = role; } public LastActivityDto getLastActivityDto() { return lastActivityDto; } public void setLastActivityDto(LastActivityDto lastActivityDto) { this.lastActivityDto = lastActivityDto; } public String getImg() { return img; } public void setImg(String img) { this.img = img; } }
1,347
0.716407
0.716407
80
15.8375
16.956152
76
false
false
0
0
0
0
0
0
1.3
false
false
2
394c892440ea435a8c2b8110815d7704ae2e4dc6
9,543,417,341,601
5b2bdde442da88cf830f9062229e8dd8b46bda95
/app/src/main/java/com/gatheringhallstudios/mhworlddatabase/data/embeds/WeaknessSummaryStatus.java
2f3a55764ca9d393a82403416c85f073bc8c14dc
[ "MIT" ]
permissive
gatheringhallstudios/MHWorldDatabase
https://github.com/gatheringhallstudios/MHWorldDatabase
9c0083eb205c7456c01e84703afc004f41d84f62
2cd97da83bb0926b4011c6c6021c025f70c5e5ec
refs/heads/master
2023-07-19T18:50:55.250000
2021-09-04T03:19:32
2021-09-04T03:19:32
109,581,966
59
25
MIT
false
2023-07-18T00:30:24
2017-11-05T13:29:59
2022-10-30T19:51:42
2023-07-18T00:30:23
49,253
52
21
6
Kotlin
false
false
package com.gatheringhallstudios.mhworlddatabase.data.embeds; public class WeaknessSummaryStatus { public Integer poison; public Integer sleep; public Integer paralysis; public Integer blast; public Integer stun; }
UTF-8
Java
236
java
WeaknessSummaryStatus.java
Java
[]
null
[]
package com.gatheringhallstudios.mhworlddatabase.data.embeds; public class WeaknessSummaryStatus { public Integer poison; public Integer sleep; public Integer paralysis; public Integer blast; public Integer stun; }
236
0.766949
0.766949
9
25.222221
17.112555
61
false
false
0
0
0
0
0
0
0.666667
false
false
2
f50e411eb172f2d5d0227a283e6115369335b7bc
14,731,737,839,915
12f588b0082f9d1892c3e8a3b19c7075da16df3f
/Engine/gl/skybox/Skybox.java
3b3b0d209a1fcd4a93ac4b755b9a4a624676cb50
[]
no_license
clow1/ProjectMoonglade
https://github.com/clow1/ProjectMoonglade
0e5300efa89a319bafd2538cfa16ef3286fb1357
58b2236ac33e14423825a61cd9330b6120378eed
refs/heads/master
2022-11-23T19:06:01.810000
2020-07-31T21:35:40
2020-07-31T21:35:40
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package gl.skybox; import java.util.ArrayList; import java.util.List; import org.joml.Matrix4f; import org.joml.Vector3f; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL13; import core.Resources; import gl.Camera; import gl.Window; import gl.res.Model; import gl.res.Texture; import gl.skybox.entity.SkyboxEntityRender; import map.Enviroment; import scene.entity.skybox.SkyboxEntity; import util.MathUtil; // This handles the logic between the player's character and the game public class Skybox { private static final float SIZE = 32; private static final float CYCLE_INTEVAL = Enviroment.CYCLE_LENGTH / 4f; private final SkyboxShader shader; private final Model box; private float alpha; private List<SkyboxEntity> entities; private SkyboxEntityRender skyEntRender; private final Vector3f topColor = new Vector3f(), bottomColor = new Vector3f(); private final Vector3f[] SKY_COLOR = new Vector3f[] { // Morning new Vector3f(255 / 255f, 153 / 255f, 153 / 255f), new Vector3f(255 / 255f, 51 / 255f, 153 / 255f), // Day new Vector3f(102 / 255f, 178 / 255f, 255 / 255f), new Vector3f(0 / 255f, 102 / 255f, 104 / 255f), // Evening new Vector3f(255 / 255f, 178 / 255f, 102 / 255f), new Vector3f(255 / 255f, 0 / 255f, 127 / 255f), // Night new Vector3f(51 / 255f, 0 / 255f, 102 / 255f), new Vector3f(25 / 255f, 0 / 255f, 51 / 255f), // Copy of morning new Vector3f(255 / 255f, 153 / 255f, 153 / 255f), new Vector3f(255 / 255f, 51 / 255f, 153 / 255f) }; private final float[] BG_ALPHAS = new float[] { 0f, 0f, .5f, 1f, 0f }; private final Texture starTexture; private float rotation; public Skybox() { this.shader = new SkyboxShader(); this.box = CubeGenerator.generateCube(SIZE); entities = new ArrayList<SkyboxEntity>(); skyEntRender = new SkyboxEntityRender(); /* * skyboxTexture = new CubemapTexture(new String[] { "sky/stars.png", * "sky/stars.png", "sky/stars.png", "sky/stars.png", "sky/stars.png", * "sky/stars.png" * * }); */ starTexture = Resources.addCubemap("skybox", "sky/stars_rgt.png", "sky/stars_lft.png", "sky/stars_top.png", "sky/stars_btm.png", "sky/stars_fnt.png", "sky/stars_bck.png"); GL11.glTexParameterf(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); } /** * Delete the shader when the game closes. */ public void cleanUp() { starTexture.delete(); shader.cleanUp(); skyEntRender.cleanUp(); } public void addEntity(SkyboxEntity entity) { entities.add(entity); } private void getColors(int gameTime, Vector3f tint, float influence) { final int currentCycle = (int) (gameTime / CYCLE_INTEVAL) * 2; final float cycleDuration = gameTime % CYCLE_INTEVAL / CYCLE_INTEVAL; alpha = MathUtil.lerp(BG_ALPHAS[currentCycle / 2], BG_ALPHAS[currentCycle / 2 + 1], cycleDuration); topColor.set(Vector3f.lerp(SKY_COLOR[currentCycle + 2], SKY_COLOR[currentCycle], cycleDuration)); bottomColor.set(Vector3f.lerp(SKY_COLOR[currentCycle + 3], SKY_COLOR[currentCycle + 1], cycleDuration)); topColor.set(Vector3f.lerp(topColor, Vector3f.mul(topColor, tint), influence)); bottomColor.set(Vector3f.lerp(bottomColor, Vector3f.mul(bottomColor, tint), influence)); } /** * Starts the shader, loads the projection-view matrix to the uniform variable, * and sets some OpenGL state which should be mostly self-explanatory. * * @param camera - the scene's camera. */ private void prepare(Camera camera) { shader.start(); final Matrix4f matrix = new Matrix4f(camera.getViewMatrix()); matrix.m30 = 0; matrix.m31 = 0; matrix.m32 = 0; // matrix.rotateX(camera.getPitch()); matrix.rotateY(rotation); rotation += Window.deltaTime / 10f; shader.projectionMatrix.loadMatrix(camera.getProjectionMatrix()); shader.viewMatrix.loadMatrix(matrix); /* * OpenGlUtils.disableBlending(); OpenGlUtils.enableDepthTesting(true); * OpenGlUtils.cullBackFaces(true); OpenGlUtils.antialias(false); */ } public void render(Camera camera, int time, Vector3f lightDirection, Vector3f tint, Vector3f weatherColor) { prepare(camera); box.bind(0); getColors(time, tint, .2f); starTexture.bind(0); shader.bgAlpha.loadFloat(alpha); shader.topColor.loadVec3(topColor); shader.bottomColor.loadVec3(bottomColor); shader.weatherColor.loadVec3(weatherColor); GL11.glDrawElements(GL11.GL_TRIANGLES, box.getIndexCount(), GL11.GL_UNSIGNED_INT, 0); box.unbind(0); shader.stop(); skyEntRender.render(camera, lightDirection, entities); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); } public Vector3f getTopColor() { return topColor; } }
UTF-8
Java
4,627
java
Skybox.java
Java
[]
null
[]
package gl.skybox; import java.util.ArrayList; import java.util.List; import org.joml.Matrix4f; import org.joml.Vector3f; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL13; import core.Resources; import gl.Camera; import gl.Window; import gl.res.Model; import gl.res.Texture; import gl.skybox.entity.SkyboxEntityRender; import map.Enviroment; import scene.entity.skybox.SkyboxEntity; import util.MathUtil; // This handles the logic between the player's character and the game public class Skybox { private static final float SIZE = 32; private static final float CYCLE_INTEVAL = Enviroment.CYCLE_LENGTH / 4f; private final SkyboxShader shader; private final Model box; private float alpha; private List<SkyboxEntity> entities; private SkyboxEntityRender skyEntRender; private final Vector3f topColor = new Vector3f(), bottomColor = new Vector3f(); private final Vector3f[] SKY_COLOR = new Vector3f[] { // Morning new Vector3f(255 / 255f, 153 / 255f, 153 / 255f), new Vector3f(255 / 255f, 51 / 255f, 153 / 255f), // Day new Vector3f(102 / 255f, 178 / 255f, 255 / 255f), new Vector3f(0 / 255f, 102 / 255f, 104 / 255f), // Evening new Vector3f(255 / 255f, 178 / 255f, 102 / 255f), new Vector3f(255 / 255f, 0 / 255f, 127 / 255f), // Night new Vector3f(51 / 255f, 0 / 255f, 102 / 255f), new Vector3f(25 / 255f, 0 / 255f, 51 / 255f), // Copy of morning new Vector3f(255 / 255f, 153 / 255f, 153 / 255f), new Vector3f(255 / 255f, 51 / 255f, 153 / 255f) }; private final float[] BG_ALPHAS = new float[] { 0f, 0f, .5f, 1f, 0f }; private final Texture starTexture; private float rotation; public Skybox() { this.shader = new SkyboxShader(); this.box = CubeGenerator.generateCube(SIZE); entities = new ArrayList<SkyboxEntity>(); skyEntRender = new SkyboxEntityRender(); /* * skyboxTexture = new CubemapTexture(new String[] { "sky/stars.png", * "sky/stars.png", "sky/stars.png", "sky/stars.png", "sky/stars.png", * "sky/stars.png" * * }); */ starTexture = Resources.addCubemap("skybox", "sky/stars_rgt.png", "sky/stars_lft.png", "sky/stars_top.png", "sky/stars_btm.png", "sky/stars_fnt.png", "sky/stars_bck.png"); GL11.glTexParameterf(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); } /** * Delete the shader when the game closes. */ public void cleanUp() { starTexture.delete(); shader.cleanUp(); skyEntRender.cleanUp(); } public void addEntity(SkyboxEntity entity) { entities.add(entity); } private void getColors(int gameTime, Vector3f tint, float influence) { final int currentCycle = (int) (gameTime / CYCLE_INTEVAL) * 2; final float cycleDuration = gameTime % CYCLE_INTEVAL / CYCLE_INTEVAL; alpha = MathUtil.lerp(BG_ALPHAS[currentCycle / 2], BG_ALPHAS[currentCycle / 2 + 1], cycleDuration); topColor.set(Vector3f.lerp(SKY_COLOR[currentCycle + 2], SKY_COLOR[currentCycle], cycleDuration)); bottomColor.set(Vector3f.lerp(SKY_COLOR[currentCycle + 3], SKY_COLOR[currentCycle + 1], cycleDuration)); topColor.set(Vector3f.lerp(topColor, Vector3f.mul(topColor, tint), influence)); bottomColor.set(Vector3f.lerp(bottomColor, Vector3f.mul(bottomColor, tint), influence)); } /** * Starts the shader, loads the projection-view matrix to the uniform variable, * and sets some OpenGL state which should be mostly self-explanatory. * * @param camera - the scene's camera. */ private void prepare(Camera camera) { shader.start(); final Matrix4f matrix = new Matrix4f(camera.getViewMatrix()); matrix.m30 = 0; matrix.m31 = 0; matrix.m32 = 0; // matrix.rotateX(camera.getPitch()); matrix.rotateY(rotation); rotation += Window.deltaTime / 10f; shader.projectionMatrix.loadMatrix(camera.getProjectionMatrix()); shader.viewMatrix.loadMatrix(matrix); /* * OpenGlUtils.disableBlending(); OpenGlUtils.enableDepthTesting(true); * OpenGlUtils.cullBackFaces(true); OpenGlUtils.antialias(false); */ } public void render(Camera camera, int time, Vector3f lightDirection, Vector3f tint, Vector3f weatherColor) { prepare(camera); box.bind(0); getColors(time, tint, .2f); starTexture.bind(0); shader.bgAlpha.loadFloat(alpha); shader.topColor.loadVec3(topColor); shader.bottomColor.loadVec3(bottomColor); shader.weatherColor.loadVec3(weatherColor); GL11.glDrawElements(GL11.GL_TRIANGLES, box.getIndexCount(), GL11.GL_UNSIGNED_INT, 0); box.unbind(0); shader.stop(); skyEntRender.render(camera, lightDirection, entities); GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); } public Vector3f getTopColor() { return topColor; } }
4,627
0.712341
0.657662
139
32.287769
30.989031
109
false
false
0
0
0
0
0
0
2.359712
false
false
2
4062d290fc7edddc409c0a10acc5dff25c023bef
28,011,776,706,925
a3616530525c95a73d6820ff2cbaf782988f9f35
/src/junk/Display.java
f4b8ca7ac1e575ad2e2fe104d953b938b681ffa0
[]
no_license
Kiranatos/Examples
https://github.com/Kiranatos/Examples
1bb2ad9836d09c1a8bff884e3980e07548938086
a3eb8904381f316014b1a06be92ea6bcad1baf89
refs/heads/master
2021-01-21T03:55:58.911000
2017-08-30T16:02:19
2017-08-30T16:02:19
101,902,468
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package junk; /* Game_Tanks package tanks; Display */ import java.awt.BorderLayout; import java.awt.Dimension; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class Display { public static void start (int width, int height, String title) { JFrame window = new JFrame(title); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Dimension size = new Dimension(width, height); window.setResizable(true); window.setMinimumSize(size); window.pack(); //Изменит размер окна, так чтобы он подходил под размер контента window.setLocationRelativeTo(null); //окно появляется по центру экрана window.setVisible(true); JPanel mPanel = new JPanel(); mPanel.setLayout(new BorderLayout()); window.getContentPane().add(mPanel, BorderLayout.CENTER); mPanel.add(new JButton("center"), BorderLayout.NORTH); mPanel.add(new JButton("center"), BorderLayout.WEST); mPanel.add(new JButton("center"), BorderLayout.CENTER); mPanel.add(new JButton("center"), BorderLayout.EAST); mPanel.add(new JButton("center"), BorderLayout.SOUTH); } }
UTF-8
Java
1,416
java
Display.java
Java
[]
null
[]
package junk; /* Game_Tanks package tanks; Display */ import java.awt.BorderLayout; import java.awt.Dimension; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class Display { public static void start (int width, int height, String title) { JFrame window = new JFrame(title); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Dimension size = new Dimension(width, height); window.setResizable(true); window.setMinimumSize(size); window.pack(); //Изменит размер окна, так чтобы он подходил под размер контента window.setLocationRelativeTo(null); //окно появляется по центру экрана window.setVisible(true); JPanel mPanel = new JPanel(); mPanel.setLayout(new BorderLayout()); window.getContentPane().add(mPanel, BorderLayout.CENTER); mPanel.add(new JButton("center"), BorderLayout.NORTH); mPanel.add(new JButton("center"), BorderLayout.WEST); mPanel.add(new JButton("center"), BorderLayout.CENTER); mPanel.add(new JButton("center"), BorderLayout.EAST); mPanel.add(new JButton("center"), BorderLayout.SOUTH); } }
1,416
0.616018
0.616018
49
25.265306
25.179985
87
false
false
0
0
0
0
0
0
0.673469
false
false
2
acfa67a54100699ce72175212aff7be276e5d64b
18,837,726,624,992
231ad1827939bd73e8591a70481555361a88b05c
/src/main/java/sdmx/common/AnnotationType.java
c21afbafcb7125cf24e2f45f203bf42877b854e2
[ "MIT" ]
permissive
kalessine/sdmx-sax-parser
https://github.com/kalessine/sdmx-sax-parser
987e607a04dc80a4d3b6b76b034c2d21d969ccbb
0bb83a80ed7329155cfef3c34b403b78775739b9
refs/heads/master
2023-07-07T15:27:36.470000
2023-07-02T00:29:33
2023-07-02T00:29:33
248,544,799
0
0
MIT
false
2022-01-28T18:01:25
2020-03-19T15:57:24
2021-03-04T10:59:22
2022-01-28T18:01:25
25,895
0
0
12
Java
false
false
/* This file is part of sdmx-sax. Copyright 2015 James Stanley Gardner Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package sdmx.common; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.ArrayList; import java.util.List; /** * <xs:complexType name="AnnotationType"> * <xs:annotation> * <xs:documentation>AnnotationType provides for non-documentation notes and * annotations to be embedded in data and structure messages. It provides * optional fields for providing a title, a type description, a URI, and the * text of the annotation.</xs:documentation> * </xs:annotation> * <xs:sequence> * <xs:element name="AnnotationTitle" type="xs:string" minOccurs="0"> * <xs:annotation> * <xs:documentation>AnnotationTitle provides a title for the * annotation.</xs:documentation> * </xs:annotation> * </xs:element> * <xs:element name="AnnotationType" type="xs:string" minOccurs="0"> * <xs:annotation> * <xs:documentation>AnnotationType is used to distinguish between annotations * designed to support various uses. The types are not enumerated, as these can * be specified by the user or creator of the annotations. The definitions and * use of annotation types should be documented by their * creator.</xs:documentation> * </xs:annotation> * </xs:element> * <xs:element name="AnnotationURL" type="xs:anyURI" minOccurs="0"> * <xs:annotation> * <xs:documentation>AnnotationURL is a URI - typically a URL - which points to * an external resource which may contain or supplement the annotation. If a * specific behavior is desired, an annotation type should be defined which * specifies the use of this field more exactly.</xs:documentation> * </xs:annotation> * </xs:element> * <xs:element name="AnnotationText" type="TextType" minOccurs="0" maxOccurs="unbounded"> * <xs:annotation> * <xs:documentation>AnnotationText holds a language-specific string containing * the text of the annotation.</xs:documentation> * </xs:annotation> * </xs:element> * </xs:sequence> * <xs:attribute name="id" type="xs:string" use="optional"> * <xs:annotation> * <xs:documentation>The id attribute provides a non-standard identification of * an annotation. It can be used to disambiguate annotations.</xs:documentation> * </xs:annotation> * </xs:attribute> * </xs:complexType> * * @author James */ public class AnnotationType implements Serializable { private String annotationTitle = null; private String annotationType = null; private String annotationUrl = null; private List<TextType> annotationText = new ArrayList<TextType>(); private String id = null; public AnnotationType() { } public AnnotationType(String tit, String ty, String url, List<TextType> text, String id) { this.annotationTitle = tit; this.annotationType = ty; this.annotationUrl = url; this.annotationText = text; this.id = id; } public AnnotationType(String tit, String ty, String url, List<TextType> text) { this.annotationTitle = tit; this.annotationType = ty; this.annotationUrl = url; this.annotationText = text; } /** * @return the annotationTitle */ public String getAnnotationTitle() { return annotationTitle; } public void addAnnotationText(TextType tt) { this.annotationText.add(tt); } public TextType removeAnnotationText(TextType tt) { this.annotationText.remove(tt); return tt; } /** * @param annotationTitle the annotationTitle to set */ public void setAnnotationTitle(String annotationTitle) { this.annotationTitle = annotationTitle; } /** * @return the annotationType */ public String getAnnotationType() { return annotationType; } /** * @param annotationType the annotationType to set */ public void setAnnotationType(String annotationType) { this.annotationType = annotationType; } /** * @return the annotationUrl */ public String getAnnotationUrl() { return annotationUrl; } /** * @param annotationUrl the annotationUrl to set */ public void setAnnotationUrl(String annotationUrl) { this.annotationUrl = annotationUrl; } /** * @return the annotationText */ public List<TextType> getAnnotationText() { return annotationText; } /** * @param annotationText the annotationText to set */ public void setAnnotationText(List<TextType> annotationText) { this.annotationText = annotationText; } /** * @return the id */ public String getId() { return id; } /** * @param id the id to set */ public void setId(String id) { this.id = id; } private void writeObject(ObjectOutputStream oos) throws IOException { if (annotationTitle == null) { oos.writeUTF(""); } else { oos.writeUTF(annotationTitle); } if (annotationType == null) { oos.writeUTF(""); } else { oos.writeUTF(annotationType); } if (annotationUrl == null) { oos.writeUTF(""); } else { oos.writeUTF(annotationUrl); } if (id == null) { oos.writeUTF(""); } else { oos.writeUTF(id); } oos.writeObject(this.annotationText); } private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { annotationTitle = ois.readUTF(); annotationType = ois.readUTF(); annotationUrl = ois.readUTF(); id = ois.readUTF(); annotationText = (List<TextType>) ois.readObject(); } }
UTF-8
Java
6,853
java
AnnotationType.java
Java
[ { "context": " This file is part of sdmx-sax.\n\nCopyright 2015 James Stanley Gardner\nPermission is hereby granted, free of charge, to ", "end": 75, "score": 0.9997404217720032, "start": 54, "tag": "NAME", "value": "James Stanley Gardner" }, { "context": "</xs:attribute>\n * </xs:complexType>\n *\n * @author James\n */\npublic class AnnotationType implements Serial", "end": 3389, "score": 0.999452531337738, "start": 3384, "tag": "NAME", "value": "James" } ]
null
[]
/* This file is part of sdmx-sax. Copyright 2015 <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package sdmx.common; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.ArrayList; import java.util.List; /** * <xs:complexType name="AnnotationType"> * <xs:annotation> * <xs:documentation>AnnotationType provides for non-documentation notes and * annotations to be embedded in data and structure messages. It provides * optional fields for providing a title, a type description, a URI, and the * text of the annotation.</xs:documentation> * </xs:annotation> * <xs:sequence> * <xs:element name="AnnotationTitle" type="xs:string" minOccurs="0"> * <xs:annotation> * <xs:documentation>AnnotationTitle provides a title for the * annotation.</xs:documentation> * </xs:annotation> * </xs:element> * <xs:element name="AnnotationType" type="xs:string" minOccurs="0"> * <xs:annotation> * <xs:documentation>AnnotationType is used to distinguish between annotations * designed to support various uses. The types are not enumerated, as these can * be specified by the user or creator of the annotations. The definitions and * use of annotation types should be documented by their * creator.</xs:documentation> * </xs:annotation> * </xs:element> * <xs:element name="AnnotationURL" type="xs:anyURI" minOccurs="0"> * <xs:annotation> * <xs:documentation>AnnotationURL is a URI - typically a URL - which points to * an external resource which may contain or supplement the annotation. If a * specific behavior is desired, an annotation type should be defined which * specifies the use of this field more exactly.</xs:documentation> * </xs:annotation> * </xs:element> * <xs:element name="AnnotationText" type="TextType" minOccurs="0" maxOccurs="unbounded"> * <xs:annotation> * <xs:documentation>AnnotationText holds a language-specific string containing * the text of the annotation.</xs:documentation> * </xs:annotation> * </xs:element> * </xs:sequence> * <xs:attribute name="id" type="xs:string" use="optional"> * <xs:annotation> * <xs:documentation>The id attribute provides a non-standard identification of * an annotation. It can be used to disambiguate annotations.</xs:documentation> * </xs:annotation> * </xs:attribute> * </xs:complexType> * * @author James */ public class AnnotationType implements Serializable { private String annotationTitle = null; private String annotationType = null; private String annotationUrl = null; private List<TextType> annotationText = new ArrayList<TextType>(); private String id = null; public AnnotationType() { } public AnnotationType(String tit, String ty, String url, List<TextType> text, String id) { this.annotationTitle = tit; this.annotationType = ty; this.annotationUrl = url; this.annotationText = text; this.id = id; } public AnnotationType(String tit, String ty, String url, List<TextType> text) { this.annotationTitle = tit; this.annotationType = ty; this.annotationUrl = url; this.annotationText = text; } /** * @return the annotationTitle */ public String getAnnotationTitle() { return annotationTitle; } public void addAnnotationText(TextType tt) { this.annotationText.add(tt); } public TextType removeAnnotationText(TextType tt) { this.annotationText.remove(tt); return tt; } /** * @param annotationTitle the annotationTitle to set */ public void setAnnotationTitle(String annotationTitle) { this.annotationTitle = annotationTitle; } /** * @return the annotationType */ public String getAnnotationType() { return annotationType; } /** * @param annotationType the annotationType to set */ public void setAnnotationType(String annotationType) { this.annotationType = annotationType; } /** * @return the annotationUrl */ public String getAnnotationUrl() { return annotationUrl; } /** * @param annotationUrl the annotationUrl to set */ public void setAnnotationUrl(String annotationUrl) { this.annotationUrl = annotationUrl; } /** * @return the annotationText */ public List<TextType> getAnnotationText() { return annotationText; } /** * @param annotationText the annotationText to set */ public void setAnnotationText(List<TextType> annotationText) { this.annotationText = annotationText; } /** * @return the id */ public String getId() { return id; } /** * @param id the id to set */ public void setId(String id) { this.id = id; } private void writeObject(ObjectOutputStream oos) throws IOException { if (annotationTitle == null) { oos.writeUTF(""); } else { oos.writeUTF(annotationTitle); } if (annotationType == null) { oos.writeUTF(""); } else { oos.writeUTF(annotationType); } if (annotationUrl == null) { oos.writeUTF(""); } else { oos.writeUTF(annotationUrl); } if (id == null) { oos.writeUTF(""); } else { oos.writeUTF(id); } oos.writeObject(this.annotationText); } private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { annotationTitle = ois.readUTF(); annotationType = ois.readUTF(); annotationUrl = ois.readUTF(); id = ois.readUTF(); annotationText = (List<TextType>) ois.readObject(); } }
6,838
0.675762
0.674595
208
31.947115
31.213781
147
false
false
0
0
0
0
0
0
0.399038
false
false
2
316231cc8dfd80b49f1ccd0d068dfef89ba1b64a
31,464,930,472,929
ca2b72ad4c5a853ab519cc590204260002c83381
/java/ch12_abstractclass/src/com/lec/ex06_lunch/Chuld2.java
a3098111533f9cc5bdf329562e08f0470c9a4837
[]
no_license
nvmr6/BIGDATA
https://github.com/nvmr6/BIGDATA
b431100b3969c53d5f9438380bce00ec27172e01
79ec5389cec876353956f9623444a710857b34d9
refs/heads/main
2023-04-23T06:22:21.872000
2021-05-09T03:33:13
2021-05-09T03:33:13
317,541,715
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lec.ex06_lunch; public class Chuld2 extends LunchMenu{ public Chuld2(int rice, int bulgogi, int soup, int milk, int banana, int almond) { super(rice, bulgogi, soup, milk, banana, almond); } @Override public int calculate() { return getRice()+getBulgogi()+getSoup()+getMilk(); } }
UTF-8
Java
315
java
Chuld2.java
Java
[]
null
[]
package com.lec.ex06_lunch; public class Chuld2 extends LunchMenu{ public Chuld2(int rice, int bulgogi, int soup, int milk, int banana, int almond) { super(rice, bulgogi, soup, milk, banana, almond); } @Override public int calculate() { return getRice()+getBulgogi()+getSoup()+getMilk(); } }
315
0.68254
0.669841
12
24.25
25.891199
83
false
false
0
0
0
0
0
0
1.833333
false
false
2
46ab072c4845b8ca4780b7eb5c9dc57d2cbc2934
566,935,750,448
dda1fa68d3e34979ef8c5563b4b2ab18f86064df
/mat/src/mat/client/shared/MultiListBoxMVP.java
2e499dbd51cd788fb1d81973ea625c17c92a78bc
[]
no_license
suesse/cmat
https://github.com/suesse/cmat
497ea7dbebda0a1f790980a783e8b84eb26950c3
c8ed859f880a49a776cddc746051945d87c2959b
refs/heads/master
2020-04-08T01:23:16.296000
2013-02-14T14:59:24
2013-02-14T14:59:24
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package mat.client.shared; import java.util.ArrayList; import java.util.List; import com.google.gwt.event.dom.client.ChangeEvent; import com.google.gwt.event.dom.client.ChangeHandler; import com.google.gwt.event.logical.shared.ValueChangeEvent; import com.google.gwt.event.logical.shared.ValueChangeHandler; import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.user.client.ui.HasValue; import com.google.gwt.user.client.ui.ListBox; public class MultiListBoxMVP extends ListBox implements HasValue<List<String>> { public MultiListBoxMVP() { super(true); addChangeHandler( new ChangeHandler() { public void onChange(ChangeEvent event) { ValueChangeEvent.fire(MultiListBoxMVP.this, getValue()); } }); } public HandlerRegistration addValueChangeHandler( ValueChangeHandler<List<String>> handler) { return super.addHandler(handler, ValueChangeEvent.getType()); } public List<String> getValue() { List<String> values = new ArrayList<String>(); for(int i = 0; i < getItemCount(); i++) { if(isItemSelected(i)) { values.add(getValue(i)); } } return values; } public void setValue(List<String> values) { setValue(values, false); } public void setValue(List<String> values, boolean fireEvents) { for(int i = 0; i < getItemCount(); i++) { if(values.contains(getValue(i))) { setItemSelected(i, true); } else { setItemSelected(i, false); } } if(fireEvents) { ValueChangeEvent.fire(this, getValue()); } } public void setDropdownOptions(List<NameValuePair> options) { clear(); addItem(""); for(NameValuePair p : options) { addItem(p.getValue(), p.getName()); } } }
UTF-8
Java
1,689
java
MultiListBoxMVP.java
Java
[]
null
[]
package mat.client.shared; import java.util.ArrayList; import java.util.List; import com.google.gwt.event.dom.client.ChangeEvent; import com.google.gwt.event.dom.client.ChangeHandler; import com.google.gwt.event.logical.shared.ValueChangeEvent; import com.google.gwt.event.logical.shared.ValueChangeHandler; import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.user.client.ui.HasValue; import com.google.gwt.user.client.ui.ListBox; public class MultiListBoxMVP extends ListBox implements HasValue<List<String>> { public MultiListBoxMVP() { super(true); addChangeHandler( new ChangeHandler() { public void onChange(ChangeEvent event) { ValueChangeEvent.fire(MultiListBoxMVP.this, getValue()); } }); } public HandlerRegistration addValueChangeHandler( ValueChangeHandler<List<String>> handler) { return super.addHandler(handler, ValueChangeEvent.getType()); } public List<String> getValue() { List<String> values = new ArrayList<String>(); for(int i = 0; i < getItemCount(); i++) { if(isItemSelected(i)) { values.add(getValue(i)); } } return values; } public void setValue(List<String> values) { setValue(values, false); } public void setValue(List<String> values, boolean fireEvents) { for(int i = 0; i < getItemCount(); i++) { if(values.contains(getValue(i))) { setItemSelected(i, true); } else { setItemSelected(i, false); } } if(fireEvents) { ValueChangeEvent.fire(this, getValue()); } } public void setDropdownOptions(List<NameValuePair> options) { clear(); addItem(""); for(NameValuePair p : options) { addItem(p.getValue(), p.getName()); } } }
1,689
0.711664
0.71048
65
24.984615
22.381649
80
false
false
0
0
0
0
0
0
2.184615
false
false
2
668d7305a60319f687b9a58d0849eadc6b82d238
12,824,772,404,283
1be747734f154eb309fadc2f8a1badc274e38143
/Test.java
53a6c70cb42fea19a3a4b5c81ecc1769fe97db12
[]
no_license
mbojey/IUIclassproject
https://github.com/mbojey/IUIclassproject
029a297ae57250a150a54e24c40a864acb4a0d75
75d4a5b7749ea6dc2ae2f0ab418334d97cd8adc2
refs/heads/master
2021-01-22T16:25:47.188000
2013-07-01T20:54:59
2013-07-01T20:54:59
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package foo; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Scanner; public class Test { public static double isBoss = 0; public static double isntBoss = 0; public static double getBoss(){ return isBoss; } public static double getnotBoss(){ return isntBoss; } public static void main(String[] args) throws IOException { Runtime.getRuntime() .exec("C:/Users/Ethan/Documents/OtherKinectStuff/TestStuff/bin/Release/JNECTSUCKS.exe"); Bayes_net test = new Bayes_net(); double[][] CPTMid = { { .7, .2, .1 }, { .1, .2, .7 } }; double[][] CPTArms = { { .5, .3, .2 }, { .2, .3, .5 } }; double[][] CPTLegs = { { .6, .25, .15 }, { .15, .25, .6 } }; double[] initial = { 1 / 2.0, 1 / 2.0 }; double[][]other = {{.8,.2},{.2,.8}}; double[][]other1 = {{.7,.3},{.3,.7}}; test.add_vertex("Bowen", 2, initial); test.add_vertex("Height", 2); test.add_vertex("BodyType", 2); test.add_vertex("Shoulder", 3); test.add_vertex("Hip", 3); test.add_vertex("LeftArm", 3); test.add_vertex("RightArm", 3); test.add_vertex("LeftThigh", 3); test.add_vertex("RightThigh", 3); test.add_vertex("Neck", 3); test.add_vertex("LeftTorso", 3); test.add_vertex("CenterTorso", 3); test.add_vertex("RightTorso", 3); test.add_edge("Bowen", 2, "BodyType", 2, other); test.add_edge("Bowen", 2, "Height", 2, other1); test.add_edge("BodyType", 2, "Shoulder", 3, CPTMid); test.add_edge("BodyType", 2, "Hip", 3, CPTMid); test.add_edge("Height", 2, "LeftArm", 3, CPTArms); test.add_edge("Height", 2, "RightArm", 3, CPTArms); test.add_edge("Height", 2, "LeftThigh", 3, CPTLegs); test.add_edge("Height", 2, "RightThigh", 3, CPTLegs); test.add_edge("Height", 2, "Neck", 3, CPTMid); test.add_edge("Height", 2, "LeftTorso", 3, CPTMid); test.add_edge("Height", 2, "RightTorso", 3, CPTMid); test.add_edge("Height", 2, "CenterTorso", 3, CPTMid); JoinTree sample = test.convertToJoinTree(); sample.makeConsistent(); Vertex<String> Hip = new Vertex<String>("Hip", 3); Vertex<String> Shoulder = new Vertex<String>("Shoulder", 3); Vertex<String> LeftArm = new Vertex<String>("LeftArm", 3); Vertex<String> RightArm = new Vertex<String>("RightArm", 3); Vertex<String> LeftThigh = new Vertex<String>("LeftThigh", 3); Vertex<String> RightThigh = new Vertex<String>("RightThigh", 3); Vertex<String> Neck = new Vertex<String>("Neck", 3); Vertex<String> LeftTorso = new Vertex<String>("LeftTorso", 3); Vertex<String> CenterTorso = new Vertex<String>("CenterTorso", 3); Vertex<String> RightTorso = new Vertex<String>("RightTorso", 3); double[] realValues = null, newValues = null; for(int m = 0; m < 4; m++){ try { realValues = new double[10]; int i = 0; File file = new File("REALONE.txt"); Scanner scan = new Scanner(file); scan.useDelimiter(","); String line = null; while (scan.hasNext() && i < 10) { line = scan.next(); realValues[i++] = Double.parseDouble(line); System.out.print(line + ","); } System.out.println(); scan.close(); } catch (FileNotFoundException e) { System.out.println("Didn't Work"); } while (newValues == null) { if (System.nanoTime() % 10 == 0) { try { int i = 0; File file = new File("CURRENTONE.txt"); file.deleteOnExit(); Scanner scan = new Scanner(file); scan.useDelimiter(","); String line = null; newValues = new double[10]; while (scan.hasNext() & i < 10) { line = scan.next(); newValues[i++] = Double.parseDouble(line); System.out.print(line + ","); } System.out.println(); scan.close(); file.delete(); } catch (FileNotFoundException e) { // System.out.println("Didn't Work"); } } } int[] evidence = new int[10]; for (int i = 0; i < evidence.length; i++) { if (Math.abs(realValues[i] - newValues[i]) < 0.008) if (Math.abs(realValues[i] - newValues[i]) < 0.004) evidence[i] = 0; else evidence[i] = 1; else evidence[i] = 2; } sample.enter_evidence(Hip, evidence[3]); sample.enter_evidence(Shoulder, evidence[2]); sample.enter_evidence(LeftArm, evidence[0]); sample.enter_evidence(RightArm, evidence[1]); sample.enter_evidence(LeftThigh, evidence[5]); sample.enter_evidence(RightThigh, evidence[6]); sample.enter_evidence(Neck, evidence[4]); sample.enter_evidence(LeftTorso, evidence[7]); sample.enter_evidence(RightTorso, evidence[8]); sample.enter_evidence(CenterTorso, evidence[9]); Vertex<String> Bowen = new Vertex<String>("Bowen", 2); double[] result = sample.find_probability(Bowen); File file1 = new File("CURRENTONE.txt"); file1.delete(); isBoss = result[0]; isntBoss = result[1]; File file = new File("working.txt"); Scanner scan = new Scanner(file); scan.useDelimiter(","); String line = null; newValues = new double[2]; int i = 0; while (scan.hasNext() && i < 2) { line = scan.next(); newValues[i++] = Double.parseDouble(line); } scan.close(); double isworking = newValues[0]; double isnotworking = newValues[1]; newValues = null; System.out.println(result[0] + " " + result[1]+" "+ isworking+" "+isnotworking); Test.isBoss = 0; Test.isntBoss = 0; if (isworking != 0) expectedutility.determineaction(result[0], result[1], isworking, isnotworking); if (expectedutility.action){ System.setErr(null); App ex = new App("http://stackoverflow.com/questions/17266383/check-if-the-user-name-is-entered-in-edittext-already-exists-in-the-sql-database"); } } } }
UTF-8
Java
5,577
java
Test.java
Java
[ { "context": "ion {\n\t\tRuntime.getRuntime()\n\t\t\t\t.exec(\"C:/Users/Ethan/Documents/OtherKinectStuff/TestStuff/bin/Release/", "end": 439, "score": 0.7731215357780457, "start": 435, "tag": "NAME", "value": "than" } ]
null
[]
package foo; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Scanner; public class Test { public static double isBoss = 0; public static double isntBoss = 0; public static double getBoss(){ return isBoss; } public static double getnotBoss(){ return isntBoss; } public static void main(String[] args) throws IOException { Runtime.getRuntime() .exec("C:/Users/Ethan/Documents/OtherKinectStuff/TestStuff/bin/Release/JNECTSUCKS.exe"); Bayes_net test = new Bayes_net(); double[][] CPTMid = { { .7, .2, .1 }, { .1, .2, .7 } }; double[][] CPTArms = { { .5, .3, .2 }, { .2, .3, .5 } }; double[][] CPTLegs = { { .6, .25, .15 }, { .15, .25, .6 } }; double[] initial = { 1 / 2.0, 1 / 2.0 }; double[][]other = {{.8,.2},{.2,.8}}; double[][]other1 = {{.7,.3},{.3,.7}}; test.add_vertex("Bowen", 2, initial); test.add_vertex("Height", 2); test.add_vertex("BodyType", 2); test.add_vertex("Shoulder", 3); test.add_vertex("Hip", 3); test.add_vertex("LeftArm", 3); test.add_vertex("RightArm", 3); test.add_vertex("LeftThigh", 3); test.add_vertex("RightThigh", 3); test.add_vertex("Neck", 3); test.add_vertex("LeftTorso", 3); test.add_vertex("CenterTorso", 3); test.add_vertex("RightTorso", 3); test.add_edge("Bowen", 2, "BodyType", 2, other); test.add_edge("Bowen", 2, "Height", 2, other1); test.add_edge("BodyType", 2, "Shoulder", 3, CPTMid); test.add_edge("BodyType", 2, "Hip", 3, CPTMid); test.add_edge("Height", 2, "LeftArm", 3, CPTArms); test.add_edge("Height", 2, "RightArm", 3, CPTArms); test.add_edge("Height", 2, "LeftThigh", 3, CPTLegs); test.add_edge("Height", 2, "RightThigh", 3, CPTLegs); test.add_edge("Height", 2, "Neck", 3, CPTMid); test.add_edge("Height", 2, "LeftTorso", 3, CPTMid); test.add_edge("Height", 2, "RightTorso", 3, CPTMid); test.add_edge("Height", 2, "CenterTorso", 3, CPTMid); JoinTree sample = test.convertToJoinTree(); sample.makeConsistent(); Vertex<String> Hip = new Vertex<String>("Hip", 3); Vertex<String> Shoulder = new Vertex<String>("Shoulder", 3); Vertex<String> LeftArm = new Vertex<String>("LeftArm", 3); Vertex<String> RightArm = new Vertex<String>("RightArm", 3); Vertex<String> LeftThigh = new Vertex<String>("LeftThigh", 3); Vertex<String> RightThigh = new Vertex<String>("RightThigh", 3); Vertex<String> Neck = new Vertex<String>("Neck", 3); Vertex<String> LeftTorso = new Vertex<String>("LeftTorso", 3); Vertex<String> CenterTorso = new Vertex<String>("CenterTorso", 3); Vertex<String> RightTorso = new Vertex<String>("RightTorso", 3); double[] realValues = null, newValues = null; for(int m = 0; m < 4; m++){ try { realValues = new double[10]; int i = 0; File file = new File("REALONE.txt"); Scanner scan = new Scanner(file); scan.useDelimiter(","); String line = null; while (scan.hasNext() && i < 10) { line = scan.next(); realValues[i++] = Double.parseDouble(line); System.out.print(line + ","); } System.out.println(); scan.close(); } catch (FileNotFoundException e) { System.out.println("Didn't Work"); } while (newValues == null) { if (System.nanoTime() % 10 == 0) { try { int i = 0; File file = new File("CURRENTONE.txt"); file.deleteOnExit(); Scanner scan = new Scanner(file); scan.useDelimiter(","); String line = null; newValues = new double[10]; while (scan.hasNext() & i < 10) { line = scan.next(); newValues[i++] = Double.parseDouble(line); System.out.print(line + ","); } System.out.println(); scan.close(); file.delete(); } catch (FileNotFoundException e) { // System.out.println("Didn't Work"); } } } int[] evidence = new int[10]; for (int i = 0; i < evidence.length; i++) { if (Math.abs(realValues[i] - newValues[i]) < 0.008) if (Math.abs(realValues[i] - newValues[i]) < 0.004) evidence[i] = 0; else evidence[i] = 1; else evidence[i] = 2; } sample.enter_evidence(Hip, evidence[3]); sample.enter_evidence(Shoulder, evidence[2]); sample.enter_evidence(LeftArm, evidence[0]); sample.enter_evidence(RightArm, evidence[1]); sample.enter_evidence(LeftThigh, evidence[5]); sample.enter_evidence(RightThigh, evidence[6]); sample.enter_evidence(Neck, evidence[4]); sample.enter_evidence(LeftTorso, evidence[7]); sample.enter_evidence(RightTorso, evidence[8]); sample.enter_evidence(CenterTorso, evidence[9]); Vertex<String> Bowen = new Vertex<String>("Bowen", 2); double[] result = sample.find_probability(Bowen); File file1 = new File("CURRENTONE.txt"); file1.delete(); isBoss = result[0]; isntBoss = result[1]; File file = new File("working.txt"); Scanner scan = new Scanner(file); scan.useDelimiter(","); String line = null; newValues = new double[2]; int i = 0; while (scan.hasNext() && i < 2) { line = scan.next(); newValues[i++] = Double.parseDouble(line); } scan.close(); double isworking = newValues[0]; double isnotworking = newValues[1]; newValues = null; System.out.println(result[0] + " " + result[1]+" "+ isworking+" "+isnotworking); Test.isBoss = 0; Test.isntBoss = 0; if (isworking != 0) expectedutility.determineaction(result[0], result[1], isworking, isnotworking); if (expectedutility.action){ System.setErr(null); App ex = new App("http://stackoverflow.com/questions/17266383/check-if-the-user-name-is-entered-in-edittext-already-exists-in-the-sql-database"); } } } }
5,577
0.633853
0.606778
159
34.07547
20.483326
148
false
false
0
0
0
0
72
0.01291
3.949686
false
false
2
d480166aabcd298acbffeb4dc64c2e6953384639
6,073,083,769,190
26a93bed47a45b221a05c4540dbef20c2addf683
/app/src/main/java/app/kbs/baseballstadiumclientcommon/assist/Configuration.java
8fd365ad29bf42f05c40189867d65e568a75ac37
[]
no_license
detective9094/baseballstadium
https://github.com/detective9094/baseballstadium
18a23f844d0a93b511a254bb69c2835f21ab72ba
1853ea7d53e99590386e604fcb89b0070ae2a544
refs/heads/master
2016-08-03T08:22:07.692000
2015-02-16T10:22:36
2015-02-16T10:22:36
30,686,529
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Configuration.java * * Created by UBIVELOX on 2012.08.28 * Copyright __UBIVELOX & SK Planet__. All right reserved. **/ package app.kbs.baseballstadiumclientcommon.assist; import java.util.HashMap; public class Configuration { /************************************************************************************************************** * static property * * Below the eight values is often used. That's why it is used as a variable. * Others value must be used HashMap or Preference. **************************************************************************************************************/ public static final boolean SUPPORT_DEBUG = true; public static final boolean SUPPORT_PACKAGE_LOG = false; // if true, show log EXCLUSIVE_PACKAGE_NAME. public static final boolean SUPPORT_MAIN_THREAD_LOG = false; public static final boolean SUPPORT_DATA_THREAD_LOG = false; public static final boolean SUPPORT_SCDOWNLOADER_LOG = false; // T store Downloader log public static final boolean SUPPORT_BGDOWNLOADER_LOG = false; // OMPDL Log public static final boolean SUPPORT_UI_LOG = false; // UI Component log public static final boolean SUPPORT_PROTOCOL_LOG = true; // Server Protocol log public static final String[] EXCLUSIVE_PACKAGE_NAME = {"com.skp.tstore.comm" , "com.skp.tstore.dataprotocols.DataManagerImpl" //, "com.skp.tstore.dataprotocols" }; public static boolean SUPPORT_USE_ALWAYS_WIFI = false; public static int PHONE_STATE = IAssist.STATE_NOT_CHECK_PHONE_STATUS; // 단말 상태 - 초기 세팅해 줘야함 public static final class Emul { public static boolean ENABLE = false; public static String X_PLANET_NETWORK_INFO = "\"lte\";operator=\"450/05\",sim-operator=\"450/05\""; public static String MDN = ""; public static String IMEI = ""; // public static String MODEL_NAME = "SHV-E250S"; public static String MODEL_NAME = ""; public static String MANUFACTURERER = ""; public static String USER_AGENT = "";//"Android/4.1 (" + MODEL_NAME + ";resolution=720*1280;dpi=320) Tstore-Svc/1.0 (com.skt.skaf.A000Z00040/92)"; public static String USER_AGENTV4 = "";//"Android/4.1 (" + MODEL_NAME + ";resolution=720*1280;dpi=320) Tstore-SC/1.0 (com.skt.skaf.A000Z00040/92)"; public static String DEVICE_INFO = "";//model=" + MODEL_NAME + ",fwVersion=4.1.1,pkgVersion=com.skt.skaf.A000Z00040/92"; public static String MODEL = "";//"SSOD"; public static String UA_PROFILE_DATA = "";//"010FCSSOD0000800999442216"; public static String CARRIER = IAssist.TELECOM_SKT; } public static final String MEMORY_RUNTIME = "RUNTIME"; public static final String MEMORY_DEBUG = "DEBUG"; private static final HashMap<String, HashMap<String, String> > m_mapCategoryKeyValue = new HashMap<String, HashMap<String, String> >(); private static HashMap<String, String> getCategoryMap(String category) { HashMap<String, String> categoryMap = m_mapCategoryKeyValue.get(category); if(categoryMap == null){ categoryMap = new HashMap<String, String>(); m_mapCategoryKeyValue.put(category, categoryMap); } return categoryMap; } public static void put(String category, String key, String value) { if (value == null) { return ; } getCategoryMap(category).put(key, value); } public static void put(String category, String key, int value) { getCategoryMap(category).put(key, String.valueOf(value)); } public static void put(String category, String key, boolean value) { getCategoryMap(category).put(key, String.valueOf(value)); } public static String getString(String category, String key) { return getCategoryMap(category).get(key); } public static int getInt(String category, String key) { if(getCategoryMap(category).containsKey(key)){ return Integer.parseInt(getCategoryMap(category).get(key)); } return 0; } public static boolean getBoolean(String category, String key) { if (getCategoryMap(category).containsKey(key)) { return Boolean.parseBoolean(getCategoryMap(category).get(key)); } return false; } public static boolean getBoolean(String category, String key, boolean bDefault) { if (getCategoryMap(category).containsKey(key)) { return Boolean.parseBoolean(getCategoryMap(category).get(key)); } put(category, key, bDefault); return bDefault; } public static boolean hasKey(String category, String key) { return getCategoryMap(category).containsKey(key); } public static void removeKey(String category, String key) { getCategoryMap(category).remove(key); } public static void clear(String category) { getCategoryMap(category).clear(); } }
UTF-8
Java
4,932
java
Configuration.java
Java
[ { "context": "/**\r\n * Configuration.java\r\n * \r\n * Created by UBIVELOX on 2012.08.28\r\n * Copyright __UBIVELOX & SK Plan", "end": 57, "score": 0.9868751764297485, "start": 49, "tag": "USERNAME", "value": "UBIVELOX" } ]
null
[]
/** * Configuration.java * * Created by UBIVELOX on 2012.08.28 * Copyright __UBIVELOX & SK Planet__. All right reserved. **/ package app.kbs.baseballstadiumclientcommon.assist; import java.util.HashMap; public class Configuration { /************************************************************************************************************** * static property * * Below the eight values is often used. That's why it is used as a variable. * Others value must be used HashMap or Preference. **************************************************************************************************************/ public static final boolean SUPPORT_DEBUG = true; public static final boolean SUPPORT_PACKAGE_LOG = false; // if true, show log EXCLUSIVE_PACKAGE_NAME. public static final boolean SUPPORT_MAIN_THREAD_LOG = false; public static final boolean SUPPORT_DATA_THREAD_LOG = false; public static final boolean SUPPORT_SCDOWNLOADER_LOG = false; // T store Downloader log public static final boolean SUPPORT_BGDOWNLOADER_LOG = false; // OMPDL Log public static final boolean SUPPORT_UI_LOG = false; // UI Component log public static final boolean SUPPORT_PROTOCOL_LOG = true; // Server Protocol log public static final String[] EXCLUSIVE_PACKAGE_NAME = {"com.skp.tstore.comm" , "com.skp.tstore.dataprotocols.DataManagerImpl" //, "com.skp.tstore.dataprotocols" }; public static boolean SUPPORT_USE_ALWAYS_WIFI = false; public static int PHONE_STATE = IAssist.STATE_NOT_CHECK_PHONE_STATUS; // 단말 상태 - 초기 세팅해 줘야함 public static final class Emul { public static boolean ENABLE = false; public static String X_PLANET_NETWORK_INFO = "\"lte\";operator=\"450/05\",sim-operator=\"450/05\""; public static String MDN = ""; public static String IMEI = ""; // public static String MODEL_NAME = "SHV-E250S"; public static String MODEL_NAME = ""; public static String MANUFACTURERER = ""; public static String USER_AGENT = "";//"Android/4.1 (" + MODEL_NAME + ";resolution=720*1280;dpi=320) Tstore-Svc/1.0 (com.skt.skaf.A000Z00040/92)"; public static String USER_AGENTV4 = "";//"Android/4.1 (" + MODEL_NAME + ";resolution=720*1280;dpi=320) Tstore-SC/1.0 (com.skt.skaf.A000Z00040/92)"; public static String DEVICE_INFO = "";//model=" + MODEL_NAME + ",fwVersion=4.1.1,pkgVersion=com.skt.skaf.A000Z00040/92"; public static String MODEL = "";//"SSOD"; public static String UA_PROFILE_DATA = "";//"010FCSSOD0000800999442216"; public static String CARRIER = IAssist.TELECOM_SKT; } public static final String MEMORY_RUNTIME = "RUNTIME"; public static final String MEMORY_DEBUG = "DEBUG"; private static final HashMap<String, HashMap<String, String> > m_mapCategoryKeyValue = new HashMap<String, HashMap<String, String> >(); private static HashMap<String, String> getCategoryMap(String category) { HashMap<String, String> categoryMap = m_mapCategoryKeyValue.get(category); if(categoryMap == null){ categoryMap = new HashMap<String, String>(); m_mapCategoryKeyValue.put(category, categoryMap); } return categoryMap; } public static void put(String category, String key, String value) { if (value == null) { return ; } getCategoryMap(category).put(key, value); } public static void put(String category, String key, int value) { getCategoryMap(category).put(key, String.valueOf(value)); } public static void put(String category, String key, boolean value) { getCategoryMap(category).put(key, String.valueOf(value)); } public static String getString(String category, String key) { return getCategoryMap(category).get(key); } public static int getInt(String category, String key) { if(getCategoryMap(category).containsKey(key)){ return Integer.parseInt(getCategoryMap(category).get(key)); } return 0; } public static boolean getBoolean(String category, String key) { if (getCategoryMap(category).containsKey(key)) { return Boolean.parseBoolean(getCategoryMap(category).get(key)); } return false; } public static boolean getBoolean(String category, String key, boolean bDefault) { if (getCategoryMap(category).containsKey(key)) { return Boolean.parseBoolean(getCategoryMap(category).get(key)); } put(category, key, bDefault); return bDefault; } public static boolean hasKey(String category, String key) { return getCategoryMap(category).containsKey(key); } public static void removeKey(String category, String key) { getCategoryMap(category).remove(key); } public static void clear(String category) { getCategoryMap(category).clear(); } }
4,932
0.647718
0.626732
137
33.824818
35.866318
152
false
false
0
0
0
0
0
0
1.978102
false
false
2
3701f1dd994f5cc27826730ae2f3187850d23bf0
15,204,184,294,937
5589d634bd5258bd67fb645ebd1d9f532dc0e623
/src/main/java/com/example/service/Impl/UserServiceImpl.java
4577a79068a2b887b616e9d734ae8269e6fb2411
[]
no_license
Aaron-97/-
https://github.com/Aaron-97/-
8ab83eb13e9f2311a21369339e940fec1e5d3b2d
99ce897926c715ab360590cfd30c605a425c571b
refs/heads/master
2023-01-29T15:26:07.178000
2020-03-12T11:34:15
2020-03-12T11:34:15
246,810,864
0
0
null
false
2023-01-11T19:53:02
2020-03-12T10:53:41
2020-03-12T11:53:55
2023-01-11T19:53:02
36,705
0
0
47
JavaScript
false
false
package com.example.service.Impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.example.Mapper.UserMapper; import com.example.po.User; import com.example.service.MailService; import com.example.service.UserService; @Service @Transactional public class UserServiceImpl implements UserService { @Autowired private UserMapper userMapper; /** * 注入邮件接口 */ @Autowired private MailService mailService; /** * 用户注册,同时发送一封激活邮件 * @param user */ @Override public void register(User user) { userMapper.register(user); //获取激活码 String code = user.getCode(); System.out.println("code:"+code); //主题 String subject = "激活邮件"; //user/checkCode?code=code(激活码)是我们点击邮件链接之后根据激活码查询用户,如果存在说明一致,将用户状态修改为“1”激活 //把激活码发送到用户注册邮箱 String context = "<a href=\"http://localhost:8080/checkCode?code="+code+"\">点击本链接激活登录</a>"; //发送激活邮件 mailService.sendHtmlMail (user.getEmail(),subject,context); } /** * 根据激活码code进行查询用户,之后再进行修改状态 */ @Override public User checkCode(String code) { return userMapper.checkCode(code); } /** * 激活账户,修改用户状态 * @param user */ @Override public void updateUserStatus(User user) { userMapper.updateUserStatus(user); } /** * 登录 * @param user * @return */ @Override public User loginUser(User user) { User user1 = userMapper.loginUser(user); if (user1 !=null){ return user1; } return null; } @Override public void insert(User t) { // TODO Auto-generated method stub userMapper.insert(t); } @Override public void update(User t) { // TODO Auto-generated method stub userMapper.updateByPrimaryKey(t); } @Override public void delete(int id) { // TODO Auto-generated method stub userMapper.deleteByPrimaryKey(id); } @Override public User selectById(int id) { // TODO Auto-generated method stub return userMapper.selectByPrimaryKey(id); } @Override public List<User> selectAll() { // TODO Auto-generated method stub return userMapper.selectByExample(null); } @Override public User selectByEmail(String email) { // TODO Auto-generated method stub return userMapper.selectByEmail(email); } }
UTF-8
Java
2,788
java
UserServiceImpl.java
Java
[]
null
[]
package com.example.service.Impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.example.Mapper.UserMapper; import com.example.po.User; import com.example.service.MailService; import com.example.service.UserService; @Service @Transactional public class UserServiceImpl implements UserService { @Autowired private UserMapper userMapper; /** * 注入邮件接口 */ @Autowired private MailService mailService; /** * 用户注册,同时发送一封激活邮件 * @param user */ @Override public void register(User user) { userMapper.register(user); //获取激活码 String code = user.getCode(); System.out.println("code:"+code); //主题 String subject = "激活邮件"; //user/checkCode?code=code(激活码)是我们点击邮件链接之后根据激活码查询用户,如果存在说明一致,将用户状态修改为“1”激活 //把激活码发送到用户注册邮箱 String context = "<a href=\"http://localhost:8080/checkCode?code="+code+"\">点击本链接激活登录</a>"; //发送激活邮件 mailService.sendHtmlMail (user.getEmail(),subject,context); } /** * 根据激活码code进行查询用户,之后再进行修改状态 */ @Override public User checkCode(String code) { return userMapper.checkCode(code); } /** * 激活账户,修改用户状态 * @param user */ @Override public void updateUserStatus(User user) { userMapper.updateUserStatus(user); } /** * 登录 * @param user * @return */ @Override public User loginUser(User user) { User user1 = userMapper.loginUser(user); if (user1 !=null){ return user1; } return null; } @Override public void insert(User t) { // TODO Auto-generated method stub userMapper.insert(t); } @Override public void update(User t) { // TODO Auto-generated method stub userMapper.updateByPrimaryKey(t); } @Override public void delete(int id) { // TODO Auto-generated method stub userMapper.deleteByPrimaryKey(id); } @Override public User selectById(int id) { // TODO Auto-generated method stub return userMapper.selectByPrimaryKey(id); } @Override public List<User> selectAll() { // TODO Auto-generated method stub return userMapper.selectByExample(null); } @Override public User selectByEmail(String email) { // TODO Auto-generated method stub return userMapper.selectByEmail(email); } }
2,788
0.654582
0.651394
114
21.017544
19.196575
99
false
false
0
0
0
0
0
0
0.649123
false
false
2
9bb0c605306c77d40882f01964063b7c623e91cd
68,719,545,773
22b4bff08f4152bc0a5786a382de8b620b95e21a
/app/src/main/java/com/example/navee/smartroom/MainActivity.java
c3e58a9093a352974d11958406b3db12596604c4
[]
no_license
sai2698/smartroom
https://github.com/sai2698/smartroom
cfca7e310d993858c392703872a0dbeb8684ea23
dc213aff3c379ff8259284cbadf9e67ac54b62ed
refs/heads/master
2021-01-01T13:35:11.075000
2017-07-18T13:54:14
2017-07-18T13:54:14
97,571,868
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.navee.smartroom; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends AppCompatActivity { EditText et1,et2; Button bt; String host,port; CheckBox box; String host1,port1; SharedPreferences sharedPreferences; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); et1=(EditText)findViewById(R.id.editText); et2=(EditText)findViewById(R.id.editText2); bt=(Button)findViewById(R.id.button); box=(CheckBox)findViewById(R.id.checkBox); et1.setFocusable(true); ConnectivityManager connManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); final NetworkInfo wifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); WifiManager wifiMgr = (WifiManager) getBaseContext().getSystemService(Context.WIFI_SERVICE); final WifiInfo wifiInfo = wifiMgr.getConnectionInfo(); sharedPreferences=getSharedPreferences("mypref", Context.MODE_PRIVATE); if(sharedPreferences!=null) { if(sharedPreferences.getBoolean("bool", Boolean.parseBoolean(null))==true) { host1 = sharedPreferences.getString("host", null); port1 = sharedPreferences.getString("port", null); box.setChecked(true); et1.setText(host1); et2.setText(port1); } } bt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { host=et1.getText().toString(); port=et2.getText().toString(); // if(wifi.isConnected()) { if (host.matches("")) { Toast.makeText(MainActivity.this, "please input host", Toast.LENGTH_SHORT).show(); } if (port.matches("")) { Toast.makeText(MainActivity.this, "please input port", Toast.LENGTH_SHORT).show(); } if (host.length() > 0 && port.length() > 0) { if (box.isChecked()) { SharedPreferences.Editor edit = sharedPreferences.edit(); edit.putString("host", host); edit.putString("port", port); edit.putBoolean("bool", true); edit.commit(); Intent intent = new Intent(getApplicationContext(), Home.class); intent.putExtra("host", host); intent.putExtra("port", port); finish(); startActivity(intent); } else { SharedPreferences.Editor edit = sharedPreferences.edit(); edit.putBoolean("bool", false); edit.commit(); Intent intent = new Intent(getApplicationContext(), Home.class); intent.putExtra("host", host); intent.putExtra("port", port); finish(); startActivity(intent); } } // } /* else{ Toast.makeText(MainActivity.this, "please turn on wifi", Toast.LENGTH_SHORT).show(); }*/ } }); } }
UTF-8
Java
4,149
java
MainActivity.java
Java
[ { "context": "package com.example.navee.smartroom;\r\n\r\nimport android.content.Context;\r\nim", "end": 25, "score": 0.8684218525886536, "start": 20, "tag": "USERNAME", "value": "navee" } ]
null
[]
package com.example.navee.smartroom; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends AppCompatActivity { EditText et1,et2; Button bt; String host,port; CheckBox box; String host1,port1; SharedPreferences sharedPreferences; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); et1=(EditText)findViewById(R.id.editText); et2=(EditText)findViewById(R.id.editText2); bt=(Button)findViewById(R.id.button); box=(CheckBox)findViewById(R.id.checkBox); et1.setFocusable(true); ConnectivityManager connManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); final NetworkInfo wifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); WifiManager wifiMgr = (WifiManager) getBaseContext().getSystemService(Context.WIFI_SERVICE); final WifiInfo wifiInfo = wifiMgr.getConnectionInfo(); sharedPreferences=getSharedPreferences("mypref", Context.MODE_PRIVATE); if(sharedPreferences!=null) { if(sharedPreferences.getBoolean("bool", Boolean.parseBoolean(null))==true) { host1 = sharedPreferences.getString("host", null); port1 = sharedPreferences.getString("port", null); box.setChecked(true); et1.setText(host1); et2.setText(port1); } } bt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { host=et1.getText().toString(); port=et2.getText().toString(); // if(wifi.isConnected()) { if (host.matches("")) { Toast.makeText(MainActivity.this, "please input host", Toast.LENGTH_SHORT).show(); } if (port.matches("")) { Toast.makeText(MainActivity.this, "please input port", Toast.LENGTH_SHORT).show(); } if (host.length() > 0 && port.length() > 0) { if (box.isChecked()) { SharedPreferences.Editor edit = sharedPreferences.edit(); edit.putString("host", host); edit.putString("port", port); edit.putBoolean("bool", true); edit.commit(); Intent intent = new Intent(getApplicationContext(), Home.class); intent.putExtra("host", host); intent.putExtra("port", port); finish(); startActivity(intent); } else { SharedPreferences.Editor edit = sharedPreferences.edit(); edit.putBoolean("bool", false); edit.commit(); Intent intent = new Intent(getApplicationContext(), Home.class); intent.putExtra("host", host); intent.putExtra("port", port); finish(); startActivity(intent); } } // } /* else{ Toast.makeText(MainActivity.this, "please turn on wifi", Toast.LENGTH_SHORT).show(); }*/ } }); } }
4,149
0.537238
0.532658
94
42.138298
26.005156
106
false
false
0
0
0
0
0
0
0.904255
false
false
2
7039bcc07386d6e6fa88c6cada52b31f65456028
24,060,406,855,839
9348c73428a9e462cecfe0914170236124374f2b
/src/main/java/com/lyonwj/titanTrade/MarketSimulation.java
e87b415b1c4efb198205b5ff0a2784c0d06bc71b
[]
no_license
johnymontana/titanTrade
https://github.com/johnymontana/titanTrade
9d10c27e8573e14b5d930618cc5ff63721166847
dc11339f3002ad6cf600487d088360481f10c827
refs/heads/master
2020-12-24T14:45:57.028000
2014-03-17T15:39:46
2014-03-17T15:39:46
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lyonwj.titanTrade; import com.thinkaurelius.titan.core.TitanFactory; import com.thinkaurelius.titan.core.TitanGraph; import com.thinkaurelius.titan.core.util.TitanCleanup; import com.tinkerpop.blueprints.impls.tg.TinkerGraph; import com.tinkerpop.blueprints.Graph; import com.tinkerpop.blueprints.Vertex; import com.tinkerpop.blueprints.Edge; import com.tinkerpop.blueprints.Direction; import org.apache.commons.configuration.BaseConfiguration; import org.apache.commons.configuration.Configuration; /** * Simulates simple graph based trading market * * */ public class MarketSimulation { public static void main( String[] args ) { Configuration conf = new BaseConfiguration(); conf.setProperty("storage.backend","cassandra"); conf.setProperty("storage.hostname","127.0.0.1"); TitanGraph g = TitanFactory.open(conf); g.shutdown(); TitanCleanup.clear(g); g = TitanFactory.open(conf); Vertex s1 = g.addVertex(null); s1.setProperty("name", "s1"); s1.setProperty("type", "seller"); Vertex s2 = g.addVertex(null); s2.setProperty("name", "s2"); s2.setProperty("type", "seller"); Vertex s3 = g.addVertex(null); s3.setProperty("name", "s3"); s3.setProperty("type", "seller"); Vertex t1 = g.addVertex(null); t1.setProperty("name", "t1"); t1.setProperty("type", "trader"); Vertex t2 = g.addVertex(null); t2.setProperty("name", "t2"); t2.setProperty("type", "trader"); Vertex b1 = g.addVertex(null); b1.setProperty("name", "b1"); b1.setProperty("type", "buyer"); Vertex b2 = g.addVertex(null); b2.setProperty("name", "b2"); b2.setProperty("type", "buyer"); Vertex b3 = g.addVertex(null); b3.setProperty("name", "b3"); b3.setProperty("type", "buyer"); Edge e = g.addEdge(null, s1, t1, "bid"); e.setProperty("weight",0.2); e = g.addEdge(null, s2, t1, "bid"); e.setProperty("weight", 0.2); e = g.addEdge(null, s2, t2, "bid"); e.setProperty("weight", 0.3); e = g.addEdge(null, s3, t2, "bid"); e.setProperty("weight", 0.0); e = g.addEdge(null, t1, b1, "ask"); e.setProperty("weight", 0.8); g.addEdge(null, t1, b2, "ask").setProperty("weight", 0.8); g.addEdge(null, t2, b2, "ask").setProperty("weight", 0.7); g.addEdge(null, t2, b3, "ask").setProperty("weight", 1.0); Iterable<Vertex> results = s1.query().vertices(); // Print name of all Traders connected to s1 // t1 for (Vertex result : results){ System.out.println(result.getProperty("name")); } // Print name of all buyers connected to s1 through all Traders connected to s1 // b1 // b2 for (Edge edge : s1.getEdges(Direction.OUT)){ for (Edge outEdge : edge.getVertex(Direction.IN).getEdges(Direction.OUT)) { System.out.println(outEdge.getVertex(Direction.IN).getProperty("name")); } } } }
UTF-8
Java
3,164
java
MarketSimulation.java
Java
[ { "context": "a\");\n conf.setProperty(\"storage.hostname\",\"127.0.0.1\");\n\n TitanGraph g = TitanFactory.open(conf", "end": 823, "score": 0.9799535274505615, "start": 814, "tag": "IP_ADDRESS", "value": "127.0.0.1" }, { "context": ".addVertex(null);\n b3.setProperty(\"name\", \"b3\");\n b3.setProperty(\"type\", \"buyer\");\n\n ", "end": 1880, "score": 0.8201872110366821, "start": 1878, "tag": "NAME", "value": "b3" } ]
null
[]
package com.lyonwj.titanTrade; import com.thinkaurelius.titan.core.TitanFactory; import com.thinkaurelius.titan.core.TitanGraph; import com.thinkaurelius.titan.core.util.TitanCleanup; import com.tinkerpop.blueprints.impls.tg.TinkerGraph; import com.tinkerpop.blueprints.Graph; import com.tinkerpop.blueprints.Vertex; import com.tinkerpop.blueprints.Edge; import com.tinkerpop.blueprints.Direction; import org.apache.commons.configuration.BaseConfiguration; import org.apache.commons.configuration.Configuration; /** * Simulates simple graph based trading market * * */ public class MarketSimulation { public static void main( String[] args ) { Configuration conf = new BaseConfiguration(); conf.setProperty("storage.backend","cassandra"); conf.setProperty("storage.hostname","127.0.0.1"); TitanGraph g = TitanFactory.open(conf); g.shutdown(); TitanCleanup.clear(g); g = TitanFactory.open(conf); Vertex s1 = g.addVertex(null); s1.setProperty("name", "s1"); s1.setProperty("type", "seller"); Vertex s2 = g.addVertex(null); s2.setProperty("name", "s2"); s2.setProperty("type", "seller"); Vertex s3 = g.addVertex(null); s3.setProperty("name", "s3"); s3.setProperty("type", "seller"); Vertex t1 = g.addVertex(null); t1.setProperty("name", "t1"); t1.setProperty("type", "trader"); Vertex t2 = g.addVertex(null); t2.setProperty("name", "t2"); t2.setProperty("type", "trader"); Vertex b1 = g.addVertex(null); b1.setProperty("name", "b1"); b1.setProperty("type", "buyer"); Vertex b2 = g.addVertex(null); b2.setProperty("name", "b2"); b2.setProperty("type", "buyer"); Vertex b3 = g.addVertex(null); b3.setProperty("name", "b3"); b3.setProperty("type", "buyer"); Edge e = g.addEdge(null, s1, t1, "bid"); e.setProperty("weight",0.2); e = g.addEdge(null, s2, t1, "bid"); e.setProperty("weight", 0.2); e = g.addEdge(null, s2, t2, "bid"); e.setProperty("weight", 0.3); e = g.addEdge(null, s3, t2, "bid"); e.setProperty("weight", 0.0); e = g.addEdge(null, t1, b1, "ask"); e.setProperty("weight", 0.8); g.addEdge(null, t1, b2, "ask").setProperty("weight", 0.8); g.addEdge(null, t2, b2, "ask").setProperty("weight", 0.7); g.addEdge(null, t2, b3, "ask").setProperty("weight", 1.0); Iterable<Vertex> results = s1.query().vertices(); // Print name of all Traders connected to s1 // t1 for (Vertex result : results){ System.out.println(result.getProperty("name")); } // Print name of all buyers connected to s1 through all Traders connected to s1 // b1 // b2 for (Edge edge : s1.getEdges(Direction.OUT)){ for (Edge outEdge : edge.getVertex(Direction.IN).getEdges(Direction.OUT)) { System.out.println(outEdge.getVertex(Direction.IN).getProperty("name")); } } } }
3,164
0.599874
0.575221
104
29.423077
23.047899
88
false
false
0
0
0
0
0
0
1.038462
false
false
2
6693737b7c4f4dd6406c52dfd3d333b4638b3b26
24,060,406,855,679
8962226bd0a2c60430eb0933938af529312e8163
/src/main/java/net/raabdev/java_practice/oop1/Point.java
06c60d97fa5ec0c87dcba4bff8d55446adbfc3d2
[]
no_license
sraab123/java-practice
https://github.com/sraab123/java-practice
cd43cc1c8243773088fe7370127229df1ff5002d
ba37722ecbfa7882989bc3db3ad2433ec36812dd
refs/heads/master
2022-12-30T12:13:36.053000
2020-07-13T09:42:09
2020-07-13T09:42:09
279,259,114
0
0
null
false
2020-10-13T23:31:38
2020-07-13T09:35:39
2020-07-13T09:42:34
2020-10-13T23:31:37
140
0
0
1
Java
false
false
package net.raabdev.java_practice.oop1; public class Point { private int x, y; public Point() { } public Point(int x, int y) { this.setX(x); this.setY(y); } public int getX() { return x; } public void setX(int x) { this.x = x; } public int getY() { return y; } public void setY(int y) { this.y = y; } public double distance() { return distance(0,0); } public double distance(int x, int y) { return Math.sqrt((x - this.x) * (x - this.x) + (y - this.y)*(y - this.y)); } public double distance(Point p) { return distance(p.getX(), p.getY()); } }
UTF-8
Java
564
java
Point.java
Java
[]
null
[]
package net.raabdev.java_practice.oop1; public class Point { private int x, y; public Point() { } public Point(int x, int y) { this.setX(x); this.setY(y); } public int getX() { return x; } public void setX(int x) { this.x = x; } public int getY() { return y; } public void setY(int y) { this.y = y; } public double distance() { return distance(0,0); } public double distance(int x, int y) { return Math.sqrt((x - this.x) * (x - this.x) + (y - this.y)*(y - this.y)); } public double distance(Point p) { return distance(p.getX(), p.getY()); } }
564
0.618794
0.613475
42
12.428572
15.669416
75
false
false
0
0
0
0
0
0
0.619048
false
false
2
30d44afd4b9b509fc0585ca35d714022fb5a8abb
13,400,298,030,727
512796190b4371518a1303aec0d27b2a54cb2529
/physicssimulation-swing/src/main/java/nl/rutgerkok/physicssimulation/swing/view/DrawPanel.java
18a65912d39093e7ce486927574b254f304863f6
[ "MIT" ]
permissive
rutgerkok/PhysicsSimulation
https://github.com/rutgerkok/PhysicsSimulation
cd1f2d8c97f2407af07205f82de6d0ab09cf880a
755822827cf245bba0c298fde21e425b72bd9f0e
refs/heads/master
2021-01-01T04:39:45.671000
2016-05-29T18:46:53
2016-05-29T18:46:53
58,942,742
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package nl.rutgerkok.physicssimulation.swing.view; import java.awt.Graphics; import java.util.Objects; import javax.swing.JPanel; import nl.rutgerkok.physicssimulation.paint.Drawable; import org.eclipse.jdt.annotation.Nullable; /** * A variant of {@link JPanel} that allows a {@link Drawable} to draw. * */ final class DrawPanel extends JPanel { private static final long serialVersionUID = -5973534506179687970L; private final Drawable painter; public DrawPanel(Drawable painter) { this.painter = Objects.requireNonNull(painter); } @Override public void paintComponent(@Nullable Graphics graphics) { Objects.requireNonNull(graphics); painter.toDrawing(new SwingCanvas(graphics, getSize())); } }
UTF-8
Java
760
java
DrawPanel.java
Java
[]
null
[]
package nl.rutgerkok.physicssimulation.swing.view; import java.awt.Graphics; import java.util.Objects; import javax.swing.JPanel; import nl.rutgerkok.physicssimulation.paint.Drawable; import org.eclipse.jdt.annotation.Nullable; /** * A variant of {@link JPanel} that allows a {@link Drawable} to draw. * */ final class DrawPanel extends JPanel { private static final long serialVersionUID = -5973534506179687970L; private final Drawable painter; public DrawPanel(Drawable painter) { this.painter = Objects.requireNonNull(painter); } @Override public void paintComponent(@Nullable Graphics graphics) { Objects.requireNonNull(graphics); painter.toDrawing(new SwingCanvas(graphics, getSize())); } }
760
0.732895
0.707895
31
23.516129
24.701927
71
false
false
0
0
0
0
0
0
0.387097
false
false
2
c3f6b1b233735612febc394c7e8782ada048386d
32,023,276,228,744
f31ffb624859d53310560122d297759ed9aa60f9
/src/com/acharluk/luk/parser/ClassParser.java
49251409eca851f9c79561bef0f0a7201918b0d4
[]
no_license
acharluk/Luk
https://github.com/acharluk/Luk
a80c545c0f6ffff925aa90627a3787bc7d301240
decb4a11b695d629733d89aa9205da0d0fe4da0f
refs/heads/master
2016-09-16T07:00:32.749000
2015-02-27T18:41:46
2015-02-27T18:41:46
24,298,395
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.acharluk.luk.parser; import com.acharluk.luk.block.Block; import com.acharluk.luk.block.Class; import com.acharluk.luk.tokenizer.Tokenizer; /** * Created by ACharLuk on 04/10/2014. */ public class ClassParser extends Parser<Class> { @Override public boolean shouldParse(String line) { return line.matches("class [a-zA-Z][a-zA-Z0-9]*"); } @Override public Class parse(Block superBlock, Tokenizer tokenizer) { tokenizer.nextToken(); String name = tokenizer.nextToken().getToken(); return new Class(name); } }
UTF-8
Java
580
java
ClassParser.java
Java
[ { "context": "harluk.luk.tokenizer.Tokenizer;\n\n/**\n * Created by ACharLuk on 04/10/2014.\n */\npublic class ClassParser exten", "end": 180, "score": 0.9987364411354065, "start": 172, "tag": "USERNAME", "value": "ACharLuk" } ]
null
[]
package com.acharluk.luk.parser; import com.acharluk.luk.block.Block; import com.acharluk.luk.block.Class; import com.acharluk.luk.tokenizer.Tokenizer; /** * Created by ACharLuk on 04/10/2014. */ public class ClassParser extends Parser<Class> { @Override public boolean shouldParse(String line) { return line.matches("class [a-zA-Z][a-zA-Z0-9]*"); } @Override public Class parse(Block superBlock, Tokenizer tokenizer) { tokenizer.nextToken(); String name = tokenizer.nextToken().getToken(); return new Class(name); } }
580
0.681035
0.663793
22
25.363636
21.022814
63
false
false
0
0
0
0
0
0
0.409091
false
false
2
a70de1f7453b816e330b3b8c3f4eefbe527f1ef0
17,652,315,593,919
135bec354622330ea6bcf637ef52c7363fb97467
/src/OoPs/Constructors/PrivateConstructor.java
d1858dc75220121c7a9d04eab5d3f8dc480bad7c
[]
no_license
Orlando-Houston/Java
https://github.com/Orlando-Houston/Java
1b057b2e6447ba79e2173462139c6714c6743b4c
b6ccbf6c05d9cbec9580875be7c5edd6e42f0de9
refs/heads/master
2020-08-31T09:12:40.047000
2020-06-23T22:44:04
2020-06-23T22:44:04
238,321,900
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package OoPs.Constructors; public class PrivateConstructor { //Static SubjectHeadings.Class Reference private static PrivateConstructor obj=null; private PrivateConstructor(){ /*Private Constructor will prevent * the instantiation of this class directly*/ } public static PrivateConstructor objectCreationMethod(){ /*This logic will ensure that no more than * one object can be created at a time */ if(obj==null){ obj= new PrivateConstructor(); } return obj; } public void display(){ System.out.println("Singleton class Example"); } public static void main(String args[]){ //Object cannot be created directly due to private constructor //This way it is forced to create object via our method where //we have logic for only one object creation PrivateConstructor myobject= PrivateConstructor.objectCreationMethod(); myobject.display(); } }
UTF-8
Java
999
java
PrivateConstructor.java
Java
[]
null
[]
package OoPs.Constructors; public class PrivateConstructor { //Static SubjectHeadings.Class Reference private static PrivateConstructor obj=null; private PrivateConstructor(){ /*Private Constructor will prevent * the instantiation of this class directly*/ } public static PrivateConstructor objectCreationMethod(){ /*This logic will ensure that no more than * one object can be created at a time */ if(obj==null){ obj= new PrivateConstructor(); } return obj; } public void display(){ System.out.println("Singleton class Example"); } public static void main(String args[]){ //Object cannot be created directly due to private constructor //This way it is forced to create object via our method where //we have logic for only one object creation PrivateConstructor myobject= PrivateConstructor.objectCreationMethod(); myobject.display(); } }
999
0.665666
0.665666
29
33.448277
22.890423
79
false
false
0
0
0
0
0
0
0.241379
false
false
2
503a9eeda5017e8af035ca9d3a90818ef1fabec7
31,275,951,917,064
7688a4f41255d6b08db57f0c47041a1dad0cab1f
/app/src/main/java/com/codepathgroup5/listeners/ChildFragmentListener.java
e1d0e4834ecd65eb50d409d6701d0ca8930e807d
[ "Apache-2.0" ]
permissive
kristianss27/LetsGoOut
https://github.com/kristianss27/LetsGoOut
c4d1cd83cb2a966e81b83d9d153d241a3b196884
548783f7e4bc649f6605ef997537cc77bd41bfe9
refs/heads/master
2020-06-10T16:10:33.232000
2019-03-03T18:17:34
2019-03-03T18:17:34
75,941,392
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.codepathgroup5.listeners; import android.support.v4.app.Fragment; import com.codepathgroup5.models.Message; public interface ChildFragmentListener { void nextQuestion(Fragment fragment,Message message); void lastQuestion(Fragment fragment); }
UTF-8
Java
267
java
ChildFragmentListener.java
Java
[]
null
[]
package com.codepathgroup5.listeners; import android.support.v4.app.Fragment; import com.codepathgroup5.models.Message; public interface ChildFragmentListener { void nextQuestion(Fragment fragment,Message message); void lastQuestion(Fragment fragment); }
267
0.808989
0.797753
11
23.272728
21.625284
57
false
false
0
0
0
0
0
0
0.545455
false
false
2
81f8d6f1350200c5b49fb29b8e7e6358900c5e71
9,328,669,030,553
c2c3f107e5f7a2e836265f7c11cbe7b3bd55308d
/com.openexchange.dav/src/com/openexchange/dav/reports/ExpandPropertyReport.java
b91293a434a1ef90b919c9d4f62c54d015a55f69
[]
no_license
yantarou/backend
https://github.com/yantarou/backend
d20a4d566a1cb80195cf3a2ee6a35e1be4faaa4a
8146bbc247512dd9e0fd1f7aaee634ebe799c40c
refs/heads/master
2020-03-12T13:16:55.281000
2018-04-23T05:50:07
2018-04-23T05:50:07
130,638,291
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * * OPEN-XCHANGE legal information * * All intellectual property rights in the Software are protected by * international copyright laws. * * * In some countries OX, OX Open-Xchange, open xchange and OXtender * as well as the corresponding Logos OX Open-Xchange and OX are registered * trademarks of the OX Software GmbH group of companies. * The use of the Logos is not covered by the GNU General Public License. * Instead, you are allowed to use these Logos according to the terms and * conditions of the Creative Commons License, Version 2.5, Attribution, * Non-commercial, ShareAlike, and the interpretation of the term * Non-commercial applicable to the aforementioned license is published * on the web site http://www.open-xchange.com/EN/legal/index.html. * * Please make sure that third-party modules and libraries are used * according to their respective licenses. * * Any modifications to this package must retain all copyright notices * of the original copyright holder(s) for the original code used. * * After any such modifications, the original and derivative code shall remain * under the copyright of the copyright holder(s) and/or original author(s)per * the Attribution and Assignment Agreement that can be located at * http://www.open-xchange.com/EN/developer/. The contributing author shall be * given Attribution for the derivative code and a license granting use. * * Copyright (C) 2016-2020 OX Software GmbH * Mail: info@open-xchange.com * * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License, Version 2 as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package com.openexchange.dav.reports; import java.util.List; import javax.servlet.http.HttpServletResponse; import org.jdom2.Document; import org.jdom2.Element; import com.openexchange.dav.DAVProtocol; import com.openexchange.dav.actions.PROPFINDAction; import com.openexchange.webdav.action.WebdavRequest; import com.openexchange.webdav.action.WebdavResponse; import com.openexchange.webdav.protocol.Protocol; import com.openexchange.webdav.protocol.WebdavProperty; import com.openexchange.webdav.protocol.WebdavProtocolException; import com.openexchange.webdav.protocol.WebdavResource; import com.openexchange.webdav.xml.resources.PropfindResponseMarshaller; /** * {@link ExpandPropertyReport} * * @author <a href="mailto:tobias.friedrich@open-xchange.com">Tobias Friedrich</a> * @since v7.8.1 */ public class ExpandPropertyReport extends PROPFINDAction { public static final String NAMESPACE = Protocol.DEFAULT_NAMESPACE; public static final String NAME = "expand-property"; /** * Initializes a new {@link ExpandPropertyReport}. * * @param protocol The underlying DAV protocol */ public ExpandPropertyReport(DAVProtocol protocol) { super(protocol); } @Override public void perform(WebdavRequest request, WebdavResponse response) throws WebdavProtocolException { Document requestBody = optRequestBody(request); if (null == requestBody) { throw WebdavProtocolException.generalError(request.getUrl(), HttpServletResponse.SC_BAD_REQUEST); } Element rootElement = requestBody.getRootElement(); if (null == rootElement || false == "expand-property".equals(rootElement.getName()) || false == Protocol.DAV_NS.getURI().equals(rootElement.getNamespaceURI())) { throw WebdavProtocolException.generalError(request.getUrl(), HttpServletResponse.SC_BAD_REQUEST); } Element multistatusElement = prepareMultistatusElement(); multistatusElement.addContent(expandProperty(request, rootElement.getChildren("property", Protocol.DAV_NS), request.getResource())); sendMultistatusResponse(response, multistatusElement); } private Element expandProperty(WebdavRequest request, List<Element> requestedProperties, WebdavResource resource) throws WebdavProtocolException { PropfindResponseMarshaller marshaller = new PropfindResponseMarshaller(request.getURLPrefix(), request.getCharset(), request.isBrief()); Element responseElement = new Element("response", Protocol.DAV_NS); responseElement.addContent(marshaller.marshalHREF(resource.getUrl(), resource.isCollection())); if (false == resource.exists()) { responseElement.addContent(marshaller.marshalStatus(HttpServletResponse.SC_NOT_FOUND)); } else { Element propstatElement = new Element("propstat", Protocol.DAV_NS); Element propElement = new Element("prop", Protocol.DAV_NS); for (Element requestedProperty : requestedProperties) { String name = requestedProperty.getAttribute("name").getValue(); String namespace = requestedProperty.getAttribute("namespace").getValue(); WebdavProperty property = resource.getProperty(namespace, name); if (null != property) { Element marshalledProperty = marshaller.marshalProperty(property, protocol); List<Element> propertiesToExpand = requestedProperty.getChildren("property", Protocol.DAV_NS); if (0 < propertiesToExpand.size()) { Element expandedElement = new Element(marshalledProperty.getName(), marshalledProperty.getNamespace()); for (Element hrefElement : marshalledProperty.getChildren("href", Protocol.DAV_NS)) { WebdavResource expandedResource = request.getFactory().resolveResource(hrefElement.getValue()); List<Element> expandedProperties = requestedProperty.getChildren("property", Protocol.DAV_NS); Element expandedProperty = expandProperty(request, expandedProperties, expandedResource); expandedElement.addContent(expandedProperty); } propElement.addContent(expandedElement); } else { propElement.addContent(marshalledProperty); } } } propstatElement.addContent(propElement); propstatElement.addContent(marshaller.marshalStatus(HttpServletResponse.SC_OK)); responseElement.addContent(propstatElement); } return responseElement; } }
UTF-8
Java
7,024
java
ExpandPropertyReport.java
Java
[ { "context": "yright (C) 2016-2020 OX Software GmbH\n * Mail: info@open-xchange.com\n *\n *\n * This program is free software; you c", "end": 1563, "score": 0.9999317526817322, "start": 1542, "tag": "EMAIL", "value": "info@open-xchange.com" }, { "context": "pandPropertyReport}\n *\n * @author <a href=\"mailto:tobias.friedrich@open-xchange.com\">Tobias Friedrich</a>\n * @since v7.8.1\n */\npublic", "end": 3026, "score": 0.9998170137405396, "start": 2993, "tag": "EMAIL", "value": "tobias.friedrich@open-xchange.com" }, { "context": "a href=\"mailto:tobias.friedrich@open-xchange.com\">Tobias Friedrich</a>\n * @since v7.8.1\n */\npublic class ExpandPrope", "end": 3044, "score": 0.9997934103012085, "start": 3028, "tag": "NAME", "value": "Tobias Friedrich" } ]
null
[]
/* * * OPEN-XCHANGE legal information * * All intellectual property rights in the Software are protected by * international copyright laws. * * * In some countries OX, OX Open-Xchange, open xchange and OXtender * as well as the corresponding Logos OX Open-Xchange and OX are registered * trademarks of the OX Software GmbH group of companies. * The use of the Logos is not covered by the GNU General Public License. * Instead, you are allowed to use these Logos according to the terms and * conditions of the Creative Commons License, Version 2.5, Attribution, * Non-commercial, ShareAlike, and the interpretation of the term * Non-commercial applicable to the aforementioned license is published * on the web site http://www.open-xchange.com/EN/legal/index.html. * * Please make sure that third-party modules and libraries are used * according to their respective licenses. * * Any modifications to this package must retain all copyright notices * of the original copyright holder(s) for the original code used. * * After any such modifications, the original and derivative code shall remain * under the copyright of the copyright holder(s) and/or original author(s)per * the Attribution and Assignment Agreement that can be located at * http://www.open-xchange.com/EN/developer/. The contributing author shall be * given Attribution for the derivative code and a license granting use. * * Copyright (C) 2016-2020 OX Software GmbH * Mail: <EMAIL> * * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License, Version 2 as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., 59 * Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package com.openexchange.dav.reports; import java.util.List; import javax.servlet.http.HttpServletResponse; import org.jdom2.Document; import org.jdom2.Element; import com.openexchange.dav.DAVProtocol; import com.openexchange.dav.actions.PROPFINDAction; import com.openexchange.webdav.action.WebdavRequest; import com.openexchange.webdav.action.WebdavResponse; import com.openexchange.webdav.protocol.Protocol; import com.openexchange.webdav.protocol.WebdavProperty; import com.openexchange.webdav.protocol.WebdavProtocolException; import com.openexchange.webdav.protocol.WebdavResource; import com.openexchange.webdav.xml.resources.PropfindResponseMarshaller; /** * {@link ExpandPropertyReport} * * @author <a href="mailto:<EMAIL>"><NAME></a> * @since v7.8.1 */ public class ExpandPropertyReport extends PROPFINDAction { public static final String NAMESPACE = Protocol.DEFAULT_NAMESPACE; public static final String NAME = "expand-property"; /** * Initializes a new {@link ExpandPropertyReport}. * * @param protocol The underlying DAV protocol */ public ExpandPropertyReport(DAVProtocol protocol) { super(protocol); } @Override public void perform(WebdavRequest request, WebdavResponse response) throws WebdavProtocolException { Document requestBody = optRequestBody(request); if (null == requestBody) { throw WebdavProtocolException.generalError(request.getUrl(), HttpServletResponse.SC_BAD_REQUEST); } Element rootElement = requestBody.getRootElement(); if (null == rootElement || false == "expand-property".equals(rootElement.getName()) || false == Protocol.DAV_NS.getURI().equals(rootElement.getNamespaceURI())) { throw WebdavProtocolException.generalError(request.getUrl(), HttpServletResponse.SC_BAD_REQUEST); } Element multistatusElement = prepareMultistatusElement(); multistatusElement.addContent(expandProperty(request, rootElement.getChildren("property", Protocol.DAV_NS), request.getResource())); sendMultistatusResponse(response, multistatusElement); } private Element expandProperty(WebdavRequest request, List<Element> requestedProperties, WebdavResource resource) throws WebdavProtocolException { PropfindResponseMarshaller marshaller = new PropfindResponseMarshaller(request.getURLPrefix(), request.getCharset(), request.isBrief()); Element responseElement = new Element("response", Protocol.DAV_NS); responseElement.addContent(marshaller.marshalHREF(resource.getUrl(), resource.isCollection())); if (false == resource.exists()) { responseElement.addContent(marshaller.marshalStatus(HttpServletResponse.SC_NOT_FOUND)); } else { Element propstatElement = new Element("propstat", Protocol.DAV_NS); Element propElement = new Element("prop", Protocol.DAV_NS); for (Element requestedProperty : requestedProperties) { String name = requestedProperty.getAttribute("name").getValue(); String namespace = requestedProperty.getAttribute("namespace").getValue(); WebdavProperty property = resource.getProperty(namespace, name); if (null != property) { Element marshalledProperty = marshaller.marshalProperty(property, protocol); List<Element> propertiesToExpand = requestedProperty.getChildren("property", Protocol.DAV_NS); if (0 < propertiesToExpand.size()) { Element expandedElement = new Element(marshalledProperty.getName(), marshalledProperty.getNamespace()); for (Element hrefElement : marshalledProperty.getChildren("href", Protocol.DAV_NS)) { WebdavResource expandedResource = request.getFactory().resolveResource(hrefElement.getValue()); List<Element> expandedProperties = requestedProperty.getChildren("property", Protocol.DAV_NS); Element expandedProperty = expandProperty(request, expandedProperties, expandedResource); expandedElement.addContent(expandedProperty); } propElement.addContent(expandedElement); } else { propElement.addContent(marshalledProperty); } } } propstatElement.addContent(propElement); propstatElement.addContent(marshaller.marshalStatus(HttpServletResponse.SC_OK)); responseElement.addContent(propstatElement); } return responseElement; } }
6,974
0.701167
0.696754
138
49.898552
38.834148
169
false
false
0
0
0
0
0
0
0.673913
false
false
2
7606bc8eeb173b5b0e88f1e00423c0e562c8948e
20,126,216,812,633
5abd1adb89873317a34d418521a37fcf64736779
/src/main/java/br/com/desafio/usuario/controller/form/PerfilForm.java
685f12ce6e0f96711ea478b625d61b380bf3e153
[]
no_license
brunoagues/desafio
https://github.com/brunoagues/desafio
7f26ef79fe3b86205b23da276f2d444ee618949b
4358341e42d751b5911806686341e963ba435d74
refs/heads/master
2020-11-29T02:34:46.152000
2019-12-24T19:48:32
2019-12-24T19:48:32
229,995,295
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.desafio.usuario.controller.form; import javax.validation.constraints.NotEmpty; import com.sun.istack.NotNull; public class PerfilForm { @NotNull @NotEmpty private String nome; public PerfilForm() { super(); } public PerfilForm(@NotEmpty String nome) { super(); this.nome = nome; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } }
UTF-8
Java
430
java
PerfilForm.java
Java
[]
null
[]
package br.com.desafio.usuario.controller.form; import javax.validation.constraints.NotEmpty; import com.sun.istack.NotNull; public class PerfilForm { @NotNull @NotEmpty private String nome; public PerfilForm() { super(); } public PerfilForm(@NotEmpty String nome) { super(); this.nome = nome; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } }
430
0.693023
0.693023
32
12.4375
14.773154
47
false
false
0
0
0
0
0
0
1.03125
false
false
2
339e5be1a9b0147dc0eab423edc6fb2832541531
24,661,702,270,960
53a298b78c573284e30e12626f0518d9f1ebed47
/org.xtext.Abs.ui/src/org/xtext/abs/plugin/ABSnature.java
cfe2e8c059efc4b9507c47d160e9d534d0e4fd11
[]
no_license
mohddanish211/MasterThesis
https://github.com/mohddanish211/MasterThesis
04d6c86050f16d60a919472343b8932c8afa67a3
aed8d90be81d0f4a7cde05eae20467a64bed8801
refs/heads/master
2021-05-09T05:36:14.604000
2018-05-01T19:33:17
2018-05-01T19:33:17
119,306,614
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.xtext.abs.plugin; import org.eclipse.xtext.ui.editor.XtextEditor; import abs.frontend.ast.CompilationUnit; import abs.frontend.parser.ABSPackageFile; import abs.frontend.parser.Main; import abs.frontend.parser.ParserError; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.List; import org.eclipse.jface.dialogs.MessageDialogWithToggle; import org.eclipse.core.resources.ICommand; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.IProjectNature; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.MessageDialogWithToggle; import org.eclipse.ui.actions.WorkspaceModifyOperation; import org.eclipse.xtext.builder.nature.Messages; import org.eclipse.xtext.builder.nature.NatureAddingEditorCallback; import org.eclipse.xtext.builder.nature.ToggleXtextNatureCommand; import org.eclipse.xtext.builder.nature.XtextNature; import org.eclipse.xtext.ui.editor.IXtextEditorCallback.NullImpl; import org.eclipse.xtext.ui.util.DontAskAgainDialogs; import org.xtext.abs.plugin.exceptions.*; import org.xtext.abs.plugin.internal.IncrementalModelBuilder; import org.xtext.abs.plugin.internal.NoModelException; import com.google.inject.Inject; @SuppressWarnings("restriction") public class ABSnature extends NatureAddingEditorCallback implements IProjectNature { public static final String NATURE_ID = "absnature"; private IProject project; @Inject private ToggleXtextNatureCommand toggleNature; private static final String ADD_XTEXT_NATURE = "add_xtext_nature"; private static final String BUILDER_ID = "org.xtext.Abs.ui.sampleABSBuilder"; private @Inject DontAskAgainDialogs dialogs; @Override public void afterCreatePartControl(XtextEditor editor) { System.out.println("Running Inside"); IResource resource = editor.getResource(); if (resource != null && !toggleNature.hasNature(resource.getProject()) && resource.getProject().isAccessible() && !resource.getProject().isHidden()) { String title = Messages.NatureAddingEditorCallback_MessageDialog_Title; String message = Messages.NatureAddingEditorCallback_MessageDialog_Msg0 + resource.getProject().getName() + Messages.NatureAddingEditorCallback_MessageDialog_Msg1; boolean addNature = false; if (MessageDialogWithToggle.PROMPT.equals(dialogs.getUserDecision(ADD_XTEXT_NATURE))) { int userAnswer = dialogs.askUser(message, title, ADD_XTEXT_NATURE, editor.getEditorSite().getShell()); if (userAnswer == IDialogConstants.YES_ID) { addNature = true; } else if (userAnswer == IDialogConstants.CANCEL_ID) { return; } } else if (MessageDialogWithToggle.ALWAYS.equals(dialogs.getUserDecision(ADD_XTEXT_NATURE))) { addNature = true; } if (addNature) { toggleNature.toggleNature(resource.getProject()); } } } private final IncrementalModelBuilder modelbuilder = new IncrementalModelBuilder(); public static XtextNature getAbsNature(IResource file){ if(file==null) return null; return getAbsNature(file.getProject()); } public void parseABSFile(IResource resource, final boolean withincomplete, IProgressMonitor monitor) { if (resource.exists()) { final IFile file = (IFile) resource; assert file.exists(); try { // Markers modify the workspace: new WorkspaceModifyOperation() { @Override protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { /* Only delete PARSE-markers first: if we've just been launched, * we don't want to erase persistent markers, since type-errors etc. * only come back through an explicit build, which doesn't happen * on launching Eclipse even with auto-build. [stolz] */ file.deleteMarkers("", true, IResource.DEPTH_ZERO); try { if (!file.isSynchronized(IResource.DEPTH_ZERO)) { file.refreshLocal(IResource.DEPTH_ZERO, monitor); } Main m = new Main(); m.setWithStdLib(true); List<CompilationUnit> units = new ArrayList<CompilationUnit>(); if (isABSPackage(file)) { units.addAll(m.parseABSPackageFile(file.getLocation().toFile())); } else { CompilationUnit cu = m.parseUnit(file.getLocation().toFile(), null, new InputStreamReader(file.getContents())); cu.setName(file.getLocation().toFile().getAbsolutePath()); units.add(cu); } modelbuilder.addCompilationUnits(units); for (CompilationUnit cu : units) { if(cu.hasParserErrors()){ for(ParserError err : cu.getParserErrors()){ // Check addMarker(file, err); } } } } catch(NoModelException e){ //ignore } catch (CoreException e) { throw e; }catch (Exception e) { throw new InvocationTargetException(e); } } }.run(monitor); } catch (InvocationTargetException e) { System.out.println(e); } catch (InterruptedException e) { } } else assert false : resource; } public void parseABSFile(File file, boolean withincomplete, Object monitor) { Main m = new Main(); m.setWithStdLib(true); List<CompilationUnit> units = new ArrayList<CompilationUnit>(); try { final File f = new File(file.getAbsolutePath()); assert f.exists(); units.addAll(m.parseABSPackageFile(f)); modelbuilder.addCompilationUnits(units); } catch (IOException e) { System.out.println("Exception in ABSNature parseAbsFile"+e); } catch (NoModelException e) { } } public static boolean isABSPackage(File file) throws IOException { return file.exists() && new ABSPackageFile(file).isABSPackage(); } // assumes file != null public static boolean isABSPackage(IFile file) { if (! "jar".equals(file.getFileExtension())) return false; try { return isABSPackage(file.getLocation().toFile()); } catch (IOException e) { System.out.println("standardExceptionHandling(e)"); //standardExceptionHandling(e); return false; } } @Override public void configure() throws CoreException { System.out.println("Inside nature"); IProjectDescription desc = project.getDescription(); ICommand[] commands = desc.getBuildSpec(); for (int i = 0; i < commands.length; ++i) { if (commands[i].getBuilderName().equals(BUILDER_ID)) { return; } } ICommand[] newCommands = new ICommand[commands.length + 1]; System.arraycopy(commands, 0, newCommands, 0, commands.length); ICommand command = desc.newCommand(); command.setBuilderName(BUILDER_ID); newCommands[newCommands.length - 1] = command; desc.setBuildSpec(newCommands); project.setDescription(desc, null); } @Override public void deconfigure() throws CoreException { System.out.println("Inside nature"); // TODO Auto-generated method stub } @Override public IProject getProject() { System.out.println("Inside nature"); // TODO Auto-generated method stub return null; } @Override public void setProject(IProject project) { System.out.println("Inside nature"); // TODO Auto-generated method stub } }
UTF-8
Java
7,529
java
ABSnature.java
Java
[]
null
[]
package org.xtext.abs.plugin; import org.eclipse.xtext.ui.editor.XtextEditor; import abs.frontend.ast.CompilationUnit; import abs.frontend.parser.ABSPackageFile; import abs.frontend.parser.Main; import abs.frontend.parser.ParserError; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.List; import org.eclipse.jface.dialogs.MessageDialogWithToggle; import org.eclipse.core.resources.ICommand; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.IProjectNature; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.MessageDialogWithToggle; import org.eclipse.ui.actions.WorkspaceModifyOperation; import org.eclipse.xtext.builder.nature.Messages; import org.eclipse.xtext.builder.nature.NatureAddingEditorCallback; import org.eclipse.xtext.builder.nature.ToggleXtextNatureCommand; import org.eclipse.xtext.builder.nature.XtextNature; import org.eclipse.xtext.ui.editor.IXtextEditorCallback.NullImpl; import org.eclipse.xtext.ui.util.DontAskAgainDialogs; import org.xtext.abs.plugin.exceptions.*; import org.xtext.abs.plugin.internal.IncrementalModelBuilder; import org.xtext.abs.plugin.internal.NoModelException; import com.google.inject.Inject; @SuppressWarnings("restriction") public class ABSnature extends NatureAddingEditorCallback implements IProjectNature { public static final String NATURE_ID = "absnature"; private IProject project; @Inject private ToggleXtextNatureCommand toggleNature; private static final String ADD_XTEXT_NATURE = "add_xtext_nature"; private static final String BUILDER_ID = "org.xtext.Abs.ui.sampleABSBuilder"; private @Inject DontAskAgainDialogs dialogs; @Override public void afterCreatePartControl(XtextEditor editor) { System.out.println("Running Inside"); IResource resource = editor.getResource(); if (resource != null && !toggleNature.hasNature(resource.getProject()) && resource.getProject().isAccessible() && !resource.getProject().isHidden()) { String title = Messages.NatureAddingEditorCallback_MessageDialog_Title; String message = Messages.NatureAddingEditorCallback_MessageDialog_Msg0 + resource.getProject().getName() + Messages.NatureAddingEditorCallback_MessageDialog_Msg1; boolean addNature = false; if (MessageDialogWithToggle.PROMPT.equals(dialogs.getUserDecision(ADD_XTEXT_NATURE))) { int userAnswer = dialogs.askUser(message, title, ADD_XTEXT_NATURE, editor.getEditorSite().getShell()); if (userAnswer == IDialogConstants.YES_ID) { addNature = true; } else if (userAnswer == IDialogConstants.CANCEL_ID) { return; } } else if (MessageDialogWithToggle.ALWAYS.equals(dialogs.getUserDecision(ADD_XTEXT_NATURE))) { addNature = true; } if (addNature) { toggleNature.toggleNature(resource.getProject()); } } } private final IncrementalModelBuilder modelbuilder = new IncrementalModelBuilder(); public static XtextNature getAbsNature(IResource file){ if(file==null) return null; return getAbsNature(file.getProject()); } public void parseABSFile(IResource resource, final boolean withincomplete, IProgressMonitor monitor) { if (resource.exists()) { final IFile file = (IFile) resource; assert file.exists(); try { // Markers modify the workspace: new WorkspaceModifyOperation() { @Override protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { /* Only delete PARSE-markers first: if we've just been launched, * we don't want to erase persistent markers, since type-errors etc. * only come back through an explicit build, which doesn't happen * on launching Eclipse even with auto-build. [stolz] */ file.deleteMarkers("", true, IResource.DEPTH_ZERO); try { if (!file.isSynchronized(IResource.DEPTH_ZERO)) { file.refreshLocal(IResource.DEPTH_ZERO, monitor); } Main m = new Main(); m.setWithStdLib(true); List<CompilationUnit> units = new ArrayList<CompilationUnit>(); if (isABSPackage(file)) { units.addAll(m.parseABSPackageFile(file.getLocation().toFile())); } else { CompilationUnit cu = m.parseUnit(file.getLocation().toFile(), null, new InputStreamReader(file.getContents())); cu.setName(file.getLocation().toFile().getAbsolutePath()); units.add(cu); } modelbuilder.addCompilationUnits(units); for (CompilationUnit cu : units) { if(cu.hasParserErrors()){ for(ParserError err : cu.getParserErrors()){ // Check addMarker(file, err); } } } } catch(NoModelException e){ //ignore } catch (CoreException e) { throw e; }catch (Exception e) { throw new InvocationTargetException(e); } } }.run(monitor); } catch (InvocationTargetException e) { System.out.println(e); } catch (InterruptedException e) { } } else assert false : resource; } public void parseABSFile(File file, boolean withincomplete, Object monitor) { Main m = new Main(); m.setWithStdLib(true); List<CompilationUnit> units = new ArrayList<CompilationUnit>(); try { final File f = new File(file.getAbsolutePath()); assert f.exists(); units.addAll(m.parseABSPackageFile(f)); modelbuilder.addCompilationUnits(units); } catch (IOException e) { System.out.println("Exception in ABSNature parseAbsFile"+e); } catch (NoModelException e) { } } public static boolean isABSPackage(File file) throws IOException { return file.exists() && new ABSPackageFile(file).isABSPackage(); } // assumes file != null public static boolean isABSPackage(IFile file) { if (! "jar".equals(file.getFileExtension())) return false; try { return isABSPackage(file.getLocation().toFile()); } catch (IOException e) { System.out.println("standardExceptionHandling(e)"); //standardExceptionHandling(e); return false; } } @Override public void configure() throws CoreException { System.out.println("Inside nature"); IProjectDescription desc = project.getDescription(); ICommand[] commands = desc.getBuildSpec(); for (int i = 0; i < commands.length; ++i) { if (commands[i].getBuilderName().equals(BUILDER_ID)) { return; } } ICommand[] newCommands = new ICommand[commands.length + 1]; System.arraycopy(commands, 0, newCommands, 0, commands.length); ICommand command = desc.newCommand(); command.setBuilderName(BUILDER_ID); newCommands[newCommands.length - 1] = command; desc.setBuildSpec(newCommands); project.setDescription(desc, null); } @Override public void deconfigure() throws CoreException { System.out.println("Inside nature"); // TODO Auto-generated method stub } @Override public IProject getProject() { System.out.println("Inside nature"); // TODO Auto-generated method stub return null; } @Override public void setProject(IProject project) { System.out.println("Inside nature"); // TODO Auto-generated method stub } }
7,529
0.723336
0.722407
234
31.175213
26.443604
119
false
false
0
0
0
0
0
0
3.08547
false
false
2
b695d0db9dd7f8012877850e611072e25d0177e0
10,247,791,981,130
4f340fe8a8580ce6b805221a0b27c36f31adddde
/lab3/lab3-war/src/java/managedbean/userManagedBean.java
9460123a8f82c599c69d86223218f0ee128c218f
[ "MIT" ]
permissive
daomtthuan/aptech-ejb-enterprise-application
https://github.com/daomtthuan/aptech-ejb-enterprise-application
82dfef4ceb87d72d26aab7e0407797fd632427f5
988c2fab70242ad9ee451fbbd67ac2dc8af8c63d
refs/heads/main
2023-01-20T02:53:31.534000
2020-12-03T13:08:05
2020-12-03T13:08:05
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 managedbean; import javax.inject.Named; import javax.enterprise.context.SessionScoped; import java.io.Serializable; import javax.ejb.EJB; import sessionbean.AuthSessionBeanLocal; /** * * @author Daomtthuan */ @Named(value = "userManagedBean") @SessionScoped public class userManagedBean implements Serializable { @EJB private AuthSessionBeanLocal authSessionBean; private String username; private String password; private String message; private boolean loggedIn; /** * Creates a new instance of userManagedBean */ public userManagedBean() { } public String login() { this.loggedIn = authSessionBean.verify(this.username, this.password); if (!this.loggedIn) { this.message = "Login failed!"; return "login?faces-redirect=true"; } this.message = null; return "welcome?faces-redirect=true"; } public String redirect(String currentView) { if (currentView.equalsIgnoreCase("login")) { if (this.loggedIn) { return "welcome?faces-redirect=true"; } } else { if (!this.loggedIn) { this.message = "Please login"; return "login?faces-redirect=true"; } } return null; } public String logout() { this.message = null; this.loggedIn = false; return "login?faces-redirect=true"; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public boolean isLoggedIn() { return loggedIn; } public void setLoggedIn(boolean loggedIn) { this.loggedIn = loggedIn; } }
UTF-8
Java
2,067
java
userManagedBean.java
Java
[ { "context": "ssionbean.AuthSessionBeanLocal;\n\n/**\n *\n * @author Daomtthuan\n */\n@Named(value = \"userManagedBean\")\n@SessionSco", "end": 402, "score": 0.9997128248214722, "start": 392, "tag": "USERNAME", "value": "Daomtthuan" } ]
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 managedbean; import javax.inject.Named; import javax.enterprise.context.SessionScoped; import java.io.Serializable; import javax.ejb.EJB; import sessionbean.AuthSessionBeanLocal; /** * * @author Daomtthuan */ @Named(value = "userManagedBean") @SessionScoped public class userManagedBean implements Serializable { @EJB private AuthSessionBeanLocal authSessionBean; private String username; private String password; private String message; private boolean loggedIn; /** * Creates a new instance of userManagedBean */ public userManagedBean() { } public String login() { this.loggedIn = authSessionBean.verify(this.username, this.password); if (!this.loggedIn) { this.message = "Login failed!"; return "login?faces-redirect=true"; } this.message = null; return "welcome?faces-redirect=true"; } public String redirect(String currentView) { if (currentView.equalsIgnoreCase("login")) { if (this.loggedIn) { return "welcome?faces-redirect=true"; } } else { if (!this.loggedIn) { this.message = "Please login"; return "login?faces-redirect=true"; } } return null; } public String logout() { this.message = null; this.loggedIn = false; return "login?faces-redirect=true"; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public boolean isLoggedIn() { return loggedIn; } public void setLoggedIn(boolean loggedIn) { this.loggedIn = loggedIn; } }
2,067
0.677794
0.677794
101
19.465347
18.543266
79
false
false
0
0
0
0
0
0
0.346535
false
false
2
c68f5bd22dab4fba00629ba9121af57a9f2b0a62
30,356,828,908,400
50fcbc357c534d6c039b686e0c1c3958744a55ca
/src/main/java/ch/sysout/util/SystemUtil.java
52a83fa70d19a705becb49d66505533961cc3e57
[ "MIT" ]
permissive
sysoutch/emuBro
https://github.com/sysoutch/emuBro
ed76862c2150b19db8e5e7561577fae4d78b199e
5273c8e1e0de65f5e9f2265538063ba48477194f
refs/heads/master
2023-08-08T23:30:29.978000
2023-02-05T12:01:04
2023-02-05T12:01:04
155,843,210
4
0
MIT
false
2023-07-19T22:25:06
2018-11-02T09:25:23
2022-12-11T03:49:50
2023-07-19T22:25:06
42,781
3
0
1
Java
false
false
package ch.sysout.util; import java.io.IOException; public class SystemUtil { public static void killTask(int pId) throws IOException { if (ValidationUtil.isWindows()) { Runtime.getRuntime().exec("cmd.exe /c taskkill -IM " + pId); } else if (ValidationUtil.isUnix()) { Runtime.getRuntime().exec("kill " + pId); } } }
UTF-8
Java
334
java
SystemUtil.java
Java
[]
null
[]
package ch.sysout.util; import java.io.IOException; public class SystemUtil { public static void killTask(int pId) throws IOException { if (ValidationUtil.isWindows()) { Runtime.getRuntime().exec("cmd.exe /c taskkill -IM " + pId); } else if (ValidationUtil.isUnix()) { Runtime.getRuntime().exec("kill " + pId); } } }
334
0.688623
0.688623
14
22.857143
21.708647
63
false
false
0
0
0
0
0
0
1.285714
false
false
2
2a3c57ce17a8eec20679976378ab76716df1c643
11,227,044,523,016
697bc1c20a33ba0a500b92fc7a9dd4cfeb477746
/src/cn/com/easytaxi/util/PullTool.java
659fea5563f5e42fa7b23113d2f4965dcd2cb4ee
[]
no_license
aitonjiaotong/BaMinGongWuCar
https://github.com/aitonjiaotong/BaMinGongWuCar
a81a93ac142ac0184ee887509711ad5df0d73924
406763bdc024cfdd32537462e891f2c48c83daf0
refs/heads/master
2020-06-30T18:43:53.571000
2016-08-25T06:19:50
2016-08-25T06:19:50
66,531,360
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.com.easytaxi.util; import android.content.Context; import android.text.format.DateUtils; import android.widget.ListView; import com.handmark.pulltorefresh.library.PullToRefreshBase; import com.handmark.pulltorefresh.library.PullToRefreshListView; /** * @author xxb * @version 创建时间:2015年9月11日 上午9:57:50 */ public class PullTool { /** * 下拉刷新控件初始化设置 * * @author xxb * * @2015年8月18日 */ public static class PullListViewUtils { public static void setPullListViewParams(PullToRefreshListView pull) { pull.setScrollingWhileRefreshingEnabled(false); pull.getLoadingLayoutProxy(true, true).setPullLabel("加载完成"); pull.getLoadingLayoutProxy(true, true).setRefreshingLabel("加载中..."); pull.getLoadingLayoutProxy(true, false).setReleaseLabel("刷新"); pull.getLoadingLayoutProxy(false, true).setReleaseLabel("加载更多"); } public static void setPullDownTime(Context context, PullToRefreshBase<ListView> arg0) { String label = DateUtils.formatDateTime(context, System.currentTimeMillis(), DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL); arg0.getLoadingLayoutProxy().setLastUpdatedLabel(label); } } }
UTF-8
Java
1,294
java
PullTool.java
Java
[ { "context": ".library.PullToRefreshListView;\r\n\r\n/**\r\n * @author xxb\r\n * @version 创建时间:2015年9月11日 上午9:57:50\r\n */\r\npubl", "end": 289, "score": 0.9996126890182495, "start": 286, "tag": "USERNAME", "value": "xxb" }, { "context": "ool {\r\n\t\r\n\t/**\r\n\t * 下拉刷新控件初始化设置\r\n\t * \r\n\t * @author xxb\r\n\t * \r\n\t * @2015年8月18日\r\n\t */\r\n\tpublic static clas", "end": 407, "score": 0.9996010661125183, "start": 404, "tag": "USERNAME", "value": "xxb" } ]
null
[]
package cn.com.easytaxi.util; import android.content.Context; import android.text.format.DateUtils; import android.widget.ListView; import com.handmark.pulltorefresh.library.PullToRefreshBase; import com.handmark.pulltorefresh.library.PullToRefreshListView; /** * @author xxb * @version 创建时间:2015年9月11日 上午9:57:50 */ public class PullTool { /** * 下拉刷新控件初始化设置 * * @author xxb * * @2015年8月18日 */ public static class PullListViewUtils { public static void setPullListViewParams(PullToRefreshListView pull) { pull.setScrollingWhileRefreshingEnabled(false); pull.getLoadingLayoutProxy(true, true).setPullLabel("加载完成"); pull.getLoadingLayoutProxy(true, true).setRefreshingLabel("加载中..."); pull.getLoadingLayoutProxy(true, false).setReleaseLabel("刷新"); pull.getLoadingLayoutProxy(false, true).setReleaseLabel("加载更多"); } public static void setPullDownTime(Context context, PullToRefreshBase<ListView> arg0) { String label = DateUtils.formatDateTime(context, System.currentTimeMillis(), DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL); arg0.getLoadingLayoutProxy().setLastUpdatedLabel(label); } } }
1,294
0.746721
0.729508
37
30.972973
35.07019
167
false
false
0
0
0
0
0
0
1.648649
false
false
2
636ee34c9858b9e05be1d01b8212d54cfb65dea0
6,433,861,077,463
946a35b19b51ccecf1a45223ecb7649f6d712353
/opentsp-gateway/opentsp-gateway-tcp-location-rp/src/main/java/com/navinfo/opentsp/gateway/tcp/proto/locationrp/cache/entry/AnswerEntry.java
190bb799b67abd63d6c55106dd0d3e47c4dd37dd
[]
no_license
PinZhang/opentsp-location
https://github.com/PinZhang/opentsp-location
2c7bedaf1abe4d0b0bf154792a2f839ef7a85828
d33967ccf64094a052c299d38112e177fbacdd84
refs/heads/master
2023-03-15T14:35:25.044000
2018-01-22T12:13:00
2018-01-22T12:13:00
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.navinfo.opentsp.gateway.tcp.proto.locationrp.cache.entry; import java.io.Serializable; /** * 默认超时时间:30秒 * * @author lgw */ public class AnswerEntry implements Serializable { private static final long serialVersionUID = 1L; private String uniqueMark; private int internalCommand; private int serialNumber; public String getUniqueMark() { return uniqueMark; } public void setUniqueMark(String uniqueMark) { this.uniqueMark = uniqueMark; } public int getInternalCommand() { return internalCommand; } public void setInternalCommand(int internalCommand) { this.internalCommand = internalCommand; } public int getSerialNumber() { return serialNumber; } public void setSerialNumber(int serialNumber) { this.serialNumber = serialNumber; } }
UTF-8
Java
887
java
AnswerEntry.java
Java
[ { "context": ".io.Serializable;\n\n/**\n * 默认超时时间:30秒\n *\n * @author lgw\n */\npublic class AnswerEntry implements Serializa", "end": 136, "score": 0.9996157884597778, "start": 133, "tag": "USERNAME", "value": "lgw" } ]
null
[]
package com.navinfo.opentsp.gateway.tcp.proto.locationrp.cache.entry; import java.io.Serializable; /** * 默认超时时间:30秒 * * @author lgw */ public class AnswerEntry implements Serializable { private static final long serialVersionUID = 1L; private String uniqueMark; private int internalCommand; private int serialNumber; public String getUniqueMark() { return uniqueMark; } public void setUniqueMark(String uniqueMark) { this.uniqueMark = uniqueMark; } public int getInternalCommand() { return internalCommand; } public void setInternalCommand(int internalCommand) { this.internalCommand = internalCommand; } public int getSerialNumber() { return serialNumber; } public void setSerialNumber(int serialNumber) { this.serialNumber = serialNumber; } }
887
0.685419
0.681975
41
20.243902
20.380264
69
true
false
0
0
0
0
0
0
0.292683
false
false
2
1353cf9904c5fbf9fe5b9c7557675a72f45eebe1
1,254,130,521,700
087456b6876133ef39977b2dcba5e8947d6c966c
/src/main/java/com/ar/pbpoints/domain/EventCategory.java
f903d0ed2de6630d5dfca4957106b2e47f475388
[]
no_license
Proypb20/psa-ranking-develop-modif
https://github.com/Proypb20/psa-ranking-develop-modif
50d43b71166b0e8c636551dafad326c29026b045
3e39268a1141e7af690c05ae85ded6265dcb2d5a
refs/heads/master
2021-06-24T21:54:01.031000
2021-04-04T00:31:00
2021-04-04T00:31:00
217,583,125
0
0
null
false
2021-04-29T21:53:28
2019-10-25T17:26:17
2021-04-04T00:31:11
2021-04-29T21:53:28
5,136
0
0
1
Java
false
false
package com.ar.pbpoints.domain; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import javax.persistence.*; import javax.validation.constraints.*; import java.io.Serializable; import java.util.HashSet; import java.util.Set; /** * A EventCategory. */ @Entity @Table(name = "event_category") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class EventCategory implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name = "split_deck") private Boolean splitDeck; @ManyToOne(optional = false) @NotNull @JsonIgnoreProperties("eventCategories") private Event event; @ManyToOne(optional = false) @NotNull @JsonIgnoreProperties("eventCategories") private Category category; @ManyToOne(optional = false) @NotNull @JsonIgnoreProperties("eventCategories") private Format format; @OneToMany(mappedBy = "eventCategory") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) private Set<Game> games = new HashSet<>(); @OneToMany(mappedBy = "eventCategory") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) private Set<Roster> rosters = new HashSet<>(); // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Boolean isSplitDeck() { return splitDeck; } public EventCategory splitDeck(Boolean splitDeck) { this.splitDeck = splitDeck; return this; } public void setSplitDeck(Boolean splitDeck) { this.splitDeck = splitDeck; } public Event getEvent() { return event; } public EventCategory event(Event event) { this.event = event; return this; } public void setEvent(Event event) { this.event = event; } public Category getCategory() { return category; } public EventCategory category(Category category) { this.category = category; return this; } public void setCategory(Category category) { this.category = category; } public Format getFormat() { return format; } public EventCategory format(Format format) { this.format = format; return this; } public void setFormat(Format format) { this.format = format; } public Set<Game> getGames() { return games; } public EventCategory games(Set<Game> games) { this.games = games; return this; } public EventCategory addGame(Game game) { this.games.add(game); game.setEventCategory(this); return this; } public EventCategory removeGame(Game game) { this.games.remove(game); game.setEventCategory(null); return this; } public void setGames(Set<Game> games) { this.games = games; } public Set<Roster> getRosters() { return rosters; } public EventCategory rosters(Set<Roster> rosters) { this.rosters = rosters; return this; } public EventCategory addRoster(Roster roster) { this.rosters.add(roster); roster.setEventCategory(this); return this; } public EventCategory removeRoster(Roster roster) { this.rosters.remove(roster); roster.setEventCategory(null); return this; } public void setRosters(Set<Roster> rosters) { this.rosters = rosters; } // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof EventCategory)) { return false; } return id != null && id.equals(((EventCategory) o).id); } @Override public int hashCode() { return 31; } @Override public String toString() { return "EventCategory{" + "id=" + getId() + ", splitDeck='" + isSplitDeck() + "'" + "}"; } }
UTF-8
Java
4,398
java
EventCategory.java
Java
[]
null
[]
package com.ar.pbpoints.domain; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import javax.persistence.*; import javax.validation.constraints.*; import java.io.Serializable; import java.util.HashSet; import java.util.Set; /** * A EventCategory. */ @Entity @Table(name = "event_category") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class EventCategory implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name = "split_deck") private Boolean splitDeck; @ManyToOne(optional = false) @NotNull @JsonIgnoreProperties("eventCategories") private Event event; @ManyToOne(optional = false) @NotNull @JsonIgnoreProperties("eventCategories") private Category category; @ManyToOne(optional = false) @NotNull @JsonIgnoreProperties("eventCategories") private Format format; @OneToMany(mappedBy = "eventCategory") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) private Set<Game> games = new HashSet<>(); @OneToMany(mappedBy = "eventCategory") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) private Set<Roster> rosters = new HashSet<>(); // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Boolean isSplitDeck() { return splitDeck; } public EventCategory splitDeck(Boolean splitDeck) { this.splitDeck = splitDeck; return this; } public void setSplitDeck(Boolean splitDeck) { this.splitDeck = splitDeck; } public Event getEvent() { return event; } public EventCategory event(Event event) { this.event = event; return this; } public void setEvent(Event event) { this.event = event; } public Category getCategory() { return category; } public EventCategory category(Category category) { this.category = category; return this; } public void setCategory(Category category) { this.category = category; } public Format getFormat() { return format; } public EventCategory format(Format format) { this.format = format; return this; } public void setFormat(Format format) { this.format = format; } public Set<Game> getGames() { return games; } public EventCategory games(Set<Game> games) { this.games = games; return this; } public EventCategory addGame(Game game) { this.games.add(game); game.setEventCategory(this); return this; } public EventCategory removeGame(Game game) { this.games.remove(game); game.setEventCategory(null); return this; } public void setGames(Set<Game> games) { this.games = games; } public Set<Roster> getRosters() { return rosters; } public EventCategory rosters(Set<Roster> rosters) { this.rosters = rosters; return this; } public EventCategory addRoster(Roster roster) { this.rosters.add(roster); roster.setEventCategory(this); return this; } public EventCategory removeRoster(Roster roster) { this.rosters.remove(roster); roster.setEventCategory(null); return this; } public void setRosters(Set<Roster> rosters) { this.rosters = rosters; } // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof EventCategory)) { return false; } return id != null && id.equals(((EventCategory) o).id); } @Override public int hashCode() { return 31; } @Override public String toString() { return "EventCategory{" + "id=" + getId() + ", splitDeck='" + isSplitDeck() + "'" + "}"; } }
4,398
0.627558
0.626876
188
22.393618
19.90815
109
false
false
0
0
0
0
0
0
0.335106
false
false
2
ddfa5d262410752f6b7cd30a92b283be1af6f5e1
15,934,328,670,390
4557861aebb1b714006d104d2506413236921dfc
/src/cn/com/common/model/TblOrderUnit.java
e7aff09ae346a953267a7a7d8b0eefc41e9afe48
[]
no_license
Fassions/ssm-1.7-my-DigCerServiceNet-idea
https://github.com/Fassions/ssm-1.7-my-DigCerServiceNet-idea
af0754255a510c0d2de11c206b2e8c090f4dabb3
98302302904b103b9977fc303c5a9974e17ad423
refs/heads/master
2022-11-17T10:58:10.597000
2020-07-23T05:48:51
2020-07-23T05:48:51
281,861,269
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.com.common.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; import java.io.Serializable; import javax.xml.bind.annotation.XmlRootElement; import cn.com.common.agent.BaseEntity; import java.util.Date; /** * @Description * @Author zhj * @Date 2019-07-04 */ @XmlRootElement ( name ="TblOrderUnit" ) public class TblOrderUnit extends BaseEntity implements Serializable { private static final long serialVersionUID = 55742346147876531L; /** * 订购单位 */ private String orderUnitName; /** * 备注 */ private String remark; public String getOrderUnitName() { return this.orderUnitName; } public void setOrderUnitName(String orderUnitName) { this.orderUnitName = orderUnitName; } public String getRemark() { return this.remark; } public void setRemark(String remark) { this.remark = remark; } }
UTF-8
Java
912
java
TblOrderUnit.java
Java
[ { "context": "java.util.Date;\n\n/**\n * @Description \n * @Author zhj\n * @Date 2019-07-04 \n */\n\n@XmlRootElement ( name ", "end": 306, "score": 0.9995840787887573, "start": 303, "tag": "USERNAME", "value": "zhj" } ]
null
[]
package cn.com.common.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; import java.io.Serializable; import javax.xml.bind.annotation.XmlRootElement; import cn.com.common.agent.BaseEntity; import java.util.Date; /** * @Description * @Author zhj * @Date 2019-07-04 */ @XmlRootElement ( name ="TblOrderUnit" ) public class TblOrderUnit extends BaseEntity implements Serializable { private static final long serialVersionUID = 55742346147876531L; /** * 订购单位 */ private String orderUnitName; /** * 备注 */ private String remark; public String getOrderUnitName() { return this.orderUnitName; } public void setOrderUnitName(String orderUnitName) { this.orderUnitName = orderUnitName; } public String getRemark() { return this.remark; } public void setRemark(String remark) { this.remark = remark; } }
912
0.736667
0.708889
51
16.647058
18.542822
70
false
false
0
0
0
0
0
0
0.784314
false
false
2
45d840392c07e025701c04b9be88144f052beb7b
9,663,676,473,889
9c819d025c691477774f2cf514ee88c6e81ac812
/platform-api/src/main/java/com/platform/entity/KeywordsVo.java
be5feb7defae206e8fd22bb7af4bb1892965d3a4
[ "Apache-2.0" ]
permissive
lipengjun92/platform-wxshop
https://github.com/lipengjun92/platform-wxshop
6115d78dfc9b871bb94d0a987a4397fac8a60c43
a1b4a3a9c49b7d16658db9682184d23edc89a682
refs/heads/master
2023-08-22T02:15:06.708000
2023-08-04T08:12:40
2023-08-04T08:12:40
133,917,652
299
119
Apache-2.0
false
2020-08-05T04:21:10
2018-05-18T07:13:56
2020-08-05T04:21:00
2020-08-05T04:21:09
73,973
100
35
0
TSQL
false
false
package com.platform.entity; import java.io.Serializable; import java.util.Date; /** * 热闹关键词表 * * @author lipengjun * @email 939961241@qq.com * @date 2017-08-15 08:03:39 */ public class KeywordsVo implements Serializable { private static final long serialVersionUID = 1L; //关键字 private String keyword; //热销 private Integer is_hot; //默认 private Integer is_default; //显示 private Integer is_show; //排序 private Integer sort_order; //关键词的跳转链接 private String scheme_url; //主键 private Integer id; //类型 private Integer type; public String getKeyword() { return keyword; } public void setKeyword(String keyword) { this.keyword = keyword; } public Integer getIs_hot() { return is_hot; } public void setIs_hot(Integer is_hot) { this.is_hot = is_hot; } public Integer getIs_default() { return is_default; } public void setIs_default(Integer is_default) { this.is_default = is_default; } public Integer getIs_show() { return is_show; } public void setIs_show(Integer is_show) { this.is_show = is_show; } public Integer getSort_order() { return sort_order; } public void setSort_order(Integer sort_order) { this.sort_order = sort_order; } public String getScheme_url() { return scheme_url; } public void setScheme_url(String scheme_url) { this.scheme_url = scheme_url; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getType() { return type; } public void setType(Integer type) { this.type = type; } }
UTF-8
Java
1,851
java
KeywordsVo.java
Java
[ { "context": "port java.util.Date;\n\n\n/**\n * 热闹关键词表\n *\n * @author lipengjun\n * @email 939961241@qq.com\n * @date 2017-08-15 08", "end": 121, "score": 0.9194951057434082, "start": 112, "tag": "USERNAME", "value": "lipengjun" }, { "context": "\n\n/**\n * 热闹关键词表\n *\n * @author lipengjun\n * @email 939961241@qq.com\n * @date 2017-08-15 08:03:39\n */\npublic class Key", "end": 148, "score": 0.9998565316200256, "start": 132, "tag": "EMAIL", "value": "939961241@qq.com" } ]
null
[]
package com.platform.entity; import java.io.Serializable; import java.util.Date; /** * 热闹关键词表 * * @author lipengjun * @email <EMAIL> * @date 2017-08-15 08:03:39 */ public class KeywordsVo implements Serializable { private static final long serialVersionUID = 1L; //关键字 private String keyword; //热销 private Integer is_hot; //默认 private Integer is_default; //显示 private Integer is_show; //排序 private Integer sort_order; //关键词的跳转链接 private String scheme_url; //主键 private Integer id; //类型 private Integer type; public String getKeyword() { return keyword; } public void setKeyword(String keyword) { this.keyword = keyword; } public Integer getIs_hot() { return is_hot; } public void setIs_hot(Integer is_hot) { this.is_hot = is_hot; } public Integer getIs_default() { return is_default; } public void setIs_default(Integer is_default) { this.is_default = is_default; } public Integer getIs_show() { return is_show; } public void setIs_show(Integer is_show) { this.is_show = is_show; } public Integer getSort_order() { return sort_order; } public void setSort_order(Integer sort_order) { this.sort_order = sort_order; } public String getScheme_url() { return scheme_url; } public void setScheme_url(String scheme_url) { this.scheme_url = scheme_url; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getType() { return type; } public void setType(Integer type) { this.type = type; } }
1,842
0.591746
0.57836
97
17.484535
15.687748
52
false
false
0
0
0
0
0
0
0.28866
false
false
2
14daa178d1037c24d4a682e4e288e5ea6a90ecc3
32,358,283,669,828
febdfb09c3d2962905e6fa2ddd7edc3c8a0603ad
/src/main/java/com/cdb/model/Subscriber.java
68bbff1c3b1a7fa9ef4918e6f25fc769f8f80be3
[]
no_license
vedratna89/cdb
https://github.com/vedratna89/cdb
5219e1352c1b639d120ef92be3244dad45dc8a8e
8956ff8440567183b01024bb248b3f8664a71327
refs/heads/master
2018-10-20T06:24:33.140000
2018-10-02T17:19:12
2018-10-02T17:19:12
138,003,682
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cdb.model; import java.util.Date; import java.util.Objects; /** * Model class for subscriber * @author Ved */ public class Subscriber extends BaseVo { private static final long serialVersionUID = 1L; private String guid; private String firstName; private String email; private String lastName; private String audienceType; private String audienceTypeOther; private String address; private String country; private String state; private String region; private String city; private String medicalSpecialization; private String professionalDesignation; private String postalCode; private Boolean requestToSpeak; private Boolean interestAmyloidosis; private Boolean interestAhus; private Boolean interestComplementMediatedDiseases; private Boolean interestHemophilia; private Boolean interestHyperoxaluria; private Boolean interestPNH; private Boolean interestPorphyrias; private String sourceInitial; private String sourceAll; private String client; private Date dateAdded; private Date dateModified; private Date doubleOptInDate; private Date optOutDate; // these instance used in JQGrid. private String dateAddedStr; private String dateModifiedStr; private String doubleOptInDateStr; private String optOutDateStr; private Boolean completeFlag; private Boolean updatedByImport; private boolean isIgnore = false; private Boolean interestCns; private Boolean requestKit; private String phoneNumber; private String facility; public Subscriber(){ } public Subscriber(boolean isIgnore){ this.isIgnore = isIgnore; } public Date getDateAdded() { return dateAdded; } public void setDateAdded(Date dateAdded) { this.dateAdded = dateAdded; } public Date getDateModified() { return dateModified; } public void setDateModified(Date dateModified) { this.dateModified = dateModified; } public String getGuid() { return guid; } public void setGuid(String guid) { this.guid = guid; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getAudienceType() { return audienceType; } public void setAudienceType(String audienceType) { this.audienceType = audienceType; } public String getAudienceTypeOther() { return audienceTypeOther; } public void setAudienceTypeOther(String audienceTypeOther) { this.audienceTypeOther = audienceTypeOther; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getRegion() { return region; } public void setRegion(String region) { this.region = region; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getMedicalSpecialization() { return medicalSpecialization; } public void setMedicalSpecialization(String medicalSpecialization) { this.medicalSpecialization = medicalSpecialization; } public String getProfessionalDesignation() { return professionalDesignation; } public void setProfessionalDesignation(String professionalDesignation) { this.professionalDesignation = professionalDesignation; } public String getPostalCode() { return postalCode; } public void setPostalCode(String postalCode) { this.postalCode = postalCode; } public Boolean getRequestToSpeak() { if(!isIgnore){ return requestToSpeak != null ? requestToSpeak : Boolean.FALSE; } return requestToSpeak; } public void setRequestToSpeak(Boolean requestToSpeak) { this.requestToSpeak = requestToSpeak; } public Boolean getInterestAmyloidosis() { if(!isIgnore){ return interestAmyloidosis != null ? interestAmyloidosis : Boolean.FALSE; } return interestAmyloidosis; } public void setInterestAmyloidosis(Boolean interestAmyloidosis) { this.interestAmyloidosis = interestAmyloidosis; } public Boolean getInterestAhus() { if(!isIgnore){ return interestAhus != null ? interestAhus : Boolean.FALSE ; } return interestAhus; } public void setInterestAhus(Boolean interestAhus) { this.interestAhus = interestAhus; } public Boolean getInterestComplementMediatedDiseases() { if(!isIgnore){ return interestComplementMediatedDiseases != null ? interestComplementMediatedDiseases : Boolean.FALSE; } return interestComplementMediatedDiseases; } public void setInterestComplementMediatedDiseases(Boolean interestComplementMediatedDiseases) { this.interestComplementMediatedDiseases = interestComplementMediatedDiseases; } public Boolean getInterestHemophilia() { if(!isIgnore){ return interestHemophilia != null ? interestHemophilia: Boolean.FALSE; } return interestHemophilia; } public void setInterestHemophilia(Boolean interestHemophilia) { this.interestHemophilia = interestHemophilia; } public Boolean getInterestHyperoxaluria() { if(!isIgnore){ return interestHyperoxaluria != null ? interestHyperoxaluria : Boolean.FALSE; } return interestHyperoxaluria; } public void setInterestHyperoxaluria(Boolean interestHyperoxaluria) { this.interestHyperoxaluria = interestHyperoxaluria; } public Boolean getInterestPNH() { if(!isIgnore){ return interestPNH != null ? interestPNH : Boolean.FALSE; } return interestPNH; } public void setInterestPNH(Boolean interestPNH) { this.interestPNH = interestPNH; } public Boolean getInterestPorphyrias() { if(!isIgnore){ return interestPorphyrias != null ? interestPorphyrias : Boolean.FALSE; } return interestPorphyrias; } public Boolean getCompleteFlag() { if(!isIgnore){ return completeFlag != null ? completeFlag: Boolean.FALSE; } return completeFlag; } public Boolean getUpdatedByImport() { if(!isIgnore){ return updatedByImport != null ? updatedByImport: Boolean.FALSE; } return updatedByImport; } public Boolean getInterestCns() { if(!isIgnore){ return interestCns != null ? interestCns: Boolean.FALSE; } return interestCns; } public void setInterestCns(Boolean interestCns) { this.interestCns = interestCns; } public Boolean getRequestKit() { if(!isIgnore){ return requestKit != null ? requestKit: Boolean.FALSE; } return requestKit; } public void setRequestKit(Boolean requestKit) { this.requestKit = requestKit; } public void setUpdatedByImport(Boolean updatedByImport) { this.updatedByImport = updatedByImport; } public void setCompleteFlag(Boolean completeFlag) { this.completeFlag = completeFlag; } public void setInterestPorphyrias(Boolean interestPorphyrias) { this.interestPorphyrias = interestPorphyrias; } public String getSourceInitial() { return sourceInitial; } public void setSourceInitial(String sourceInitial) { this.sourceInitial = sourceInitial; } public String getSourceAll() { return sourceAll; } public void setSourceAll(String sourceAll) { this.sourceAll = sourceAll; } public String getClient() { return client; } public void setClient(String client) { this.client = client; } public Date getDoubleOptInDate() { return doubleOptInDate; } public void setDoubleOptInDate(Date doubleOptInDate) { this.doubleOptInDate = doubleOptInDate; } public Date getOptOutDate() { return optOutDate; } public void setOptOutDate(Date optOutDate) { this.optOutDate = optOutDate; } public String getDateAddedStr() { return dateAddedStr; } public void setDateAddedStr(String dateAddedStr) { this.dateAddedStr = dateAddedStr; } public String getDateModifiedStr() { return dateModifiedStr; } public void setDateModifiedStr(String dateModifiedStr) { this.dateModifiedStr = dateModifiedStr; } public String getDoubleOptInDateStr() { return doubleOptInDateStr; } public void setDoubleOptInDateStr(String doubleOptInDateStr) { this.doubleOptInDateStr = doubleOptInDateStr; } public String getOptOutDateStr() { return optOutDateStr; } public void setOptOutDateStr(String optOutDateStr) { this.optOutDateStr = optOutDateStr; } public String getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } public String getFacility() { return facility; } public void setFacility(String facility) { this.facility = facility; } @Override public int hashCode() { int result = 17; result = 31 * result + Objects.hashCode(guid); return result; } @Override public boolean equals(Object obj) { if(this == obj){ return true; } if(Objects.isNull(obj) || this.getClass() != obj.getClass()){ return false; } Subscriber s = (Subscriber)obj; return Objects.equals(this.guid, s.guid); } }
UTF-8
Java
9,575
java
Subscriber.java
Java
[ { "context": "s;\r\n/**\r\n * Model class for subscriber\r\n * @author Ved\r\n */\r\npublic class Subscriber extends BaseVo {\r\n\r\n\t", "end": 125, "score": 0.8358420729637146, "start": 122, "tag": "NAME", "value": "Ved" } ]
null
[]
package com.cdb.model; import java.util.Date; import java.util.Objects; /** * Model class for subscriber * @author Ved */ public class Subscriber extends BaseVo { private static final long serialVersionUID = 1L; private String guid; private String firstName; private String email; private String lastName; private String audienceType; private String audienceTypeOther; private String address; private String country; private String state; private String region; private String city; private String medicalSpecialization; private String professionalDesignation; private String postalCode; private Boolean requestToSpeak; private Boolean interestAmyloidosis; private Boolean interestAhus; private Boolean interestComplementMediatedDiseases; private Boolean interestHemophilia; private Boolean interestHyperoxaluria; private Boolean interestPNH; private Boolean interestPorphyrias; private String sourceInitial; private String sourceAll; private String client; private Date dateAdded; private Date dateModified; private Date doubleOptInDate; private Date optOutDate; // these instance used in JQGrid. private String dateAddedStr; private String dateModifiedStr; private String doubleOptInDateStr; private String optOutDateStr; private Boolean completeFlag; private Boolean updatedByImport; private boolean isIgnore = false; private Boolean interestCns; private Boolean requestKit; private String phoneNumber; private String facility; public Subscriber(){ } public Subscriber(boolean isIgnore){ this.isIgnore = isIgnore; } public Date getDateAdded() { return dateAdded; } public void setDateAdded(Date dateAdded) { this.dateAdded = dateAdded; } public Date getDateModified() { return dateModified; } public void setDateModified(Date dateModified) { this.dateModified = dateModified; } public String getGuid() { return guid; } public void setGuid(String guid) { this.guid = guid; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getAudienceType() { return audienceType; } public void setAudienceType(String audienceType) { this.audienceType = audienceType; } public String getAudienceTypeOther() { return audienceTypeOther; } public void setAudienceTypeOther(String audienceTypeOther) { this.audienceTypeOther = audienceTypeOther; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getRegion() { return region; } public void setRegion(String region) { this.region = region; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getMedicalSpecialization() { return medicalSpecialization; } public void setMedicalSpecialization(String medicalSpecialization) { this.medicalSpecialization = medicalSpecialization; } public String getProfessionalDesignation() { return professionalDesignation; } public void setProfessionalDesignation(String professionalDesignation) { this.professionalDesignation = professionalDesignation; } public String getPostalCode() { return postalCode; } public void setPostalCode(String postalCode) { this.postalCode = postalCode; } public Boolean getRequestToSpeak() { if(!isIgnore){ return requestToSpeak != null ? requestToSpeak : Boolean.FALSE; } return requestToSpeak; } public void setRequestToSpeak(Boolean requestToSpeak) { this.requestToSpeak = requestToSpeak; } public Boolean getInterestAmyloidosis() { if(!isIgnore){ return interestAmyloidosis != null ? interestAmyloidosis : Boolean.FALSE; } return interestAmyloidosis; } public void setInterestAmyloidosis(Boolean interestAmyloidosis) { this.interestAmyloidosis = interestAmyloidosis; } public Boolean getInterestAhus() { if(!isIgnore){ return interestAhus != null ? interestAhus : Boolean.FALSE ; } return interestAhus; } public void setInterestAhus(Boolean interestAhus) { this.interestAhus = interestAhus; } public Boolean getInterestComplementMediatedDiseases() { if(!isIgnore){ return interestComplementMediatedDiseases != null ? interestComplementMediatedDiseases : Boolean.FALSE; } return interestComplementMediatedDiseases; } public void setInterestComplementMediatedDiseases(Boolean interestComplementMediatedDiseases) { this.interestComplementMediatedDiseases = interestComplementMediatedDiseases; } public Boolean getInterestHemophilia() { if(!isIgnore){ return interestHemophilia != null ? interestHemophilia: Boolean.FALSE; } return interestHemophilia; } public void setInterestHemophilia(Boolean interestHemophilia) { this.interestHemophilia = interestHemophilia; } public Boolean getInterestHyperoxaluria() { if(!isIgnore){ return interestHyperoxaluria != null ? interestHyperoxaluria : Boolean.FALSE; } return interestHyperoxaluria; } public void setInterestHyperoxaluria(Boolean interestHyperoxaluria) { this.interestHyperoxaluria = interestHyperoxaluria; } public Boolean getInterestPNH() { if(!isIgnore){ return interestPNH != null ? interestPNH : Boolean.FALSE; } return interestPNH; } public void setInterestPNH(Boolean interestPNH) { this.interestPNH = interestPNH; } public Boolean getInterestPorphyrias() { if(!isIgnore){ return interestPorphyrias != null ? interestPorphyrias : Boolean.FALSE; } return interestPorphyrias; } public Boolean getCompleteFlag() { if(!isIgnore){ return completeFlag != null ? completeFlag: Boolean.FALSE; } return completeFlag; } public Boolean getUpdatedByImport() { if(!isIgnore){ return updatedByImport != null ? updatedByImport: Boolean.FALSE; } return updatedByImport; } public Boolean getInterestCns() { if(!isIgnore){ return interestCns != null ? interestCns: Boolean.FALSE; } return interestCns; } public void setInterestCns(Boolean interestCns) { this.interestCns = interestCns; } public Boolean getRequestKit() { if(!isIgnore){ return requestKit != null ? requestKit: Boolean.FALSE; } return requestKit; } public void setRequestKit(Boolean requestKit) { this.requestKit = requestKit; } public void setUpdatedByImport(Boolean updatedByImport) { this.updatedByImport = updatedByImport; } public void setCompleteFlag(Boolean completeFlag) { this.completeFlag = completeFlag; } public void setInterestPorphyrias(Boolean interestPorphyrias) { this.interestPorphyrias = interestPorphyrias; } public String getSourceInitial() { return sourceInitial; } public void setSourceInitial(String sourceInitial) { this.sourceInitial = sourceInitial; } public String getSourceAll() { return sourceAll; } public void setSourceAll(String sourceAll) { this.sourceAll = sourceAll; } public String getClient() { return client; } public void setClient(String client) { this.client = client; } public Date getDoubleOptInDate() { return doubleOptInDate; } public void setDoubleOptInDate(Date doubleOptInDate) { this.doubleOptInDate = doubleOptInDate; } public Date getOptOutDate() { return optOutDate; } public void setOptOutDate(Date optOutDate) { this.optOutDate = optOutDate; } public String getDateAddedStr() { return dateAddedStr; } public void setDateAddedStr(String dateAddedStr) { this.dateAddedStr = dateAddedStr; } public String getDateModifiedStr() { return dateModifiedStr; } public void setDateModifiedStr(String dateModifiedStr) { this.dateModifiedStr = dateModifiedStr; } public String getDoubleOptInDateStr() { return doubleOptInDateStr; } public void setDoubleOptInDateStr(String doubleOptInDateStr) { this.doubleOptInDateStr = doubleOptInDateStr; } public String getOptOutDateStr() { return optOutDateStr; } public void setOptOutDateStr(String optOutDateStr) { this.optOutDateStr = optOutDateStr; } public String getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } public String getFacility() { return facility; } public void setFacility(String facility) { this.facility = facility; } @Override public int hashCode() { int result = 17; result = 31 * result + Objects.hashCode(guid); return result; } @Override public boolean equals(Object obj) { if(this == obj){ return true; } if(Objects.isNull(obj) || this.getClass() != obj.getClass()){ return false; } Subscriber s = (Subscriber)obj; return Objects.equals(this.guid, s.guid); } }
9,575
0.723029
0.722507
387
22.741602
20.434059
106
false
false
0
0
0
0
0
0
1.671835
false
false
2
b0dc5b8daf4e9425020dbd49cc9654d04d78a149
19,550,691,195,884
6d77cec89b305126523e8fed2ed86e3a1e8204ba
/src/main/java/thread/ThreadTest2.java
6acd760802ed51502843449cc3f3e92c501a77d6
[]
no_license
shannonCg/lang-java
https://github.com/shannonCg/lang-java
2d1c7242a2abb54695eabf78084e11f1759d82c4
9d7203805d8742ae9e105b2f1a986a3d38a1b390
refs/heads/master
2022-12-25T01:13:05.727000
2020-10-03T14:39:32
2020-10-03T14:39:32
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package thread; public class ThreadTest2 implements Runnable { @Override public void run() { String threadName = Thread.currentThread().getName(); System.out.println("Thread ["+threadName+"] executed"); } }
UTF-8
Java
217
java
ThreadTest2.java
Java
[]
null
[]
package thread; public class ThreadTest2 implements Runnable { @Override public void run() { String threadName = Thread.currentThread().getName(); System.out.println("Thread ["+threadName+"] executed"); } }
217
0.718894
0.714286
11
18.727272
21.871904
57
false
false
0
0
0
0
0
0
0.909091
false
false
2
58a2f7d047ea7c5231ff0bc70e8a84b06c1423b8
32,444,183,012,279
9bf3b688739f5d50d1ecf9ccc061ed34911b837b
/src/main/java/com/cg/App/entites/Department.java
50e2d8f98ff4c3061aac444a53db95deeda0507d
[]
no_license
SpandanaPalakurthy/Sample
https://github.com/SpandanaPalakurthy/Sample
22b181ce2445eda42fc5c700f1d7bcddf0bcbbdd
e81a9e66a357ebbdc8e1299dfd610b436ebdeeae
refs/heads/master
2022-04-24T02:03:28.533000
2020-04-28T08:16:22
2020-04-28T08:16:22
258,158,513
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cg.App.entites; import java.util.List; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.SequenceGenerator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @Entity @JsonIgnoreProperties({"hibernateLazyInitializer", "handler"}) public class Department { @Override public String toString() { return "Department [empDeptId=" + empDeptId + ", empDeptName=" + empDeptName + ", employee=" + employee + "]"; } @Id @SequenceGenerator(name = "seq", sequenceName = "seq", initialValue = 100000, allocationSize = 100001) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq") private int empDeptId; private String empDeptName; @JsonIgnore @OneToMany(mappedBy = "department") private List<Employee> employee; public int getEmpDeptId() { return empDeptId; } public void setEmpDeptId(int empDeptId) { this.empDeptId = empDeptId; } public String getEmpDeptName() { return empDeptName; } public void setEmpDeptName(String empDeptName) { this.empDeptName = empDeptName; } }
UTF-8
Java
1,248
java
Department.java
Java
[]
null
[]
package com.cg.App.entites; import java.util.List; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.SequenceGenerator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @Entity @JsonIgnoreProperties({"hibernateLazyInitializer", "handler"}) public class Department { @Override public String toString() { return "Department [empDeptId=" + empDeptId + ", empDeptName=" + empDeptName + ", employee=" + employee + "]"; } @Id @SequenceGenerator(name = "seq", sequenceName = "seq", initialValue = 100000, allocationSize = 100001) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq") private int empDeptId; private String empDeptName; @JsonIgnore @OneToMany(mappedBy = "department") private List<Employee> employee; public int getEmpDeptId() { return empDeptId; } public void setEmpDeptId(int empDeptId) { this.empDeptId = empDeptId; } public String getEmpDeptName() { return empDeptName; } public void setEmpDeptName(String empDeptName) { this.empDeptName = empDeptName; } }
1,248
0.766026
0.75641
48
25
25.743122
112
false
false
0
0
0
0
0
0
1.1875
false
false
2
e7179d2c4eac4250b27c71657e17db1fc537d763
14,963,666,064,424
cee10b593c9b17347e52d5d044bfe1b6b372e179
/src/main/java/com/shunya/tutorial/dynamodbatomiccounter/atomic/Content.java
1aefdbef76de504b545e4a203310cb22ffe20429
[]
no_license
jingood2/localstack-dynamodb-test
https://github.com/jingood2/localstack-dynamodb-test
43808c01f46b7333046eae3661fafde20831a2a1
eab4a9794065b895d782bc422ec7dffab9e34b4a
refs/heads/master
2021-03-09T19:43:01.672000
2019-04-24T05:43:52
2019-04-24T05:43:52
246,373,625
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.shunya.tutorial.dynamodbatomiccounter.atomic; import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAttribute; import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey; import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTable; @DynamoDBTable(tableName = "local-content") public class Content { @DynamoDBHashKey(attributeName = "id") private String id; @DynamoDBAttribute private String title; @DynamoDBAttribute private String description; @DynamoDBAttribute private long views; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public long getViews() { return views; } public void setViews(long views) { this.views = views; } }
UTF-8
Java
1,120
java
Content.java
Java
[]
null
[]
package com.shunya.tutorial.dynamodbatomiccounter.atomic; import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAttribute; import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey; import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTable; @DynamoDBTable(tableName = "local-content") public class Content { @DynamoDBHashKey(attributeName = "id") private String id; @DynamoDBAttribute private String title; @DynamoDBAttribute private String description; @DynamoDBAttribute private long views; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public long getViews() { return views; } public void setViews(long views) { this.views = views; } }
1,120
0.675
0.672321
52
20.538462
19.777086
72
false
false
0
0
0
0
0
0
0.307692
false
false
2
bbf07f048d2530bc11fa1c1dec3e20c5d6f2af6e
4,423,816,379,584
5d090791eaf27c953ce43305a800de0ec712e4ad
/app/src/main/java/com/nixsolutions/cupboard/entities/Device.java
706242bcbfaeacc3ff4050cd6d2386fb3274f0ac
[]
no_license
user56i/sample
https://github.com/user56i/sample
44353b1d67e1aaebe9668b242123ae646f679185
cd60ff0e24d6775f49ab0337f58784463b21c155
refs/heads/master
2021-01-23T05:34:59.493000
2015-06-17T14:35:03
2015-06-17T14:35:03
37,599,521
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.nixsolutions.cupboard.entities; public class Device { public Long _id; public Long humanId; public String deviceName; }
UTF-8
Java
148
java
Device.java
Java
[]
null
[]
package com.nixsolutions.cupboard.entities; public class Device { public Long _id; public Long humanId; public String deviceName; }
148
0.716216
0.716216
10
13.8
14.844527
43
false
false
0
0
0
0
0
0
0.4
false
false
2
485857ca9c0485fd2bc7fe753b0ddaacb89da23b
13,572,096,704,054
732baf9eb51790fafe8348a959a5b1987d429070
/BOJ/num7576.java
38de75352afdc5a3ef897965668aaaab3794a2a8
[]
no_license
woojin9606/Algorithm
https://github.com/woojin9606/Algorithm
30036e501869bc2b6f8d1f2efa54ecf4b0321cc3
fa526ab77114e0401270e64208b16ed2bdbe1e60
refs/heads/master
2023-07-05T00:10:51.411000
2021-08-30T07:02:44
2021-08-30T07:02:44
392,319,956
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package algo; import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; public class num7576 { static int N; static int M; static int[][] board; static boolean[][] check; public static void main(String[] args) { Scanner sc=new Scanner(System.in); N=sc.nextInt(); M=sc.nextInt(); board=new int[M][N]; check=new boolean[M][N]; for (int i = 0; i < M; i++) { for (int j = 0; j < N; j++) { board[i][j]=sc.nextInt(); } } System.out.println(bfs()); } public static int bfs() { Queue<int[]> q = new LinkedList<>(); for (int i = 0; i < M; i++) { for (int j = 0; j < N; j++) { if(board[i][j]==1) { q.add(new int[] {i,j}); check[i][j] = true; } } } int[] dx= {-1,1,0,0}; int[] dy= {0,0,-1,1}; while (!q.isEmpty()) { int temp[] = q.poll(); for (int i = 0; i < dx.length; i++) { int newx=temp[0]+dx[i]; int newy=temp[1]+dy[i]; if (isNotWall(newx,newy)&&!check[newx][newy] &&board[newx][newy] == 0) { q.add(new int[] {newx,newy}); check[newx][newy] = true; board[newx][newy] = board[temp[0]][temp[1]]+1; } } } int max=0; for (int i = 0; i < M; i++) { for (int j = 0; j < N; j++) { if(board[i][j]==0) { return -1; } if(board[i][j]>max) { max=board[i][j]; } } } return max-1; } public static boolean isNotWall(int x, int y) { if (x >= 0 && x < M && y >= 0 && y < N) { return true; } return false; } }
UTF-8
Java
1,522
java
num7576.java
Java
[]
null
[]
package algo; import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; public class num7576 { static int N; static int M; static int[][] board; static boolean[][] check; public static void main(String[] args) { Scanner sc=new Scanner(System.in); N=sc.nextInt(); M=sc.nextInt(); board=new int[M][N]; check=new boolean[M][N]; for (int i = 0; i < M; i++) { for (int j = 0; j < N; j++) { board[i][j]=sc.nextInt(); } } System.out.println(bfs()); } public static int bfs() { Queue<int[]> q = new LinkedList<>(); for (int i = 0; i < M; i++) { for (int j = 0; j < N; j++) { if(board[i][j]==1) { q.add(new int[] {i,j}); check[i][j] = true; } } } int[] dx= {-1,1,0,0}; int[] dy= {0,0,-1,1}; while (!q.isEmpty()) { int temp[] = q.poll(); for (int i = 0; i < dx.length; i++) { int newx=temp[0]+dx[i]; int newy=temp[1]+dy[i]; if (isNotWall(newx,newy)&&!check[newx][newy] &&board[newx][newy] == 0) { q.add(new int[] {newx,newy}); check[newx][newy] = true; board[newx][newy] = board[temp[0]][temp[1]]+1; } } } int max=0; for (int i = 0; i < M; i++) { for (int j = 0; j < N; j++) { if(board[i][j]==0) { return -1; } if(board[i][j]>max) { max=board[i][j]; } } } return max-1; } public static boolean isNotWall(int x, int y) { if (x >= 0 && x < M && y >= 0 && y < N) { return true; } return false; } }
1,522
0.492773
0.471748
86
16.697674
15.017098
76
false
false
0
0
0
0
0
0
2.930233
false
false
2
127224240de4b4890df62f71cd853ead0e6f32c3
13,039,520,740,280
80a0f8a14c23e88f92fb83ec1082a9464f84a403
/src/View/DrawPanel.java
da9695472186858140d3a1ae59908564bb8b8b1b
[]
no_license
huzhejie/SystemSimulation
https://github.com/huzhejie/SystemSimulation
6941d299852cec168d7c40556ee643bb80dcf9da
711b4da6818850f0812333e4250185491c94e8cb
refs/heads/master
2021-01-21T05:28:12.952000
2017-05-08T04:49:49
2017-05-08T04:49:49
83,190,200
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package View; import Control.*; import View.Frame.*; import twaver.*; import twaver.network.*; import twaver.network.background.ColorBackground; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.beans.PropertyChangeEvent; import java.sql.Connection; import java.sql.DriverManager; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Map; /** * Created by huzhejie on 2017/2/14. */ public class DrawPanel extends TNetwork{ //定义编辑工具栏中需要的用到的功能 public String ids[] = new String[]{ "Selection", "LazyMove", "Magnifier", "Pan", "$SEPARATOR", "ZoomIn", "ZoomOut", "ZoomReset", "ZoomToOverview", "ZoomToRectangle", "$SEPARATOR",//分隔符 "CreateLink", "CreateShapeLink", "$SEPARATOR",//分隔符 "Undo", "Redo", "$SEPARATOR", "OpenDataFile", "SaveDataFile", "FullScreen", "ExportImage", "ExportSVG", "Print" }; //数据库连接 public static Connection connection = null; private Color elementColor = null; private Color voltageColor_10 = Color.blue; private Color voltageColor_35 = Color.yellow; private Color voltageColor_110 = Color.red; private Color voltageColor_220 = Color.orange; private Color voltageColor_500 = Color.green; public DrawPanel(TDataBox dataBox){ this.setDataBox(dataBox); this.init(dataBox); } /** * 初始化画板和数据库连接 */ private void init(final TDataBox dataBox){ //初始化数据库连接 try{ Class.forName("com.mysql.jdbc.Driver").newInstance(); String url = "jdbc:mysql://localhost:3306/electronicsystem?" + "user=root&password=hzj199429&useUnicode=true&characterEncoding=UTF8&useSSL=false"; connection = DriverManager.getConnection(url); // System.out.println("数据库连接成功"); }catch (Exception cnfe){ cnfe.printStackTrace(); } //设置背景颜色 this.setBackground(new ColorBackground(Color.CYAN.darker().darker())); //设置工具栏 this.setToolbar(NetworkToolBarFactory.getToolBar(ids, this)); this.getToolbar().setMinimumSize(new Dimension(50,50)); //设置undo/redo的步数限制 this.getDataBox().getUndoRedoManager().setLimit(100); //允许使用快捷键ctrl+y与ctrl+z this.setEnableUndoRedoWithKeyboard(true); //允许使用快捷键ctrl+a全选 this.setEnableSelectAllWithKeyboard(true); //设置Resizable Node可以直接改变大小 this.setResizableFilter(new ResizableFilter() { @Override public boolean isResizable(Element element) { return true; } }); //元素内容有变化时就重画该元素 this.setElementPropertyChangeRepaintFilter(new ElementPropertyChangeRepaintFilter() { @Override public boolean isInterested(Element element, PropertyChangeEvent propertyChangeEvent) { if(element instanceof Link){ ((Link) element).putLinkWidth(1); ((Link) element).putLinkOutlineWidth(0); ((Link) element).putLinkAntialias(true); } return true; } }); //添加右键菜单 this.setPopupMenuGenerator(new PopupMenuGenerator() { @Override public JPopupMenu generate(final TView tView, final MouseEvent mouseEvent) { JPopupMenu jPopupMenu = new JPopupMenu(); if(tView.getDataBox().getSelectionModel().isEmpty()){ jPopupMenu.add(new JMenuItem("您未选择任何元件")); } else{ final JMenuItem attribute = new JMenuItem("图形属性"); final JMenuItem property = new JMenuItem("设备资料"); final JMenuItem rotate = new JMenuItem("旋转90°"); final JMenuItem paint = new JMenuItem("重新着色"); final JMenuItem addPoint = new JMenuItem("增加节点"); final JMenuItem removePoint = new JMenuItem("删除节点"); final JMenuItem open = new JMenuItem("断开开关"); final JMenuItem close = new JMenuItem("合上开关"); jPopupMenu.add(attribute); jPopupMenu.add(property); jPopupMenu.add(paint); jPopupMenu.add(rotate); jPopupMenu.add(addPoint); jPopupMenu.add(removePoint); jPopupMenu.add(open); jPopupMenu.add(close); rotate.setVisible(false); property.setVisible(false); addPoint.setVisible(false); removePoint.setVisible(false); open.setVisible(false); close.setVisible(false); Iterator iterator = DrawPanel.this.getDataBox().getSelectionModel().selection(); while(iterator.hasNext()){ final Element element = (Element)iterator.next(); if(element.getClientProperty("attribute")==null){ Map<String,Object> attributeMap = new HashMap<>(); element.putClientProperty("attribute",attributeMap); } paint.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if(elementColor ==null) { JColorChooser chooser = new JColorChooser(); Color color = chooser.showDialog(DrawPanel.this, "调色板", Color.green); if (color == null) { color = Color.green; } elementColor = color; } element.putRenderColor(elementColor); } }); attribute.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final AttributeFrame attributeFrame = new AttributeFrame(element); attributeFrame.setVisible(true); } }); //如果是母线 if(element instanceof Trunk){ rotate.setVisible(true); property.setVisible(true); rotate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((Trunk) element).setRotate(!((Trunk) element).isRotate()); ((Trunk) element).setSize(element.getHeight(),element.getWidth()); rotate.setVisible(false); } }); property.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new GeneratrixFrame(element,connection); property.setVisible(false); } }); } //如果是开关类型的元件 else if(element instanceof Switch) { rotate.setVisible(true); property.setVisible(true); property.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new SwitchFrame(element,connection); property.setVisible(false); } }); rotate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((Switch) element).setRotate(!((Switch) element).isRotate()); ((Switch) element).setSize(element.getHeight(),element.getWidth()); rotate.setVisible(false); } }); if(!((Switch)element).isTurnOn()){ close.setVisible(true); close.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((Switch) element).setTurnOn(true); close.setVisible(false); } }); } else { open.setVisible(true); open.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((Switch) element).setTurnOn(false); open.setVisible(false); } }); } } //如果是卷变器或者站用变 else if(element instanceof RollChange){ rotate.setVisible(true); property.setVisible(true); property.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new RollChangeFrame(element,connection); property.setVisible(false); } }); rotate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((RollChange) element).setRotate(!((RollChange) element).isRotate()); ((RollChange) element).setSize(element.getHeight(),element.getWidth()); rotate.setVisible(false); } }); } //如果是断路器 else if(element instanceof Breaker){ rotate.setVisible(true); property.setVisible(true); property.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { BreakerFrame frame = new BreakerFrame(element,connection); frame.setContentPane(new BreakerFrame(element,connection).getMainPanel()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); property.setVisible(false); } }); rotate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((Breaker) element).setRotate(!((Breaker) element).isRotate()); ((Breaker) element).setSize(element.getHeight(),element.getWidth()); rotate.setVisible(false); } }); } //如果是接地开关 else if(element instanceof GroundSwitch){ rotate.setVisible(true); property.setVisible(true); property.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new EarthSwitchFrame(element,connection); property.setVisible(false); } }); rotate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((GroundSwitch) element).setRotate(!((GroundSwitch) element).isRotate()); ((GroundSwitch) element).setSize(element.getHeight(),element.getWidth()); rotate.setVisible(false); } }); if(((GroundSwitch)element).isTurnOn()){ close.setVisible(true); close.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((GroundSwitch) element).setTurnOn(false); close.setVisible(false); } }); } else { open.setVisible(true); open.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((GroundSwitch) element).setTurnOn(true); open.setVisible(false); } }); } } //如果是箱变,配电站 else if(element instanceof BoxChange){ rotate.setVisible(true); property.setVisible(true); property.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new ControlCenterFrame(element,connection); property.setVisible(false); } }); rotate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((BoxChange) element).setRotate(!((BoxChange) element).isRotate()); ((BoxChange) element).setSize(element.getHeight(),element.getWidth()); rotate.setVisible(false); } }); } //如果是变电站 else if(element instanceof DistributionStation){ rotate.setVisible(true); property.setVisible(true); property.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new ControlCenterFrame(element,connection); property.setVisible(false); } }); rotate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((DistributionStation) element).setRotate(!((DistributionStation) element).isRotate()); ((DistributionStation) element).setSize(element.getHeight(),element.getWidth()); rotate.setVisible(false); } }); } //如果是用电用户 else if(element instanceof MainUser){ property.setVisible(true); property.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new ControlCenterFrame(element,connection); property.setVisible(false); } }); } //如果是熔断器,跌落熔断器,保险丝 else if(element instanceof Fuse){ rotate.setVisible(true); property.setVisible(true); property.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new FuseFrame(element,connection); property.setVisible(false); } }); rotate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((Fuse) element).setRotate(!((Fuse) element).isRotate()); ((Fuse) element).setSize(element.getHeight(),element.getWidth()); rotate.setVisible(false); } }); } //如果是变电所 else if(element instanceof VariableField){ property.setVisible(true); property.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new SubstationFrame(element,connection); property.setVisible(false); } }); } //如果是馈线 else if(element instanceof Link && !(element instanceof ShapeLink)){ property.setVisible(true); property.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new FeederFrame(element, connection); property.setVisible(false); } }); } //如果是多节点连线的元件 else if(element instanceof ShapeLink) { addPoint.setVisible(true); removePoint.setVisible(true); addPoint.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((ShapeLink) element).addPoint(mouseEvent.getPoint()); addPoint.setVisible(false); removePoint.setVisible(false); } }); removePoint.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((ShapeLink)element).removePoint(((ShapeLink)element).getPoints().size()-1); addPoint.setVisible(false); removePoint.setVisible(false); } }); } } elementColor = null; } return jPopupMenu; } }); //双击元素标签可以重新编辑该标签 this.setElementLabelEditableFilter(new EditableFilter() { @Override public boolean isEditable(Element element) { return true; } }); //加快拖动速度 this.setDraggingSpeed(DraggingSpeed.HIGH); //可以使用ctrl+c以及ctrl+v快捷键(不复制子节点) // this.setEnableCopyPasteWithKeyboard(true); //添加网格背景 // CanvasCushion canvasCushion = new CanvasCushion() { // int gridSize = 20; // Stroke stroke = new BasicStroke(0,BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND,10.0f,new float[]{2},0.0f); // @Override // public void paint(Graphics2D graphics2D) { // graphics2D.setColor(Color.WHITE); // graphics2D.setStroke(stroke); // for(int x = gridSize;x<width;x+=gridSize){ // graphics2D.drawLine(x,1,x,height); // } // for(int y = gridSize;y<height;y+=gridSize){ // graphics2D.drawLine(0,y,width,y); // } // } // }; // this.addCanvasCushion(canvasCushion); //添加按delete键就会删除选中的元件的事件 this.getCanvas().addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if(e.getKeyCode()==KeyEvent.VK_DELETE) dataBox.removeSelectedElements(); } }); } public Color getVoltageColor(int voltage){ switch (voltage){ case 10: return voltageColor_10; case 35: return voltageColor_35; case 110: return voltageColor_110; case 220: return voltageColor_220; case 500: return voltageColor_500; default: return Color.white; } } public Color getVoltageColor_10() { return voltageColor_10; } public void setVoltageColor_10(Color voltageColor_10) { this.voltageColor_10 = voltageColor_10; } public Color getVoltageColor_35() { return voltageColor_35; } public void setVoltageColor_35(Color voltageColor_35) { this.voltageColor_35 = voltageColor_35; } public Color getVoltageColor_110() { return voltageColor_110; } public void setVoltageColor_110(Color voltageColor_110) { this.voltageColor_110 = voltageColor_110; } public Color getVoltageColor_220() { return voltageColor_220; } public void setVoltageColor_220(Color voltageColor_220) { this.voltageColor_220 = voltageColor_220; } public Color getVoltageColor_500() { return voltageColor_500; } public void setVoltageColor_500(Color voltageColor_500) { this.voltageColor_500 = voltageColor_500; } }
UTF-8
Java
26,695
java
DrawPanel.java
Java
[ { "context": "Iterator;\nimport java.util.Map;\n\n/**\n * Created by huzhejie on 2017/2/14.\n */\npublic class DrawPanel extends ", "end": 441, "score": 0.9995926022529602, "start": 433, "tag": "USERNAME", "value": "huzhejie" }, { "context": "ystem?\" +\n \"user=root&password=hzj199429&useUnicode=true&characterEncoding=UTF8&useSSL=fal", "end": 1926, "score": 0.999064564704895, "start": 1917, "tag": "PASSWORD", "value": "hzj199429" } ]
null
[]
package View; import Control.*; import View.Frame.*; import twaver.*; import twaver.network.*; import twaver.network.background.ColorBackground; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.beans.PropertyChangeEvent; import java.sql.Connection; import java.sql.DriverManager; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Map; /** * Created by huzhejie on 2017/2/14. */ public class DrawPanel extends TNetwork{ //定义编辑工具栏中需要的用到的功能 public String ids[] = new String[]{ "Selection", "LazyMove", "Magnifier", "Pan", "$SEPARATOR", "ZoomIn", "ZoomOut", "ZoomReset", "ZoomToOverview", "ZoomToRectangle", "$SEPARATOR",//分隔符 "CreateLink", "CreateShapeLink", "$SEPARATOR",//分隔符 "Undo", "Redo", "$SEPARATOR", "OpenDataFile", "SaveDataFile", "FullScreen", "ExportImage", "ExportSVG", "Print" }; //数据库连接 public static Connection connection = null; private Color elementColor = null; private Color voltageColor_10 = Color.blue; private Color voltageColor_35 = Color.yellow; private Color voltageColor_110 = Color.red; private Color voltageColor_220 = Color.orange; private Color voltageColor_500 = Color.green; public DrawPanel(TDataBox dataBox){ this.setDataBox(dataBox); this.init(dataBox); } /** * 初始化画板和数据库连接 */ private void init(final TDataBox dataBox){ //初始化数据库连接 try{ Class.forName("com.mysql.jdbc.Driver").newInstance(); String url = "jdbc:mysql://localhost:3306/electronicsystem?" + "user=root&password=<PASSWORD>&useUnicode=true&characterEncoding=UTF8&useSSL=false"; connection = DriverManager.getConnection(url); // System.out.println("数据库连接成功"); }catch (Exception cnfe){ cnfe.printStackTrace(); } //设置背景颜色 this.setBackground(new ColorBackground(Color.CYAN.darker().darker())); //设置工具栏 this.setToolbar(NetworkToolBarFactory.getToolBar(ids, this)); this.getToolbar().setMinimumSize(new Dimension(50,50)); //设置undo/redo的步数限制 this.getDataBox().getUndoRedoManager().setLimit(100); //允许使用快捷键ctrl+y与ctrl+z this.setEnableUndoRedoWithKeyboard(true); //允许使用快捷键ctrl+a全选 this.setEnableSelectAllWithKeyboard(true); //设置Resizable Node可以直接改变大小 this.setResizableFilter(new ResizableFilter() { @Override public boolean isResizable(Element element) { return true; } }); //元素内容有变化时就重画该元素 this.setElementPropertyChangeRepaintFilter(new ElementPropertyChangeRepaintFilter() { @Override public boolean isInterested(Element element, PropertyChangeEvent propertyChangeEvent) { if(element instanceof Link){ ((Link) element).putLinkWidth(1); ((Link) element).putLinkOutlineWidth(0); ((Link) element).putLinkAntialias(true); } return true; } }); //添加右键菜单 this.setPopupMenuGenerator(new PopupMenuGenerator() { @Override public JPopupMenu generate(final TView tView, final MouseEvent mouseEvent) { JPopupMenu jPopupMenu = new JPopupMenu(); if(tView.getDataBox().getSelectionModel().isEmpty()){ jPopupMenu.add(new JMenuItem("您未选择任何元件")); } else{ final JMenuItem attribute = new JMenuItem("图形属性"); final JMenuItem property = new JMenuItem("设备资料"); final JMenuItem rotate = new JMenuItem("旋转90°"); final JMenuItem paint = new JMenuItem("重新着色"); final JMenuItem addPoint = new JMenuItem("增加节点"); final JMenuItem removePoint = new JMenuItem("删除节点"); final JMenuItem open = new JMenuItem("断开开关"); final JMenuItem close = new JMenuItem("合上开关"); jPopupMenu.add(attribute); jPopupMenu.add(property); jPopupMenu.add(paint); jPopupMenu.add(rotate); jPopupMenu.add(addPoint); jPopupMenu.add(removePoint); jPopupMenu.add(open); jPopupMenu.add(close); rotate.setVisible(false); property.setVisible(false); addPoint.setVisible(false); removePoint.setVisible(false); open.setVisible(false); close.setVisible(false); Iterator iterator = DrawPanel.this.getDataBox().getSelectionModel().selection(); while(iterator.hasNext()){ final Element element = (Element)iterator.next(); if(element.getClientProperty("attribute")==null){ Map<String,Object> attributeMap = new HashMap<>(); element.putClientProperty("attribute",attributeMap); } paint.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if(elementColor ==null) { JColorChooser chooser = new JColorChooser(); Color color = chooser.showDialog(DrawPanel.this, "调色板", Color.green); if (color == null) { color = Color.green; } elementColor = color; } element.putRenderColor(elementColor); } }); attribute.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final AttributeFrame attributeFrame = new AttributeFrame(element); attributeFrame.setVisible(true); } }); //如果是母线 if(element instanceof Trunk){ rotate.setVisible(true); property.setVisible(true); rotate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((Trunk) element).setRotate(!((Trunk) element).isRotate()); ((Trunk) element).setSize(element.getHeight(),element.getWidth()); rotate.setVisible(false); } }); property.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new GeneratrixFrame(element,connection); property.setVisible(false); } }); } //如果是开关类型的元件 else if(element instanceof Switch) { rotate.setVisible(true); property.setVisible(true); property.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new SwitchFrame(element,connection); property.setVisible(false); } }); rotate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((Switch) element).setRotate(!((Switch) element).isRotate()); ((Switch) element).setSize(element.getHeight(),element.getWidth()); rotate.setVisible(false); } }); if(!((Switch)element).isTurnOn()){ close.setVisible(true); close.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((Switch) element).setTurnOn(true); close.setVisible(false); } }); } else { open.setVisible(true); open.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((Switch) element).setTurnOn(false); open.setVisible(false); } }); } } //如果是卷变器或者站用变 else if(element instanceof RollChange){ rotate.setVisible(true); property.setVisible(true); property.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new RollChangeFrame(element,connection); property.setVisible(false); } }); rotate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((RollChange) element).setRotate(!((RollChange) element).isRotate()); ((RollChange) element).setSize(element.getHeight(),element.getWidth()); rotate.setVisible(false); } }); } //如果是断路器 else if(element instanceof Breaker){ rotate.setVisible(true); property.setVisible(true); property.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { BreakerFrame frame = new BreakerFrame(element,connection); frame.setContentPane(new BreakerFrame(element,connection).getMainPanel()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); property.setVisible(false); } }); rotate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((Breaker) element).setRotate(!((Breaker) element).isRotate()); ((Breaker) element).setSize(element.getHeight(),element.getWidth()); rotate.setVisible(false); } }); } //如果是接地开关 else if(element instanceof GroundSwitch){ rotate.setVisible(true); property.setVisible(true); property.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new EarthSwitchFrame(element,connection); property.setVisible(false); } }); rotate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((GroundSwitch) element).setRotate(!((GroundSwitch) element).isRotate()); ((GroundSwitch) element).setSize(element.getHeight(),element.getWidth()); rotate.setVisible(false); } }); if(((GroundSwitch)element).isTurnOn()){ close.setVisible(true); close.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((GroundSwitch) element).setTurnOn(false); close.setVisible(false); } }); } else { open.setVisible(true); open.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((GroundSwitch) element).setTurnOn(true); open.setVisible(false); } }); } } //如果是箱变,配电站 else if(element instanceof BoxChange){ rotate.setVisible(true); property.setVisible(true); property.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new ControlCenterFrame(element,connection); property.setVisible(false); } }); rotate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((BoxChange) element).setRotate(!((BoxChange) element).isRotate()); ((BoxChange) element).setSize(element.getHeight(),element.getWidth()); rotate.setVisible(false); } }); } //如果是变电站 else if(element instanceof DistributionStation){ rotate.setVisible(true); property.setVisible(true); property.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new ControlCenterFrame(element,connection); property.setVisible(false); } }); rotate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((DistributionStation) element).setRotate(!((DistributionStation) element).isRotate()); ((DistributionStation) element).setSize(element.getHeight(),element.getWidth()); rotate.setVisible(false); } }); } //如果是用电用户 else if(element instanceof MainUser){ property.setVisible(true); property.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new ControlCenterFrame(element,connection); property.setVisible(false); } }); } //如果是熔断器,跌落熔断器,保险丝 else if(element instanceof Fuse){ rotate.setVisible(true); property.setVisible(true); property.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new FuseFrame(element,connection); property.setVisible(false); } }); rotate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((Fuse) element).setRotate(!((Fuse) element).isRotate()); ((Fuse) element).setSize(element.getHeight(),element.getWidth()); rotate.setVisible(false); } }); } //如果是变电所 else if(element instanceof VariableField){ property.setVisible(true); property.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new SubstationFrame(element,connection); property.setVisible(false); } }); } //如果是馈线 else if(element instanceof Link && !(element instanceof ShapeLink)){ property.setVisible(true); property.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new FeederFrame(element, connection); property.setVisible(false); } }); } //如果是多节点连线的元件 else if(element instanceof ShapeLink) { addPoint.setVisible(true); removePoint.setVisible(true); addPoint.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((ShapeLink) element).addPoint(mouseEvent.getPoint()); addPoint.setVisible(false); removePoint.setVisible(false); } }); removePoint.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((ShapeLink)element).removePoint(((ShapeLink)element).getPoints().size()-1); addPoint.setVisible(false); removePoint.setVisible(false); } }); } } elementColor = null; } return jPopupMenu; } }); //双击元素标签可以重新编辑该标签 this.setElementLabelEditableFilter(new EditableFilter() { @Override public boolean isEditable(Element element) { return true; } }); //加快拖动速度 this.setDraggingSpeed(DraggingSpeed.HIGH); //可以使用ctrl+c以及ctrl+v快捷键(不复制子节点) // this.setEnableCopyPasteWithKeyboard(true); //添加网格背景 // CanvasCushion canvasCushion = new CanvasCushion() { // int gridSize = 20; // Stroke stroke = new BasicStroke(0,BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND,10.0f,new float[]{2},0.0f); // @Override // public void paint(Graphics2D graphics2D) { // graphics2D.setColor(Color.WHITE); // graphics2D.setStroke(stroke); // for(int x = gridSize;x<width;x+=gridSize){ // graphics2D.drawLine(x,1,x,height); // } // for(int y = gridSize;y<height;y+=gridSize){ // graphics2D.drawLine(0,y,width,y); // } // } // }; // this.addCanvasCushion(canvasCushion); //添加按delete键就会删除选中的元件的事件 this.getCanvas().addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if(e.getKeyCode()==KeyEvent.VK_DELETE) dataBox.removeSelectedElements(); } }); } public Color getVoltageColor(int voltage){ switch (voltage){ case 10: return voltageColor_10; case 35: return voltageColor_35; case 110: return voltageColor_110; case 220: return voltageColor_220; case 500: return voltageColor_500; default: return Color.white; } } public Color getVoltageColor_10() { return voltageColor_10; } public void setVoltageColor_10(Color voltageColor_10) { this.voltageColor_10 = voltageColor_10; } public Color getVoltageColor_35() { return voltageColor_35; } public void setVoltageColor_35(Color voltageColor_35) { this.voltageColor_35 = voltageColor_35; } public Color getVoltageColor_110() { return voltageColor_110; } public void setVoltageColor_110(Color voltageColor_110) { this.voltageColor_110 = voltageColor_110; } public Color getVoltageColor_220() { return voltageColor_220; } public void setVoltageColor_220(Color voltageColor_220) { this.voltageColor_220 = voltageColor_220; } public Color getVoltageColor_500() { return voltageColor_500; } public void setVoltageColor_500(Color voltageColor_500) { this.voltageColor_500 = voltageColor_500; } }
26,696
0.405993
0.399701
540
47.262962
27.26029
127
false
false
0
0
0
0
0
0
0.542593
false
false
2
a65dd7f5ce7e6ef44bd83e22b1f57bbeef0887aa
16,587,163,765,192
9e181f233ab7ae650eb6f3f602b8c9e009e875ab
/strategy/AStrategy.java
4764854125fe7edd8a44de896e34e44a7dd7da9b
[]
no_license
QiaoJiaLing/JavaDesignMode
https://github.com/QiaoJiaLing/JavaDesignMode
f7286367d19cb1e2a0d1a871c0ddaf4151de608a
67c3ba8ba4282d733f2b15c4c007e9933fbcea29
refs/heads/master
2020-12-10T08:35:12.150000
2020-01-13T09:35:55
2020-01-13T09:35:55
233,546,502
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package partten.strategy; public class AStrategy implements Strategy { @Override public void toDoSomething() { System.out.println("我是A策略"); } }
UTF-8
Java
173
java
AStrategy.java
Java
[]
null
[]
package partten.strategy; public class AStrategy implements Strategy { @Override public void toDoSomething() { System.out.println("我是A策略"); } }
173
0.678788
0.678788
8
19.625
16.04632
44
false
false
0
0
0
0
0
0
0.25
false
false
2
b4e8abd6a6673928d3ec76486584e15eb364fe08
16,587,163,765,469
f21978da46c1e37d79d35a2027a223c6d7dd3982
/core/src/com/raiden/game/physics_controller/movement/Movement.java
ad99b2f01aa5ba3c114a9dee628dde1c4ce85337
[]
no_license
ineeve/LPOO1617_T1G11
https://github.com/ineeve/LPOO1617_T1G11
e8eef9c599e3cf489df29628fe39982d29d3f655
24aeeafd5b16a6cd23118855386dd8cfdfd187e2
refs/heads/master
2021-03-27T11:05:24.526000
2017-06-11T22:56:48
2017-06-11T22:56:48
81,873,424
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.raiden.game.physics_controller.movement; import com.raiden.game.physics_controller.entities.DynamicBody; /** * Defines an interface for all the bodies to move. * Allow for defining movement patterns */ interface Movement { /** * Move a dynamic body in space, given an elapsed time. * @param ship the dynamic body to move. * @param deltaTime the time elapsed. */ void move(DynamicBody ship, float deltaTime); }
UTF-8
Java
455
java
Movement.java
Java
[]
null
[]
package com.raiden.game.physics_controller.movement; import com.raiden.game.physics_controller.entities.DynamicBody; /** * Defines an interface for all the bodies to move. * Allow for defining movement patterns */ interface Movement { /** * Move a dynamic body in space, given an elapsed time. * @param ship the dynamic body to move. * @param deltaTime the time elapsed. */ void move(DynamicBody ship, float deltaTime); }
455
0.70989
0.70989
16
27.4375
23.406647
63
false
false
0
0
0
0
0
0
0.3125
false
false
2
849c531b0d306c75e60d4411844f2ca78d3e9f41
19,722,489,892,518
6f83e721b27b381607d17837cb3387a5dcb10866
/androidarchitecturecomponents/app/src/main/java/com/androidarchitecturecomponents/todo/model/Comment.java
6bab12bba7c7388787d521fc332dae66aebddcd1
[]
no_license
ashutosh1234ojha/androidArchitectureComponet
https://github.com/ashutosh1234ojha/androidArchitectureComponet
b86085ea018bd22b7d570cb8182170db99aa19dc
b7dcc5e3375207f1e4807f9b0ac4b3f1b58ac539
refs/heads/master
2020-04-08T15:49:32.086000
2019-10-26T06:36:27
2019-10-26T06:36:27
159,493,479
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.androidarchitecturecomponents.todo.model; /** * Created by Ashutosh Ojha on 1/17/19. */ public class Comment { }
UTF-8
Java
128
java
Comment.java
Java
[ { "context": "hitecturecomponents.todo.model;\n\n/**\n * Created by Ashutosh Ojha on 1/17/19.\n */\npublic class Comment {\n}\n", "end": 86, "score": 0.9998711347579956, "start": 73, "tag": "NAME", "value": "Ashutosh Ojha" } ]
null
[]
package com.androidarchitecturecomponents.todo.model; /** * Created by <NAME> on 1/17/19. */ public class Comment { }
121
0.734375
0.695313
7
17.285715
19.789711
53
false
false
0
0
0
0
0
0
0.142857
false
false
2
8d3f44660ba956afb4223480a4718f1c4a845eb7
9,466,107,943,424
25df66201168998c29a7cddd1fd6b5edebed1a49
/src/Program/Actuator.java
11a4ffdb2798111c688bfccd36bcd0d46758d5f5
[]
no_license
sival19/workshop
https://github.com/sival19/workshop
a0c9d8d1295b4eacb6182ea27f70af881b71c6b9
9db0948a0737fa73caff8adda8ef5ab536c86585
refs/heads/main
2023-01-20T07:05:41.687000
2020-11-23T11:58:22
2020-11-23T11:58:22
313,855,086
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Program; /* * This class is responsible for keeping * track of the Actuators */ public class Actuator extends Unit{ private double value; public Actuator(String name, double value) { super(name); this.value = value; } public double getValue(){ return value; } public void setValue(double value) { this.value = value; } }
UTF-8
Java
397
java
Actuator.java
Java
[]
null
[]
package Program; /* * This class is responsible for keeping * track of the Actuators */ public class Actuator extends Unit{ private double value; public Actuator(String name, double value) { super(name); this.value = value; } public double getValue(){ return value; } public void setValue(double value) { this.value = value; } }
397
0.617128
0.617128
23
16.26087
15.297676
48
false
false
0
0
0
0
0
0
0.304348
false
false
2
791e0ca56d85ebde548327aa98d1b4834cc9a8f3
13,975,823,612,248
b56b32da6ce4b6b0d69a22faa0f10e0b5a2c088e
/ANDROID/KapZivota/app/src/main/java/kap/trippleit/com/kapzivota/MainActivity.java
a1d5d92de2e4768bc5e2eec5fe7ea6cf3333ad84
[]
no_license
TheWildHorse/Kap-Zivota
https://github.com/TheWildHorse/Kap-Zivota
47f4247015ad4c5e204a93dad30fde386704dd63
a02e9f3975020f4aa9cc0ea76397b4cce617ad8a
refs/heads/master
2020-12-11T01:44:48.732000
2015-03-31T19:47:57
2015-03-31T19:47:57
27,124,338
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package kap.trippleit.com.kapzivota; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.Window; import android.view.WindowManager; import com.pushbots.push.Pushbots; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.splash); Pushbots.init(this, "30119727242", "54705e2f1d0ab18e108b4595"); Pushbots.getInstance().setMsgReceiver(CustomPushReceiver.class); /* PBGenerateCustomNotification PBCustom = new PBGenerateCustomNotification(); PBCustom.layout = R.layout.activity_main; PBCustom.titleId = R.id.title; PBCustom.messageId = R.id.message; PBCustom.iconId = R.id.image; PBCustom.icondId = R.drawable.ic_launcher; Pushbots.getInstance().setNotificationBuilder(PBCustom); */ } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } static boolean active = false; @Override public void onStart() { super.onStart(); active = true; } @Override public void onStop() { super.onStop(); active = false; } public static boolean isActive() { return active; } }
UTF-8
Java
1,693
java
MainActivity.java
Java
[]
null
[]
package kap.trippleit.com.kapzivota; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.Window; import android.view.WindowManager; import com.pushbots.push.Pushbots; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.splash); Pushbots.init(this, "30119727242", "54705e2f1d0ab18e108b4595"); Pushbots.getInstance().setMsgReceiver(CustomPushReceiver.class); /* PBGenerateCustomNotification PBCustom = new PBGenerateCustomNotification(); PBCustom.layout = R.layout.activity_main; PBCustom.titleId = R.id.title; PBCustom.messageId = R.id.message; PBCustom.iconId = R.id.image; PBCustom.icondId = R.drawable.ic_launcher; Pushbots.getInstance().setNotificationBuilder(PBCustom); */ } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } static boolean active = false; @Override public void onStart() { super.onStart(); active = true; } @Override public void onStop() { super.onStop(); active = false; } public static boolean isActive() { return active; } }
1,693
0.653869
0.63733
76
21.276316
21.53125
83
false
false
0
0
0
0
0
0
0.434211
false
false
2
962becff0e44c445cfef8ba6525eef84b1fe2823
7,499,012,945,177
57ce88ae9c58c43ae1ffe84560af7799e77d83cd
/Framework/src/com/nwollmann/jgame/test/package-info.java
05af39a3c0aff93578f4d9a294af4a8956bbc84e
[]
no_license
nwollmann/Java-Game-Engine
https://github.com/nwollmann/Java-Game-Engine
fa9394ff2c887dd28f4e012dcb2c06d89c71b74e
40b564becb78bf289f6703d2b89ee72a78e3c79c
refs/heads/master
2021-05-28T16:27:52.660000
2015-04-20T21:33:09
2015-04-20T21:33:09
27,106,822
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Provides tests for the game engine. */ package com.nwollmann.jgame.test;
UTF-8
Java
80
java
package-info.java
Java
[]
null
[]
/** * Provides tests for the game engine. */ package com.nwollmann.jgame.test;
80
0.7125
0.7125
4
19.25
16.345871
38
false
false
0
0
0
0
0
0
0.25
false
false
2
787ee19f4bcca3ffec4c4d35c92ff3dc0c19a271
2,379,411,916,537
84f24f94e72d1280ab0d7167e4c7c36887514efe
/components/core/src/main/java/com/atlassian/plugin/connect/plugin/auth/scope/whitelist/RpcEncodedSoapApiScopeHelper.java
b3144aaa3ee047ddf40acb03eb762df7753b291b
[ "Apache-2.0" ]
permissive
tied/ac
https://github.com/tied/ac
797838f6535fec460697cb94b3f5be35a4645266
6626e4130c172bcf42f2dae7438ea2d5019b036d
refs/heads/master
2021-05-31T19:29:21.425000
2016-03-02T00:33:26
2016-03-02T00:33:26
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.atlassian.plugin.connect.plugin.auth.scope.whitelist; import java.util.ArrayList; import java.util.Collection; import java.util.Optional; import javax.servlet.http.HttpServletRequest; import com.atlassian.fugue.Pair; import com.atlassian.plugin.connect.api.util.ServletUtils; import com.atlassian.plugin.connect.plugin.auth.scope.ApiResourceInfo; import com.google.common.base.Function; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import org.dom4j.Document; import org.dom4j.Element; import static com.atlassian.plugin.connect.api.util.Dom4jUtils.readDocument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.collect.Collections2.transform; /** * An api scope for SOAP requests */ public final class RpcEncodedSoapApiScopeHelper { private final String path; private final Collection<SoapScope> soapActions; private final String httpMethod; private transient final Iterable<ApiResourceInfo> apiResourceInfo; public RpcEncodedSoapApiScopeHelper(final String path, Collection<SoapScope> soapActions, String httpMethod) { this.path = path; this.soapActions = soapActions; this.httpMethod = checkNotNull(httpMethod).toUpperCase(); this.apiResourceInfo = transform(soapActions, from -> new ApiResourceInfo(path, RpcEncodedSoapApiScopeHelper.this.httpMethod, from.name)); } public RpcEncodedSoapApiScopeHelper(String path, final String namespace, Collection<String> methods, String httpMethod) { // convert to ArrayList because the Collection subclass returned from Collections2.transform() has a broken equals() this(path, new ArrayList<>(transform(methods, from -> new SoapScope(namespace, from))), httpMethod); } public static Optional<Pair<String, String>> getMethod(HttpServletRequest rq) { Document doc = readDocument(rq); if (null == doc) { return Optional.empty(); } Element root = doc.getRootElement(); if (null == root) { return Optional.empty(); } Element body = root.element("Body"); if (null == body) { return Optional.empty(); } Element methodElement = (Element) body.elements().get(0); if (null == methodElement) { return Optional.empty(); } String name = methodElement.getName(); String namespace = methodElement.getNamespaceURI(); return Optional.of(Pair.pair(namespace, name)); } public boolean allow(HttpServletRequest request) { if (!httpMethod.equals(request.getMethod())) { return false; } final String pathInfo = ServletUtils.extractPathInfo(request); if (path.equals(pathInfo)) { Optional<Pair<String, String>> maybeNamespaceAndName = getMethod(request); if (!maybeNamespaceAndName.isPresent()) { return false; } Pair<String, String> namespaceAndName = maybeNamespaceAndName.get(); for (SoapScope scope : soapActions) { if (scope.match(namespaceAndName.left(), namespaceAndName.right())) { return true; } } } return false; } public Iterable<ApiResourceInfo> getApiResourceInfos() { return apiResourceInfo; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } RpcEncodedSoapApiScopeHelper that = (RpcEncodedSoapApiScopeHelper) o; // don't consider apiResourceInfo because they are a static transform of soapActions and path return new EqualsBuilder() .append(path, that.path) .append(soapActions, that.soapActions) .build(); } @Override public int hashCode() { // don't consider apiResourceInfo because they are a static transform of soapActions and path return new HashCodeBuilder(41, 5) .append(path) .append(soapActions) .build(); } @Override public String toString() { // don't consider apiResourceInfo because they are a static transform of soapActions and path return new ToStringBuilder(this, ToStringStyle.SIMPLE_STYLE) .append("path", path) .append("soapActions", soapActions) .build(); } public static class SoapScope { private final String namespace; private final String name; public SoapScope(String namespace, String name) { this.namespace = namespace; this.name = name; } public boolean match(String namespace, String name) { return this.namespace.equals(namespace) && this.name.equals(name); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } SoapScope that = (SoapScope) o; return new EqualsBuilder() .append(name, that.name) .append(namespace, that.namespace) .build(); } @Override public int hashCode() { return new HashCodeBuilder(37, 11) .append(name) .append(namespace) .build(); } @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SIMPLE_STYLE) .append("name", name) .append("namespace", namespace) .build(); } } }
UTF-8
Java
6,157
java
RpcEncodedSoapApiScopeHelper.java
Java
[]
null
[]
package com.atlassian.plugin.connect.plugin.auth.scope.whitelist; import java.util.ArrayList; import java.util.Collection; import java.util.Optional; import javax.servlet.http.HttpServletRequest; import com.atlassian.fugue.Pair; import com.atlassian.plugin.connect.api.util.ServletUtils; import com.atlassian.plugin.connect.plugin.auth.scope.ApiResourceInfo; import com.google.common.base.Function; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import org.dom4j.Document; import org.dom4j.Element; import static com.atlassian.plugin.connect.api.util.Dom4jUtils.readDocument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.collect.Collections2.transform; /** * An api scope for SOAP requests */ public final class RpcEncodedSoapApiScopeHelper { private final String path; private final Collection<SoapScope> soapActions; private final String httpMethod; private transient final Iterable<ApiResourceInfo> apiResourceInfo; public RpcEncodedSoapApiScopeHelper(final String path, Collection<SoapScope> soapActions, String httpMethod) { this.path = path; this.soapActions = soapActions; this.httpMethod = checkNotNull(httpMethod).toUpperCase(); this.apiResourceInfo = transform(soapActions, from -> new ApiResourceInfo(path, RpcEncodedSoapApiScopeHelper.this.httpMethod, from.name)); } public RpcEncodedSoapApiScopeHelper(String path, final String namespace, Collection<String> methods, String httpMethod) { // convert to ArrayList because the Collection subclass returned from Collections2.transform() has a broken equals() this(path, new ArrayList<>(transform(methods, from -> new SoapScope(namespace, from))), httpMethod); } public static Optional<Pair<String, String>> getMethod(HttpServletRequest rq) { Document doc = readDocument(rq); if (null == doc) { return Optional.empty(); } Element root = doc.getRootElement(); if (null == root) { return Optional.empty(); } Element body = root.element("Body"); if (null == body) { return Optional.empty(); } Element methodElement = (Element) body.elements().get(0); if (null == methodElement) { return Optional.empty(); } String name = methodElement.getName(); String namespace = methodElement.getNamespaceURI(); return Optional.of(Pair.pair(namespace, name)); } public boolean allow(HttpServletRequest request) { if (!httpMethod.equals(request.getMethod())) { return false; } final String pathInfo = ServletUtils.extractPathInfo(request); if (path.equals(pathInfo)) { Optional<Pair<String, String>> maybeNamespaceAndName = getMethod(request); if (!maybeNamespaceAndName.isPresent()) { return false; } Pair<String, String> namespaceAndName = maybeNamespaceAndName.get(); for (SoapScope scope : soapActions) { if (scope.match(namespaceAndName.left(), namespaceAndName.right())) { return true; } } } return false; } public Iterable<ApiResourceInfo> getApiResourceInfos() { return apiResourceInfo; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } RpcEncodedSoapApiScopeHelper that = (RpcEncodedSoapApiScopeHelper) o; // don't consider apiResourceInfo because they are a static transform of soapActions and path return new EqualsBuilder() .append(path, that.path) .append(soapActions, that.soapActions) .build(); } @Override public int hashCode() { // don't consider apiResourceInfo because they are a static transform of soapActions and path return new HashCodeBuilder(41, 5) .append(path) .append(soapActions) .build(); } @Override public String toString() { // don't consider apiResourceInfo because they are a static transform of soapActions and path return new ToStringBuilder(this, ToStringStyle.SIMPLE_STYLE) .append("path", path) .append("soapActions", soapActions) .build(); } public static class SoapScope { private final String namespace; private final String name; public SoapScope(String namespace, String name) { this.namespace = namespace; this.name = name; } public boolean match(String namespace, String name) { return this.namespace.equals(namespace) && this.name.equals(name); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } SoapScope that = (SoapScope) o; return new EqualsBuilder() .append(name, that.name) .append(namespace, that.namespace) .build(); } @Override public int hashCode() { return new HashCodeBuilder(37, 11) .append(name) .append(namespace) .build(); } @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SIMPLE_STYLE) .append("name", name) .append("namespace", namespace) .build(); } } }
6,157
0.608576
0.605815
176
33.982956
28.121384
146
false
false
0
0
0
0
0
0
0.556818
false
false
2
6524c4fb2ed915b61bda79f0538331352fe24680
4,398,046,561,281
33c6a9f458c192be59cf2a96511744f27b76e36d
/src/main/java/com/shopping_cart/config/AppBeanConfiguration.java
a820d5e871e116ea93ecb38b0444f35f6706e0f7
[ "MIT" ]
permissive
Andrey-V-Georgiev/ShoppingCartSpring
https://github.com/Andrey-V-Georgiev/ShoppingCartSpring
c360bcac0d17be0c07c0a66d198840e7771dd5b7
8309ac843315457a500680bfdc7587c468622777
refs/heads/main
2023-08-22T01:19:32.683000
2021-10-03T17:53:39
2021-10-03T17:53:39
390,064,391
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.shopping_cart.config; import com.shopping_cart.models.entities.Contact; import com.shopping_cart.models.entities.Product; import com.shopping_cart.repositories.ContactRepository; import com.shopping_cart.repositories.ProductRepository; import org.modelmapper.ModelMapper; import org.springframework.boot.ApplicationRunner; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.Arrays; @Configuration public class AppBeanConfiguration { @Bean public ModelMapper modelMapper() { return new ModelMapper(); } @Bean public BCryptPasswordEncoder bCryptPasswordEncoder() { return new BCryptPasswordEncoder(); } @Bean public ApplicationRunner initializer( ProductRepository productRepository, ContactRepository contactRepository) { if (productRepository.count() == 0) { productRepository.saveAll(Arrays.asList( new Product( "H&K VP9 Tactical OR", "The new HK VP9 Tactical OR (Optics Ready) Pistol is the latest addition to the VP family of HK pistols that is both optics-ready and suppressor-ready. This pistol stands out with its 4.7 inch hammer-forged barrel with threaded muzzle and suppressor-height tritium sights. Providing a day or night lower 1/3 co-witness through the window of a red dot sight, the sights remain visible over the top of most suppressors. Also included is an optics cut that, when combined with one of five availble adapter plates, accepts most popular red dot sights. Suppressor and/or optics can be added with no modifications needed.", "https://isteam.wsimg.com/ip/a7237bb7-0471-4ebe-82e6-c17ed6d9db95/ols/1055_original/:/rs=w:600,h:600", BigDecimal.valueOf(848), LocalDateTime.now() ), new Product( "G19 Gen5 FS", "The GLOCK 19 Gen5 pistol in 9mm Luger is ideal for a more versatile role due to its reduced dimensions. The new frame design without finger grooves still allows to instantly customize its grip to accommodate any hand size by mounting the different back straps. The reversible magazine catch and ambidextrous slide stop lever make it ideal for left and right-handed shooters. The rifling and the crown of the barrel were slightly modified for increased precision..", "https://i.pinimg.com/originals/d8/3d/c7/d83dc74b151313c13fe94d1954c9f2d9.jpg", BigDecimal.valueOf(729), LocalDateTime.now() ), new Product( "GLOCK 17 Gen5", "The new frame design of the GLOCK 17 Gen5 removed the finger grooves for more versatility but still allows to easily customize its grip by using the different back straps. A flared mag-well and a cutout at the front of the frame give the user more speed during reloading when fractions of a second matter. A reversible enlarged magazine catch, changeable at user level as well as the ambidextrous slide stop lever accommodate left and right-handed operators. The rifling and the crown of the barrel were slightly modified for increased precision.", "https://cdnammoclub.ammoforsale.com/ammo-club/media/DSC08507-scaled.jpg", BigDecimal.valueOf(911), LocalDateTime.now() ), new Product( "Sig Sauer P220 LEGION", "The Sig Sauer® P220® Legion SAO Full-Size Semi-Auto Pistol features a stainless steel slide with high-visibility Sig Sauer Electro-Optics X-RAY day/night sights. Custom G-10 grips allow sure handling, while front cocking serrations pair with aggressive checkering on the front strap and under the trigger guard to ensure a solid grip when it matters. An X-Five undercut on the trigger guard lets you get a higher grip for better weapon control. Low-profile levers reduce the risk of snagging when you need to get your weapon out in a hurry. Steel guide rod adds weight to enhance stability. ", "https://i2.wp.com/shootarillusions.com/wp-content/uploads/2021/04/pix679079443.jpg?fit=1000%2C750&ssl=1", BigDecimal.valueOf(1329), LocalDateTime.now() ), new Product( "CZ Shadow 2 OR", "A sport special intended especially for fans of target shooting with large-calibre pistols, as well as anyone who agrees with the pistol guru, Jeff Cooper, that a double action trigger mechanism is an ingenious solution for a non-existent problem. (Although where the CZ 75 is concerned, Cooper himself admitted that the solution was indeed perfect). The single action variant of the phenomenal CZ SHADOW 2 model features a target style trigger blade made of aluminium alloy anodized blue and a combat style hammer with a large, weight-reducing hole. The trigger pull weight is set at 13 to 15 N", "https://content.osgnetworks.tv/gunsandammo/content/photos/CZ-Shadow-2-OR-770.jpg", BigDecimal.valueOf(1349), LocalDateTime.now() ), new Product( "STI DVC-P DUO 9mm", "The STI DVC DUO (Dawson Universal Optic) system is designed to work with the Leupold Delta Point Pro, Trijicon RMR, and most popular optics that use the same mounting platform. 25 years of evolution and refinement resulted in the Omni. Nothing comes close.5″ Recoil Compensation. DUO (Dawson Universal Optic) with Fiber Optic Fron", "https://pistol-forum.com/attachment.php?attachmentid=53982&d=1589495813", BigDecimal.valueOf(3999), LocalDateTime.now() ) )); } if (contactRepository.count() == 0) { contactRepository.saveAll(Arrays.asList( new Contact( "Sofia", "https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2932.3179396759338!2d23.329512315700562!3d42.69698822174912!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x40aa8570f039ab5f%3A0x29f700e9fb9d4353!2sul.%20%22Moskovska%22%2033%2C%201000%20Sofia%20Center%2C%20Sofia!5e0!3m2!1sen!2sbg!4v1628771840855!5m2!1sen!2sbg", "33 Moskovska Str. Sofia 1000", "0888 888 881", "shopping-cart-sofia@gmail.com", "09:00 - 17:00", "10:00 - 16:00" ), new Contact( "Plovdiv", "https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2958.3108304311527!2d24.746848415449495!3d42.14363487920201!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x14acd1bac53d66b3%3A0xa3e24860cb8d7ba4!2spl.%20%22Stefan%20Stambolov%22%201%2C%204000%20Tsentar%2C%20Plovdiv!5e0!3m2!1sen!2sbg!4v1628787167519!5m2!1sen!2sbg", "4000, pl.Stefan Stambolov 1", "0888 888 882", "shopping-cart-plovdiv@gmail.com", "09:30 - 17:30", "10:40 - 16:40" ), new Contact( "Varna", "https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2907.8014619994174!2d27.923320315712537!3d43.21365338875918!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x958943ca7d072728!2z0J_QsNC80LXRgtC90LjQuiDQvdCwINCe0YHQvNC4INC_0LXRhdC-0YLQtdC9INC_0YDQuNC80L7RgNGB0LrQuCDQv9C-0LvQug!5e0!3m2!1sen!2sbg!4v1628772176805!5m2!1sen!2sbg", "9000, Bulgaria Osmi Primorski Polk 43", "0888 888 883", "shopping-cart-varna@gmail.com", "09:00 - 17:00", "10:30 - 16:30" ), new Contact( "Burgas", "https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2941.927260424515!2d27.470166915695856!3d42.4930990346817!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x40a694c73b5b063d%3A0xef53d6e5fa2881a4!2sul.%20%22Aleksandrovska%22%2026%2C%208000%20Burgas%20Center%2C%20Burgas!5e0!3m2!1sen!2sbg!4v1628772341245!5m2!1sen!2sbg", "8000 Alexandrovska Street 26", "0888 888 884", "shopping-cart-burgas@gmail.com", "09:40 - 17:40", "11:00 - 16:00" ) )); } return null; } }
UTF-8
Java
9,392
java
AppBeanConfiguration.java
Java
[ { "context": "as well as anyone who agrees with the pistol guru, Jeff Cooper, that a double action trigger mechanism is an ing", "end": 5027, "score": 0.9996306300163269, "start": 5016, "tag": "NAME", "value": "Jeff Cooper" }, { "context": " new Contact(\n \"Sofia\",\n \"https://www.google", "end": 6572, "score": 0.9985661506652832, "start": 6567, "tag": "NAME", "value": "Sofia" }, { "context": " \"0888 888 881\",\n \"shopping-cart-sofia@gmail.com\",\n \"09:00 - 17:00\",\n ", "end": 7087, "score": 0.999872088432312, "start": 7058, "tag": "EMAIL", "value": "shopping-cart-sofia@gmail.com" }, { "context": " new Contact(\n \"Plovdiv\",\n \"https://www.google", "end": 7271, "score": 0.9997674822807312, "start": 7264, "tag": "NAME", "value": "Plovdiv" }, { "context": "1sen!2sbg\",\n \"4000, pl.Stefan Stambolov 1\",\n \"0888 888 882\",\n ", "end": 7681, "score": 0.7514823079109192, "start": 7665, "tag": "NAME", "value": "Stefan Stambolov" }, { "context": " \"0888 888 882\",\n \"shopping-cart-plovdiv@gmail.com\",\n \"09:30 - 17:30\",\n ", "end": 7790, "score": 0.9999064803123474, "start": 7759, "tag": "EMAIL", "value": "shopping-cart-plovdiv@gmail.com" }, { "context": " new Contact(\n \"Varna\",\n \"https://www.google", "end": 7972, "score": 0.9997320175170898, "start": 7967, "tag": "NAME", "value": "Varna" }, { "context": " \"0888 888 883\",\n \"shopping-cart-varna@gmail.com\",\n \"09:00 - 17:00\",\n ", "end": 8515, "score": 0.9999136924743652, "start": 8486, "tag": "EMAIL", "value": "shopping-cart-varna@gmail.com" }, { "context": " new Contact(\n \"Burgas\",\n \"https://www.google", "end": 8698, "score": 0.99873948097229, "start": 8692, "tag": "NAME", "value": "Burgas" }, { "context": " \"0888 888 884\",\n \"shopping-cart-burgas@gmail.com\",\n \"09:40 - 17:40\",\n ", "end": 9219, "score": 0.9999073147773743, "start": 9189, "tag": "EMAIL", "value": "shopping-cart-burgas@gmail.com" } ]
null
[]
package com.shopping_cart.config; import com.shopping_cart.models.entities.Contact; import com.shopping_cart.models.entities.Product; import com.shopping_cart.repositories.ContactRepository; import com.shopping_cart.repositories.ProductRepository; import org.modelmapper.ModelMapper; import org.springframework.boot.ApplicationRunner; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.Arrays; @Configuration public class AppBeanConfiguration { @Bean public ModelMapper modelMapper() { return new ModelMapper(); } @Bean public BCryptPasswordEncoder bCryptPasswordEncoder() { return new BCryptPasswordEncoder(); } @Bean public ApplicationRunner initializer( ProductRepository productRepository, ContactRepository contactRepository) { if (productRepository.count() == 0) { productRepository.saveAll(Arrays.asList( new Product( "H&K VP9 Tactical OR", "The new HK VP9 Tactical OR (Optics Ready) Pistol is the latest addition to the VP family of HK pistols that is both optics-ready and suppressor-ready. This pistol stands out with its 4.7 inch hammer-forged barrel with threaded muzzle and suppressor-height tritium sights. Providing a day or night lower 1/3 co-witness through the window of a red dot sight, the sights remain visible over the top of most suppressors. Also included is an optics cut that, when combined with one of five availble adapter plates, accepts most popular red dot sights. Suppressor and/or optics can be added with no modifications needed.", "https://isteam.wsimg.com/ip/a7237bb7-0471-4ebe-82e6-c17ed6d9db95/ols/1055_original/:/rs=w:600,h:600", BigDecimal.valueOf(848), LocalDateTime.now() ), new Product( "G19 Gen5 FS", "The GLOCK 19 Gen5 pistol in 9mm Luger is ideal for a more versatile role due to its reduced dimensions. The new frame design without finger grooves still allows to instantly customize its grip to accommodate any hand size by mounting the different back straps. The reversible magazine catch and ambidextrous slide stop lever make it ideal for left and right-handed shooters. The rifling and the crown of the barrel were slightly modified for increased precision..", "https://i.pinimg.com/originals/d8/3d/c7/d83dc74b151313c13fe94d1954c9f2d9.jpg", BigDecimal.valueOf(729), LocalDateTime.now() ), new Product( "GLOCK 17 Gen5", "The new frame design of the GLOCK 17 Gen5 removed the finger grooves for more versatility but still allows to easily customize its grip by using the different back straps. A flared mag-well and a cutout at the front of the frame give the user more speed during reloading when fractions of a second matter. A reversible enlarged magazine catch, changeable at user level as well as the ambidextrous slide stop lever accommodate left and right-handed operators. The rifling and the crown of the barrel were slightly modified for increased precision.", "https://cdnammoclub.ammoforsale.com/ammo-club/media/DSC08507-scaled.jpg", BigDecimal.valueOf(911), LocalDateTime.now() ), new Product( "Sig Sauer P220 LEGION", "The Sig Sauer® P220® Legion SAO Full-Size Semi-Auto Pistol features a stainless steel slide with high-visibility Sig Sauer Electro-Optics X-RAY day/night sights. Custom G-10 grips allow sure handling, while front cocking serrations pair with aggressive checkering on the front strap and under the trigger guard to ensure a solid grip when it matters. An X-Five undercut on the trigger guard lets you get a higher grip for better weapon control. Low-profile levers reduce the risk of snagging when you need to get your weapon out in a hurry. Steel guide rod adds weight to enhance stability. ", "https://i2.wp.com/shootarillusions.com/wp-content/uploads/2021/04/pix679079443.jpg?fit=1000%2C750&ssl=1", BigDecimal.valueOf(1329), LocalDateTime.now() ), new Product( "CZ Shadow 2 OR", "A sport special intended especially for fans of target shooting with large-calibre pistols, as well as anyone who agrees with the pistol guru, <NAME>, that a double action trigger mechanism is an ingenious solution for a non-existent problem. (Although where the CZ 75 is concerned, Cooper himself admitted that the solution was indeed perfect). The single action variant of the phenomenal CZ SHADOW 2 model features a target style trigger blade made of aluminium alloy anodized blue and a combat style hammer with a large, weight-reducing hole. The trigger pull weight is set at 13 to 15 N", "https://content.osgnetworks.tv/gunsandammo/content/photos/CZ-Shadow-2-OR-770.jpg", BigDecimal.valueOf(1349), LocalDateTime.now() ), new Product( "STI DVC-P DUO 9mm", "The STI DVC DUO (Dawson Universal Optic) system is designed to work with the Leupold Delta Point Pro, Trijicon RMR, and most popular optics that use the same mounting platform. 25 years of evolution and refinement resulted in the Omni. Nothing comes close.5″ Recoil Compensation. DUO (Dawson Universal Optic) with Fiber Optic Fron", "https://pistol-forum.com/attachment.php?attachmentid=53982&d=1589495813", BigDecimal.valueOf(3999), LocalDateTime.now() ) )); } if (contactRepository.count() == 0) { contactRepository.saveAll(Arrays.asList( new Contact( "Sofia", "https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2932.3179396759338!2d23.329512315700562!3d42.69698822174912!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x40aa8570f039ab5f%3A0x29f700e9fb9d4353!2sul.%20%22Moskovska%22%2033%2C%201000%20Sofia%20Center%2C%20Sofia!5e0!3m2!1sen!2sbg!4v1628771840855!5m2!1sen!2sbg", "33 Moskovska Str. Sofia 1000", "0888 888 881", "<EMAIL>", "09:00 - 17:00", "10:00 - 16:00" ), new Contact( "Plovdiv", "https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2958.3108304311527!2d24.746848415449495!3d42.14363487920201!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x14acd1bac53d66b3%3A0xa3e24860cb8d7ba4!2spl.%20%22Stefan%20Stambolov%22%201%2C%204000%20Tsentar%2C%20Plovdiv!5e0!3m2!1sen!2sbg!4v1628787167519!5m2!1sen!2sbg", "4000, pl.<NAME> 1", "0888 888 882", "<EMAIL>", "09:30 - 17:30", "10:40 - 16:40" ), new Contact( "Varna", "https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2907.8014619994174!2d27.923320315712537!3d43.21365338875918!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x958943ca7d072728!2z0J_QsNC80LXRgtC90LjQuiDQvdCwINCe0YHQvNC4INC_0LXRhdC-0YLQtdC9INC_0YDQuNC80L7RgNGB0LrQuCDQv9C-0LvQug!5e0!3m2!1sen!2sbg!4v1628772176805!5m2!1sen!2sbg", "9000, Bulgaria Osmi Primorski Polk 43", "0888 888 883", "<EMAIL>", "09:00 - 17:00", "10:30 - 16:30" ), new Contact( "Burgas", "https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2941.927260424515!2d27.470166915695856!3d42.4930990346817!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x40a694c73b5b063d%3A0xef53d6e5fa2881a4!2sul.%20%22Aleksandrovska%22%2026%2C%208000%20Burgas%20Center%2C%20Burgas!5e0!3m2!1sen!2sbg!4v1628772341245!5m2!1sen!2sbg", "8000 Alexandrovska Street 26", "0888 888 884", "<EMAIL>", "09:40 - 17:40", "11:00 - 16:00" ) )); } return null; } }
9,286
0.610993
0.513315
125
74.103996
125.641891
645
false
false
0
0
0
0
0
0
0.72
false
false
2
034bbea24a30384b8c62ffe53d02695ef677c53e
20,375,324,862,760
e549718eaa62f2fa7b56646a0b2bcbcdc4cc0792
/cardlang/node/AAndExpr.java
70547b3bd6ba4e5856048c415b5769c392f0f710
[ "Unlicense" ]
permissive
FinchZHU/PolyU-Cardlang
https://github.com/FinchZHU/PolyU-Cardlang
5a4d3e7c0c7d2971cd551836482f8a820c4ae2e2
dca9e0c30d72c322f8467d8ff41774a79853e150
refs/heads/master
2020-03-12T06:42:34.735000
2018-04-23T12:47:00
2018-04-23T12:47:00
130,491,346
0
0
Unlicense
true
2018-04-23T02:12:20
2018-04-21T16:22:11
2018-04-21T16:22:13
2018-04-23T02:12:16
75
0
0
1
Java
false
null
/* This file was generated by SableCC (http://www.sablecc.org/). */ package cardlang.node; import cardlang.analysis.*; @SuppressWarnings("nls") public final class AAndExpr extends PExpr { private PExpr _expr_; private TKwand _kwand_; private PFactor _factor_; public AAndExpr() { // Constructor } public AAndExpr( @SuppressWarnings("hiding") PExpr _expr_, @SuppressWarnings("hiding") TKwand _kwand_, @SuppressWarnings("hiding") PFactor _factor_) { // Constructor setExpr(_expr_); setKwand(_kwand_); setFactor(_factor_); } @Override public Object clone() { return new AAndExpr( cloneNode(this._expr_), cloneNode(this._kwand_), cloneNode(this._factor_)); } @Override public void apply(Switch sw) { ((Analysis) sw).caseAAndExpr(this); } public PExpr getExpr() { return this._expr_; } public void setExpr(PExpr node) { if(this._expr_ != null) { this._expr_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } this._expr_ = node; } public TKwand getKwand() { return this._kwand_; } public void setKwand(TKwand node) { if(this._kwand_ != null) { this._kwand_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } this._kwand_ = node; } public PFactor getFactor() { return this._factor_; } public void setFactor(PFactor node) { if(this._factor_ != null) { this._factor_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } this._factor_ = node; } @Override public String toString() { return "" + toString(this._expr_) + toString(this._kwand_) + toString(this._factor_); } @Override void removeChild(@SuppressWarnings("unused") Node child) { // Remove child if(this._expr_ == child) { this._expr_ = null; return; } if(this._kwand_ == child) { this._kwand_ = null; return; } if(this._factor_ == child) { this._factor_ = null; return; } throw new RuntimeException("Not a child."); } @Override void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild) { // Replace child if(this._expr_ == oldChild) { setExpr((PExpr) newChild); return; } if(this._kwand_ == oldChild) { setKwand((TKwand) newChild); return; } if(this._factor_ == oldChild) { setFactor((PFactor) newChild); return; } throw new RuntimeException("Not a child."); } }
UTF-8
Java
3,484
java
AAndExpr.java
Java
[]
null
[]
/* This file was generated by SableCC (http://www.sablecc.org/). */ package cardlang.node; import cardlang.analysis.*; @SuppressWarnings("nls") public final class AAndExpr extends PExpr { private PExpr _expr_; private TKwand _kwand_; private PFactor _factor_; public AAndExpr() { // Constructor } public AAndExpr( @SuppressWarnings("hiding") PExpr _expr_, @SuppressWarnings("hiding") TKwand _kwand_, @SuppressWarnings("hiding") PFactor _factor_) { // Constructor setExpr(_expr_); setKwand(_kwand_); setFactor(_factor_); } @Override public Object clone() { return new AAndExpr( cloneNode(this._expr_), cloneNode(this._kwand_), cloneNode(this._factor_)); } @Override public void apply(Switch sw) { ((Analysis) sw).caseAAndExpr(this); } public PExpr getExpr() { return this._expr_; } public void setExpr(PExpr node) { if(this._expr_ != null) { this._expr_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } this._expr_ = node; } public TKwand getKwand() { return this._kwand_; } public void setKwand(TKwand node) { if(this._kwand_ != null) { this._kwand_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } this._kwand_ = node; } public PFactor getFactor() { return this._factor_; } public void setFactor(PFactor node) { if(this._factor_ != null) { this._factor_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } this._factor_ = node; } @Override public String toString() { return "" + toString(this._expr_) + toString(this._kwand_) + toString(this._factor_); } @Override void removeChild(@SuppressWarnings("unused") Node child) { // Remove child if(this._expr_ == child) { this._expr_ = null; return; } if(this._kwand_ == child) { this._kwand_ = null; return; } if(this._factor_ == child) { this._factor_ = null; return; } throw new RuntimeException("Not a child."); } @Override void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild) { // Replace child if(this._expr_ == oldChild) { setExpr((PExpr) newChild); return; } if(this._kwand_ == oldChild) { setKwand((TKwand) newChild); return; } if(this._factor_ == oldChild) { setFactor((PFactor) newChild); return; } throw new RuntimeException("Not a child."); } }
3,484
0.467279
0.467279
181
18.248619
16.929462
107
false
false
0
0
0
0
0
0
0.248619
false
false
2
cefc53c9fedb59c64b239ef3e2803daf0fb63a71
15,779,709,915,752
f18644ae9c62134947b201b544c9a9a5d0a6dec9
/src/unzip_agenturen/Unzip_Agenturen.java
0bf3d55c282e783db302cc6601e8c85be0394f96
[]
no_license
BOfH85/UnzipAgenturen
https://github.com/BOfH85/UnzipAgenturen
f5d8eaf391c27497a60fc384804dbc67af484181
df0447b694e48effce3d74a912242a423e9c2d91
refs/heads/master
2021-01-21T13:08:00.691000
2017-09-22T14:06:42
2017-09-22T14:06:42
91,807,941
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * (c) 2016 Oliver Jung (MSG Mediaservice Gmbh&Co.KG) Programm zum Entpacken verschlüsselter ZIP-Dateien von Agenturen Für den Vertrieb des Schwäbischen Verlags durch speziell enkryptete Passwörter */ package unzip_agenturen; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StringWriter; import java.io.UnsupportedEncodingException; import java.util.logging.Level; import java.util.logging.Logger; import javax.mail.MessagingException; /** * * @author jungoliver */ public class Unzip_Agenturen { /** * @param args the command line arguments */ /** * @param args */ public static void main(String[] args) { try { String ini = "C:\\U7_Schnittstellen\\U7_to_ViVa\\U_seven2ViVa\\agents.ini"; int AgentCounter = (int) new Datasets().quantity(ini); BufferedReader Ini = new BufferedReader(new InputStreamReader(new FileInputStream(ini), "ISO-8859-1")); String Agents[]= new String[AgentCounter]; for (int i=0;i<Agents.length;i++) { Agents[i]=Ini.readLine(); } new Unzip_Agenturen().extractArchive(new String( "C:\\U7_Schnittstellen\\U7_to_ViVa\\U_seven2ViVa\\fromAgents"), new File( "C:\\U7_Schnittstellen\\U7_to_ViVa\\U_seven2ViVa\\fromAgents"), Agents); } catch (Exception ex) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); ex.printStackTrace(pw); String str = sw.toString(); pw.close(); System.err.println(str); String exception = new Datum().logstamp()+": "+str; String[] exMail= new String[1]; exMail[0]=exception; System.out.println(ex); try { SendMail.main(exMail); } catch (MessagingException ex1) { Logger.getLogger(Unzip_Agenturen.class.getName()).log(Level.SEVERE, null, ex1); } catch (UnsupportedEncodingException ex1) { Logger.getLogger(Unzip_Agenturen.class.getName()).log(Level.SEVERE, null, ex1); } catch (FileNotFoundException ex1) { Logger.getLogger(Unzip_Agenturen.class.getName()).log(Level.SEVERE, null, ex1); } catch (IOException ex1) { Logger.getLogger(Unzip_Agenturen.class.getName()).log(Level.SEVERE, null, ex1); } } } public void extractArchive(String archive, File destDir, String[] Agents) throws Exception { if (!destDir.exists()) { destDir.mkdir(); } String error=""; String[] args = new String[5]; File[] ListFiles= new File(archive).listFiles(); for(int i=0;i<ListFiles.length;i++) { int filecount=0; for (int j=0;j<Agents.length;j++) { if(ListFiles[i].getName().contains(".zip")&& ListFiles[i].getName().contains(ScrambledEggs.agentfix(Agents[j].split(":")[0]))) { filecount =1; String entryFileName = ListFiles[i].getAbsolutePath(); int errordata=0; //check if File contains Data from Agents for (int z=0;z<Agents.length;z++) { if (entryFileName.contains(ScrambledEggs.agentfix(Agents[z].split(":")[0]))) { args[0]=entryFileName; args[1]=ScrambledEggs.degrade(Agents[z].split(":")[1]); error = sevenzip.main(args); //Fehlermail, wenn Problem bei Commandline auftrat if (!(error.isEmpty())) { String[] Mail= new String[3]; Mail[0]=error; SendMail.main(Mail); System.out.println(Mail[0]); errordata=1; } } } //Bei Erfolg wird ZIP gelöscht if (errordata ==0) { ListFiles[i].delete(); } //Bei Fehler wird 0KB Datei von 7ZIP gelöscht else { File[] ListFiles2= new File(archive).listFiles(); for (int x=0;x<ListFiles2.length;x++) { if (ListFiles2[x].length() == 0) { ListFiles2[x].delete(); } } } } } if (filecount==0 && ListFiles[i].getName().contains("zip")) { //Abfangen, falls Dateiname kein Kürzel enthielt: String[] Mail= new String[3]; Mail[0]="Datei: "+ListFiles[i]+"\n Fehler: Dateiname enthaelt kein Agenturkürzel"; SendMail.main(Mail); System.out.println(Mail[0]); } } } private File buildDirectoryHierarchyFor(String entryName, File destDir) { int lastIndex = entryName.lastIndexOf('/'); String entryFileName = entryName.substring(lastIndex + 1); String internalPathToEntry = entryName.substring(0, lastIndex + 1); return new File(destDir, internalPathToEntry); } }
UTF-8
Java
6,059
java
Unzip_Agenturen.java
Java
[ { "context": "/*\n * \n\n (c) 2016 Oliver Jung (MSG Mediaservice Gmbh&Co.KG)\n\n Programm zum E", "end": 32, "score": 0.9998311996459961, "start": 21, "tag": "NAME", "value": "Oliver Jung" }, { "context": "vax.mail.MessagingException;\n\n\n\n\n/**\n *\n * @author jungoliver\n */\npublic class Unzip_Agenturen {\n\n /**\n ", "end": 673, "score": 0.9996601343154907, "start": 663, "tag": "USERNAME", "value": "jungoliver" } ]
null
[]
/* * (c) 2016 <NAME> (MSG Mediaservice Gmbh&Co.KG) Programm zum Entpacken verschlüsselter ZIP-Dateien von Agenturen Für den Vertrieb des Schwäbischen Verlags durch speziell enkryptete Passwörter */ package unzip_agenturen; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StringWriter; import java.io.UnsupportedEncodingException; import java.util.logging.Level; import java.util.logging.Logger; import javax.mail.MessagingException; /** * * @author jungoliver */ public class Unzip_Agenturen { /** * @param args the command line arguments */ /** * @param args */ public static void main(String[] args) { try { String ini = "C:\\U7_Schnittstellen\\U7_to_ViVa\\U_seven2ViVa\\agents.ini"; int AgentCounter = (int) new Datasets().quantity(ini); BufferedReader Ini = new BufferedReader(new InputStreamReader(new FileInputStream(ini), "ISO-8859-1")); String Agents[]= new String[AgentCounter]; for (int i=0;i<Agents.length;i++) { Agents[i]=Ini.readLine(); } new Unzip_Agenturen().extractArchive(new String( "C:\\U7_Schnittstellen\\U7_to_ViVa\\U_seven2ViVa\\fromAgents"), new File( "C:\\U7_Schnittstellen\\U7_to_ViVa\\U_seven2ViVa\\fromAgents"), Agents); } catch (Exception ex) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); ex.printStackTrace(pw); String str = sw.toString(); pw.close(); System.err.println(str); String exception = new Datum().logstamp()+": "+str; String[] exMail= new String[1]; exMail[0]=exception; System.out.println(ex); try { SendMail.main(exMail); } catch (MessagingException ex1) { Logger.getLogger(Unzip_Agenturen.class.getName()).log(Level.SEVERE, null, ex1); } catch (UnsupportedEncodingException ex1) { Logger.getLogger(Unzip_Agenturen.class.getName()).log(Level.SEVERE, null, ex1); } catch (FileNotFoundException ex1) { Logger.getLogger(Unzip_Agenturen.class.getName()).log(Level.SEVERE, null, ex1); } catch (IOException ex1) { Logger.getLogger(Unzip_Agenturen.class.getName()).log(Level.SEVERE, null, ex1); } } } public void extractArchive(String archive, File destDir, String[] Agents) throws Exception { if (!destDir.exists()) { destDir.mkdir(); } String error=""; String[] args = new String[5]; File[] ListFiles= new File(archive).listFiles(); for(int i=0;i<ListFiles.length;i++) { int filecount=0; for (int j=0;j<Agents.length;j++) { if(ListFiles[i].getName().contains(".zip")&& ListFiles[i].getName().contains(ScrambledEggs.agentfix(Agents[j].split(":")[0]))) { filecount =1; String entryFileName = ListFiles[i].getAbsolutePath(); int errordata=0; //check if File contains Data from Agents for (int z=0;z<Agents.length;z++) { if (entryFileName.contains(ScrambledEggs.agentfix(Agents[z].split(":")[0]))) { args[0]=entryFileName; args[1]=ScrambledEggs.degrade(Agents[z].split(":")[1]); error = sevenzip.main(args); //Fehlermail, wenn Problem bei Commandline auftrat if (!(error.isEmpty())) { String[] Mail= new String[3]; Mail[0]=error; SendMail.main(Mail); System.out.println(Mail[0]); errordata=1; } } } //Bei Erfolg wird ZIP gelöscht if (errordata ==0) { ListFiles[i].delete(); } //Bei Fehler wird 0KB Datei von 7ZIP gelöscht else { File[] ListFiles2= new File(archive).listFiles(); for (int x=0;x<ListFiles2.length;x++) { if (ListFiles2[x].length() == 0) { ListFiles2[x].delete(); } } } } } if (filecount==0 && ListFiles[i].getName().contains("zip")) { //Abfangen, falls Dateiname kein Kürzel enthielt: String[] Mail= new String[3]; Mail[0]="Datei: "+ListFiles[i]+"\n Fehler: Dateiname enthaelt kein Agenturkürzel"; SendMail.main(Mail); System.out.println(Mail[0]); } } } private File buildDirectoryHierarchyFor(String entryName, File destDir) { int lastIndex = entryName.lastIndexOf('/'); String entryFileName = entryName.substring(lastIndex + 1); String internalPathToEntry = entryName.substring(0, lastIndex + 1); return new File(destDir, internalPathToEntry); } }
6,054
0.489341
0.47926
174
33.712643
27.815239
138
false
false
0
0
0
0
0
0
0.511494
false
false
2
a1fddc220f359b6e74664106452ca3f3c4838a6b
6,579,889,934,093
d0835d031ac8197c69b072e8b3e9698603192801
/apiComisariaCorp/WEB-INF/classes/csv/comisaria/com/resources/FuncionResource.java
049248b9b3ef7357d3fedea8d286caee4c645953
[]
no_license
JhonnySA/Comisaria
https://github.com/JhonnySA/Comisaria
31ba630572023d393e3a2602efc33be609c962bd
39bc8952432c6a4f85720c3bb49aca62cc14d83d
refs/heads/master
2021-09-06T10:38:06.485000
2018-02-05T16:40:04
2018-02-05T16:40:04
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package csv.comisaria.com.resources; import java.net.URI; import java.util.ArrayList; import java.util.List; import javax.ejb.Stateless; import javax.inject.Inject; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import csv.comisaria.com.domain.Funcion; import csv.comisaria.com.excepciones.DatosNoEncontradosExcepcion; import csv.comisaria.com.services.dto.FuncionDTO; import csv.comisaria.com.services.ejb.FuncionEJBInterface; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @Stateless @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Path("funciones") @io.swagger.annotations.Api(value = "/funciones") public class FuncionResource { @Inject FuncionEJBInterface funcionEJB; @Context private HttpServletResponse response; @QueryParam("page") private Integer page; @QueryParam("limit") private Integer maxRecords; private List<FuncionDTO> listEntity2DTO(List<Funcion> entityList) { List<FuncionDTO> list = new ArrayList<>(); for (Funcion entity : entityList) { list.add(new FuncionDTO(entity)); } return list; } @GET @ApiOperation(value = " Devuelve la lista de Funciones ", notes = " Lista completa ", response = Funcion.class, responseContainer = " List ") public List<FuncionDTO> getFunciones() { if (page != null && maxRecords != null) { this.response.setIntHeader("X-Total-Count", funcionEJB.countFunciones()); return listEntity2DTO(funcionEJB.getFunciones(page, maxRecords)); } return listEntity2DTO(funcionEJB.getFunciones()); } @GET @Path("/{cod: \\d+}") @ApiOperation(value = " Devuelve un registro de la lista de Funciones ", notes = " Una Funcion especifica ", response = Funcion.class, responseContainer = "Funcion.Class") public FuncionDTO getFuncion(@ApiParam(value = " Cod de la Funcion ", allowableValues = "range[1," + Integer.MAX_VALUE + "]", required = true) @PathParam("cod") int cod, @Context UriInfo uriInfo) { FuncionDTO dto = new FuncionDTO(funcionEJB.getFuncionById(cod)); ArrayList<FuncionDTO> list = (ArrayList<FuncionDTO>) listEntity2DTO(funcionEJB.getFunciones()); String linkNext = null; String linkFirt; String linkPrevious; String linkSelf; String linkLast; if (dto.getCodFuncion() == 0) { throw new DatosNoEncontradosExcepcion( "No se ha encontrado la funcion con el cod: " + cod + " , probablemente fue removido del servidor"); } else { linkFirt = getLinkFirt(uriInfo, list); linkPrevious = getLinkPrevious(uriInfo, cod); linkSelf = getlinkSelf(uriInfo); linkNext = getLinkNext(uriInfo, cod); linkLast = getLinkLast(uriInfo, list); if (linkSelf.equals(linkLast)) { linkNext = linkFirt; } if (linkSelf.equals(linkFirt)) { linkPrevious = linkLast; } } dto.addLink(linkFirt, "Firt"); dto.addLink(linkPrevious, "Previous"); dto.addLink(linkSelf, "Self"); dto.addLink(linkNext, "Next"); dto.addLink(linkLast, "Last"); return dto; } private String getLinkFirt(UriInfo uriInfo, ArrayList<FuncionDTO> list) { return uriInfo.getBaseUriBuilder().path(FuncionResource.class) .path(Integer.toString(list.get(0).getCodFuncion())).build().toString(); } private String getLinkPrevious(UriInfo uriInfo, int cod) { FuncionDTO clase = new FuncionDTO(funcionEJB.getPreviusFuncion(cod)); String linkPrevious = null; if (clase != null) { linkPrevious = uriInfo.getBaseUriBuilder().path(FuncionResource.class) .path(Integer.toString(clase.getCodFuncion())).build().toString(); } return linkPrevious; } private String getlinkSelf(UriInfo uriInfo) { return uriInfo.getAbsolutePath().toString(); } private String getLinkNext(UriInfo uriInfo, int cod) { FuncionDTO funcion = new FuncionDTO(funcionEJB.getNexFuncion(cod)); String linkNext = null; if (funcion != null) { linkNext = uriInfo.getBaseUriBuilder().path(FuncionResource.class) .path(Integer.toString(funcion.getCodFuncion())).build().toString(); } return linkNext; } private String getLinkLast(UriInfo uriInfo, ArrayList<FuncionDTO> list) { return uriInfo.getBaseUriBuilder().path(FuncionResource.class) .path(Integer.toString(list.get(list.size() - 1).getCodFuncion())).build().toString(); } @POST @ApiOperation(value = " Crea un nuevo registro de tipo Funcion ", notes = " Crea un nuevo Funcion.CLass ", response = Funcion.class, responseContainer = "201") // @StatusCreated public Response createFuncion(FuncionDTO dto, @Context UriInfo uriInfo) { FuncionDTO funcionDTO=new FuncionDTO(funcionEJB.createFuncion(dto.toEntity())); URI uri=uriInfo.getAbsolutePathBuilder().path(String.valueOf(funcionDTO.getCodFuncion())).build(); return Response.created(uri).entity(funcionDTO).build(); } @PUT @Path("{cod: \\d+}") @ApiOperation(value = " Actualiza un registro de la lista de Funciones ", notes = " Actualiza un registro con un {codFuncion} ", response = Funcion.class, responseContainer = "Funcion.Class") public FuncionDTO updateFuncion(@ApiParam(value = " Cod de la Funcion ", allowableValues = "range[1," + Integer.MAX_VALUE + "]", required = true) @PathParam("cod") int cod, FuncionDTO dto) { Funcion entity = dto.toEntity(); entity.setCodFuncion(cod); Funcion oldEntity = funcionEJB.getFuncionById(cod); entity.setNombre(oldEntity.getNombre()); entity.setPolicias(oldEntity.getPolicias()); return new FuncionDTO(funcionEJB.updateFuncion(entity)); } @DELETE @Path("{cod: \\d+}") @ApiOperation(value = " Elimina un registro de la lista de Funciones ", notes = " Elimina un registro con un {codFuncion} ", responseContainer = "200") public void deleteFuncion(@ApiParam(value = " Cod de la Funcion ", allowableValues = "range[1," + Integer.MAX_VALUE + "]", required = true) @PathParam("cod") int cod) { funcionEJB.deleteFuncion(funcionEJB.getFuncionById(cod)); } public void existsFuncion(int codFuncion) { Funcion funcion = funcionEJB.getFuncionById(codFuncion); if (funcion == null) { throw new WebApplicationException(404); } } // creando el subservicio // http://localhost:8080/apiVentasCorp/v1/funciones/2/policias @Path("{codFuncion: \\d+}/policias") public Class<FuncionPoliciaResource> getFuncionPoliciaResource(@PathParam("codFuncion") int codFuncion) { existsFuncion(codFuncion); return FuncionPoliciaResource.class; } }
UTF-8
Java
6,828
java
FuncionResource.java
Java
[]
null
[]
package csv.comisaria.com.resources; import java.net.URI; import java.util.ArrayList; import java.util.List; import javax.ejb.Stateless; import javax.inject.Inject; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import csv.comisaria.com.domain.Funcion; import csv.comisaria.com.excepciones.DatosNoEncontradosExcepcion; import csv.comisaria.com.services.dto.FuncionDTO; import csv.comisaria.com.services.ejb.FuncionEJBInterface; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @Stateless @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) @Path("funciones") @io.swagger.annotations.Api(value = "/funciones") public class FuncionResource { @Inject FuncionEJBInterface funcionEJB; @Context private HttpServletResponse response; @QueryParam("page") private Integer page; @QueryParam("limit") private Integer maxRecords; private List<FuncionDTO> listEntity2DTO(List<Funcion> entityList) { List<FuncionDTO> list = new ArrayList<>(); for (Funcion entity : entityList) { list.add(new FuncionDTO(entity)); } return list; } @GET @ApiOperation(value = " Devuelve la lista de Funciones ", notes = " Lista completa ", response = Funcion.class, responseContainer = " List ") public List<FuncionDTO> getFunciones() { if (page != null && maxRecords != null) { this.response.setIntHeader("X-Total-Count", funcionEJB.countFunciones()); return listEntity2DTO(funcionEJB.getFunciones(page, maxRecords)); } return listEntity2DTO(funcionEJB.getFunciones()); } @GET @Path("/{cod: \\d+}") @ApiOperation(value = " Devuelve un registro de la lista de Funciones ", notes = " Una Funcion especifica ", response = Funcion.class, responseContainer = "Funcion.Class") public FuncionDTO getFuncion(@ApiParam(value = " Cod de la Funcion ", allowableValues = "range[1," + Integer.MAX_VALUE + "]", required = true) @PathParam("cod") int cod, @Context UriInfo uriInfo) { FuncionDTO dto = new FuncionDTO(funcionEJB.getFuncionById(cod)); ArrayList<FuncionDTO> list = (ArrayList<FuncionDTO>) listEntity2DTO(funcionEJB.getFunciones()); String linkNext = null; String linkFirt; String linkPrevious; String linkSelf; String linkLast; if (dto.getCodFuncion() == 0) { throw new DatosNoEncontradosExcepcion( "No se ha encontrado la funcion con el cod: " + cod + " , probablemente fue removido del servidor"); } else { linkFirt = getLinkFirt(uriInfo, list); linkPrevious = getLinkPrevious(uriInfo, cod); linkSelf = getlinkSelf(uriInfo); linkNext = getLinkNext(uriInfo, cod); linkLast = getLinkLast(uriInfo, list); if (linkSelf.equals(linkLast)) { linkNext = linkFirt; } if (linkSelf.equals(linkFirt)) { linkPrevious = linkLast; } } dto.addLink(linkFirt, "Firt"); dto.addLink(linkPrevious, "Previous"); dto.addLink(linkSelf, "Self"); dto.addLink(linkNext, "Next"); dto.addLink(linkLast, "Last"); return dto; } private String getLinkFirt(UriInfo uriInfo, ArrayList<FuncionDTO> list) { return uriInfo.getBaseUriBuilder().path(FuncionResource.class) .path(Integer.toString(list.get(0).getCodFuncion())).build().toString(); } private String getLinkPrevious(UriInfo uriInfo, int cod) { FuncionDTO clase = new FuncionDTO(funcionEJB.getPreviusFuncion(cod)); String linkPrevious = null; if (clase != null) { linkPrevious = uriInfo.getBaseUriBuilder().path(FuncionResource.class) .path(Integer.toString(clase.getCodFuncion())).build().toString(); } return linkPrevious; } private String getlinkSelf(UriInfo uriInfo) { return uriInfo.getAbsolutePath().toString(); } private String getLinkNext(UriInfo uriInfo, int cod) { FuncionDTO funcion = new FuncionDTO(funcionEJB.getNexFuncion(cod)); String linkNext = null; if (funcion != null) { linkNext = uriInfo.getBaseUriBuilder().path(FuncionResource.class) .path(Integer.toString(funcion.getCodFuncion())).build().toString(); } return linkNext; } private String getLinkLast(UriInfo uriInfo, ArrayList<FuncionDTO> list) { return uriInfo.getBaseUriBuilder().path(FuncionResource.class) .path(Integer.toString(list.get(list.size() - 1).getCodFuncion())).build().toString(); } @POST @ApiOperation(value = " Crea un nuevo registro de tipo Funcion ", notes = " Crea un nuevo Funcion.CLass ", response = Funcion.class, responseContainer = "201") // @StatusCreated public Response createFuncion(FuncionDTO dto, @Context UriInfo uriInfo) { FuncionDTO funcionDTO=new FuncionDTO(funcionEJB.createFuncion(dto.toEntity())); URI uri=uriInfo.getAbsolutePathBuilder().path(String.valueOf(funcionDTO.getCodFuncion())).build(); return Response.created(uri).entity(funcionDTO).build(); } @PUT @Path("{cod: \\d+}") @ApiOperation(value = " Actualiza un registro de la lista de Funciones ", notes = " Actualiza un registro con un {codFuncion} ", response = Funcion.class, responseContainer = "Funcion.Class") public FuncionDTO updateFuncion(@ApiParam(value = " Cod de la Funcion ", allowableValues = "range[1," + Integer.MAX_VALUE + "]", required = true) @PathParam("cod") int cod, FuncionDTO dto) { Funcion entity = dto.toEntity(); entity.setCodFuncion(cod); Funcion oldEntity = funcionEJB.getFuncionById(cod); entity.setNombre(oldEntity.getNombre()); entity.setPolicias(oldEntity.getPolicias()); return new FuncionDTO(funcionEJB.updateFuncion(entity)); } @DELETE @Path("{cod: \\d+}") @ApiOperation(value = " Elimina un registro de la lista de Funciones ", notes = " Elimina un registro con un {codFuncion} ", responseContainer = "200") public void deleteFuncion(@ApiParam(value = " Cod de la Funcion ", allowableValues = "range[1," + Integer.MAX_VALUE + "]", required = true) @PathParam("cod") int cod) { funcionEJB.deleteFuncion(funcionEJB.getFuncionById(cod)); } public void existsFuncion(int codFuncion) { Funcion funcion = funcionEJB.getFuncionById(codFuncion); if (funcion == null) { throw new WebApplicationException(404); } } // creando el subservicio // http://localhost:8080/apiVentasCorp/v1/funciones/2/policias @Path("{codFuncion: \\d+}/policias") public Class<FuncionPoliciaResource> getFuncionPoliciaResource(@PathParam("codFuncion") int codFuncion) { existsFuncion(codFuncion); return FuncionPoliciaResource.class; } }
6,828
0.738137
0.734476
197
33.664974
34.926746
192
false
false
0
0
0
0
0
0
1.893401
false
false
2
f710c9550f210a1152b236b695cfb734ecc281e9
22,333,829,990,770
a4192675cdf2bbfa5a22fba434253d9e628dc6e8
/app/src/main/java/com/shyj/jianshen/fragment/MyWorkoutFragment.java
5c79029a76845a2922db74ee09a5f8c843337831
[]
no_license
githup123456/Jianshen
https://github.com/githup123456/Jianshen
910d556c6350744c587320a6bfdbf1e868e3b093
39d4d19c804c13747e4093d6049551744d950785
refs/heads/main
2023-05-08T07:34:08.742000
2021-05-24T05:10:04
2021-05-24T05:10:04
370,218,420
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.shyj.jianshen.fragment; import android.view.View; import android.widget.LinearLayout; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.shyj.jianshen.R; import com.shyj.jianshen.adapter.PlanCourseAdapter; import com.shyj.jianshen.bean.CourseBean; import java.util.ArrayList; import java.util.List; import butterknife.BindView; public class MyWorkoutFragment extends BaseFragment { @BindView(R.id.my_work_lly_null) LinearLayout llyNull; @BindView(R.id.my_work_rcl) RecyclerView recyclerView; private PlanCourseAdapter planCourseAdapter; private List<CourseBean> courseBeanList; private boolean isNull = true; @Override public int layoutId() { return R.layout.fragment_my_work; } @Override public void init() { if (isNull){ llyNull.setVisibility(View.VISIBLE); recyclerView.setVisibility(View.GONE); }else { recyclerView.setVisibility(View.VISIBLE); llyNull.setVisibility(View.GONE); } initRcl(); } @Override public void onResume() { super.onResume(); } public void initRcl(){ courseBeanList = new ArrayList<>(); planCourseAdapter = new PlanCourseAdapter(getActivity(),courseBeanList,false,false); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); recyclerView.setAdapter(planCourseAdapter); } @Override public void onHiddenChanged(boolean hidden) { super.onHiddenChanged(hidden); } }
UTF-8
Java
1,619
java
MyWorkoutFragment.java
Java
[]
null
[]
package com.shyj.jianshen.fragment; import android.view.View; import android.widget.LinearLayout; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.shyj.jianshen.R; import com.shyj.jianshen.adapter.PlanCourseAdapter; import com.shyj.jianshen.bean.CourseBean; import java.util.ArrayList; import java.util.List; import butterknife.BindView; public class MyWorkoutFragment extends BaseFragment { @BindView(R.id.my_work_lly_null) LinearLayout llyNull; @BindView(R.id.my_work_rcl) RecyclerView recyclerView; private PlanCourseAdapter planCourseAdapter; private List<CourseBean> courseBeanList; private boolean isNull = true; @Override public int layoutId() { return R.layout.fragment_my_work; } @Override public void init() { if (isNull){ llyNull.setVisibility(View.VISIBLE); recyclerView.setVisibility(View.GONE); }else { recyclerView.setVisibility(View.VISIBLE); llyNull.setVisibility(View.GONE); } initRcl(); } @Override public void onResume() { super.onResume(); } public void initRcl(){ courseBeanList = new ArrayList<>(); planCourseAdapter = new PlanCourseAdapter(getActivity(),courseBeanList,false,false); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); recyclerView.setAdapter(planCourseAdapter); } @Override public void onHiddenChanged(boolean hidden) { super.onHiddenChanged(hidden); } }
1,619
0.695491
0.695491
64
24.296875
21.363432
92
false
false
0
0
0
0
0
0
0.484375
false
false
2
7af643bdf08766cacfb91c29f7b78f6af89030dd
20,607,253,117,709
09b9653664384174659310df86e236a2b1d6fadb
/common/src/main/java/zc/utils/MapUtils.java
ecaa0b3829a59ab48dd8df9d9ccec956397c5ed0
[]
no_license
wanzhs/netty-test
https://github.com/wanzhs/netty-test
135642cb19c5a37246c31c3bec99de59b02086c2
d8c1c8b8fd510c051ac780210e1ff5554b8a8bfc
refs/heads/master
2020-04-13T14:42:08.248000
2019-01-02T11:08:08
2019-01-02T11:08:08
163,269,882
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package zc.utils; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.Comparator; import java.util.HashMap; import java.util.Map; import java.util.TreeMap; public class MapUtils { public static Object mapToObject(Map<String,Object> map, Class<?> beanClass){ try { Object object=beanClass.newInstance(); if (map!=null){ Field[] fields=object.getClass().getDeclaredFields(); for (Field field:fields){ int mod=field.getModifiers(); if (Modifier.isStatic(mod) || Modifier.isFinal(mod)){ continue; } field.setAccessible(true); field.set(object,map.get(field.getName())); field.setAccessible(false); } } return object; } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } return null; } public static Map<String,Object> objectToMap(Object object){ Map<String,Object> map=new HashMap<String, Object>(); if (object!=null){ Field[] declaredFileds=object.getClass().getDeclaredFields(); for (Field field:declaredFileds){ field.setAccessible(true); try { map.put(field.getName(),field.get(object)); } catch (IllegalAccessException e) { e.printStackTrace(); }finally { field.setAccessible(false); } } } return map; } public static Map<String,Object> objectToMapOrdered(Object object){ Map<String,Object> map=new TreeMap<String, Object>(new Comparator<String>() { public int compare(String o1, String o2) { return o1.compareTo(o2); } }); if (object!=null){ Field[] declaredFileds=object.getClass().getDeclaredFields(); for (Field field:declaredFileds){ field.setAccessible(true); try { map.put(field.getName(),field.get(object)); } catch (IllegalAccessException e) { e.printStackTrace(); }finally { field.setAccessible(false); } } } return map; } }
UTF-8
Java
2,529
java
MapUtils.java
Java
[]
null
[]
package zc.utils; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.Comparator; import java.util.HashMap; import java.util.Map; import java.util.TreeMap; public class MapUtils { public static Object mapToObject(Map<String,Object> map, Class<?> beanClass){ try { Object object=beanClass.newInstance(); if (map!=null){ Field[] fields=object.getClass().getDeclaredFields(); for (Field field:fields){ int mod=field.getModifiers(); if (Modifier.isStatic(mod) || Modifier.isFinal(mod)){ continue; } field.setAccessible(true); field.set(object,map.get(field.getName())); field.setAccessible(false); } } return object; } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } return null; } public static Map<String,Object> objectToMap(Object object){ Map<String,Object> map=new HashMap<String, Object>(); if (object!=null){ Field[] declaredFileds=object.getClass().getDeclaredFields(); for (Field field:declaredFileds){ field.setAccessible(true); try { map.put(field.getName(),field.get(object)); } catch (IllegalAccessException e) { e.printStackTrace(); }finally { field.setAccessible(false); } } } return map; } public static Map<String,Object> objectToMapOrdered(Object object){ Map<String,Object> map=new TreeMap<String, Object>(new Comparator<String>() { public int compare(String o1, String o2) { return o1.compareTo(o2); } }); if (object!=null){ Field[] declaredFileds=object.getClass().getDeclaredFields(); for (Field field:declaredFileds){ field.setAccessible(true); try { map.put(field.getName(),field.get(object)); } catch (IllegalAccessException e) { e.printStackTrace(); }finally { field.setAccessible(false); } } } return map; } }
2,529
0.517596
0.516014
74
33.175674
21.749407
85
false
false
0
0
0
0
0
0
0.635135
false
false
2
ce8394ab2eacb3715a12451c938e3bcae3cbdec2
31,009,663,927,208
895657924d320ba3b5368a8efbf87847b6fde373
/ovsdb/providers/src/main/java/org/onosproject/ovsdb/providers/constant/ConnectionConstants.java
a0be858fdbea8c117a0f5bf4fa23ba33820e0095
[ "Apache-2.0" ]
permissive
zhanghaoyu7/onos
https://github.com/zhanghaoyu7/onos
f9ff4ced8af31a9d82ac5d05e53d0c0445697de6
d32006bee1973d9f7c10b81ad89ab553c3a76659
refs/heads/master
2021-01-17T20:47:39.491000
2015-04-29T01:34:41
2015-04-29T01:34:41
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.onosproject.ovsdb.providers.constant; public enum ConnectionConstants { ADDRESS("address"), PORT("port"), PROTOCOL("protocol"), USERNAME("username"), PASSWORD("password"); private String name; private ConnectionConstants(String name) { this.name = name; } public String toString() { return this.name; } }
UTF-8
Java
365
java
ConnectionConstants.java
Java
[ { "context": "PORT(\"port\"), PROTOCOL(\"protocol\"),\n USERNAME(\"username\"), PASSWORD(\"password\");\n\n private String name", "end": 167, "score": 0.9995482563972473, "start": 159, "tag": "USERNAME", "value": "username" }, { "context": "(\"protocol\"),\n USERNAME(\"username\"), PASSWORD(\"password\");\n\n private String name;\n\n private Connect", "end": 189, "score": 0.9988799691200256, "start": 181, "tag": "PASSWORD", "value": "password" } ]
null
[]
package org.onosproject.ovsdb.providers.constant; public enum ConnectionConstants { ADDRESS("address"), PORT("port"), PROTOCOL("protocol"), USERNAME("username"), PASSWORD("<PASSWORD>"); private String name; private ConnectionConstants(String name) { this.name = name; } public String toString() { return this.name; } }
367
0.660274
0.660274
16
21.8125
20.094212
59
false
false
0
0
0
0
0
0
0.5625
false
false
2
6d3f9b3ec9848b9bc5a2b0dcc163c2457b30703a
28,887,950,101,623
67108716f071002caeabafc7ca9dc92f3e7cb856
/src/main/java/co/kr/cafego/core/config/AbstractApplicationConfig.java
2db9fcc864309f5dd514fc7edbf0b0e8d6654ac3
[]
no_license
Hsooooo/cafeGo_api
https://github.com/Hsooooo/cafeGo_api
3bb4d623e1b114d2b98483422caa773c6da1a153
80bd597002345afe8efde4e6d1461e8e5bc69d0f
refs/heads/master
2022-12-30T22:15:25.544000
2020-10-18T17:41:05
2020-10-18T17:41:05
297,512,869
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package co.kr.cafego.core.config; import java.util.ArrayList; import java.util.List; import javax.inject.Inject; import org.springframework.context.annotation.Bean; import org.springframework.context.support.ResourceBundleMessageSource; import org.springframework.core.env.Environment; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; import org.springframework.web.multipart.MultipartResolver; import org.springframework.web.multipart.commons.CommonsMultipartResolver; import org.springframework.web.servlet.View; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.view.ContentNegotiatingViewResolver; import org.springframework.web.servlet.view.InternalResourceViewResolver; import org.springframework.web.servlet.view.JstlView; import org.springframework.web.servlet.view.json.MappingJackson2JsonView; import co.kr.cafego.core.view.FileDownloadView; import co.kr.cafego.core.view.IE89ContentNegotiatingViewResolver; public abstract class AbstractApplicationConfig extends WebMvcConfigurerAdapter{ @Bean public ResourceBundleMessageSource messageSource(){ ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource(); messageSource.setBasenames(new String[] { "messages" }); return messageSource; } @Bean public MultipartResolver multipartResolver() { CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver(); return multipartResolver; } @Bean public ViewResolver viewResolver() { InternalResourceViewResolver internalResourceViewResolver = new InternalResourceViewResolver(); internalResourceViewResolver.setViewClass(JstlView.class); internalResourceViewResolver.setPrefix("/WEB-INF/jsp/"); internalResourceViewResolver.setSuffix(".jsp"); internalResourceViewResolver.setRequestContextAttribute("rc"); List<ViewResolver> viewResolvers = new ArrayList<ViewResolver>(); viewResolvers.add(internalResourceViewResolver); MappingJackson2JsonView jsonView = new MappingJackson2JsonView(); jsonView.setPrettyPrint(getJsonPrettyPrint()); List<View> defaultViews = new ArrayList<View>(); defaultViews.add(jsonView); ContentNegotiatingViewResolver viewResolver = new IE89ContentNegotiatingViewResolver(); viewResolver.setViewResolvers(viewResolvers); viewResolver.setDefaultViews(defaultViews); return viewResolver; } // @Bean // public LocalValidatorFactoryBean validator() { // return new LocalValidatorFactoryBean(); // } @Bean public FileDownloadView fileDownloadView() { return new FileDownloadView(); } @Bean public LoggingAspect loggingAspect() { return new LoggingAspect(); } @Bean @Inject public EnvironmentWrapper environmentWrapper(Environment env) { return new EnvironmentWrapper(env); } public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { configurer.enable(); } public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter(); jsonConverter.setPrettyPrint(getJsonPrettyPrint()); converters.add(jsonConverter); } protected boolean getJsonPrettyPrint() { return false; } }
UTF-8
Java
3,656
java
AbstractApplicationConfig.java
Java
[]
null
[]
package co.kr.cafego.core.config; import java.util.ArrayList; import java.util.List; import javax.inject.Inject; import org.springframework.context.annotation.Bean; import org.springframework.context.support.ResourceBundleMessageSource; import org.springframework.core.env.Environment; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; import org.springframework.web.multipart.MultipartResolver; import org.springframework.web.multipart.commons.CommonsMultipartResolver; import org.springframework.web.servlet.View; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.view.ContentNegotiatingViewResolver; import org.springframework.web.servlet.view.InternalResourceViewResolver; import org.springframework.web.servlet.view.JstlView; import org.springframework.web.servlet.view.json.MappingJackson2JsonView; import co.kr.cafego.core.view.FileDownloadView; import co.kr.cafego.core.view.IE89ContentNegotiatingViewResolver; public abstract class AbstractApplicationConfig extends WebMvcConfigurerAdapter{ @Bean public ResourceBundleMessageSource messageSource(){ ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource(); messageSource.setBasenames(new String[] { "messages" }); return messageSource; } @Bean public MultipartResolver multipartResolver() { CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver(); return multipartResolver; } @Bean public ViewResolver viewResolver() { InternalResourceViewResolver internalResourceViewResolver = new InternalResourceViewResolver(); internalResourceViewResolver.setViewClass(JstlView.class); internalResourceViewResolver.setPrefix("/WEB-INF/jsp/"); internalResourceViewResolver.setSuffix(".jsp"); internalResourceViewResolver.setRequestContextAttribute("rc"); List<ViewResolver> viewResolvers = new ArrayList<ViewResolver>(); viewResolvers.add(internalResourceViewResolver); MappingJackson2JsonView jsonView = new MappingJackson2JsonView(); jsonView.setPrettyPrint(getJsonPrettyPrint()); List<View> defaultViews = new ArrayList<View>(); defaultViews.add(jsonView); ContentNegotiatingViewResolver viewResolver = new IE89ContentNegotiatingViewResolver(); viewResolver.setViewResolvers(viewResolvers); viewResolver.setDefaultViews(defaultViews); return viewResolver; } // @Bean // public LocalValidatorFactoryBean validator() { // return new LocalValidatorFactoryBean(); // } @Bean public FileDownloadView fileDownloadView() { return new FileDownloadView(); } @Bean public LoggingAspect loggingAspect() { return new LoggingAspect(); } @Bean @Inject public EnvironmentWrapper environmentWrapper(Environment env) { return new EnvironmentWrapper(env); } public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { configurer.enable(); } public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter(); jsonConverter.setPrettyPrint(getJsonPrettyPrint()); converters.add(jsonConverter); } protected boolean getJsonPrettyPrint() { return false; } }
3,656
0.80826
0.805525
105
33.819046
30.523928
98
false
false
0
0
0
0
0
0
1.333333
false
false
2
47cf96c42691cee84fbc82563ee94f712a06c950
30,331,059,113,371
c143f357c6411f4ef75cbc31c6488cb09ae32860
/src/compraventamvc1/modelo/datos/Detallecompra.java
cc4e3bd88fac69bcc6fe04998903497ccb1bacde
[]
no_license
rolion/CompraVentaMVC1
https://github.com/rolion/CompraVentaMVC1
d6b7b341344f2d19a93ef1acdd7daf97fbff033d
99cefde72156414013baefb1c9e6e7a66328d72b
refs/heads/master
2020-05-27T08:42:02.565000
2015-04-13T01:39:03
2015-04-13T01:39:03
33,831,412
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package compraventamvc1.modelo.datos; // Generated 12-abr-2015 14:39:54 by Hibernate Tools 4.3.1 import java.util.HashSet; import java.util.Set; /** * Detallecompra generated by hbm2java */ public class Detallecompra implements java.io.Serializable { private Integer idDetaC; private Notacompra notacompra; private int cantidad; private float precioXcant; private Integer idProducto; private Set productos = new HashSet(0); public Detallecompra() { } public Detallecompra(int cantidad, float precioXcant) { this.cantidad = cantidad; this.precioXcant = precioXcant; } public Detallecompra(Notacompra notacompra, int cantidad, float precioXcant, Integer idProducto, Set productos) { this.notacompra = notacompra; this.cantidad = cantidad; this.precioXcant = precioXcant; this.idProducto = idProducto; this.productos = productos; } public Integer getIdDetaC() { return this.idDetaC; } public void setIdDetaC(Integer idDetaC) { this.idDetaC = idDetaC; } public Notacompra getNotacompra() { return this.notacompra; } public void setNotacompra(Notacompra notacompra) { this.notacompra = notacompra; } public int getCantidad() { return this.cantidad; } public void setCantidad(int cantidad) { this.cantidad = cantidad; } public float getPrecioXcant() { return this.precioXcant; } public void setPrecioXcant(float precioXcant) { this.precioXcant = precioXcant; } public Integer getIdProducto() { return this.idProducto; } public void setIdProducto(Integer idProducto) { this.idProducto = idProducto; } public Set getProductos() { return this.productos; } public void setProductos(Set productos) { this.productos = productos; } }
UTF-8
Java
1,970
java
Detallecompra.java
Java
[]
null
[]
package compraventamvc1.modelo.datos; // Generated 12-abr-2015 14:39:54 by Hibernate Tools 4.3.1 import java.util.HashSet; import java.util.Set; /** * Detallecompra generated by hbm2java */ public class Detallecompra implements java.io.Serializable { private Integer idDetaC; private Notacompra notacompra; private int cantidad; private float precioXcant; private Integer idProducto; private Set productos = new HashSet(0); public Detallecompra() { } public Detallecompra(int cantidad, float precioXcant) { this.cantidad = cantidad; this.precioXcant = precioXcant; } public Detallecompra(Notacompra notacompra, int cantidad, float precioXcant, Integer idProducto, Set productos) { this.notacompra = notacompra; this.cantidad = cantidad; this.precioXcant = precioXcant; this.idProducto = idProducto; this.productos = productos; } public Integer getIdDetaC() { return this.idDetaC; } public void setIdDetaC(Integer idDetaC) { this.idDetaC = idDetaC; } public Notacompra getNotacompra() { return this.notacompra; } public void setNotacompra(Notacompra notacompra) { this.notacompra = notacompra; } public int getCantidad() { return this.cantidad; } public void setCantidad(int cantidad) { this.cantidad = cantidad; } public float getPrecioXcant() { return this.precioXcant; } public void setPrecioXcant(float precioXcant) { this.precioXcant = precioXcant; } public Integer getIdProducto() { return this.idProducto; } public void setIdProducto(Integer idProducto) { this.idProducto = idProducto; } public Set getProductos() { return this.productos; } public void setProductos(Set productos) { this.productos = productos; } }
1,970
0.649239
0.640102
83
22.710844
20.858404
117
false
false
0
0
0
0
0
0
0.409639
false
false
2
942366d51a1938f51f702a2a38b17c6de7775a1e
575,525,676,517
f97694aaa2a9dfa968915a163a0577ec552ffff8
/demo/springs/springs/Restconsumer/src/com/mccoy/consumer/client.java
5a04220344ad334ac66a3b7d44b4405698769eb6
[]
no_license
smi21/lastRepository
https://github.com/smi21/lastRepository
2b19253cf8416ca80e69c81c9f55f8a59f5e4034
50c74e67376ee450ecb0681493cb1c0d81bed764
refs/heads/master
2020-03-07T08:49:53.907000
2018-04-02T09:53:58
2018-04-02T09:54:33
127,389,971
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mccoy.consumer; import java.net.URI; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Scanner; import java.util.Set; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; import org.glassfish.jersey.client.ClientConfig; public class client { public static void main(String[] args) { Scanner sc=new Scanner(System.in); ClientConfig config = new ClientConfig(); System.out.println("client configured"); Client client = ClientBuilder.newClient(config); System.out.println("new client"); WebTarget target = client.target(getBaseURI()); System.out.println(target); System.out.println("geturl done"); String response = target.path("rest").path("bankservices").request().accept(MediaType.TEXT_PLAIN).get(Response.class).toString(); System.out.println(response); HashMap<String, Integer> plainAnswer =target.path("rest").path("bankservices").request().accept(MediaType.APPLICATION_JSON).get(HashMap.class); //System.out.println(plainAnswer); Set c=plainAnswer.keySet(); Iterator iterator=c.iterator(); while(iterator.hasNext()) { String key=(String) iterator.next(); Object value=plainAnswer.get(key); System.out.println(key+" -- "+value); } /* String response = target.path("rest").path("sbi").request().accept(MediaType.TEXT_PLAIN).get(Response.class).toString(); System.out.println(response); String plainAnswer = target.path("rest").path("sbi").request().accept(MediaType.TEXT_PLAIN).get(String.class); /* String xmlAnswer = target.path("rest").path("canara").request().accept(MediaType.TEXT_PLAIN).get(String.class); String htmlAnswer= target.path("rest").path("icici").request().accept(MediaType.TEXT_PLAIN).get(String.class);*/ //System.out.println(response); // System.out.println(plainAnswer); // System.out.println(xmlAnswer); // System.out.println(htmlAnswer); } private static URI getBaseURI() { return UriBuilder.fromUri("http://localhost:8050/Restprovider").build(); } }
UTF-8
Java
2,356
java
client.java
Java
[]
null
[]
package com.mccoy.consumer; import java.net.URI; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Scanner; import java.util.Set; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; import org.glassfish.jersey.client.ClientConfig; public class client { public static void main(String[] args) { Scanner sc=new Scanner(System.in); ClientConfig config = new ClientConfig(); System.out.println("client configured"); Client client = ClientBuilder.newClient(config); System.out.println("new client"); WebTarget target = client.target(getBaseURI()); System.out.println(target); System.out.println("geturl done"); String response = target.path("rest").path("bankservices").request().accept(MediaType.TEXT_PLAIN).get(Response.class).toString(); System.out.println(response); HashMap<String, Integer> plainAnswer =target.path("rest").path("bankservices").request().accept(MediaType.APPLICATION_JSON).get(HashMap.class); //System.out.println(plainAnswer); Set c=plainAnswer.keySet(); Iterator iterator=c.iterator(); while(iterator.hasNext()) { String key=(String) iterator.next(); Object value=plainAnswer.get(key); System.out.println(key+" -- "+value); } /* String response = target.path("rest").path("sbi").request().accept(MediaType.TEXT_PLAIN).get(Response.class).toString(); System.out.println(response); String plainAnswer = target.path("rest").path("sbi").request().accept(MediaType.TEXT_PLAIN).get(String.class); /* String xmlAnswer = target.path("rest").path("canara").request().accept(MediaType.TEXT_PLAIN).get(String.class); String htmlAnswer= target.path("rest").path("icici").request().accept(MediaType.TEXT_PLAIN).get(String.class);*/ //System.out.println(response); // System.out.println(plainAnswer); // System.out.println(xmlAnswer); // System.out.println(htmlAnswer); } private static URI getBaseURI() { return UriBuilder.fromUri("http://localhost:8050/Restprovider").build(); } }
2,356
0.689728
0.688031
70
31.657143
32.322433
145
false
false
0
0
0
0
0
0
1.514286
false
false
2
487a422bf1168b7645c66e4fdf56da86d6e3e5f5
9,397,388,506,637
d885150d7b6a1267cca2c7af7e7ea8f3233e94ba
/src/main/java/com/zslin/admin/controller/AdminWxMenuController.java
f8d18a20104c3fcada64de7065af80d2940211a0
[]
no_license
zsl131/hlx
https://github.com/zsl131/hlx
029f23bfb6868f7bee2cfb3ee78cb0341567094c
2aaf1a8b80f1d4592f1aff78f23a24fed274b4ba
refs/heads/master
2023-04-18T00:50:04.105000
2022-10-16T03:17:50
2022-10-16T03:17:50
83,254,725
1
1
null
false
2023-03-27T22:23:29
2017-02-27T01:17:01
2022-02-11T09:28:59
2023-03-27T22:23:25
10,179
1
1
10
JavaScript
false
false
package com.zslin.admin.controller; import com.zslin.basic.annotations.AdminAuth; import com.zslin.basic.annotations.Token; import com.zslin.basic.repository.SimpleSortBuilder; import com.zslin.basic.repository.SimpleSpecificationBuilder; import com.zslin.basic.tools.MyBeanUtils; import com.zslin.basic.tools.TokenTools; import com.zslin.web.model.WxMenu; import com.zslin.web.service.IWxMenuService; import com.zslin.wx.tools.AccessTokenTools; import com.zslin.wx.tools.JsonTools; import com.zslin.wx.tools.WeixinUtil; import com.zslin.wx.tools.WxConfig; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import java.util.List; /** * Created by 钟述林 393156105@qq.com on 2017/1/26 0:10. */ @Controller @RequestMapping(value = "admin/wxMenu") @AdminAuth(name = "微信菜单管理", psn = "微信管理", orderNum = 7, porderNum = 1, pentity = 0, icon = "fa fa-list") public class AdminWxMenuController { @Autowired private IWxMenuService wxMenuService; @Autowired private AccessTokenTools accessTokenTools; @Autowired private WxConfig wxConfig; @GetMapping(value = "list") @AdminAuth(name = "微信菜单管理", type = "1", orderNum = 1, icon = "fa fa-list") public String list(Model model, Integer pid, HttpServletRequest request) { /*Page<WxMenu> datas = wxMenuService.findAll(ParamFilterUtil.getInstance().buildSearch(model, request), SimplePageBuilder.generate(page));*/ if(pid!=null && pid>0) { //获取子菜单 SimpleSpecificationBuilder b = new SimpleSpecificationBuilder(); b.add("pid", "eq", pid); List<WxMenu> subList = wxMenuService.findAll(b.generate(), SimpleSortBuilder.generateSort("orderNo")); model.addAttribute("datas", subList); model.addAttribute("parent", wxMenuService.findOne(pid)); //获取父对象 } else { SimpleSpecificationBuilder builder = new SimpleSpecificationBuilder(); builder.add("pid", "isnull", "", "or").add("pid", "le", 0, "or"); List<WxMenu> rootList = wxMenuService.findAll(builder.generate(), SimpleSortBuilder.generateSort("orderNo")); model.addAttribute("datas", rootList); } // model.addAttribute("datas", datas); return "admin/wxMenu/list"; } @Token(flag= Token.READY) @AdminAuth(name = "添加微信菜单", orderNum = 2, icon="fa fa-plus") @RequestMapping(value="add", method= RequestMethod.GET) public String add(Model model, Integer pid, HttpServletRequest request) { WxMenu m = new WxMenu(); if(pid!=null && pid>0) { model.addAttribute("parent", wxMenuService.findOne(pid)); //获取父对象 } model.addAttribute("wxMenu", m); return "admin/wxMenu/add"; } @Token(flag= Token.CHECK) @RequestMapping(value="add", method=RequestMethod.POST) public String add(Model model, Integer pid, WxMenu wxMenu, HttpServletRequest request) { if(TokenTools.isNoRepeat(request)) { //不是重复提交 wxMenuService.save(wxMenu); } return "redirect:/admin/wxMenu/list"; } @Token(flag= Token.READY) @AdminAuth(name="修改微信菜单", orderNum=3, icon = "fa fa-pencil") @RequestMapping(value="update/{id}", method=RequestMethod.GET) public String update(Model model, @PathVariable Integer id, HttpServletRequest request) { WxMenu m = wxMenuService.findOne(id); model.addAttribute("wxMenu", m); return "admin/wxMenu/update"; } @Token(flag= Token.CHECK) @RequestMapping(value="update/{id}", method=RequestMethod.POST) public String update(Model model, @PathVariable Integer id, WxMenu wxMenu, HttpServletRequest request) { // Boolean isRepeat = (Boolean) request.getAttribute("isRepeat"); if(TokenTools.isNoRepeat(request)) { WxMenu m = wxMenuService.findOne(id); MyBeanUtils.copyProperties(wxMenu, m, new String[]{"id"}); wxMenuService.save(m); } return "redirect:/admin/wxMenu/list"; } @AdminAuth(name="删除微信菜单", orderNum=4, icon = "fa fa-remove") @RequestMapping(value="delete/{id}", method=RequestMethod.POST) public @ResponseBody String delete(@PathVariable Integer id) { try { wxMenuService.delete(id); return "1"; } catch (Exception e) { return "0"; } } @AdminAuth(name="生成微信菜单", orderNum=4, icon = "fa fa-remove") @RequestMapping(value="gen", method=RequestMethod.GET) public String gen() { try { String json = createMenuJson(); System.out.println("======AdminWxMenuController====="); System.out.println(json); String url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token="+accessTokenTools.getAccessToken(); JSONObject jsonObj = WeixinUtil.httpRequest(url, "POST", json); System.out.println("------------------AdminWxMenuController-----------------"); System.out.println(jsonObj.toString()); String code = JsonTools.getJsonParam(jsonObj.toString(), "errcode"); if("0".equals(code)) { return "redirect:/admin/wxMenu/list"; } else { return "redirect:/admin/wxMenu/list"; } } catch (Exception e) { return "0"; } } private String createMenuJson() { StringBuffer sb = new StringBuffer("{\"button\":["); List<WxMenu> parents = wxMenuService.findParent(); int temp = 0; for(WxMenu p : parents) { sb.append(createSinglMenuJson(p)); temp++; if(temp<parents.size()) {sb.append(",");} } sb.append("]}"); return sb.toString(); } private String createSinglMenuJson(WxMenu menu) { StringBuffer sb = new StringBuffer("{"); List<WxMenu> suns = wxMenuService.findByPid(menu.getId()); sb.append("\"name\":\"").append(menu.getName()).append("\""); if(suns==null || suns.size()<=0) { //无子菜单 sb.append(createMenu(menu)); } else { sb.append(",\"sub_button\":["); int temp = 0; for(WxMenu sun : suns) { sb.append("{"); sb.append("\"name\":\"").append(sun.getName()).append("\""); sb.append(createMenu(sun)); sb.append("}"); temp ++; if(temp<suns.size()) {sb.append(",");} } sb.append("]"); } sb.append("}"); return sb.toString(); } private String createMenu(WxMenu menu) { /*String url = menu.getUrl(); if(!url.toLowerCase().startsWith("http://") && !url.toLowerCase().startsWith("https://")) { //如果不是http链接 if(!url.startsWith("/")) {url = "/"+url;} url = wxConfig.getConfig().getUrl()+url; } StringBuffer sb = new StringBuffer(); sb.append(",\"type\":\"view\""); sb.append(",\"url\":\"").append(url).append("\""); return sb.toString();*/ StringBuffer sb = new StringBuffer(); String type = menu.getType(); sb.append(",\"type\":\"").append(type).append("\""); if("view".equalsIgnoreCase(type)) { String url = menu.getUrl(); if(!url.toLowerCase().startsWith("http://") && !url.toLowerCase().startsWith("https://")) { //如果不是http链接 if(!url.startsWith("/")) {url = "/"+url;} url = wxConfig.getConfig().getUrl()+url; } sb.append(",\"url\":\"").append(url).append("\""); } else if("click".equalsIgnoreCase(type)) { sb.append(",\"key\":\"").append(menu.getOptKey()).append("\""); } else if("miniprogram".equalsIgnoreCase(type)) { sb.append(",\"appid\":\"").append(menu.getAppid()).append("\""); sb.append(",\"url\":\"").append(menu.getPagePath()).append("\""); sb.append(",\"pagepath\":\"").append(menu.getPagePath()).append("\""); } return sb.toString(); } }
UTF-8
Java
8,502
java
AdminWxMenuController.java
Java
[ { "context": "equest;\nimport java.util.List;\n\n/**\n * Created by 钟述林 393156105@qq.com on 2017/1/26 0:10.\n */\n@Controll", "end": 878, "score": 0.9982383251190186, "start": 875, "tag": "NAME", "value": "钟述林" }, { "context": "st;\nimport java.util.List;\n\n/**\n * Created by 钟述林 393156105@qq.com on 2017/1/26 0:10.\n */\n@Controller\n@RequestMappin", "end": 895, "score": 0.999707818031311, "start": 879, "tag": "EMAIL", "value": "393156105@qq.com" } ]
null
[]
package com.zslin.admin.controller; import com.zslin.basic.annotations.AdminAuth; import com.zslin.basic.annotations.Token; import com.zslin.basic.repository.SimpleSortBuilder; import com.zslin.basic.repository.SimpleSpecificationBuilder; import com.zslin.basic.tools.MyBeanUtils; import com.zslin.basic.tools.TokenTools; import com.zslin.web.model.WxMenu; import com.zslin.web.service.IWxMenuService; import com.zslin.wx.tools.AccessTokenTools; import com.zslin.wx.tools.JsonTools; import com.zslin.wx.tools.WeixinUtil; import com.zslin.wx.tools.WxConfig; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import java.util.List; /** * Created by 钟述林 <EMAIL> on 2017/1/26 0:10. */ @Controller @RequestMapping(value = "admin/wxMenu") @AdminAuth(name = "微信菜单管理", psn = "微信管理", orderNum = 7, porderNum = 1, pentity = 0, icon = "fa fa-list") public class AdminWxMenuController { @Autowired private IWxMenuService wxMenuService; @Autowired private AccessTokenTools accessTokenTools; @Autowired private WxConfig wxConfig; @GetMapping(value = "list") @AdminAuth(name = "微信菜单管理", type = "1", orderNum = 1, icon = "fa fa-list") public String list(Model model, Integer pid, HttpServletRequest request) { /*Page<WxMenu> datas = wxMenuService.findAll(ParamFilterUtil.getInstance().buildSearch(model, request), SimplePageBuilder.generate(page));*/ if(pid!=null && pid>0) { //获取子菜单 SimpleSpecificationBuilder b = new SimpleSpecificationBuilder(); b.add("pid", "eq", pid); List<WxMenu> subList = wxMenuService.findAll(b.generate(), SimpleSortBuilder.generateSort("orderNo")); model.addAttribute("datas", subList); model.addAttribute("parent", wxMenuService.findOne(pid)); //获取父对象 } else { SimpleSpecificationBuilder builder = new SimpleSpecificationBuilder(); builder.add("pid", "isnull", "", "or").add("pid", "le", 0, "or"); List<WxMenu> rootList = wxMenuService.findAll(builder.generate(), SimpleSortBuilder.generateSort("orderNo")); model.addAttribute("datas", rootList); } // model.addAttribute("datas", datas); return "admin/wxMenu/list"; } @Token(flag= Token.READY) @AdminAuth(name = "添加微信菜单", orderNum = 2, icon="fa fa-plus") @RequestMapping(value="add", method= RequestMethod.GET) public String add(Model model, Integer pid, HttpServletRequest request) { WxMenu m = new WxMenu(); if(pid!=null && pid>0) { model.addAttribute("parent", wxMenuService.findOne(pid)); //获取父对象 } model.addAttribute("wxMenu", m); return "admin/wxMenu/add"; } @Token(flag= Token.CHECK) @RequestMapping(value="add", method=RequestMethod.POST) public String add(Model model, Integer pid, WxMenu wxMenu, HttpServletRequest request) { if(TokenTools.isNoRepeat(request)) { //不是重复提交 wxMenuService.save(wxMenu); } return "redirect:/admin/wxMenu/list"; } @Token(flag= Token.READY) @AdminAuth(name="修改微信菜单", orderNum=3, icon = "fa fa-pencil") @RequestMapping(value="update/{id}", method=RequestMethod.GET) public String update(Model model, @PathVariable Integer id, HttpServletRequest request) { WxMenu m = wxMenuService.findOne(id); model.addAttribute("wxMenu", m); return "admin/wxMenu/update"; } @Token(flag= Token.CHECK) @RequestMapping(value="update/{id}", method=RequestMethod.POST) public String update(Model model, @PathVariable Integer id, WxMenu wxMenu, HttpServletRequest request) { // Boolean isRepeat = (Boolean) request.getAttribute("isRepeat"); if(TokenTools.isNoRepeat(request)) { WxMenu m = wxMenuService.findOne(id); MyBeanUtils.copyProperties(wxMenu, m, new String[]{"id"}); wxMenuService.save(m); } return "redirect:/admin/wxMenu/list"; } @AdminAuth(name="删除微信菜单", orderNum=4, icon = "fa fa-remove") @RequestMapping(value="delete/{id}", method=RequestMethod.POST) public @ResponseBody String delete(@PathVariable Integer id) { try { wxMenuService.delete(id); return "1"; } catch (Exception e) { return "0"; } } @AdminAuth(name="生成微信菜单", orderNum=4, icon = "fa fa-remove") @RequestMapping(value="gen", method=RequestMethod.GET) public String gen() { try { String json = createMenuJson(); System.out.println("======AdminWxMenuController====="); System.out.println(json); String url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token="+accessTokenTools.getAccessToken(); JSONObject jsonObj = WeixinUtil.httpRequest(url, "POST", json); System.out.println("------------------AdminWxMenuController-----------------"); System.out.println(jsonObj.toString()); String code = JsonTools.getJsonParam(jsonObj.toString(), "errcode"); if("0".equals(code)) { return "redirect:/admin/wxMenu/list"; } else { return "redirect:/admin/wxMenu/list"; } } catch (Exception e) { return "0"; } } private String createMenuJson() { StringBuffer sb = new StringBuffer("{\"button\":["); List<WxMenu> parents = wxMenuService.findParent(); int temp = 0; for(WxMenu p : parents) { sb.append(createSinglMenuJson(p)); temp++; if(temp<parents.size()) {sb.append(",");} } sb.append("]}"); return sb.toString(); } private String createSinglMenuJson(WxMenu menu) { StringBuffer sb = new StringBuffer("{"); List<WxMenu> suns = wxMenuService.findByPid(menu.getId()); sb.append("\"name\":\"").append(menu.getName()).append("\""); if(suns==null || suns.size()<=0) { //无子菜单 sb.append(createMenu(menu)); } else { sb.append(",\"sub_button\":["); int temp = 0; for(WxMenu sun : suns) { sb.append("{"); sb.append("\"name\":\"").append(sun.getName()).append("\""); sb.append(createMenu(sun)); sb.append("}"); temp ++; if(temp<suns.size()) {sb.append(",");} } sb.append("]"); } sb.append("}"); return sb.toString(); } private String createMenu(WxMenu menu) { /*String url = menu.getUrl(); if(!url.toLowerCase().startsWith("http://") && !url.toLowerCase().startsWith("https://")) { //如果不是http链接 if(!url.startsWith("/")) {url = "/"+url;} url = wxConfig.getConfig().getUrl()+url; } StringBuffer sb = new StringBuffer(); sb.append(",\"type\":\"view\""); sb.append(",\"url\":\"").append(url).append("\""); return sb.toString();*/ StringBuffer sb = new StringBuffer(); String type = menu.getType(); sb.append(",\"type\":\"").append(type).append("\""); if("view".equalsIgnoreCase(type)) { String url = menu.getUrl(); if(!url.toLowerCase().startsWith("http://") && !url.toLowerCase().startsWith("https://")) { //如果不是http链接 if(!url.startsWith("/")) {url = "/"+url;} url = wxConfig.getConfig().getUrl()+url; } sb.append(",\"url\":\"").append(url).append("\""); } else if("click".equalsIgnoreCase(type)) { sb.append(",\"key\":\"").append(menu.getOptKey()).append("\""); } else if("miniprogram".equalsIgnoreCase(type)) { sb.append(",\"appid\":\"").append(menu.getAppid()).append("\""); sb.append(",\"url\":\"").append(menu.getPagePath()).append("\""); sb.append(",\"pagepath\":\"").append(menu.getPagePath()).append("\""); } return sb.toString(); } }
8,493
0.595181
0.590626
209
38.913876
27.294113
121
false
false
0
0
0
0
0
0
0.851675
false
false
2
ede942e18c87b740df537f12edbc6d2c25c1255a
13,443,247,693,376
15767a0f42005fe54301bc77f5194695c88e327e
/pureJava/src/main/java/com/john/purejava/designpattern/proxy/Image.java
aada8f8284b90c476a6ba5b70920dd9627a977cb
[]
no_license
JohnZh/SnippetProject
https://github.com/JohnZh/SnippetProject
a9f4f12b4e5987aef05aeb2952644e4f3b091e35
ec13da770660a02cf7e8fa5d519f1834befbf309
refs/heads/master
2023-03-07T23:50:27.870000
2021-02-19T05:54:36
2021-02-19T05:54:36
268,417,606
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.john.purejava.designpattern.proxy; /** * Created by JohnZh on 2020/5/27 * * <p>Image for proxy</p> */ public interface Image { void display(); }
UTF-8
Java
166
java
Image.java
Java
[ { "context": "n.purejava.designpattern.proxy;\n\n/**\n * Created by JohnZh on 2020/5/27\n *\n * <p>Image for proxy</p>\n */\npub", "end": 72, "score": 0.984154462814331, "start": 66, "tag": "USERNAME", "value": "JohnZh" } ]
null
[]
package com.john.purejava.designpattern.proxy; /** * Created by JohnZh on 2020/5/27 * * <p>Image for proxy</p> */ public interface Image { void display(); }
166
0.662651
0.620482
10
15.6
15.35057
46
false
false
0
0
0
0
0
0
0.2
false
false
2
e244a7aee420b935370707a76799a2d1d0a33a8c
1,967,095,023,462
6646f5561507e07ac908b5e50bb3785ef8793d79
/app/src/main/java/com/b2gsoft/mrb/Activity/input/LoadUnloadActivity.java
2487c7ef7089fa55008fe34ebeaacd73c0a6928c
[ "Apache-2.0" ]
permissive
imsajib02/BrickField
https://github.com/imsajib02/BrickField
6b67e7b576110525aed6e27e108d68d6db90d8b8
88237a76c626e9555c1f922e3d5f6fcb5a66eba2
refs/heads/main
2023-07-06T07:31:39.335000
2021-08-12T04:42:37
2021-08-12T04:42:37
395,189,186
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.b2gsoft.mrb.Activity.input; import android.content.Intent; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.KeyEvent; import com.b2gsoft.mrb.Activity.HomeActivity; import com.b2gsoft.mrb.Fragment.LoadUnload.LoadFragment; import com.b2gsoft.mrb.Fragment.LoadUnload.UnloadFragment; import com.b2gsoft.mrb.R; import com.b2gsoft.mrb.Utils.StaticValue; import java.util.ArrayList; import java.util.List; public class LoadUnloadActivity extends AppCompatActivity { ViewPager viewPager; TabLayout tabLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_load_unload); getSupportActionBar().hide(); viewPager = (ViewPager) findViewById(R.id.viewpager); tabLayout = (TabLayout) findViewById(R.id.tabs); setUpViewPager(viewPager); tabLayout.setupWithViewPager(viewPager); setUpTab(); } private void setUpTab() { tabLayout.getTabAt(0).setText(getString(R.string.load)); tabLayout.getTabAt(1).setText(getString(R.string.unload)); } private void setUpViewPager(ViewPager viewPager) { ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager()); adapter.addFragment(new LoadFragment()); adapter.addFragment(new UnloadFragment()); viewPager.setAdapter(adapter); } class ViewPagerAdapter extends FragmentPagerAdapter { List<Fragment> fragments = new ArrayList<>(); public ViewPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { return fragments.get(position); } @Override public int getCount() { return fragments.size(); } private void addFragment(Fragment fragment) { fragments.add(fragment); } } public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == 4) { Intent intent = new Intent(getApplicationContext(), HomeActivity.class); intent.putExtra(StaticValue.Page, StaticValue.InputPage); startActivity(intent); finish(); } return super.onKeyDown(keyCode, event); } }
UTF-8
Java
2,600
java
LoadUnloadActivity.java
Java
[]
null
[]
package com.b2gsoft.mrb.Activity.input; import android.content.Intent; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.KeyEvent; import com.b2gsoft.mrb.Activity.HomeActivity; import com.b2gsoft.mrb.Fragment.LoadUnload.LoadFragment; import com.b2gsoft.mrb.Fragment.LoadUnload.UnloadFragment; import com.b2gsoft.mrb.R; import com.b2gsoft.mrb.Utils.StaticValue; import java.util.ArrayList; import java.util.List; public class LoadUnloadActivity extends AppCompatActivity { ViewPager viewPager; TabLayout tabLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_load_unload); getSupportActionBar().hide(); viewPager = (ViewPager) findViewById(R.id.viewpager); tabLayout = (TabLayout) findViewById(R.id.tabs); setUpViewPager(viewPager); tabLayout.setupWithViewPager(viewPager); setUpTab(); } private void setUpTab() { tabLayout.getTabAt(0).setText(getString(R.string.load)); tabLayout.getTabAt(1).setText(getString(R.string.unload)); } private void setUpViewPager(ViewPager viewPager) { ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager()); adapter.addFragment(new LoadFragment()); adapter.addFragment(new UnloadFragment()); viewPager.setAdapter(adapter); } class ViewPagerAdapter extends FragmentPagerAdapter { List<Fragment> fragments = new ArrayList<>(); public ViewPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { return fragments.get(position); } @Override public int getCount() { return fragments.size(); } private void addFragment(Fragment fragment) { fragments.add(fragment); } } public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == 4) { Intent intent = new Intent(getApplicationContext(), HomeActivity.class); intent.putExtra(StaticValue.Page, StaticValue.InputPage); startActivity(intent); finish(); } return super.onKeyDown(keyCode, event); } }
2,600
0.687308
0.681923
92
27.26087
23.576365
85
false
false
0
0
0
0
0
0
0.51087
false
false
2
135449d5b1f119c05cd92984b338bbddb2e23180
5,549,097,800,070
afeac296d5bf373d27662a877ec700780e40236c
/service-implementation/src/main/java/com/liaison/mailbox/service/dto/ui/GetProfileResponseDTO.java
8a52f414a185f2fbe57fa6d4e494d2e170541abe
[ "Apache-2.0" ]
permissive
sivakumar-g-liaison/alloy-conveyor-server
https://github.com/sivakumar-g-liaison/alloy-conveyor-server
33869576191eb86d639a560018325c8fdf759375
b3dfc1e8b41196d832b5cc52606893b4391a1708
refs/heads/master
2020-06-17T01:35:57.923000
2019-07-07T22:33:39
2019-07-07T22:33:39
195,748,170
0
0
Apache-2.0
true
2019-07-08T06:14:27
2019-07-08T06:14:26
2019-07-07T22:33:50
2019-07-07T22:33:49
18,747
0
0
0
null
false
false
/** * Copyright Liaison Technologies, Inc. All rights reserved. * * This software is the confidential and proprietary information of * Liaison Technologies, Inc. ("Confidential Information"). You shall * not disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered into * with Liaison Technologies. */ package com.liaison.mailbox.service.dto.ui; import java.util.ArrayList; import java.util.List; import org.codehaus.jackson.map.annotate.JsonRootName; import com.liaison.mailbox.service.dto.CommonResponseDTO; import com.liaison.mailbox.service.dto.configuration.ProfileDTO; /** * Data Transfer Object used for retrieving the profiles. * * @author OFS */ @JsonRootName("getProfileResponse") public class GetProfileResponseDTO extends CommonResponseDTO { /** * */ private static final long serialVersionUID = 1L; private List<ProfileDTO> profiles; private ProfileDTO profile; private long totalItems = 0L; public long getTotalItems() { return totalItems; } public void setTotalItems(long totalItems) { this.totalItems = totalItems; } public List<ProfileDTO> getProfiles() { if (null == profiles) { profiles = new ArrayList<ProfileDTO>(); } return profiles; } public void setProfiles(List<ProfileDTO> profiles) { this.profiles = profiles; } public ProfileDTO getProfile() { return profile; } public void setProfile(ProfileDTO profile) { this.profile = profile; } }
UTF-8
Java
1,504
java
GetProfileResponseDTO.java
Java
[ { "context": "ct used for retrieving the profiles.\n *\n * @author OFS\n */\n@JsonRootName(\"getProfileResponse\")\npublic cl", "end": 740, "score": 0.9731829166412354, "start": 737, "tag": "USERNAME", "value": "OFS" } ]
null
[]
/** * Copyright Liaison Technologies, Inc. All rights reserved. * * This software is the confidential and proprietary information of * Liaison Technologies, Inc. ("Confidential Information"). You shall * not disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered into * with Liaison Technologies. */ package com.liaison.mailbox.service.dto.ui; import java.util.ArrayList; import java.util.List; import org.codehaus.jackson.map.annotate.JsonRootName; import com.liaison.mailbox.service.dto.CommonResponseDTO; import com.liaison.mailbox.service.dto.configuration.ProfileDTO; /** * Data Transfer Object used for retrieving the profiles. * * @author OFS */ @JsonRootName("getProfileResponse") public class GetProfileResponseDTO extends CommonResponseDTO { /** * */ private static final long serialVersionUID = 1L; private List<ProfileDTO> profiles; private ProfileDTO profile; private long totalItems = 0L; public long getTotalItems() { return totalItems; } public void setTotalItems(long totalItems) { this.totalItems = totalItems; } public List<ProfileDTO> getProfiles() { if (null == profiles) { profiles = new ArrayList<ProfileDTO>(); } return profiles; } public void setProfiles(List<ProfileDTO> profiles) { this.profiles = profiles; } public ProfileDTO getProfile() { return profile; } public void setProfile(ProfileDTO profile) { this.profile = profile; } }
1,504
0.749335
0.748005
67
21.447762
23.257343
70
false
false
0
0
0
0
0
0
0.850746
false
false
2
6463726d7a1d603e66a0c64ba87784468b691e55
5,549,097,801,486
83f1c4cd1b7379d90357b7e18df7cf92c4200295
/domain/src/main/java/com/sabre/api/sacs/domain/BaseDomainResponse.java
d960cdb560ab246b54098ef9abc3d8e53333c0d5
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
SabreDevStudio/SACS-Android
https://github.com/SabreDevStudio/SACS-Android
412437f2f51e29ec470243577e8d39364f6039d8
afc3d4d299b06ca455e54156823990598460ac59
refs/heads/master
2019-07-17T20:49:32.156000
2016-06-02T07:09:13
2016-06-02T07:09:13
55,608,641
5
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sabre.api.sacs.domain; /** * Created by SG0946321 on 10/5/2015. */ public class BaseDomainResponse<RS> { private int status = 200; private RS result; public void setStatus(int status) { this.status = status; } public int getStatus() { return status; } public RS getResult() { return result; } public void setResult(RS result) { this.result = result; } }
UTF-8
Java
474
java
BaseDomainResponse.java
Java
[ { "context": "e com.sabre.api.sacs.domain;\r\n\r\n/**\r\n * Created by SG0946321 on 10/5/2015.\r\n */\r\npublic class BaseDomainRespon", "end": 66, "score": 0.9990783333778381, "start": 57, "tag": "USERNAME", "value": "SG0946321" } ]
null
[]
package com.sabre.api.sacs.domain; /** * Created by SG0946321 on 10/5/2015. */ public class BaseDomainResponse<RS> { private int status = 200; private RS result; public void setStatus(int status) { this.status = status; } public int getStatus() { return status; } public RS getResult() { return result; } public void setResult(RS result) { this.result = result; } }
474
0.561181
0.525316
27
15.555555
14.823238
39
false
false
0
0
0
0
0
0
0.259259
false
false
2
b05eb05596b16d6b4c5cd1d5038178969c84dd20
14,216,341,804,520
a6a77fe32d5e04b4aa75ab3ce24dcdc63e91b35a
/app/src/main/java/org/techtown/capstoneproject/service/api/ApiServiceEmail.java
6e4e2f0abc6d98083c75c081d5e81dd7484ff94e
[]
no_license
hahava/2018_capstone_client
https://github.com/hahava/2018_capstone_client
377f54e22de5aa1ecd4690a13814a6bb686f49de
57abda82e84d2f1f1378e8e3945169d33c876f49
refs/heads/master
2023-02-05T07:17:41.958000
2018-06-14T10:41:00
2018-06-14T10:41:00
324,495,580
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.techtown.capstoneproject.service.api; import org.json.JSONObject; import org.techtown.capstoneproject.service.dto.InquiryDTO; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.Headers; import retrofit2.http.POST; public interface ApiServiceEmail { @Headers( { "Accept: application/json", "Content-Type: application/json; charset=utf-8" }) @POST("sendRequest") Call<JSONObject> getPostCommentStr(@Body InquiryDTO inquiryDTO); }
UTF-8
Java
541
java
ApiServiceEmail.java
Java
[]
null
[]
package org.techtown.capstoneproject.service.api; import org.json.JSONObject; import org.techtown.capstoneproject.service.dto.InquiryDTO; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.Headers; import retrofit2.http.POST; public interface ApiServiceEmail { @Headers( { "Accept: application/json", "Content-Type: application/json; charset=utf-8" }) @POST("sendRequest") Call<JSONObject> getPostCommentStr(@Body InquiryDTO inquiryDTO); }
541
0.691312
0.68207
19
27.473684
21.399382
68
false
false
0
0
0
0
0
0
0.526316
false
false
2
576179e4639db0f59cf3ed6d2a07f127f50a8802
6,219,112,674,085
3182dd5e2cb4c93c562293816203038d5e4c9708
/src/java/com/github/fge/jsonschema/core/processing/CachingProcessor.java
d71b183c88fbcc4387140e63e4bf21c8877e0f7e
[]
no_license
mrauer/TAC-Verif
https://github.com/mrauer/TAC-Verif
46f1fdc06475fef6d217f48a2ee6a6ffc8ec3e4f
5231854f94008729fb1be67992ffafd2ae8908a3
refs/heads/master
2023-07-16T22:25:33.181000
2021-08-29T16:00:37
2021-08-29T16:00:37
401,082,799
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Decompiled with CFR 0.0. * * Could not load the following classes: * com.android.tools.r8.GeneratedOutlineSupport * com.github.fge.jsonschema.core.report.ListProcessingReport * com.google.android.material.R * com.google.android.material.R$style * com.google.common.base.Equivalence * com.google.common.base.Equivalence$Wrapper * com.google.common.cache.CacheBuilder * com.google.common.cache.CacheLoader * com.google.common.cache.LoadingCache * com.google.common.cache.LocalCache * com.google.common.cache.LocalCache$LocalLoadingCache * java.lang.Exception * java.lang.Object * java.lang.String * java.lang.StringBuilder * java.lang.Throwable * java.util.concurrent.ExecutionException */ package com.github.fge.jsonschema.core.processing; import com.android.tools.r8.GeneratedOutlineSupport; import com.github.fge.jsonschema.core.exceptions.ProcessingException; import com.github.fge.jsonschema.core.messages.JsonSchemaCoreMessageBundle; import com.github.fge.jsonschema.core.processing.ProcessingResult; import com.github.fge.jsonschema.core.processing.Processor; import com.github.fge.jsonschema.core.report.ListProcessingReport; import com.github.fge.jsonschema.core.report.LogLevel; import com.github.fge.jsonschema.core.report.MessageProvider; import com.github.fge.jsonschema.core.report.ProcessingReport; import com.github.fge.jsonschema.core.util.equivalence.Equivalences; import com.github.fge.msgsimple.bundle.MessageBundle; import com.github.fge.msgsimple.load.MessageBundles; import com.google.android.material.R; import com.google.common.base.Equivalence; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import com.google.common.cache.LocalCache; import java.util.concurrent.ExecutionException; public final class CachingProcessor<IN extends MessageProvider, OUT extends MessageProvider> implements Processor<IN, OUT> { private static final MessageBundle BUNDLE = MessageBundles.getBundle(JsonSchemaCoreMessageBundle.class); private static final int DEFAULT_CACHE_SIZE = 512; private final LoadingCache<Equivalence.Wrapper<IN>, ProcessingResult<OUT>> cache; private final Equivalence<IN> equivalence; private final Processor<IN, OUT> processor; public CachingProcessor(Processor<IN, OUT> processor) { this(processor, Equivalences.equals()); } public CachingProcessor(Processor<IN, OUT> processor, Equivalence<IN> equivalence) { this(processor, equivalence, 512); } public CachingProcessor(Processor<IN, OUT> processor, Equivalence<IN> equivalence, int n) { MessageBundle messageBundle = BUNDLE; messageBundle.checkNotNull(processor, "processing.nullProcessor"); messageBundle.checkNotNull(equivalence, "processing.nullEquivalence"); boolean bl = n >= -1; messageBundle.checkArgument(bl, "processing.invalidCacheSize"); this.processor = processor; this.equivalence = equivalence; CacheBuilder cacheBuilder = new CacheBuilder(); if (n != -1) { cacheBuilder.maximumSize((long)n); } CacheLoader<Equivalence.Wrapper<IN>, ProcessingResult<OUT>> cacheLoader = this.loader(); R.style.checkState((boolean)true, (Object)"maximumWeight requires weigher"); this.cache = new LocalCache.LocalLoadingCache(cacheBuilder, cacheLoader); } private CacheLoader<Equivalence.Wrapper<IN>, ProcessingResult<OUT>> loader() { return new CacheLoader<Equivalence.Wrapper<IN>, ProcessingResult<OUT>>(){ public ProcessingResult<OUT> load(Equivalence.Wrapper<IN> wrapper) throws ProcessingException { MessageProvider messageProvider = (MessageProvider)wrapper.reference; ListProcessingReport listProcessingReport = new ListProcessingReport(LogLevel.DEBUG, LogLevel.NONE); return ProcessingResult.of(CachingProcessor.this.processor, (ProcessingReport)listProcessingReport, messageProvider); } }; } @Override public OUT process(ProcessingReport processingReport, IN IN) throws ProcessingException { ProcessingResult processingResult; try { LoadingCache<Equivalence.Wrapper<IN>, ProcessingResult<OUT>> loadingCache = this.cache; Equivalence.Wrapper wrapper = this.equivalence.wrap(IN); processingResult = (ProcessingResult)((LocalCache.LocalLoadingCache)loadingCache).get((Object)wrapper); } catch (ExecutionException executionException) { throw (ProcessingException)executionException.getCause(); } processingReport.mergeWith(processingResult.getReport()); return (OUT)processingResult.getResult(); } public String toString() { StringBuilder stringBuilder = GeneratedOutlineSupport.outline24((String)"CACHED["); stringBuilder.append(this.processor); stringBuilder.append(']'); return stringBuilder.toString(); } }
UTF-8
Java
5,063
java
CachingProcessor.java
Java
[]
null
[]
/* * Decompiled with CFR 0.0. * * Could not load the following classes: * com.android.tools.r8.GeneratedOutlineSupport * com.github.fge.jsonschema.core.report.ListProcessingReport * com.google.android.material.R * com.google.android.material.R$style * com.google.common.base.Equivalence * com.google.common.base.Equivalence$Wrapper * com.google.common.cache.CacheBuilder * com.google.common.cache.CacheLoader * com.google.common.cache.LoadingCache * com.google.common.cache.LocalCache * com.google.common.cache.LocalCache$LocalLoadingCache * java.lang.Exception * java.lang.Object * java.lang.String * java.lang.StringBuilder * java.lang.Throwable * java.util.concurrent.ExecutionException */ package com.github.fge.jsonschema.core.processing; import com.android.tools.r8.GeneratedOutlineSupport; import com.github.fge.jsonschema.core.exceptions.ProcessingException; import com.github.fge.jsonschema.core.messages.JsonSchemaCoreMessageBundle; import com.github.fge.jsonschema.core.processing.ProcessingResult; import com.github.fge.jsonschema.core.processing.Processor; import com.github.fge.jsonschema.core.report.ListProcessingReport; import com.github.fge.jsonschema.core.report.LogLevel; import com.github.fge.jsonschema.core.report.MessageProvider; import com.github.fge.jsonschema.core.report.ProcessingReport; import com.github.fge.jsonschema.core.util.equivalence.Equivalences; import com.github.fge.msgsimple.bundle.MessageBundle; import com.github.fge.msgsimple.load.MessageBundles; import com.google.android.material.R; import com.google.common.base.Equivalence; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import com.google.common.cache.LocalCache; import java.util.concurrent.ExecutionException; public final class CachingProcessor<IN extends MessageProvider, OUT extends MessageProvider> implements Processor<IN, OUT> { private static final MessageBundle BUNDLE = MessageBundles.getBundle(JsonSchemaCoreMessageBundle.class); private static final int DEFAULT_CACHE_SIZE = 512; private final LoadingCache<Equivalence.Wrapper<IN>, ProcessingResult<OUT>> cache; private final Equivalence<IN> equivalence; private final Processor<IN, OUT> processor; public CachingProcessor(Processor<IN, OUT> processor) { this(processor, Equivalences.equals()); } public CachingProcessor(Processor<IN, OUT> processor, Equivalence<IN> equivalence) { this(processor, equivalence, 512); } public CachingProcessor(Processor<IN, OUT> processor, Equivalence<IN> equivalence, int n) { MessageBundle messageBundle = BUNDLE; messageBundle.checkNotNull(processor, "processing.nullProcessor"); messageBundle.checkNotNull(equivalence, "processing.nullEquivalence"); boolean bl = n >= -1; messageBundle.checkArgument(bl, "processing.invalidCacheSize"); this.processor = processor; this.equivalence = equivalence; CacheBuilder cacheBuilder = new CacheBuilder(); if (n != -1) { cacheBuilder.maximumSize((long)n); } CacheLoader<Equivalence.Wrapper<IN>, ProcessingResult<OUT>> cacheLoader = this.loader(); R.style.checkState((boolean)true, (Object)"maximumWeight requires weigher"); this.cache = new LocalCache.LocalLoadingCache(cacheBuilder, cacheLoader); } private CacheLoader<Equivalence.Wrapper<IN>, ProcessingResult<OUT>> loader() { return new CacheLoader<Equivalence.Wrapper<IN>, ProcessingResult<OUT>>(){ public ProcessingResult<OUT> load(Equivalence.Wrapper<IN> wrapper) throws ProcessingException { MessageProvider messageProvider = (MessageProvider)wrapper.reference; ListProcessingReport listProcessingReport = new ListProcessingReport(LogLevel.DEBUG, LogLevel.NONE); return ProcessingResult.of(CachingProcessor.this.processor, (ProcessingReport)listProcessingReport, messageProvider); } }; } @Override public OUT process(ProcessingReport processingReport, IN IN) throws ProcessingException { ProcessingResult processingResult; try { LoadingCache<Equivalence.Wrapper<IN>, ProcessingResult<OUT>> loadingCache = this.cache; Equivalence.Wrapper wrapper = this.equivalence.wrap(IN); processingResult = (ProcessingResult)((LocalCache.LocalLoadingCache)loadingCache).get((Object)wrapper); } catch (ExecutionException executionException) { throw (ProcessingException)executionException.getCause(); } processingReport.mergeWith(processingResult.getReport()); return (OUT)processingResult.getResult(); } public String toString() { StringBuilder stringBuilder = GeneratedOutlineSupport.outline24((String)"CACHED["); stringBuilder.append(this.processor); stringBuilder.append(']'); return stringBuilder.toString(); } }
5,063
0.74521
0.742445
111
44.603603
31.450312
133
false
false
0
0
0
0
0
0
0.720721
false
false
2
e4ba48c304053e500dad7f718f799fe0cf296209
3,023,657,033,423
9f5c58d3a1421a19a3a82d0cd0be197ea58edbaa
/src/es/miguel/Fifo.java
80fde9cb4c8aa7190ca8fb3eaa1a5448867bbb1a
[]
no_license
Miguelotero/Colas2
https://github.com/Miguelotero/Colas2
4314e355789e09cb426827dc94949f973f6fca9f
4d573e7556d348f18a22c408c66bcee343809f0a
refs/heads/master
2021-01-20T10:42:54.576000
2014-07-24T09:20:35
2014-07-24T09:20:35
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package es.miguel; //~--- JDK imports ------------------------------------------------------------ import java.util.Collections; /** * Created by ada on 24/07/14. */ public class Fifo implements Cola { @Override public void push(Object a) { this.stack.add(a); } @Override public Object pop() { Object temp = this.stack.get(0); this.stack.remove(0); return temp; } @Override public Object peek() { Object temp = this.stack.get(0); return temp; } @Override public void sort(String a) { try { if (a.equals("a")) { Collections.sort(this.stack); } else if (a.equals("d")) { Collections.sort(this.stack); Collections.reverse(this.stack); } } catch (Exception e) { System.out.println("Se ordena con a o d"); } } @Override public void sort(Integer a) { try { if (a.equals("0")) { Collections.sort(this.stack); } else if (a.equals("1")) { Collections.sort(this.stack); Collections.reverse(this.stack); } } catch (Exception e) { System.out.println("Se ordena con 0 o 1"); } } @Override public void sort(Boolean a) { try { if (a.equals(true)) { Collections.sort(this.stack); } else if (a.equals(false)) { Collections.sort(this.stack); Collections.reverse(this.stack); } } catch (Exception e) { System.out.println("Se ordena con true o false"); } } } //~ Formatted by Jindent --- http://www.jindent.com
UTF-8
Java
1,786
java
Fifo.java
Java
[ { "context": "\n\nimport java.util.Collections;\n\n/**\n * Created by ada on 24/07/14.\n */\npublic class Fifo implements Col", "end": 153, "score": 0.9691007137298584, "start": 150, "tag": "USERNAME", "value": "ada" } ]
null
[]
package es.miguel; //~--- JDK imports ------------------------------------------------------------ import java.util.Collections; /** * Created by ada on 24/07/14. */ public class Fifo implements Cola { @Override public void push(Object a) { this.stack.add(a); } @Override public Object pop() { Object temp = this.stack.get(0); this.stack.remove(0); return temp; } @Override public Object peek() { Object temp = this.stack.get(0); return temp; } @Override public void sort(String a) { try { if (a.equals("a")) { Collections.sort(this.stack); } else if (a.equals("d")) { Collections.sort(this.stack); Collections.reverse(this.stack); } } catch (Exception e) { System.out.println("Se ordena con a o d"); } } @Override public void sort(Integer a) { try { if (a.equals("0")) { Collections.sort(this.stack); } else if (a.equals("1")) { Collections.sort(this.stack); Collections.reverse(this.stack); } } catch (Exception e) { System.out.println("Se ordena con 0 o 1"); } } @Override public void sort(Boolean a) { try { if (a.equals(true)) { Collections.sort(this.stack); } else if (a.equals(false)) { Collections.sort(this.stack); Collections.reverse(this.stack); } } catch (Exception e) { System.out.println("Se ordena con true o false"); } } } //~ Formatted by Jindent --- http://www.jindent.com
1,786
0.475364
0.468085
76
22.5
18.672735
79
false
false
0
0
0
0
0
0
0.263158
false
false
2
c04fadfd5c25201fc4967c01580877de5e7da7be
11,759,620,517,852
5b03534cc4da688b004ae85cf0493db04488734b
/AmazonBotHM/src/org/itstep/model/Action.java
d24a14b20048d7bdc57cb4230aeba67c716b7756
[]
no_license
Oxxrim/AmazonBot
https://github.com/Oxxrim/AmazonBot
25c7f537fdfbca82b9736d3e9787141dea2246c8
a96369cd2cbcffd72b1f727df2cb118a41997018
refs/heads/master
2021-04-15T05:24:45.523000
2018-03-22T16:38:41
2018-03-22T16:38:41
126,364,912
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.itstep.model; public class Action { private String asin; private String login; private String add; private long time; public String getAsin() { return asin; } public void setAsin(String asin) { this.asin = asin; } public String getLogin() { return login; } public void setLogin(String login) { this.login = login; } public String getAdd() { return add; } public void setAdd(String add) { this.add = add; } public long getTime() { return time; } public void setTime(long time) { this.time = time; } public Action(String asin, String login, String add, long time) { this.asin = asin; this.login = login; this.add = add; this.time = time; } public Action() { // TODO Auto-generated constructor stub } }
UTF-8
Java
834
java
Action.java
Java
[]
null
[]
package org.itstep.model; public class Action { private String asin; private String login; private String add; private long time; public String getAsin() { return asin; } public void setAsin(String asin) { this.asin = asin; } public String getLogin() { return login; } public void setLogin(String login) { this.login = login; } public String getAdd() { return add; } public void setAdd(String add) { this.add = add; } public long getTime() { return time; } public void setTime(long time) { this.time = time; } public Action(String asin, String login, String add, long time) { this.asin = asin; this.login = login; this.add = add; this.time = time; } public Action() { // TODO Auto-generated constructor stub } }
834
0.616307
0.616307
51
14.352942
13.8108
66
false
false
0
0
0
0
0
0
1.568627
false
false
2
a80b67e1e9bce60b7a77936d9af07da0a60832a4
34,875,134,453,391
53e3c5d651efbb9129e6c7ddef370bf0655826b0
/app/src/main/java/tk/bungeefan/flohmarkt_shamader16/RightFragment.java
71afa42a51fdeaf046255c5f5b3a40ba1c7aed5f
[]
no_license
Bungeefan/Flohmarkt_shamader16
https://github.com/Bungeefan/Flohmarkt_shamader16
ee528dd5def9d8181ca48046e44c72daf7ce0169
ab8d7ae1910a5af566b1caaf6e9c6e503ad871c7
refs/heads/master
2020-04-29T23:00:15.769000
2019-05-20T23:30:49
2019-05-20T23:30:49
176,464,506
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package tk.bungeefan.flohmarkt_shamader16; import android.Manifest; import android.content.Intent; import android.content.pm.PackageManager; import android.location.Location; import android.location.LocationManager; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; public class RightFragment extends Fragment { private TextView idView; private TextView nameView; private TextView priceView; private TextView usernameView; private TextView emailView; private TextView phoneView; private TextView distanceView; private Button mapBtn; private LocationManager locationManager; public RightFragment() { } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); locationManager = getActivity().getSystemService(LocationManager.class); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return initializeViews(inflater.inflate(R.layout.fragment_right, container, false)); } private View initializeViews(View view) { idView = view.findViewById(R.id.idView); nameView = view.findViewById(R.id.nameView); priceView = view.findViewById(R.id.priceView); usernameView = view.findViewById(R.id.usernameView); emailView = view.findViewById(R.id.emailView); phoneView = view.findViewById(R.id.phoneView); distanceView = view.findViewById(R.id.distanceView); mapBtn = view.findViewById(R.id.mapBtn); return view; } public void show(Article item) { String distance = "Unknown (Maybe (0/0) ?)"; Intent maps = null; double aLatitude = Double.parseDouble(item.getLatitude()); double aLongitude = Double.parseDouble(item.getLongitude()); if (aLatitude != 0 && aLongitude != 0 && getActivity().checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { Location currentLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); if (currentLocation != null) { maps = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:" + item.getLatitude() + "," + item.getLongitude())); Location targetLocation = new Location(""); targetLocation.setLatitude(aLatitude); targetLocation.setLongitude(aLongitude); distance = (targetLocation.distanceTo(currentLocation) / 1000) + " km"; } } idView.setText("ID:" + item.getId()); nameView.setText("Name: " + item.getName()); priceView.setText("Price: " + item.getPrice()); usernameView.setText("Username: " + item.getUsername()); emailView.setText("Email: " + item.getEmail()); phoneView.setText("Phone: " + item.getPhone()); distanceView.setText("Distance: " + distance); Intent finalMaps = maps; mapBtn.setOnClickListener(v -> { if (finalMaps != null) { startActivity(finalMaps); } else { Toast.makeText(getContext(), "Location: Unknown (Maybe (0/0) ?)", Toast.LENGTH_SHORT).show(); } }); } }
UTF-8
Java
3,524
java
RightFragment.java
Java
[]
null
[]
package tk.bungeefan.flohmarkt_shamader16; import android.Manifest; import android.content.Intent; import android.content.pm.PackageManager; import android.location.Location; import android.location.LocationManager; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; public class RightFragment extends Fragment { private TextView idView; private TextView nameView; private TextView priceView; private TextView usernameView; private TextView emailView; private TextView phoneView; private TextView distanceView; private Button mapBtn; private LocationManager locationManager; public RightFragment() { } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); locationManager = getActivity().getSystemService(LocationManager.class); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return initializeViews(inflater.inflate(R.layout.fragment_right, container, false)); } private View initializeViews(View view) { idView = view.findViewById(R.id.idView); nameView = view.findViewById(R.id.nameView); priceView = view.findViewById(R.id.priceView); usernameView = view.findViewById(R.id.usernameView); emailView = view.findViewById(R.id.emailView); phoneView = view.findViewById(R.id.phoneView); distanceView = view.findViewById(R.id.distanceView); mapBtn = view.findViewById(R.id.mapBtn); return view; } public void show(Article item) { String distance = "Unknown (Maybe (0/0) ?)"; Intent maps = null; double aLatitude = Double.parseDouble(item.getLatitude()); double aLongitude = Double.parseDouble(item.getLongitude()); if (aLatitude != 0 && aLongitude != 0 && getActivity().checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { Location currentLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); if (currentLocation != null) { maps = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:" + item.getLatitude() + "," + item.getLongitude())); Location targetLocation = new Location(""); targetLocation.setLatitude(aLatitude); targetLocation.setLongitude(aLongitude); distance = (targetLocation.distanceTo(currentLocation) / 1000) + " km"; } } idView.setText("ID:" + item.getId()); nameView.setText("Name: " + item.getName()); priceView.setText("Price: " + item.getPrice()); usernameView.setText("Username: " + item.getUsername()); emailView.setText("Email: " + item.getEmail()); phoneView.setText("Phone: " + item.getPhone()); distanceView.setText("Distance: " + distance); Intent finalMaps = maps; mapBtn.setOnClickListener(v -> { if (finalMaps != null) { startActivity(finalMaps); } else { Toast.makeText(getContext(), "Location: Unknown (Maybe (0/0) ?)", Toast.LENGTH_SHORT).show(); } }); } }
3,524
0.666856
0.663167
87
39.505749
28.685722
164
false
false
0
0
0
0
0
0
0.747126
false
false
2
616b48fa40c0b38fcad15ea90029e656e3a3960a
30,288,109,391,778
385dfd330a478741af57fad0e5302f2e2331f782
/src/main/java/plan3/recruitment/backend/resources/PersonResource.java
d20c6831c2c19d0a80b484e659dd06e033d50853
[]
no_license
linkra/omnilk
https://github.com/linkra/omnilk
f2d0c1a8d4f7a74467ac4f8c8a2030d17003de18
4f737a3e5ce24d37a4052d476ae9a95aa8dff2ab
HEAD
2016-08-06T01:22:36.972000
2013-09-02T12:12:03
2013-09-02T12:12:03
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package plan3.recruitment.backend.resources; import static javax.ws.rs.core.MediaType.APPLICATION_JSON; import java.net.URI; import java.net.URISyntaxException; import java.util.Collection; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import com.google.common.base.Optional; import plan3.recruitment.backend.model.Person; import plan3.recruitment.backend.model.PersonStorage; import plan3.recruitment.backend.model.PersonStorageImpl; @Path("person") @Produces(PersonResource.APPLICATION_JSON_UTF8) @Consumes(PersonResource.APPLICATION_JSON_UTF8) public class PersonResource { public static final String APPLICATION_JSON_UTF8 = APPLICATION_JSON + "; charset=utf-8"; private static final String EMAIL_PARAM = "email"; private static final String EMAIL_PATH_PARAM = '{' + EMAIL_PARAM + '}'; private PersonStorageImpl storage = new PersonStorageImpl(); @GET public Collection<Person> list() { return this.storage.list(); } @GET @Path(EMAIL_PATH_PARAM) public Optional fetch(@PathParam(EMAIL_PARAM) final String email) { return this.storage.fetch(email); } @PUT public Response save(final Person person, @Context final UriInfo uri) throws URISyntaxException{ this.storage.save(person); URI resourceUri = new URI("/" + person.getEmail()); return Response.created(resourceUri).build(); } }
UTF-8
Java
1,603
java
PersonResource.java
Java
[]
null
[]
package plan3.recruitment.backend.resources; import static javax.ws.rs.core.MediaType.APPLICATION_JSON; import java.net.URI; import java.net.URISyntaxException; import java.util.Collection; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import com.google.common.base.Optional; import plan3.recruitment.backend.model.Person; import plan3.recruitment.backend.model.PersonStorage; import plan3.recruitment.backend.model.PersonStorageImpl; @Path("person") @Produces(PersonResource.APPLICATION_JSON_UTF8) @Consumes(PersonResource.APPLICATION_JSON_UTF8) public class PersonResource { public static final String APPLICATION_JSON_UTF8 = APPLICATION_JSON + "; charset=utf-8"; private static final String EMAIL_PARAM = "email"; private static final String EMAIL_PATH_PARAM = '{' + EMAIL_PARAM + '}'; private PersonStorageImpl storage = new PersonStorageImpl(); @GET public Collection<Person> list() { return this.storage.list(); } @GET @Path(EMAIL_PATH_PARAM) public Optional fetch(@PathParam(EMAIL_PARAM) final String email) { return this.storage.fetch(email); } @PUT public Response save(final Person person, @Context final UriInfo uri) throws URISyntaxException{ this.storage.save(person); URI resourceUri = new URI("/" + person.getEmail()); return Response.created(resourceUri).build(); } }
1,603
0.739239
0.734248
51
30.450981
24.936243
100
false
false
0
0
0
0
0
0
0.568627
false
false
2
7278c9c38cbf85f065e6bcfce30645b2f90767ec
21,818,433,927,190
308d42f104238049526a83be2fc9519e1eec23ec
/PhoneFormation/src/main/java/com/phonefo/board/service/BoardService.java
bbedf8c44a2b77d029851c1376ce833f59ae4a91
[]
no_license
lee52x/PhoneFormation
https://github.com/lee52x/PhoneFormation
ecad456ccb8829b47e4d0197fd9b86ec31f5405f
18f964905cb7600aebc3909d6bd1a1cc24df8e9f
refs/heads/master
2020-07-11T04:57:39.483000
2016-12-14T00:36:54
2016-12-14T00:36:54
74,006,122
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.phonefo.board.service; import java.util.List; import com.phonefo.board.domain.SearchCriteria; import com.phonefo.board.domain.BoardGoodVO; import com.phonefo.board.domain.BoardVO; public interface BoardService { // 검색어를 통한 리스트 조회 public List<BoardVO> selectlist(SearchCriteria cri) throws Exception; public int listCount(int tno) throws Exception; public String selecttitle(int tno) throws Exception; public void insert(BoardVO board) throws Exception; public BoardVO selectpage(int bno) throws Exception; public void delete(int bno) throws Exception; public void update(BoardVO board) throws Exception; public void update_viewcnt(int bno) throws Exception; public int select_prevbno(int bno) throws Exception; public int select_nextbno(int bno) throws Exception; public String select_title(int bno) throws Exception; public List<BoardVO> selectmain()throws Exception; }
UHC
Java
948
java
BoardService.java
Java
[]
null
[]
package com.phonefo.board.service; import java.util.List; import com.phonefo.board.domain.SearchCriteria; import com.phonefo.board.domain.BoardGoodVO; import com.phonefo.board.domain.BoardVO; public interface BoardService { // 검색어를 통한 리스트 조회 public List<BoardVO> selectlist(SearchCriteria cri) throws Exception; public int listCount(int tno) throws Exception; public String selecttitle(int tno) throws Exception; public void insert(BoardVO board) throws Exception; public BoardVO selectpage(int bno) throws Exception; public void delete(int bno) throws Exception; public void update(BoardVO board) throws Exception; public void update_viewcnt(int bno) throws Exception; public int select_prevbno(int bno) throws Exception; public int select_nextbno(int bno) throws Exception; public String select_title(int bno) throws Exception; public List<BoardVO> selectmain()throws Exception; }
948
0.780778
0.780778
25
35.040001
22.246761
70
false
false
0
0
0
0
0
0
1.2
false
false
2
480d1ace35206cc9c8da1b4d6c08971ce1a0f7f8
26,216,480,391,926
1f820faf9b131c0724c852dab6ecf4d576303ba0
/src/chapter05/strategy/old/Operation.java
229fb147226db86952ac760e5a311774ce6338e3
[]
no_license
neroHua/designPatterns
https://github.com/neroHua/designPatterns
7da431c0ed2aef081483ceb941a6835c0ac577c5
eb39733270dadd8517b81ded3d564b0375ce7545
refs/heads/master
2022-02-20T10:28:32.325000
2022-02-09T01:42:33
2022-02-09T01:42:33
151,999,927
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package chapter05.strategy.old; public interface Operation { public int operation(int number1, int number2); }
UTF-8
Java
130
java
Operation.java
Java
[]
null
[]
package chapter05.strategy.old; public interface Operation { public int operation(int number1, int number2); }
130
0.684615
0.653846
7
17.571428
17.990927
51
false
false
0
0
0
0
0
0
0.428571
false
false
2
508546ac17d158dbce4da92790e3a6c653684c59
27,032,524,209,463
bff94a0db82162e498416bb6308e833b3305e6f3
/BullStore_EG02/src/cn/itbull/bullstore/service/UserService.java
bad1aecb575286cb3057e2905b45751803851b8b
[]
no_license
kang123138/BullStore_EG07
https://github.com/kang123138/BullStore_EG07
a04a960cc38485759b56e1b4372f0c93994b16ba
8862e4acfbe9fa0dae0294ba0db923e95ba0fe5a
refs/heads/master
2021-04-09T10:22:39.996000
2018-03-20T13:09:49
2018-03-20T13:09:49
125,314,514
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.itbull.bullstore.service; import cn.itbull.bullstore.domain.User; public interface UserService { /** * 登录方法 */ User login(User user); /** * 注册的方法 */ boolean register(User user); }
UTF-8
Java
225
java
UserService.java
Java
[]
null
[]
package cn.itbull.bullstore.service; import cn.itbull.bullstore.domain.User; public interface UserService { /** * 登录方法 */ User login(User user); /** * 注册的方法 */ boolean register(User user); }
225
0.671498
0.671498
16
11.9375
13.731664
39
false
false
0
0
0
0
0
0
0.75
false
false
2
6fa99b8670f9f1d521f91b87373bbd7953e15dd2
27,101,243,686,690
7d88ba79c1cbe785ea5c64abfda7ff7a3c4d5135
/app/Util/ServerUtil.java
400830bf337667310ed34347eef7e72f06a450f5
[]
no_license
skylinego/PlayTravelSer
https://github.com/skylinego/PlayTravelSer
f5c9b45c056f57c41761668e0b21c8b1a79af5b7
6d5a7b71c35800733adc289facd4ecfb9f736f4a
refs/heads/master
2021-04-29T17:19:02.367000
2018-05-05T14:33:34
2018-05-05T14:33:34
121,666,149
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Util; import controllers.ServerController; import java.util.Map; import play.mvc.*; import play.mvc.Result; import play.libs.Json; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; /** * Created by dliu15 on 3/2/18. */ public class ServerUtil { public static Result outputMimeStr(String str, String mimeType) { ServerHttpRequest.putObject(Controller.ctx(), ServerHttpContext.RESPONSE_BODY_KEY, str); // set content Type to current context Controller.ctx().response().setContentType(mimeType); return ServerController.ok(str).as(mimeType); } public static Result toJsonRes(Object obj) { return toJsonRes(obj, null); } public static Result toJsonRes(Object obj, Map<String, Object> extra) { return outputJsonStr(toJsonStr(obj, extra)); } public static Result outputJsonStr(String str) { return outputMimeStr(str, "application/json"); } // Output related utilities public static String toJsonStr(Object obj) { return toJsonStr(obj, null); } public static String toJsonStr(Object obj, Map<String, Object> extra) { if (obj != null) { JsonNode jsnode = toJsonIgnoreNull(obj); if (extra != null && jsnode.isObject()) { ObjectNode objNode = (ObjectNode) jsnode; for (String key : extra.keySet()) { Object val = extra.get(key); JsonNode valNode = toJsonIgnoreNull(val); objNode.put(key, valNode); } } return Json.stringify(jsnode); } else { return ""; } } /** * Convert an object to JsonNode and ignore null value. * * @param data Value to convert in Json. */ public static JsonNode toJsonIgnoreNull(final Object data) { try { ObjectMapper mapper = new ObjectMapper(); mapper.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false); return mapper.valueToTree(data); } catch(Exception e) { throw new RuntimeException(e); } } }
UTF-8
Java
2,322
java
ServerUtil.java
Java
[ { "context": ".databind.SerializationFeature;\n\n/**\n * Created by dliu15 on 3/2/18.\n */\npublic class ServerUtil {\n\n pub", "end": 381, "score": 0.999454140663147, "start": 375, "tag": "USERNAME", "value": "dliu15" } ]
null
[]
package Util; import controllers.ServerController; import java.util.Map; import play.mvc.*; import play.mvc.Result; import play.libs.Json; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; /** * Created by dliu15 on 3/2/18. */ public class ServerUtil { public static Result outputMimeStr(String str, String mimeType) { ServerHttpRequest.putObject(Controller.ctx(), ServerHttpContext.RESPONSE_BODY_KEY, str); // set content Type to current context Controller.ctx().response().setContentType(mimeType); return ServerController.ok(str).as(mimeType); } public static Result toJsonRes(Object obj) { return toJsonRes(obj, null); } public static Result toJsonRes(Object obj, Map<String, Object> extra) { return outputJsonStr(toJsonStr(obj, extra)); } public static Result outputJsonStr(String str) { return outputMimeStr(str, "application/json"); } // Output related utilities public static String toJsonStr(Object obj) { return toJsonStr(obj, null); } public static String toJsonStr(Object obj, Map<String, Object> extra) { if (obj != null) { JsonNode jsnode = toJsonIgnoreNull(obj); if (extra != null && jsnode.isObject()) { ObjectNode objNode = (ObjectNode) jsnode; for (String key : extra.keySet()) { Object val = extra.get(key); JsonNode valNode = toJsonIgnoreNull(val); objNode.put(key, valNode); } } return Json.stringify(jsnode); } else { return ""; } } /** * Convert an object to JsonNode and ignore null value. * * @param data Value to convert in Json. */ public static JsonNode toJsonIgnoreNull(final Object data) { try { ObjectMapper mapper = new ObjectMapper(); mapper.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false); return mapper.valueToTree(data); } catch(Exception e) { throw new RuntimeException(e); } } }
2,322
0.627046
0.624462
77
29.155844
24.983665
96
false
false
0
0
0
0
0
0
0.532468
false
false
2
3096b87161b2bbbd06b396c5cb6287131cc100d8
18,073,222,411,678
6c8acd4c6ac30cee7c716798bbfdb99be3ab2b13
/src/test/java/week07d02/DigitSumTest.java
894d8d8dad9e0cc639d622ee0740043f493c4704
[]
no_license
paizsbalazs/training-solutions
https://github.com/paizsbalazs/training-solutions
6bfea6713f0a4664feb23326ff5e56e56db9a906
c7f6e8c7de4b12e6694c1b132d81de2ac1d6d77f
refs/heads/master
2023-03-17T15:25:08.030000
2021-03-15T11:18:33
2021-03-15T11:18:33
308,643,880
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package week07d02; import org.junit.jupiter.api.Test; public class DigitSumTest { @Test public void DigitSumTestCreate() { System.out.println(new DigitSum().sumOfDigits(123)); } }
UTF-8
Java
205
java
DigitSumTest.java
Java
[]
null
[]
package week07d02; import org.junit.jupiter.api.Test; public class DigitSumTest { @Test public void DigitSumTestCreate() { System.out.println(new DigitSum().sumOfDigits(123)); } }
205
0.682927
0.64878
13
14.769231
18.655392
60
false
false
0
0
0
0
0
0
0.230769
false
false
2
5e45b9442af94605895af2f01f9b7bfaa298429f
13,305,808,746,192
aee6cea185282f6273e5712c8d369bc5a1260ff9
/lab_5/app/src/main/java/com/example/android/lab_5/DB.java
badbeda8549f13b8abc3d4c6e6d5192123a0bba2
[]
no_license
SatanSnape/MobileAppDevelopment
https://github.com/SatanSnape/MobileAppDevelopment
effde5a58f248f1f95d052244a8aed3c0850bf57
e1ab323735dfedb7aa1304c236ddf86f8e06b328
refs/heads/master
2020-03-29T02:23:12.210000
2018-12-11T19:25:54
2018-12-11T19:25:54
149,433,817
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.android.lab_5; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; import java.text.SimpleDateFormat; import java.util.Calendar; public class DB { // Создаем private static final String DB_NAME = "mydb"; private static final int DB_VERSION = 1; private static final String DB_TABLE = "mytab"; public static final String COLUMN_ID = "_id"; public static final String COLUMN_NAME = "name"; public static final String COLUMN_EMAIL = "email"; public static final String COLUMN_DATE = "date"; private Calendar calendar = Calendar.getInstance(); private SimpleDateFormat mdformat = new SimpleDateFormat("dd.MM.yyyy "); private static final String DB_CREATE = "create table " + DB_TABLE + "(" + COLUMN_ID + " integer primary key autoincrement, " + COLUMN_NAME + " text, " + COLUMN_EMAIL + " text," + COLUMN_DATE + " text" + ");"; private final Context mCtx; private DBHelper mDBHelper; private SQLiteDatabase mDB; public DB(Context ctx) { mCtx = ctx; } // открыть подключение public void open() { mDBHelper = new DBHelper(mCtx, DB_NAME, null, DB_VERSION); mDB = mDBHelper.getWritableDatabase(); } // закрыть подключение public void close() { if (mDBHelper != null) mDBHelper.close(); } // получить все данные из таблицы DB_TABLE public Cursor getAllData() { return mDB.query(DB_TABLE, null, null, null, null, null, null); } // добавить запись в DB_TABLE public void addRec(String name, String email) { ContentValues cv = new ContentValues(); cv.put(COLUMN_NAME, name); cv.put(COLUMN_EMAIL, email); cv.put(COLUMN_DATE, mdformat.format(calendar.getTime())); mDB.insert(DB_TABLE, null, cv); } // удалить запись из DB_TABLE public void delRec(long id) { mDB.delete(DB_TABLE, COLUMN_ID + " = " + id, null); } // очистить DB_TABLE public void clear() { mDB.delete(DB_TABLE, null, null); } // класс по созданию и управлению БД private class DBHelper extends SQLiteOpenHelper { public DBHelper(Context context, String name, CursorFactory factory, int version) { super(context, name, factory, version); } // создаем БД @Override public void onCreate(SQLiteDatabase db) { db.execSQL(DB_CREATE); ContentValues cv = new ContentValues(); for (int i = 0; i < 10; i++) { Log.println(Log.ASSERT, "MY_LOG", "New item " + i + " added"); cv.put(COLUMN_NAME, "Name" + i); cv.put(COLUMN_EMAIL, "example" + i + "@mail.com"); cv.put(COLUMN_DATE, i + ".10.2018"); db.insert(DB_TABLE, null, cv); } } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { } } }
UTF-8
Java
3,468
java
DB.java
Java
[]
null
[]
package com.example.android.lab_5; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; import java.text.SimpleDateFormat; import java.util.Calendar; public class DB { // Создаем private static final String DB_NAME = "mydb"; private static final int DB_VERSION = 1; private static final String DB_TABLE = "mytab"; public static final String COLUMN_ID = "_id"; public static final String COLUMN_NAME = "name"; public static final String COLUMN_EMAIL = "email"; public static final String COLUMN_DATE = "date"; private Calendar calendar = Calendar.getInstance(); private SimpleDateFormat mdformat = new SimpleDateFormat("dd.MM.yyyy "); private static final String DB_CREATE = "create table " + DB_TABLE + "(" + COLUMN_ID + " integer primary key autoincrement, " + COLUMN_NAME + " text, " + COLUMN_EMAIL + " text," + COLUMN_DATE + " text" + ");"; private final Context mCtx; private DBHelper mDBHelper; private SQLiteDatabase mDB; public DB(Context ctx) { mCtx = ctx; } // открыть подключение public void open() { mDBHelper = new DBHelper(mCtx, DB_NAME, null, DB_VERSION); mDB = mDBHelper.getWritableDatabase(); } // закрыть подключение public void close() { if (mDBHelper != null) mDBHelper.close(); } // получить все данные из таблицы DB_TABLE public Cursor getAllData() { return mDB.query(DB_TABLE, null, null, null, null, null, null); } // добавить запись в DB_TABLE public void addRec(String name, String email) { ContentValues cv = new ContentValues(); cv.put(COLUMN_NAME, name); cv.put(COLUMN_EMAIL, email); cv.put(COLUMN_DATE, mdformat.format(calendar.getTime())); mDB.insert(DB_TABLE, null, cv); } // удалить запись из DB_TABLE public void delRec(long id) { mDB.delete(DB_TABLE, COLUMN_ID + " = " + id, null); } // очистить DB_TABLE public void clear() { mDB.delete(DB_TABLE, null, null); } // класс по созданию и управлению БД private class DBHelper extends SQLiteOpenHelper { public DBHelper(Context context, String name, CursorFactory factory, int version) { super(context, name, factory, version); } // создаем БД @Override public void onCreate(SQLiteDatabase db) { db.execSQL(DB_CREATE); ContentValues cv = new ContentValues(); for (int i = 0; i < 10; i++) { Log.println(Log.ASSERT, "MY_LOG", "New item " + i + " added"); cv.put(COLUMN_NAME, "Name" + i); cv.put(COLUMN_EMAIL, "example" + i + "@mail.com"); cv.put(COLUMN_DATE, i + ".10.2018"); db.insert(DB_TABLE, null, cv); } } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { } } }
3,468
0.598977
0.595668
109
29.504587
22.85881
82
false
false
0
0
0
0
0
0
0.761468
false
false
2
53ee59055c20a1111bd0e6e83a1a4a92e91a43b3
29,506,425,352,546
824edc2dba5b530c50e5d4165488b5effa8f0f67
/Portalwebsite/src/main/java/com/htzx/website/entity/Contactway.java
ebd93894b924834d53000f62fc77429154318e64
[]
no_license
silentwu/website
https://github.com/silentwu/website
0995ccd81bf1530b007e809c6637e13aa2490d2c
a49e5753fb811ccaf0c416053b96c234caf9c859
refs/heads/master
2016-09-06T16:36:24.202000
2014-09-12T01:18:25
2014-09-12T01:18:25
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.htzx.website.entity; import javax.persistence.Entity; import javax.persistence.Table; import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; import com.htzx.website.utils.entity.BaseEntity; /** * 联系方式 * * @author silentwu * */ @Entity @DynamicUpdate(true) @DynamicInsert(true) @Table(name = "t_contactway") public class Contactway extends BaseEntity { private String name; private String address; /** * 联系人 */ private String contact; private String phone; private String tel; /** * 邮编 */ private String code; /** * 网址 */ private String weburl; private String email; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getContact() { return contact; } public void setContact(String contact) { this.contact = contact; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getTel() { return tel; } public void setTel(String tel) { this.tel = tel; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getWeburl() { return weburl; } public void setWeburl(String weburl) { this.weburl = weburl; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } }
UTF-8
Java
1,579
java
Contactway.java
Java
[ { "context": "ils.entity.BaseEntity;\n\n/**\n * 联系方式\n * \n * @author silentwu\n *\n */\n@Entity\n@DynamicUpdate(true)\n@DynamicInser", "end": 282, "score": 0.9994000196456909, "start": 274, "tag": "USERNAME", "value": "silentwu" } ]
null
[]
package com.htzx.website.entity; import javax.persistence.Entity; import javax.persistence.Table; import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; import com.htzx.website.utils.entity.BaseEntity; /** * 联系方式 * * @author silentwu * */ @Entity @DynamicUpdate(true) @DynamicInsert(true) @Table(name = "t_contactway") public class Contactway extends BaseEntity { private String name; private String address; /** * 联系人 */ private String contact; private String phone; private String tel; /** * 邮编 */ private String code; /** * 网址 */ private String weburl; private String email; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getContact() { return contact; } public void setContact(String contact) { this.contact = contact; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getTel() { return tel; } public void setTel(String tel) { this.tel = tel; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getWeburl() { return weburl; } public void setWeburl(String weburl) { this.weburl = weburl; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } }
1,579
0.689146
0.689146
104
13.971154
13.967308
48
false
false
0
0
0
0
0
0
1.067308
false
false
2
85e39936564ffcd6b753c4d6c64a585b2fd55804
30,855,045,119,883
bbf285982178a559e454cf919aec7706b501d782
/BackEnd/src/main/java/com/employ/employment/EmploymentApplication.java
06d780ed976ac6975144602428cb465b1b0a2276
[]
no_license
sakura1379/employment
https://github.com/sakura1379/employment
b3ae1b6f558ad54c7d885d498f7540eed7086921
8566607f2ec29def3ef6ea72d5ef5854a97d7349
refs/heads/main
2023-05-31T09:09:05.771000
2021-06-23T08:15:33
2021-06-23T08:15:33
360,169,693
3
1
null
false
2021-06-20T03:11:09
2021-04-21T12:53:45
2021-06-20T03:07:19
2021-06-20T03:11:08
279
2
1
0
Java
false
false
package com.employ.employment; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cache.annotation.EnableCaching; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.transaction.annotation.EnableTransactionManagement; //@EnableCaching // 启用缓存 //@EnableScheduling // 启动定时任务 @SpringBootApplication // springboot本尊 @MapperScan("com.employ.employment.mapper") //@EnableTransactionManagement // 启动注解事务管理 public class EmploymentApplication { public static void main(String[] args) { SpringApplication.run(EmploymentApplication.class, args); } }
UTF-8
Java
786
java
EmploymentApplication.java
Java
[]
null
[]
package com.employ.employment; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cache.annotation.EnableCaching; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.transaction.annotation.EnableTransactionManagement; //@EnableCaching // 启用缓存 //@EnableScheduling // 启动定时任务 @SpringBootApplication // springboot本尊 @MapperScan("com.employ.employment.mapper") //@EnableTransactionManagement // 启动注解事务管理 public class EmploymentApplication { public static void main(String[] args) { SpringApplication.run(EmploymentApplication.class, args); } }
786
0.821716
0.821716
21
34.523811
24.93729
78
false
false
0
0
0
0
0
0
0.428571
false
false
2
155c90258bba746a33af719729828a7db44295b8
22,333,829,958,173
234df6180bc1c5adb2f0a7e2ce4c61df262b5b73
/src/main/java/com/gameleton/jesque/JesqueAppVerticle.java
2e0811717f3afed008d075462291f334ba34df15
[]
no_license
bellmit/mod-jesque
https://github.com/bellmit/mod-jesque
494c080f16ea09b27220c3f069e78e96b11c2941
75c620326d5184ed423a3a97ecf281040be76399
refs/heads/master
2022-03-06T12:41:25.189000
2014-08-25T02:54:37
2014-08-25T02:54:37
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.gameleton.jesque; import org.vertx.java.core.AsyncResult; import org.vertx.java.core.AsyncResultHandler; import org.vertx.java.core.json.JsonObject; import org.vertx.java.platform.Verticle; import java.util.ArrayList; import java.util.List; /** * Created by levin on 8/19/2014. */ public class JesqueAppVerticle extends Verticle { List<String> deployed = new ArrayList<>(); @Override public void start() { final JsonObject config = container.config(); //container.logger().info(config.toString()); container.deployWorkerVerticle("com.gameleton.jesque.JesqueVerticle", config, 1, true, new AsyncResultHandler<String>() { @Override public void handle(AsyncResult<String> event) { if(event.succeeded()){ deployed.add(event.result()); } } }); // container.deployVerticle("com.gameleton.jesque.JesqueVerticle", config, 1, new AsyncResultHandler<String>() { // @Override // public void handle(AsyncResult<String> event) { // if(event.succeeded()){ // deployed.add(event.result()); // } // } // }); // container.deployVerticle("com.gameleton.jesque.JesqueWebVerticle", config, 1); } @Override public void stop() { for (String deployId : deployed) { container.undeployVerticle(deployId); } deployed.clear(); } }
UTF-8
Java
1,515
java
JesqueAppVerticle.java
Java
[ { "context": "rayList;\nimport java.util.List;\n\n/**\n * Created by levin on 8/19/2014.\n */\npublic class JesqueAppVerticle ", "end": 279, "score": 0.9537402391433716, "start": 274, "tag": "USERNAME", "value": "levin" } ]
null
[]
package com.gameleton.jesque; import org.vertx.java.core.AsyncResult; import org.vertx.java.core.AsyncResultHandler; import org.vertx.java.core.json.JsonObject; import org.vertx.java.platform.Verticle; import java.util.ArrayList; import java.util.List; /** * Created by levin on 8/19/2014. */ public class JesqueAppVerticle extends Verticle { List<String> deployed = new ArrayList<>(); @Override public void start() { final JsonObject config = container.config(); //container.logger().info(config.toString()); container.deployWorkerVerticle("com.gameleton.jesque.JesqueVerticle", config, 1, true, new AsyncResultHandler<String>() { @Override public void handle(AsyncResult<String> event) { if(event.succeeded()){ deployed.add(event.result()); } } }); // container.deployVerticle("com.gameleton.jesque.JesqueVerticle", config, 1, new AsyncResultHandler<String>() { // @Override // public void handle(AsyncResult<String> event) { // if(event.succeeded()){ // deployed.add(event.result()); // } // } // }); // container.deployVerticle("com.gameleton.jesque.JesqueWebVerticle", config, 1); } @Override public void stop() { for (String deployId : deployed) { container.undeployVerticle(deployId); } deployed.clear(); } }
1,515
0.60132
0.594719
52
28.134615
28.345417
129
false
false
0
0
0
0
0
0
0.5
false
false
2
3fad273b6fd93289a95c37245c328c35184ec4c7
32,581,621,927,316
6f672fb72caedccb841ee23f53e32aceeaf1895e
/domioz-source/src/com/dominos/wear/client/WearTrackerClient.java
978971bdd3afd77b5bc833afb6534bc092faa1c8
[]
no_license
cha63506/CompSecurity
https://github.com/cha63506/CompSecurity
5c69743f660b9899146ed3cf21eceabe3d5f4280
eee7e74f4088b9c02dd711c061fc04fb1e4e2654
refs/heads/master
2018-03-23T04:15:18.480000
2015-12-19T01:29:58
2015-12-19T01:29:58
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.dominos.wear.client; import com.dominos.remote.util.ResponseEvent; // Referenced classes of package com.dominos.wear.client: // WearBaseOrderClient public class WearTrackerClient extends WearBaseOrderClient { public WearTrackerClient() { } public void onResponseReceived(ResponseEvent responseevent) { WearBaseOrderClient.DataMapEvent datamapevent = createDataMapRequest(23, responseevent); sendResponse(responseevent.getContext(), datamapevent.toPutDataMapRequest()); } }
UTF-8
Java
716
java
WearTrackerClient.java
Java
[ { "context": "// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.\n// Jad home page: http://www.geocities.com/kpdus", "end": 61, "score": 0.9996740818023682, "start": 45, "tag": "NAME", "value": "Pavel Kouznetsov" } ]
null
[]
// Decompiled by Jad v1.5.8e. Copyright 2001 <NAME>. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.dominos.wear.client; import com.dominos.remote.util.ResponseEvent; // Referenced classes of package com.dominos.wear.client: // WearBaseOrderClient public class WearTrackerClient extends WearBaseOrderClient { public WearTrackerClient() { } public void onResponseReceived(ResponseEvent responseevent) { WearBaseOrderClient.DataMapEvent datamapevent = createDataMapRequest(23, responseevent); sendResponse(responseevent.getContext(), datamapevent.toPutDataMapRequest()); } }
706
0.751397
0.738827
24
28.833334
30.281549
96
false
false
0
0
0
0
0
0
0.25
false
false
2
b528842650f0b9ad805c792eb078b587eba0f6f6
23,278,722,786,937
795ede33d707d53da212dc12e0493a25c1771b27
/src/hanoi/Hanoi.java
1df0aa35eb8549c51969e69d84f6ab434f44b5e5
[ "MIT" ]
permissive
akhy/hanoi
https://github.com/akhy/hanoi
5a1c4fdc9734fce75c486b5f225c796e10cdbf40
4e1eac23a19e1f5708c2c4063cdb7eaa694ee153
refs/heads/master
2020-11-25T09:59:41.757000
2019-12-17T12:15:49
2019-12-17T12:15:49
228,608,385
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 hanoi; import library.*; /** * * @author akhyar */ public class Hanoi { Stack[] s = new Stack[4]; int jumlahRing; public static void main(String[] args) { Hanoi h = new Hanoi(); System.out.print("Masukkan jumlah tumpukan ring: "); h.jumlahRing = Input.readInt(); System.out.println(""); h.init(); int step=0; do { h.tampil(); step++; } while (h.pindah()); System.out.println("\n"); System.out.println("=============================================="); System.out.println("Selamat anda berhasil memecahkan teka-teki ini!"); System.out.println("==============================================\n"); h.tampil(); System.out.println("\nlangkah yang dibutuhkan: " + step); } public void init() { s[1] = new Stack(); s[2] = new Stack(); s[3] = new Stack(); for (int i = jumlahRing; i >= 1; i--) { String x = "" + i; s[1].push(x); } } public boolean pindah() { int dari = 0, ke = 0, dari_top = 0, ke_top = 0; try{ System.out.print("=> Pindahkan dari tiang nomor: "); dari = Input.readInt(); System.out.print("=> Ke tiang nomor: "); ke = Input.readInt(); }catch (Exception e){ System.out.println("\nMasukan tidak valid!"); return true; } try { // periksa tiang sumber dari_top = Integer.parseInt((String) (s[dari].getTop().getElemen())); } catch (NullPointerException e) { System.out.print("\n"); System.out.println("====================================="); System.out.println("Tiang yang mau anda pindahkan kosong!"); System.out.println("====================================="); return true; } try { //periksa tiang tujuan ke_top = Integer.parseInt((String) (s[ke].getTop().getElemen())); } catch (NullPointerException e) { ke_top = jumlahRing + 1; } if (dari_top < ke_top) { String dipindah = (String) (s[dari].getTop().getElemen()); s[ke].push(dipindah); s[dari].pop(); } else { System.out.print("\n"); System.out.println("=================="); System.out.println("Gerakan tidak sah!"); System.out.println("=================="); } if (s[3].countElement()==jumlahRing) return false; return true; } public void tampil() { for (int i = 1; i <= 3; i++) { Elemen tmp; System.out.println(i + " ======="); tmp = s[i].getTop(); if (tmp == null){ System.out.println(" -"); } while (tmp != null) { System.out.println(" " + tmp.getElemen()); tmp = tmp.getNext(); } System.out.println("---------\n"); } } }
UTF-8
Java
3,208
java
Hanoi.java
Java
[ { "context": "ckage hanoi;\n\nimport library.*;\n\n/**\n *\n * @author akhyar\n */\npublic class Hanoi {\n\n Stack[] s = new Sta", "end": 159, "score": 0.9990331530570984, "start": 153, "tag": "USERNAME", "value": "akhyar" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package hanoi; import library.*; /** * * @author akhyar */ public class Hanoi { Stack[] s = new Stack[4]; int jumlahRing; public static void main(String[] args) { Hanoi h = new Hanoi(); System.out.print("Masukkan jumlah tumpukan ring: "); h.jumlahRing = Input.readInt(); System.out.println(""); h.init(); int step=0; do { h.tampil(); step++; } while (h.pindah()); System.out.println("\n"); System.out.println("=============================================="); System.out.println("Selamat anda berhasil memecahkan teka-teki ini!"); System.out.println("==============================================\n"); h.tampil(); System.out.println("\nlangkah yang dibutuhkan: " + step); } public void init() { s[1] = new Stack(); s[2] = new Stack(); s[3] = new Stack(); for (int i = jumlahRing; i >= 1; i--) { String x = "" + i; s[1].push(x); } } public boolean pindah() { int dari = 0, ke = 0, dari_top = 0, ke_top = 0; try{ System.out.print("=> Pindahkan dari tiang nomor: "); dari = Input.readInt(); System.out.print("=> Ke tiang nomor: "); ke = Input.readInt(); }catch (Exception e){ System.out.println("\nMasukan tidak valid!"); return true; } try { // periksa tiang sumber dari_top = Integer.parseInt((String) (s[dari].getTop().getElemen())); } catch (NullPointerException e) { System.out.print("\n"); System.out.println("====================================="); System.out.println("Tiang yang mau anda pindahkan kosong!"); System.out.println("====================================="); return true; } try { //periksa tiang tujuan ke_top = Integer.parseInt((String) (s[ke].getTop().getElemen())); } catch (NullPointerException e) { ke_top = jumlahRing + 1; } if (dari_top < ke_top) { String dipindah = (String) (s[dari].getTop().getElemen()); s[ke].push(dipindah); s[dari].pop(); } else { System.out.print("\n"); System.out.println("=================="); System.out.println("Gerakan tidak sah!"); System.out.println("=================="); } if (s[3].countElement()==jumlahRing) return false; return true; } public void tampil() { for (int i = 1; i <= 3; i++) { Elemen tmp; System.out.println(i + " ======="); tmp = s[i].getTop(); if (tmp == null){ System.out.println(" -"); } while (tmp != null) { System.out.println(" " + tmp.getElemen()); tmp = tmp.getNext(); } System.out.println("---------\n"); } } }
3,208
0.441085
0.436409
111
27.900902
22.536839
81
false
false
0
0
0
0
0
0
0.576577
false
false
2
e9b237c609fc379ff2c9290a29029aa86feb7b14
23,278,722,787,871
cca6096b77713a56fefd62b872d0f83c38ee26b0
/aws-java-sdk-kms/src/main/java/com/amazonaws/services/kms/model/EncryptRequest.java
a25c2f25c198d6c3b771bce0873368926d61ac46
[ "Apache-2.0", "JSON" ]
permissive
nezihyigitbasi/aws-sdk-java
https://github.com/nezihyigitbasi/aws-sdk-java
8a6ed3a588b2b4362b59755386ae65335247e01c
bb9e0be441afb5658f0edbbd19bcf27e2fac4105
refs/heads/master
2020-12-11T05:30:55.972000
2015-10-08T22:46:32
2015-10-08T22:46:32
44,122,680
1
0
null
true
2015-10-12T17:25:50
2015-10-12T17:25:50
2015-10-12T14:57:02
2015-10-08T22:46:42
184,314
0
0
0
null
null
null
/* * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.kms.model; import java.io.Serializable; import com.amazonaws.AmazonWebServiceRequest; /** * Container for the parameters to the {@link com.amazonaws.services.kms.AWSKMS#encrypt(EncryptRequest) Encrypt operation}. * <p> * Encrypts plaintext into ciphertext by using a customer master key. The * <code>Encrypt</code> function has two primary use cases: * <ul> * <li>You can encrypt up to 4 KB of arbitrary data such as an RSA key, * a database password, or other sensitive customer information.</li> * <li>If you are moving encrypted data from one region to another, you * can use this API to encrypt in the new region the plaintext data key * that was used to encrypt the data in the original region. This * provides you with an encrypted copy of the data key that can be * decrypted in the new region and used there to decrypt the encrypted * data. </li> * * </ul> * * </p> * <p> * Unless you are moving encrypted data from one region to another, you * don't use this function to encrypt a generated data key within a * region. You retrieve data keys already encrypted by calling the * GenerateDataKey or GenerateDataKeyWithoutPlaintext function. Data keys * don't need to be encrypted again by calling <code>Encrypt</code> . * * </p> * <p> * If you want to encrypt data locally in your application, you can use * the <code>GenerateDataKey</code> function to return a plaintext data * encryption key and a copy of the key encrypted under the customer * master key (CMK) of your choosing. * </p> * * @see com.amazonaws.services.kms.AWSKMS#encrypt(EncryptRequest) */ public class EncryptRequest extends AmazonWebServiceRequest implements Serializable, Cloneable { /** * A unique identifier for the customer master key. This value can be a * globally unique identifier, a fully specified ARN to either an alias * or a key, or an alias name prefixed by "alias/". <ul> <li>Key ARN * Example - * arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</li> * <li>Alias ARN Example - * arn:aws:kms:us-east-1:123456789012:alias/MyAliasName</li> <li>Globally * Unique Key ID Example - 12345678-1234-1234-1234-123456789012</li> * <li>Alias Name Example - alias/MyAliasName</li> </ul> * <p> * <b>Constraints:</b><br/> * <b>Length: </b>1 - 256<br/> */ private String keyId; /** * Data to be encrypted. * <p> * <b>Constraints:</b><br/> * <b>Length: </b>1 - 4096<br/> */ private java.nio.ByteBuffer plaintext; /** * Name/value pair that specifies the encryption context to be used for * authenticated encryption. If used here, the same value must be * supplied to the <code>Decrypt</code> API or decryption will fail. For * more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/encrypt-context.html">Encryption * Context</a>. */ private java.util.Map<String,String> encryptionContext; /** * For more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token">Grant * Tokens</a>. * <p> * <b>Constraints:</b><br/> * <b>Length: </b>0 - 10<br/> */ private com.amazonaws.internal.ListWithAutoConstructFlag<String> grantTokens; /** * A unique identifier for the customer master key. This value can be a * globally unique identifier, a fully specified ARN to either an alias * or a key, or an alias name prefixed by "alias/". <ul> <li>Key ARN * Example - * arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</li> * <li>Alias ARN Example - * arn:aws:kms:us-east-1:123456789012:alias/MyAliasName</li> <li>Globally * Unique Key ID Example - 12345678-1234-1234-1234-123456789012</li> * <li>Alias Name Example - alias/MyAliasName</li> </ul> * <p> * <b>Constraints:</b><br/> * <b>Length: </b>1 - 256<br/> * * @return A unique identifier for the customer master key. This value can be a * globally unique identifier, a fully specified ARN to either an alias * or a key, or an alias name prefixed by "alias/". <ul> <li>Key ARN * Example - * arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</li> * <li>Alias ARN Example - * arn:aws:kms:us-east-1:123456789012:alias/MyAliasName</li> <li>Globally * Unique Key ID Example - 12345678-1234-1234-1234-123456789012</li> * <li>Alias Name Example - alias/MyAliasName</li> </ul> */ public String getKeyId() { return keyId; } /** * A unique identifier for the customer master key. This value can be a * globally unique identifier, a fully specified ARN to either an alias * or a key, or an alias name prefixed by "alias/". <ul> <li>Key ARN * Example - * arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</li> * <li>Alias ARN Example - * arn:aws:kms:us-east-1:123456789012:alias/MyAliasName</li> <li>Globally * Unique Key ID Example - 12345678-1234-1234-1234-123456789012</li> * <li>Alias Name Example - alias/MyAliasName</li> </ul> * <p> * <b>Constraints:</b><br/> * <b>Length: </b>1 - 256<br/> * * @param keyId A unique identifier for the customer master key. This value can be a * globally unique identifier, a fully specified ARN to either an alias * or a key, or an alias name prefixed by "alias/". <ul> <li>Key ARN * Example - * arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</li> * <li>Alias ARN Example - * arn:aws:kms:us-east-1:123456789012:alias/MyAliasName</li> <li>Globally * Unique Key ID Example - 12345678-1234-1234-1234-123456789012</li> * <li>Alias Name Example - alias/MyAliasName</li> </ul> */ public void setKeyId(String keyId) { this.keyId = keyId; } /** * A unique identifier for the customer master key. This value can be a * globally unique identifier, a fully specified ARN to either an alias * or a key, or an alias name prefixed by "alias/". <ul> <li>Key ARN * Example - * arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</li> * <li>Alias ARN Example - * arn:aws:kms:us-east-1:123456789012:alias/MyAliasName</li> <li>Globally * Unique Key ID Example - 12345678-1234-1234-1234-123456789012</li> * <li>Alias Name Example - alias/MyAliasName</li> </ul> * <p> * Returns a reference to this object so that method calls can be chained together. * <p> * <b>Constraints:</b><br/> * <b>Length: </b>1 - 256<br/> * * @param keyId A unique identifier for the customer master key. This value can be a * globally unique identifier, a fully specified ARN to either an alias * or a key, or an alias name prefixed by "alias/". <ul> <li>Key ARN * Example - * arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</li> * <li>Alias ARN Example - * arn:aws:kms:us-east-1:123456789012:alias/MyAliasName</li> <li>Globally * Unique Key ID Example - 12345678-1234-1234-1234-123456789012</li> * <li>Alias Name Example - alias/MyAliasName</li> </ul> * * @return A reference to this updated object so that method calls can be chained * together. */ public EncryptRequest withKeyId(String keyId) { this.keyId = keyId; return this; } /** * Data to be encrypted. * <p> * <b>Constraints:</b><br/> * <b>Length: </b>1 - 4096<br/> * * @return Data to be encrypted. */ public java.nio.ByteBuffer getPlaintext() { return plaintext; } /** * Data to be encrypted. * <p> * <b>Constraints:</b><br/> * <b>Length: </b>1 - 4096<br/> * * @param plaintext Data to be encrypted. */ public void setPlaintext(java.nio.ByteBuffer plaintext) { this.plaintext = plaintext; } /** * Data to be encrypted. * <p> * Returns a reference to this object so that method calls can be chained together. * <p> * <b>Constraints:</b><br/> * <b>Length: </b>1 - 4096<br/> * * @param plaintext Data to be encrypted. * * @return A reference to this updated object so that method calls can be chained * together. */ public EncryptRequest withPlaintext(java.nio.ByteBuffer plaintext) { this.plaintext = plaintext; return this; } /** * Name/value pair that specifies the encryption context to be used for * authenticated encryption. If used here, the same value must be * supplied to the <code>Decrypt</code> API or decryption will fail. For * more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/encrypt-context.html">Encryption * Context</a>. * * @return Name/value pair that specifies the encryption context to be used for * authenticated encryption. If used here, the same value must be * supplied to the <code>Decrypt</code> API or decryption will fail. For * more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/encrypt-context.html">Encryption * Context</a>. */ public java.util.Map<String,String> getEncryptionContext() { if (encryptionContext == null) { encryptionContext = new java.util.HashMap<String,String>(); } return encryptionContext; } /** * Name/value pair that specifies the encryption context to be used for * authenticated encryption. If used here, the same value must be * supplied to the <code>Decrypt</code> API or decryption will fail. For * more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/encrypt-context.html">Encryption * Context</a>. * * @param encryptionContext Name/value pair that specifies the encryption context to be used for * authenticated encryption. If used here, the same value must be * supplied to the <code>Decrypt</code> API or decryption will fail. For * more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/encrypt-context.html">Encryption * Context</a>. */ public void setEncryptionContext(java.util.Map<String,String> encryptionContext) { this.encryptionContext = encryptionContext; } /** * Name/value pair that specifies the encryption context to be used for * authenticated encryption. If used here, the same value must be * supplied to the <code>Decrypt</code> API or decryption will fail. For * more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/encrypt-context.html">Encryption * Context</a>. * <p> * Returns a reference to this object so that method calls can be chained together. * * @param encryptionContext Name/value pair that specifies the encryption context to be used for * authenticated encryption. If used here, the same value must be * supplied to the <code>Decrypt</code> API or decryption will fail. For * more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/encrypt-context.html">Encryption * Context</a>. * * @return A reference to this updated object so that method calls can be chained * together. */ public EncryptRequest withEncryptionContext(java.util.Map<String,String> encryptionContext) { setEncryptionContext(encryptionContext); return this; } /** * Name/value pair that specifies the encryption context to be used for * authenticated encryption. If used here, the same value must be * supplied to the <code>Decrypt</code> API or decryption will fail. For * more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/encrypt-context.html">Encryption * Context</a>. * <p> * The method adds a new key-value pair into EncryptionContext parameter, * and returns a reference to this object so that method calls can be * chained together. * * @param key The key of the entry to be added into EncryptionContext. * @param value The corresponding value of the entry to be added into EncryptionContext. */ public EncryptRequest addEncryptionContextEntry(String key, String value) { if (null == this.encryptionContext) { this.encryptionContext = new java.util.HashMap<String,String>(); } if (this.encryptionContext.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.encryptionContext.put(key, value); return this; } /** * Removes all the entries added into EncryptionContext. * <p> * Returns a reference to this object so that method calls can be chained together. */ public EncryptRequest clearEncryptionContextEntries() { this.encryptionContext = null; return this; } /** * For more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token">Grant * Tokens</a>. * <p> * <b>Constraints:</b><br/> * <b>Length: </b>0 - 10<br/> * * @return For more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token">Grant * Tokens</a>. */ public java.util.List<String> getGrantTokens() { if (grantTokens == null) { grantTokens = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(); grantTokens.setAutoConstruct(true); } return grantTokens; } /** * For more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token">Grant * Tokens</a>. * <p> * <b>Constraints:</b><br/> * <b>Length: </b>0 - 10<br/> * * @param grantTokens For more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token">Grant * Tokens</a>. */ public void setGrantTokens(java.util.Collection<String> grantTokens) { if (grantTokens == null) { this.grantTokens = null; return; } com.amazonaws.internal.ListWithAutoConstructFlag<String> grantTokensCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(grantTokens.size()); grantTokensCopy.addAll(grantTokens); this.grantTokens = grantTokensCopy; } /** * For more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token">Grant * Tokens</a>. * <p> * <b>NOTE:</b> This method appends the values to the existing list (if * any). Use {@link #setGrantTokens(java.util.Collection)} or {@link * #withGrantTokens(java.util.Collection)} if you want to override the * existing values. * <p> * Returns a reference to this object so that method calls can be chained together. * <p> * <b>Constraints:</b><br/> * <b>Length: </b>0 - 10<br/> * * @param grantTokens For more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token">Grant * Tokens</a>. * * @return A reference to this updated object so that method calls can be chained * together. */ public EncryptRequest withGrantTokens(String... grantTokens) { if (getGrantTokens() == null) setGrantTokens(new java.util.ArrayList<String>(grantTokens.length)); for (String value : grantTokens) { getGrantTokens().add(value); } return this; } /** * For more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token">Grant * Tokens</a>. * <p> * Returns a reference to this object so that method calls can be chained together. * <p> * <b>Constraints:</b><br/> * <b>Length: </b>0 - 10<br/> * * @param grantTokens For more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token">Grant * Tokens</a>. * * @return A reference to this updated object so that method calls can be chained * together. */ public EncryptRequest withGrantTokens(java.util.Collection<String> grantTokens) { if (grantTokens == null) { this.grantTokens = null; } else { com.amazonaws.internal.ListWithAutoConstructFlag<String> grantTokensCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(grantTokens.size()); grantTokensCopy.addAll(grantTokens); this.grantTokens = grantTokensCopy; } return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getKeyId() != null) sb.append("KeyId: " + getKeyId() + ","); if (getPlaintext() != null) sb.append("Plaintext: " + getPlaintext() + ","); if (getEncryptionContext() != null) sb.append("EncryptionContext: " + getEncryptionContext() + ","); if (getGrantTokens() != null) sb.append("GrantTokens: " + getGrantTokens() ); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getKeyId() == null) ? 0 : getKeyId().hashCode()); hashCode = prime * hashCode + ((getPlaintext() == null) ? 0 : getPlaintext().hashCode()); hashCode = prime * hashCode + ((getEncryptionContext() == null) ? 0 : getEncryptionContext().hashCode()); hashCode = prime * hashCode + ((getGrantTokens() == null) ? 0 : getGrantTokens().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof EncryptRequest == false) return false; EncryptRequest other = (EncryptRequest)obj; if (other.getKeyId() == null ^ this.getKeyId() == null) return false; if (other.getKeyId() != null && other.getKeyId().equals(this.getKeyId()) == false) return false; if (other.getPlaintext() == null ^ this.getPlaintext() == null) return false; if (other.getPlaintext() != null && other.getPlaintext().equals(this.getPlaintext()) == false) return false; if (other.getEncryptionContext() == null ^ this.getEncryptionContext() == null) return false; if (other.getEncryptionContext() != null && other.getEncryptionContext().equals(this.getEncryptionContext()) == false) return false; if (other.getGrantTokens() == null ^ this.getGrantTokens() == null) return false; if (other.getGrantTokens() != null && other.getGrantTokens().equals(this.getGrantTokens()) == false) return false; return true; } @Override public EncryptRequest clone() { return (EncryptRequest) super.clone(); } }
UTF-8
Java
20,716
java
EncryptRequest.java
Java
[ { "context": "</li> <li>Globally\n * Unique Key ID Example - 12345678-1234-1234-1234-123456789012</li>\n * <li>Alias Name Example - alias/MyAlia", "end": 2836, "score": 0.9956774115562439, "start": 2800, "tag": "KEY", "value": "12345678-1234-1234-1234-123456789012" }, { "context": "/li> <li>Globally\n * Unique Key ID Example - 12345678-1234-1234-1234-123456789012</li>\n * <li>Alias Name Example - alias/MyAlia", "end": 4479, "score": 0.7405356764793396, "start": 4444, "tag": "KEY", "value": "2345678-1234-1234-1234-123456789012" }, { "context": "i>Globally\n * Unique Key ID Example - 12345678-1234-1234-1234-123456789012</li>\n * <li>Alias Name Example - alia", "end": 5201, "score": 0.9985743761062622, "start": 5165, "tag": "KEY", "value": "12345678-1234-1234-1234-123456789012" }, { "context": "</li> <li>Globally\n * Unique Key ID Example - 12345678-1234-1234-1234-123456789012</li>\n * <li>Alias Name Example - alias/MyAlia", "end": 5862, "score": 0.9985973834991455, "start": 5826, "tag": "KEY", "value": "12345678-1234-1234-1234-123456789012" }, { "context": "i>Globally\n * Unique Key ID Example - 12345678-1234-1234-1234-123456789012</li>\n * <li>Alias Name Example - alia", "end": 6589, "score": 0.9993407130241394, "start": 6553, "tag": "KEY", "value": "12345678-1234-1234-1234-123456789012" }, { "context": "</li> <li>Globally\n * Unique Key ID Example - 12345678-1234-1234-1234-123456789012</li>\n * <li>Alias Name Example - alias/MyAlia", "end": 7266, "score": 0.9993881583213806, "start": 7230, "tag": "KEY", "value": "12345678-1234-1234-1234-123456789012" }, { "context": "i>Globally\n * Unique Key ID Example - 12345678-1234-1234-1234-123456789012</li>\n * <li>Alias Name Example - alia", "end": 8092, "score": 0.9960640668869019, "start": 8056, "tag": "KEY", "value": "12345678-1234-1234-1234-123456789012" } ]
null
[]
/* * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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.amazonaws.services.kms.model; import java.io.Serializable; import com.amazonaws.AmazonWebServiceRequest; /** * Container for the parameters to the {@link com.amazonaws.services.kms.AWSKMS#encrypt(EncryptRequest) Encrypt operation}. * <p> * Encrypts plaintext into ciphertext by using a customer master key. The * <code>Encrypt</code> function has two primary use cases: * <ul> * <li>You can encrypt up to 4 KB of arbitrary data such as an RSA key, * a database password, or other sensitive customer information.</li> * <li>If you are moving encrypted data from one region to another, you * can use this API to encrypt in the new region the plaintext data key * that was used to encrypt the data in the original region. This * provides you with an encrypted copy of the data key that can be * decrypted in the new region and used there to decrypt the encrypted * data. </li> * * </ul> * * </p> * <p> * Unless you are moving encrypted data from one region to another, you * don't use this function to encrypt a generated data key within a * region. You retrieve data keys already encrypted by calling the * GenerateDataKey or GenerateDataKeyWithoutPlaintext function. Data keys * don't need to be encrypted again by calling <code>Encrypt</code> . * * </p> * <p> * If you want to encrypt data locally in your application, you can use * the <code>GenerateDataKey</code> function to return a plaintext data * encryption key and a copy of the key encrypted under the customer * master key (CMK) of your choosing. * </p> * * @see com.amazonaws.services.kms.AWSKMS#encrypt(EncryptRequest) */ public class EncryptRequest extends AmazonWebServiceRequest implements Serializable, Cloneable { /** * A unique identifier for the customer master key. This value can be a * globally unique identifier, a fully specified ARN to either an alias * or a key, or an alias name prefixed by "alias/". <ul> <li>Key ARN * Example - * arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</li> * <li>Alias ARN Example - * arn:aws:kms:us-east-1:123456789012:alias/MyAliasName</li> <li>Globally * Unique Key ID Example - 12345678-1234-1234-1234-123456789012</li> * <li>Alias Name Example - alias/MyAliasName</li> </ul> * <p> * <b>Constraints:</b><br/> * <b>Length: </b>1 - 256<br/> */ private String keyId; /** * Data to be encrypted. * <p> * <b>Constraints:</b><br/> * <b>Length: </b>1 - 4096<br/> */ private java.nio.ByteBuffer plaintext; /** * Name/value pair that specifies the encryption context to be used for * authenticated encryption. If used here, the same value must be * supplied to the <code>Decrypt</code> API or decryption will fail. For * more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/encrypt-context.html">Encryption * Context</a>. */ private java.util.Map<String,String> encryptionContext; /** * For more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token">Grant * Tokens</a>. * <p> * <b>Constraints:</b><br/> * <b>Length: </b>0 - 10<br/> */ private com.amazonaws.internal.ListWithAutoConstructFlag<String> grantTokens; /** * A unique identifier for the customer master key. This value can be a * globally unique identifier, a fully specified ARN to either an alias * or a key, or an alias name prefixed by "alias/". <ul> <li>Key ARN * Example - * arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</li> * <li>Alias ARN Example - * arn:aws:kms:us-east-1:123456789012:alias/MyAliasName</li> <li>Globally * Unique Key ID Example - 12345678-1234-1234-1234-123456789012</li> * <li>Alias Name Example - alias/MyAliasName</li> </ul> * <p> * <b>Constraints:</b><br/> * <b>Length: </b>1 - 256<br/> * * @return A unique identifier for the customer master key. This value can be a * globally unique identifier, a fully specified ARN to either an alias * or a key, or an alias name prefixed by "alias/". <ul> <li>Key ARN * Example - * arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</li> * <li>Alias ARN Example - * arn:aws:kms:us-east-1:123456789012:alias/MyAliasName</li> <li>Globally * Unique Key ID Example - 12345678-1234-1234-1234-123456789012</li> * <li>Alias Name Example - alias/MyAliasName</li> </ul> */ public String getKeyId() { return keyId; } /** * A unique identifier for the customer master key. This value can be a * globally unique identifier, a fully specified ARN to either an alias * or a key, or an alias name prefixed by "alias/". <ul> <li>Key ARN * Example - * arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</li> * <li>Alias ARN Example - * arn:aws:kms:us-east-1:123456789012:alias/MyAliasName</li> <li>Globally * Unique Key ID Example - 12345678-1234-1234-1234-123456789012</li> * <li>Alias Name Example - alias/MyAliasName</li> </ul> * <p> * <b>Constraints:</b><br/> * <b>Length: </b>1 - 256<br/> * * @param keyId A unique identifier for the customer master key. This value can be a * globally unique identifier, a fully specified ARN to either an alias * or a key, or an alias name prefixed by "alias/". <ul> <li>Key ARN * Example - * arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</li> * <li>Alias ARN Example - * arn:aws:kms:us-east-1:123456789012:alias/MyAliasName</li> <li>Globally * Unique Key ID Example - 12345678-1234-1234-1234-123456789012</li> * <li>Alias Name Example - alias/MyAliasName</li> </ul> */ public void setKeyId(String keyId) { this.keyId = keyId; } /** * A unique identifier for the customer master key. This value can be a * globally unique identifier, a fully specified ARN to either an alias * or a key, or an alias name prefixed by "alias/". <ul> <li>Key ARN * Example - * arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</li> * <li>Alias ARN Example - * arn:aws:kms:us-east-1:123456789012:alias/MyAliasName</li> <li>Globally * Unique Key ID Example - 12345678-1234-1234-1234-123456789012</li> * <li>Alias Name Example - alias/MyAliasName</li> </ul> * <p> * Returns a reference to this object so that method calls can be chained together. * <p> * <b>Constraints:</b><br/> * <b>Length: </b>1 - 256<br/> * * @param keyId A unique identifier for the customer master key. This value can be a * globally unique identifier, a fully specified ARN to either an alias * or a key, or an alias name prefixed by "alias/". <ul> <li>Key ARN * Example - * arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012</li> * <li>Alias ARN Example - * arn:aws:kms:us-east-1:123456789012:alias/MyAliasName</li> <li>Globally * Unique Key ID Example - 12345678-1234-1234-1234-123456789012</li> * <li>Alias Name Example - alias/MyAliasName</li> </ul> * * @return A reference to this updated object so that method calls can be chained * together. */ public EncryptRequest withKeyId(String keyId) { this.keyId = keyId; return this; } /** * Data to be encrypted. * <p> * <b>Constraints:</b><br/> * <b>Length: </b>1 - 4096<br/> * * @return Data to be encrypted. */ public java.nio.ByteBuffer getPlaintext() { return plaintext; } /** * Data to be encrypted. * <p> * <b>Constraints:</b><br/> * <b>Length: </b>1 - 4096<br/> * * @param plaintext Data to be encrypted. */ public void setPlaintext(java.nio.ByteBuffer plaintext) { this.plaintext = plaintext; } /** * Data to be encrypted. * <p> * Returns a reference to this object so that method calls can be chained together. * <p> * <b>Constraints:</b><br/> * <b>Length: </b>1 - 4096<br/> * * @param plaintext Data to be encrypted. * * @return A reference to this updated object so that method calls can be chained * together. */ public EncryptRequest withPlaintext(java.nio.ByteBuffer plaintext) { this.plaintext = plaintext; return this; } /** * Name/value pair that specifies the encryption context to be used for * authenticated encryption. If used here, the same value must be * supplied to the <code>Decrypt</code> API or decryption will fail. For * more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/encrypt-context.html">Encryption * Context</a>. * * @return Name/value pair that specifies the encryption context to be used for * authenticated encryption. If used here, the same value must be * supplied to the <code>Decrypt</code> API or decryption will fail. For * more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/encrypt-context.html">Encryption * Context</a>. */ public java.util.Map<String,String> getEncryptionContext() { if (encryptionContext == null) { encryptionContext = new java.util.HashMap<String,String>(); } return encryptionContext; } /** * Name/value pair that specifies the encryption context to be used for * authenticated encryption. If used here, the same value must be * supplied to the <code>Decrypt</code> API or decryption will fail. For * more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/encrypt-context.html">Encryption * Context</a>. * * @param encryptionContext Name/value pair that specifies the encryption context to be used for * authenticated encryption. If used here, the same value must be * supplied to the <code>Decrypt</code> API or decryption will fail. For * more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/encrypt-context.html">Encryption * Context</a>. */ public void setEncryptionContext(java.util.Map<String,String> encryptionContext) { this.encryptionContext = encryptionContext; } /** * Name/value pair that specifies the encryption context to be used for * authenticated encryption. If used here, the same value must be * supplied to the <code>Decrypt</code> API or decryption will fail. For * more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/encrypt-context.html">Encryption * Context</a>. * <p> * Returns a reference to this object so that method calls can be chained together. * * @param encryptionContext Name/value pair that specifies the encryption context to be used for * authenticated encryption. If used here, the same value must be * supplied to the <code>Decrypt</code> API or decryption will fail. For * more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/encrypt-context.html">Encryption * Context</a>. * * @return A reference to this updated object so that method calls can be chained * together. */ public EncryptRequest withEncryptionContext(java.util.Map<String,String> encryptionContext) { setEncryptionContext(encryptionContext); return this; } /** * Name/value pair that specifies the encryption context to be used for * authenticated encryption. If used here, the same value must be * supplied to the <code>Decrypt</code> API or decryption will fail. For * more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/encrypt-context.html">Encryption * Context</a>. * <p> * The method adds a new key-value pair into EncryptionContext parameter, * and returns a reference to this object so that method calls can be * chained together. * * @param key The key of the entry to be added into EncryptionContext. * @param value The corresponding value of the entry to be added into EncryptionContext. */ public EncryptRequest addEncryptionContextEntry(String key, String value) { if (null == this.encryptionContext) { this.encryptionContext = new java.util.HashMap<String,String>(); } if (this.encryptionContext.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.encryptionContext.put(key, value); return this; } /** * Removes all the entries added into EncryptionContext. * <p> * Returns a reference to this object so that method calls can be chained together. */ public EncryptRequest clearEncryptionContextEntries() { this.encryptionContext = null; return this; } /** * For more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token">Grant * Tokens</a>. * <p> * <b>Constraints:</b><br/> * <b>Length: </b>0 - 10<br/> * * @return For more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token">Grant * Tokens</a>. */ public java.util.List<String> getGrantTokens() { if (grantTokens == null) { grantTokens = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(); grantTokens.setAutoConstruct(true); } return grantTokens; } /** * For more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token">Grant * Tokens</a>. * <p> * <b>Constraints:</b><br/> * <b>Length: </b>0 - 10<br/> * * @param grantTokens For more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token">Grant * Tokens</a>. */ public void setGrantTokens(java.util.Collection<String> grantTokens) { if (grantTokens == null) { this.grantTokens = null; return; } com.amazonaws.internal.ListWithAutoConstructFlag<String> grantTokensCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(grantTokens.size()); grantTokensCopy.addAll(grantTokens); this.grantTokens = grantTokensCopy; } /** * For more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token">Grant * Tokens</a>. * <p> * <b>NOTE:</b> This method appends the values to the existing list (if * any). Use {@link #setGrantTokens(java.util.Collection)} or {@link * #withGrantTokens(java.util.Collection)} if you want to override the * existing values. * <p> * Returns a reference to this object so that method calls can be chained together. * <p> * <b>Constraints:</b><br/> * <b>Length: </b>0 - 10<br/> * * @param grantTokens For more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token">Grant * Tokens</a>. * * @return A reference to this updated object so that method calls can be chained * together. */ public EncryptRequest withGrantTokens(String... grantTokens) { if (getGrantTokens() == null) setGrantTokens(new java.util.ArrayList<String>(grantTokens.length)); for (String value : grantTokens) { getGrantTokens().add(value); } return this; } /** * For more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token">Grant * Tokens</a>. * <p> * Returns a reference to this object so that method calls can be chained together. * <p> * <b>Constraints:</b><br/> * <b>Length: </b>0 - 10<br/> * * @param grantTokens For more information, see <a * href="http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token">Grant * Tokens</a>. * * @return A reference to this updated object so that method calls can be chained * together. */ public EncryptRequest withGrantTokens(java.util.Collection<String> grantTokens) { if (grantTokens == null) { this.grantTokens = null; } else { com.amazonaws.internal.ListWithAutoConstructFlag<String> grantTokensCopy = new com.amazonaws.internal.ListWithAutoConstructFlag<String>(grantTokens.size()); grantTokensCopy.addAll(grantTokens); this.grantTokens = grantTokensCopy; } return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getKeyId() != null) sb.append("KeyId: " + getKeyId() + ","); if (getPlaintext() != null) sb.append("Plaintext: " + getPlaintext() + ","); if (getEncryptionContext() != null) sb.append("EncryptionContext: " + getEncryptionContext() + ","); if (getGrantTokens() != null) sb.append("GrantTokens: " + getGrantTokens() ); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getKeyId() == null) ? 0 : getKeyId().hashCode()); hashCode = prime * hashCode + ((getPlaintext() == null) ? 0 : getPlaintext().hashCode()); hashCode = prime * hashCode + ((getEncryptionContext() == null) ? 0 : getEncryptionContext().hashCode()); hashCode = prime * hashCode + ((getGrantTokens() == null) ? 0 : getGrantTokens().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof EncryptRequest == false) return false; EncryptRequest other = (EncryptRequest)obj; if (other.getKeyId() == null ^ this.getKeyId() == null) return false; if (other.getKeyId() != null && other.getKeyId().equals(this.getKeyId()) == false) return false; if (other.getPlaintext() == null ^ this.getPlaintext() == null) return false; if (other.getPlaintext() != null && other.getPlaintext().equals(this.getPlaintext()) == false) return false; if (other.getEncryptionContext() == null ^ this.getEncryptionContext() == null) return false; if (other.getEncryptionContext() != null && other.getEncryptionContext().equals(this.getEncryptionContext()) == false) return false; if (other.getGrantTokens() == null ^ this.getGrantTokens() == null) return false; if (other.getGrantTokens() != null && other.getGrantTokens().equals(this.getGrantTokens()) == false) return false; return true; } @Override public EncryptRequest clone() { return (EncryptRequest) super.clone(); } }
20,716
0.635547
0.601709
494
40.927124
34.17878
168
false
false
0
0
0
0
0
0
0.269231
false
false
2