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
c2859b6ef056a1a9312639e0524a006856ad904f
24,111,946,463,295
ff31dcb3a6c54ed1d90c8f9a784a9960ece928b3
/src/main/java/cc/mrbird/febs/monitor/entity/AskInfo.java
d3b0d7486ae6b0fd635e3cd36e334f1409fdf77e
[ "Apache-2.0" ]
permissive
sanwan99/ChemistrySystem
https://github.com/sanwan99/ChemistrySystem
dfd606ee0d02f4c66320643e8cf1672f0ac8fd80
78d750a8bb748fd2c0e3f9b060a5a47b3c91e1cb
refs/heads/master
2023-07-25T09:44:13.182000
2021-09-09T03:25:24
2021-09-09T03:25:24
404,569,092
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package cc.mrbird.febs.monitor.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import com.wuwenze.poi.annotation.ExcelField; import lombok.Data; import javax.validation.constraints.Size; import java.io.Serializable; import java.util.Date; @TableName("t_ask") @Data public class AskInfo implements Serializable { private static final long serialVersionUID = -5178504845341050690L; // @TableId(value = "ID") // private Long ID; @TableId(value = "ID",type = IdType.AUTO) private Long id; @TableField(value = "Chemistry_ID") private Long chemistryId; @TableField("CHEMISTRYNAME") private String chemistryName; @TableField("DESCRIPTION") @Size(max = 100, message = "{noMoreThan}") @ExcelField(value = "试剂描述") private String description; @TableField("STATUS") private String status; @TableField("USERNAME") private String username; @TableField("CREATE_TIME") @JsonFormat(pattern = "yyyy年dd日HH时",timezone = "GMT+8") private Date createTime; }
UTF-8
Java
1,262
java
AskInfo.java
Java
[]
null
[]
package cc.mrbird.febs.monitor.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import com.wuwenze.poi.annotation.ExcelField; import lombok.Data; import javax.validation.constraints.Size; import java.io.Serializable; import java.util.Date; @TableName("t_ask") @Data public class AskInfo implements Serializable { private static final long serialVersionUID = -5178504845341050690L; // @TableId(value = "ID") // private Long ID; @TableId(value = "ID",type = IdType.AUTO) private Long id; @TableField(value = "Chemistry_ID") private Long chemistryId; @TableField("CHEMISTRYNAME") private String chemistryName; @TableField("DESCRIPTION") @Size(max = 100, message = "{noMoreThan}") @ExcelField(value = "试剂描述") private String description; @TableField("STATUS") private String status; @TableField("USERNAME") private String username; @TableField("CREATE_TIME") @JsonFormat(pattern = "yyyy年dd日HH时",timezone = "GMT+8") private Date createTime; }
1,262
0.737179
0.71875
45
26.733334
19.249704
71
false
false
0
0
0
0
0
0
0.511111
false
false
7
d3a21bb07daa557bbf731c214cb60fcb37be952d
21,672,405,037,660
76e099eda8969cad945678e93f9e48655d76685e
/MoneyLover/app/src/main/java/com/facebook/crypto/keygen/PasswordBasedKeyDerivation.java
137fab0120943a70380f335cfc435e55cbf458d1
[]
no_license
NguyenTheTrinh/money
https://github.com/NguyenTheTrinh/money
44536145980466973c9599ad81c52cc228834223
4a471a10dabb3f42a98c398367ab44c834bbadfb
refs/heads/master
2018-05-02T14:39:20.869000
2017-12-05T04:52:07
2017-12-05T04:52:07
92,408,243
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.facebook.crypto.keygen; import com.facebook.crypto.util.*; import java.security.*; import com.facebook.crypto.exception.*; public class PasswordBasedKeyDerivation { public static final int DEFAULT_ITERATIONS = 4096; public static final int DEFAULT_KEY_LENGTH = 16; private static final int DEFAULT_SALT_LENGTH = 16; public static final int MINIMUM_ITERATIONS = 1; public static final int MINIMUM_KEY_LENGTH = 8; private static final int MINIMUM_SALT_LENGTH = 4; private byte[] mGeneratedKey; private int mIterations; private int mKeyLengthInBytes; private final NativeCryptoLibrary mNativeLibrary; private String mPassword; private byte[] mSalt; private final SecureRandom mSecureRandom; public PasswordBasedKeyDerivation(final SecureRandom mSecureRandom, final NativeCryptoLibrary mNativeLibrary) { this.mSecureRandom = mSecureRandom; this.mNativeLibrary = mNativeLibrary; this.mIterations = 4096; this.mKeyLengthInBytes = 16; } private native int nativePbkdf2(final String p0, final byte[] p1, final int p2, final byte[] p3); public byte[] generate() throws CryptoInitializationException { if (this.mPassword == null) { throw new IllegalStateException("Password was not set"); } if (this.mSalt == null) { this.mSalt = new byte[16]; this.mSecureRandom.nextBytes(this.mSalt); } this.mGeneratedKey = new byte[this.mKeyLengthInBytes]; this.mNativeLibrary.ensureCryptoLoaded(); if (this.nativePbkdf2(this.mPassword, this.mSalt, this.mIterations, this.mGeneratedKey) != 1) { throw new RuntimeException("Native PBKDF2 failed..."); } return this.mGeneratedKey; } public byte[] getGeneratedKey() { return this.mGeneratedKey; } public int getIterations() { return this.mIterations; } public int getKeyLengthInBytes() { return this.mKeyLengthInBytes; } public String getPassword() { return this.mPassword; } public byte[] getSalt() { return this.mSalt; } public PasswordBasedKeyDerivation setIterations(final int mIterations) { if (mIterations < 1) { throw new IllegalArgumentException("Iterations cannot be less than 1"); } this.mIterations = mIterations; return this; } public PasswordBasedKeyDerivation setKeyLengthInBytes(final int mKeyLengthInBytes) { if (mKeyLengthInBytes < 8) { throw new IllegalArgumentException("Key length cannot be less than 8 bytes"); } this.mKeyLengthInBytes = mKeyLengthInBytes; return this; } public PasswordBasedKeyDerivation setPassword(final String mPassword) { if (mPassword == null) { throw new IllegalArgumentException("Password cannot be null"); } this.mPassword = mPassword; return this; } public PasswordBasedKeyDerivation setSalt(final byte[] mSalt) { if (mSalt != null && mSalt.length < 4) { throw new IllegalArgumentException("Salt cannot be shorter than 8 bytes"); } this.mSalt = mSalt; return this; } }
UTF-8
Java
3,326
java
PasswordBasedKeyDerivation.java
Java
[ { "context": "nnot be null\");\n }\n this.mPassword = mPassword;\n return this;\n }\n \n public Passw", "end": 3021, "score": 0.9901931285858154, "start": 3012, "tag": "PASSWORD", "value": "mPassword" } ]
null
[]
package com.facebook.crypto.keygen; import com.facebook.crypto.util.*; import java.security.*; import com.facebook.crypto.exception.*; public class PasswordBasedKeyDerivation { public static final int DEFAULT_ITERATIONS = 4096; public static final int DEFAULT_KEY_LENGTH = 16; private static final int DEFAULT_SALT_LENGTH = 16; public static final int MINIMUM_ITERATIONS = 1; public static final int MINIMUM_KEY_LENGTH = 8; private static final int MINIMUM_SALT_LENGTH = 4; private byte[] mGeneratedKey; private int mIterations; private int mKeyLengthInBytes; private final NativeCryptoLibrary mNativeLibrary; private String mPassword; private byte[] mSalt; private final SecureRandom mSecureRandom; public PasswordBasedKeyDerivation(final SecureRandom mSecureRandom, final NativeCryptoLibrary mNativeLibrary) { this.mSecureRandom = mSecureRandom; this.mNativeLibrary = mNativeLibrary; this.mIterations = 4096; this.mKeyLengthInBytes = 16; } private native int nativePbkdf2(final String p0, final byte[] p1, final int p2, final byte[] p3); public byte[] generate() throws CryptoInitializationException { if (this.mPassword == null) { throw new IllegalStateException("Password was not set"); } if (this.mSalt == null) { this.mSalt = new byte[16]; this.mSecureRandom.nextBytes(this.mSalt); } this.mGeneratedKey = new byte[this.mKeyLengthInBytes]; this.mNativeLibrary.ensureCryptoLoaded(); if (this.nativePbkdf2(this.mPassword, this.mSalt, this.mIterations, this.mGeneratedKey) != 1) { throw new RuntimeException("Native PBKDF2 failed..."); } return this.mGeneratedKey; } public byte[] getGeneratedKey() { return this.mGeneratedKey; } public int getIterations() { return this.mIterations; } public int getKeyLengthInBytes() { return this.mKeyLengthInBytes; } public String getPassword() { return this.mPassword; } public byte[] getSalt() { return this.mSalt; } public PasswordBasedKeyDerivation setIterations(final int mIterations) { if (mIterations < 1) { throw new IllegalArgumentException("Iterations cannot be less than 1"); } this.mIterations = mIterations; return this; } public PasswordBasedKeyDerivation setKeyLengthInBytes(final int mKeyLengthInBytes) { if (mKeyLengthInBytes < 8) { throw new IllegalArgumentException("Key length cannot be less than 8 bytes"); } this.mKeyLengthInBytes = mKeyLengthInBytes; return this; } public PasswordBasedKeyDerivation setPassword(final String mPassword) { if (mPassword == null) { throw new IllegalArgumentException("Password cannot be null"); } this.mPassword = <PASSWORD>; return this; } public PasswordBasedKeyDerivation setSalt(final byte[] mSalt) { if (mSalt != null && mSalt.length < 4) { throw new IllegalArgumentException("Salt cannot be shorter than 8 bytes"); } this.mSalt = mSalt; return this; } }
3,327
0.653638
0.643716
99
32.595959
26.774374
115
false
false
0
0
0
0
0
0
0.535354
false
false
7
ac0af92de19332305c42c49a7a100f8030cffd93
36,507,222,028,363
59c304ba8532e2d06f549dfc1f4258ac5e90ab65
/voronoi-pages-app/src/test/java/uq/VoronoiDiagramGenerator.java
856395002646fad0f7b11cea3d823b68a6766cf1
[]
no_license
douglasapeixoto/voronoi-pages-spark
https://github.com/douglasapeixoto/voronoi-pages-spark
5c70348885dfae022eb6adca0c4e0fcd9c157ce5
0246d272e083c3c22102990e9aab841dbaf8f7dd
refs/heads/master
2020-12-29T00:13:08.771000
2016-06-15T08:23:19
2016-06-15T08:23:19
46,105,129
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package uq; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import uq.spatial.Point; import uq.spatial.delaunay.DelaunayTriangulation; import uq.spatial.delaunay.TriangleEdge; import uq.spatial.delaunay.Triangle; /** * Build a Voronoi diagram from a set of points (pivots). * Given a list of points, first calculate the Delaunay * triangulation, then calculate the dual graph of the * triagulation. Return the Voronoi polygon edges. * * Note that the list of points must not contain * repeated points, i.e. same X and Y coordinates. * * @author uqdalves * */ @SuppressWarnings("serial") public class VoronoiDiagramGenerator implements Serializable { /** * Test */ public static void main(String []arg0){ /* Point p1 = new Point(0, 40, 1);p1.pivotId=1; Point p2 = new Point(40, -10, 2);p2.pivotId=2; Point p3 = new Point(50, 100, 3);p3.pivotId=3; Point p4 = new Point(95, 0, 4);p4.pivotId=4; Point p5 = new Point(120, 60, 5);p5.pivotId=5;*/ Point p1 = new Point(0, 0);p1.pivotId=1; Point p2 = new Point(10, 10);p2.pivotId=2; Point p3 = new Point(15, -10);p3.pivotId=3; Point p4 = new Point(20, 3);p4.pivotId=4; Point p5 = new Point(25, 0);p5.pivotId=5; Point p6 = new Point(30, 20);p6.pivotId=6; Point p7 = new Point(38, 8);p7.pivotId=7; Point p8 = new Point(45, -5);p8.pivotId=8; List<Point> pivots = new ArrayList<Point>(); pivots.add(p1); pivots.add(p2); pivots.add(p3); pivots.add(p4); pivots.add(p5); pivots.add(p6); pivots.add(p7); pivots.add(p8); List<TriangleEdge> edges = build(pivots); System.out.println("Voronoi Edges: " + edges.size()); for(TriangleEdge e : edges){ e.print(); System.out.println(); } } /** * Build a Voronoi diagram from a set of points (pivots). * Return the Voronoi polygon edges. */ public static List<TriangleEdge> build(List<Point> pointsList){ // computes the Delaunay triangulation DelaunayTriangulation delaunay = new DelaunayTriangulation(); List<Triangle> triangleList = delaunay.triangulate(pointsList); // max bounding rectangle /* double minX = -100000; double maxX = 100000; double minY = -100000; double maxY = 100000; */ // build an edge between every triangle's circumcenter // and its adjacent's triangle circumcenter. List<TriangleEdge> edgeList = new ArrayList<TriangleEdge>(); for(int i=0; i<triangleList.size()-1; i++){ Triangle tri_i = triangleList.get(i); int numAdjacent = 0; // compute internal edges for(int j=i+1; j<triangleList.size(); j++){ Triangle tri_j = triangleList.get(j); if(tri_j.isAdjacent(tri_i)){ edgeList.add(new TriangleEdge(tri_i.circumcenter(), tri_j.circumcenter())); numAdjacent++; } // already computed all edges if(numAdjacent == 3){ break; } } // TODO: // if tri_i is a border triangle, // compute external edges. if(numAdjacent == 2){ // get the outer edge of this triangle // computa o vetor que eh perpendicular (ortogonal) a esta aresta } if(numAdjacent == 1){ } } // se o triangulo so tivetr dois adjacentes, // entao ele eh um triangulo de borda, // tem que fazer uma aresta do circuncentro dele indo pro infinito return edgeList; } }
UTF-8
Java
3,322
java
VoronoiDiagramGenerator.java
Java
[ { "context": "nts, i.e. same X and Y coordinates.\n * \n * @author uqdalves\n *\n */\n@SuppressWarnings(\"serial\")\npublic class V", "end": 603, "score": 0.9995381832122803, "start": 595, "tag": "USERNAME", "value": "uqdalves" } ]
null
[]
package uq; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import uq.spatial.Point; import uq.spatial.delaunay.DelaunayTriangulation; import uq.spatial.delaunay.TriangleEdge; import uq.spatial.delaunay.Triangle; /** * Build a Voronoi diagram from a set of points (pivots). * Given a list of points, first calculate the Delaunay * triangulation, then calculate the dual graph of the * triagulation. Return the Voronoi polygon edges. * * Note that the list of points must not contain * repeated points, i.e. same X and Y coordinates. * * @author uqdalves * */ @SuppressWarnings("serial") public class VoronoiDiagramGenerator implements Serializable { /** * Test */ public static void main(String []arg0){ /* Point p1 = new Point(0, 40, 1);p1.pivotId=1; Point p2 = new Point(40, -10, 2);p2.pivotId=2; Point p3 = new Point(50, 100, 3);p3.pivotId=3; Point p4 = new Point(95, 0, 4);p4.pivotId=4; Point p5 = new Point(120, 60, 5);p5.pivotId=5;*/ Point p1 = new Point(0, 0);p1.pivotId=1; Point p2 = new Point(10, 10);p2.pivotId=2; Point p3 = new Point(15, -10);p3.pivotId=3; Point p4 = new Point(20, 3);p4.pivotId=4; Point p5 = new Point(25, 0);p5.pivotId=5; Point p6 = new Point(30, 20);p6.pivotId=6; Point p7 = new Point(38, 8);p7.pivotId=7; Point p8 = new Point(45, -5);p8.pivotId=8; List<Point> pivots = new ArrayList<Point>(); pivots.add(p1); pivots.add(p2); pivots.add(p3); pivots.add(p4); pivots.add(p5); pivots.add(p6); pivots.add(p7); pivots.add(p8); List<TriangleEdge> edges = build(pivots); System.out.println("Voronoi Edges: " + edges.size()); for(TriangleEdge e : edges){ e.print(); System.out.println(); } } /** * Build a Voronoi diagram from a set of points (pivots). * Return the Voronoi polygon edges. */ public static List<TriangleEdge> build(List<Point> pointsList){ // computes the Delaunay triangulation DelaunayTriangulation delaunay = new DelaunayTriangulation(); List<Triangle> triangleList = delaunay.triangulate(pointsList); // max bounding rectangle /* double minX = -100000; double maxX = 100000; double minY = -100000; double maxY = 100000; */ // build an edge between every triangle's circumcenter // and its adjacent's triangle circumcenter. List<TriangleEdge> edgeList = new ArrayList<TriangleEdge>(); for(int i=0; i<triangleList.size()-1; i++){ Triangle tri_i = triangleList.get(i); int numAdjacent = 0; // compute internal edges for(int j=i+1; j<triangleList.size(); j++){ Triangle tri_j = triangleList.get(j); if(tri_j.isAdjacent(tri_i)){ edgeList.add(new TriangleEdge(tri_i.circumcenter(), tri_j.circumcenter())); numAdjacent++; } // already computed all edges if(numAdjacent == 3){ break; } } // TODO: // if tri_i is a border triangle, // compute external edges. if(numAdjacent == 2){ // get the outer edge of this triangle // computa o vetor que eh perpendicular (ortogonal) a esta aresta } if(numAdjacent == 1){ } } // se o triangulo so tivetr dois adjacentes, // entao ele eh um triangulo de borda, // tem que fazer uma aresta do circuncentro dele indo pro infinito return edgeList; } }
3,322
0.665262
0.626129
116
27.637932
20.746996
70
false
false
0
0
0
0
0
0
2.706897
false
false
7
a9fa32187508ba8944e0e7a22856d74411705b9a
35,562,329,239,553
e0971d53af9383480eda3f984be7c11b0ab492e0
/src/test/java/phrasecount/PhraseCounterTest.java
91a6877a565b320c2f47aabc0f56cd2364a85d93
[ "Apache-2.0" ]
permissive
keith-turner/phrasecount
https://github.com/keith-turner/phrasecount
ec83ab91f57410c287e0b219cb23d1bb58217bf4
fde5547ccd9ca98e7fd727a71d028f884e26ce0d
refs/heads/master
2021-01-18T05:21:28.086000
2015-06-24T21:39:37
2015-06-24T21:39:37
24,682,945
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package phrasecount; import java.util.Arrays; import java.util.Map; import java.util.Random; import java.util.concurrent.atomic.AtomicInteger; import io.fluo.api.client.FluoAdmin.InitOpts; import io.fluo.api.client.FluoClient; import io.fluo.api.client.FluoFactory; import io.fluo.api.client.LoaderExecutor; import io.fluo.api.config.FluoConfiguration; import io.fluo.api.config.ObserverConfiguration; import io.fluo.api.data.Column; import io.fluo.api.mini.MiniFluo; import io.fluo.api.types.TypedSnapshot; import io.fluo.api.types.TypedSnapshotBase.Value; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.minicluster.MiniAccumuloCluster; import org.apache.accumulo.minicluster.MiniAccumuloConfig; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.junit.rules.TemporaryFolder; import static phrasecount.Constants.DOC_CONTENT_COL; import static phrasecount.Constants.DOC_REF_COUNT_COL; import static phrasecount.Constants.STAT_DOC_COUNT_COL; import static phrasecount.Constants.STAT_SUM_COL; import static phrasecount.Constants.TYPEL; //TODO make this an integration test public class PhraseCounterTest { public static TemporaryFolder folder = new TemporaryFolder(); public static MiniAccumuloCluster cluster; private static FluoConfiguration props; private static MiniFluo miniFluo; private static final PasswordToken password = new PasswordToken("secret"); private static AtomicInteger tableCounter = new AtomicInteger(1); @BeforeClass public static void setUpBeforeClass() throws Exception { folder.create(); MiniAccumuloConfig cfg = new MiniAccumuloConfig(folder.newFolder("miniAccumulo"), new String(password.getPassword())); cluster = new MiniAccumuloCluster(cfg); cluster.start(); } @AfterClass public static void tearDownAfterClass() throws Exception { cluster.stop(); folder.delete(); } @Before public void setUpFluo() throws Exception { // TODO add helper code to make this shorter props = new FluoConfiguration(); props.setMiniStartAccumulo(false); props.setApplicationName("phrasecount"); props.setAccumuloInstance(cluster.getInstanceName()); props.setAccumuloUser("root"); props.setAccumuloPassword("secret"); props.setInstanceZookeepers(cluster.getZooKeepers()+"/fluo"); props.setAccumuloZookeepers(cluster.getZooKeepers()); props.setAccumuloTable("data" + tableCounter.getAndIncrement()); props.setWorkerThreads(5); props.setObservers(Arrays.asList(new ObserverConfiguration(PhraseCounter.class.getName()), new ObserverConfiguration(HCCounter.class.getName()))); FluoFactory.newAdmin(props).initialize(new InitOpts().setClearTable(true).setClearZookeeper(true)); miniFluo = FluoFactory.newMiniFluo(props); } @After public void tearDownFluo() throws Exception { miniFluo.close(); } static class PhraseInfo { public PhraseInfo() {} public PhraseInfo(int s, int n) { this.sum = s; this.numDocs = n; } int sum; int numDocs; @Override public boolean equals(Object o) { if (o instanceof PhraseInfo) { PhraseInfo opi = (PhraseInfo) o; return sum == opi.sum && numDocs == opi.numDocs; } return false; } @Override public String toString() { return numDocs + " " + sum; } } private PhraseInfo getPhraseInfo(FluoClient fluoClient, String phrase) throws Exception { TypedSnapshot tsnap = TYPEL.wrap(fluoClient.newSnapshot()); Map<Column,Value> map = tsnap.get().row("phrase:" + phrase).columns(STAT_SUM_COL, STAT_DOC_COUNT_COL); if (map.size() == 0) return null; PhraseInfo pi = new PhraseInfo(); pi.sum = map.get(STAT_SUM_COL).toInteger(); pi.numDocs = map.get(STAT_DOC_COUNT_COL).toInteger(); return pi; } private void loadDocument(LoaderExecutor le, String uri, String content) { Document doc = new Document(uri, content); le.execute(new DocumentLoader(doc)); miniFluo.waitForObservers(); } @Test public void test1() throws Exception { FluoConfiguration lep = new FluoConfiguration(props); lep.setLoaderThreads(0); lep.setLoaderQueueSize(0); FluoClient fluoClient = FluoFactory.newClient(lep); LoaderExecutor le = fluoClient.newLoaderExecutor(); loadDocument(le, "/foo1", "This is only a test. Do not panic. This is only a test."); Assert.assertEquals(new PhraseInfo(2, 1), getPhraseInfo(fluoClient, "is only a test")); Assert.assertEquals(new PhraseInfo(1, 1), getPhraseInfo(fluoClient, "test do not panic")); // add new document w/ different content and overlapping phrase.. should change some counts loadDocument(le, "/foo2", "This is only a test"); Assert.assertEquals(new PhraseInfo(3, 2), getPhraseInfo(fluoClient, "is only a test")); Assert.assertEquals(new PhraseInfo(1, 1), getPhraseInfo(fluoClient, "test do not panic")); // add new document w/ same content, should not change any counts loadDocument(le, "/foo3", "This is only a test"); Assert.assertEquals(new PhraseInfo(3, 2), getPhraseInfo(fluoClient, "is only a test")); Assert.assertEquals(new PhraseInfo(1, 1), getPhraseInfo(fluoClient, "test do not panic")); // change the content of /foo1, should change counts loadDocument(le, "/foo1", "The test is over, for now."); Assert.assertEquals(new PhraseInfo(1, 1), getPhraseInfo(fluoClient, "the test is over")); Assert.assertEquals(new PhraseInfo(1, 1), getPhraseInfo(fluoClient, "is only a test")); Assert.assertNull(getPhraseInfo(fluoClient, "test do not panic")); // change content of foo2, should not change anything loadDocument(le, "/foo2", "The test is over, for now."); Assert.assertEquals(new PhraseInfo(1, 1), getPhraseInfo(fluoClient, "the test is over")); Assert.assertEquals(new PhraseInfo(1, 1), getPhraseInfo(fluoClient, "is only a test")); Assert.assertNull(getPhraseInfo(fluoClient, "test do not panic")); String oldHash = new Document("/foo3", "This is only a test").getHash(); TypedSnapshot tsnap = TYPEL.wrap(fluoClient.newSnapshot()); Assert.assertNotNull(tsnap.get().row("doc:" + oldHash).col(DOC_CONTENT_COL).toString()); Assert.assertEquals(1, tsnap.get().row("doc:" + oldHash).col(DOC_REF_COUNT_COL).toInteger(0)); // dereference document that foo3 was referencing loadDocument(le, "/foo3", "The test is over, for now."); Assert.assertEquals(new PhraseInfo(1, 1), getPhraseInfo(fluoClient, "the test is over")); Assert.assertNull(getPhraseInfo(fluoClient, "is only a test")); Assert.assertNull(getPhraseInfo(fluoClient, "test do not panic")); tsnap = TYPEL.wrap(fluoClient.newSnapshot()); Assert.assertNull(tsnap.get().row("doc:" + oldHash).col(DOC_CONTENT_COL).toString()); Assert.assertNull(tsnap.get().row("doc:" + oldHash).col(DOC_REF_COUNT_COL).toInteger()); le.close(); fluoClient.close(); } @Test public void testHighCardinality() throws Exception { FluoConfiguration lep = new FluoConfiguration(props); lep.setLoaderThreads(0); lep.setLoaderQueueSize(0); FluoClient fluoClient = FluoFactory.newClient(lep); LoaderExecutor le = fluoClient.newLoaderExecutor(); Random rand = new Random(); loadDocsWithRandomWords(le, rand, "This is only a test", 0, 100); Assert.assertEquals(new PhraseInfo(100, 100), getPhraseInfo(fluoClient, "this is only a")); Assert.assertEquals(new PhraseInfo(100, 100), getPhraseInfo(fluoClient, "is only a test")); loadDocsWithRandomWords(le, rand, "This is not a test", 0, 2); Assert.assertEquals(new PhraseInfo(2, 2), getPhraseInfo(fluoClient, "this is not a")); Assert.assertEquals(new PhraseInfo(2, 2), getPhraseInfo(fluoClient, "is not a test")); Assert.assertEquals(new PhraseInfo(98, 98), getPhraseInfo(fluoClient, "this is only a")); Assert.assertEquals(new PhraseInfo(98, 98), getPhraseInfo(fluoClient, "is only a test")); loadDocsWithRandomWords(le, rand, "This is not a test", 2, 100); Assert.assertEquals(new PhraseInfo(100, 100), getPhraseInfo(fluoClient, "this is not a")); Assert.assertEquals(new PhraseInfo(100, 100), getPhraseInfo(fluoClient, "is not a test")); Assert.assertEquals(new PhraseInfo(0, 0), getPhraseInfo(fluoClient, "this is only a")); Assert.assertEquals(new PhraseInfo(0, 0), getPhraseInfo(fluoClient, "is only a test")); loadDocsWithRandomWords(le, rand, "This is only a test", 0, 50); Assert.assertEquals(new PhraseInfo(50, 50), getPhraseInfo(fluoClient, "this is not a")); Assert.assertEquals(new PhraseInfo(50, 50), getPhraseInfo(fluoClient, "is not a test")); Assert.assertEquals(new PhraseInfo(50, 50), getPhraseInfo(fluoClient, "this is only a")); Assert.assertEquals(new PhraseInfo(50, 50), getPhraseInfo(fluoClient, "is only a test")); le.close(); fluoClient.close(); } void loadDocsWithRandomWords(LoaderExecutor le, Random rand, String phrase, int start, int end) { // load many documents that share the same phrase for (int i = start; i < end; i++) { String uri = "/foo" + i; StringBuilder content = new StringBuilder(phrase); // add a bunch of random words for (int j = 0; j < 20; j++) { content.append(' '); content.append(Integer.toString(rand.nextInt(10000), 36)); } Document doc = new Document(uri, content.toString()); le.execute(new DocumentLoader(doc)); } miniFluo.waitForObservers(); } }
UTF-8
Java
9,672
java
PhraseCounterTest.java
Java
[ { "context": "final PasswordToken password = new PasswordToken(\"secret\");\n private static AtomicInteger tableCounter = ", "end": 1535, "score": 0.9779514074325562, "start": 1529, "tag": "PASSWORD", "value": "secret" }, { "context": "umuloUser(\"root\");\n props.setAccumuloPassword(\"secret\");\n props.setInstanceZookeepers(cluster.getZoo", "end": 2372, "score": 0.9994734525680542, "start": 2366, "tag": "PASSWORD", "value": "secret" } ]
null
[]
package phrasecount; import java.util.Arrays; import java.util.Map; import java.util.Random; import java.util.concurrent.atomic.AtomicInteger; import io.fluo.api.client.FluoAdmin.InitOpts; import io.fluo.api.client.FluoClient; import io.fluo.api.client.FluoFactory; import io.fluo.api.client.LoaderExecutor; import io.fluo.api.config.FluoConfiguration; import io.fluo.api.config.ObserverConfiguration; import io.fluo.api.data.Column; import io.fluo.api.mini.MiniFluo; import io.fluo.api.types.TypedSnapshot; import io.fluo.api.types.TypedSnapshotBase.Value; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.minicluster.MiniAccumuloCluster; import org.apache.accumulo.minicluster.MiniAccumuloConfig; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.junit.rules.TemporaryFolder; import static phrasecount.Constants.DOC_CONTENT_COL; import static phrasecount.Constants.DOC_REF_COUNT_COL; import static phrasecount.Constants.STAT_DOC_COUNT_COL; import static phrasecount.Constants.STAT_SUM_COL; import static phrasecount.Constants.TYPEL; //TODO make this an integration test public class PhraseCounterTest { public static TemporaryFolder folder = new TemporaryFolder(); public static MiniAccumuloCluster cluster; private static FluoConfiguration props; private static MiniFluo miniFluo; private static final PasswordToken password = new PasswordToken("<PASSWORD>"); private static AtomicInteger tableCounter = new AtomicInteger(1); @BeforeClass public static void setUpBeforeClass() throws Exception { folder.create(); MiniAccumuloConfig cfg = new MiniAccumuloConfig(folder.newFolder("miniAccumulo"), new String(password.getPassword())); cluster = new MiniAccumuloCluster(cfg); cluster.start(); } @AfterClass public static void tearDownAfterClass() throws Exception { cluster.stop(); folder.delete(); } @Before public void setUpFluo() throws Exception { // TODO add helper code to make this shorter props = new FluoConfiguration(); props.setMiniStartAccumulo(false); props.setApplicationName("phrasecount"); props.setAccumuloInstance(cluster.getInstanceName()); props.setAccumuloUser("root"); props.setAccumuloPassword("<PASSWORD>"); props.setInstanceZookeepers(cluster.getZooKeepers()+"/fluo"); props.setAccumuloZookeepers(cluster.getZooKeepers()); props.setAccumuloTable("data" + tableCounter.getAndIncrement()); props.setWorkerThreads(5); props.setObservers(Arrays.asList(new ObserverConfiguration(PhraseCounter.class.getName()), new ObserverConfiguration(HCCounter.class.getName()))); FluoFactory.newAdmin(props).initialize(new InitOpts().setClearTable(true).setClearZookeeper(true)); miniFluo = FluoFactory.newMiniFluo(props); } @After public void tearDownFluo() throws Exception { miniFluo.close(); } static class PhraseInfo { public PhraseInfo() {} public PhraseInfo(int s, int n) { this.sum = s; this.numDocs = n; } int sum; int numDocs; @Override public boolean equals(Object o) { if (o instanceof PhraseInfo) { PhraseInfo opi = (PhraseInfo) o; return sum == opi.sum && numDocs == opi.numDocs; } return false; } @Override public String toString() { return numDocs + " " + sum; } } private PhraseInfo getPhraseInfo(FluoClient fluoClient, String phrase) throws Exception { TypedSnapshot tsnap = TYPEL.wrap(fluoClient.newSnapshot()); Map<Column,Value> map = tsnap.get().row("phrase:" + phrase).columns(STAT_SUM_COL, STAT_DOC_COUNT_COL); if (map.size() == 0) return null; PhraseInfo pi = new PhraseInfo(); pi.sum = map.get(STAT_SUM_COL).toInteger(); pi.numDocs = map.get(STAT_DOC_COUNT_COL).toInteger(); return pi; } private void loadDocument(LoaderExecutor le, String uri, String content) { Document doc = new Document(uri, content); le.execute(new DocumentLoader(doc)); miniFluo.waitForObservers(); } @Test public void test1() throws Exception { FluoConfiguration lep = new FluoConfiguration(props); lep.setLoaderThreads(0); lep.setLoaderQueueSize(0); FluoClient fluoClient = FluoFactory.newClient(lep); LoaderExecutor le = fluoClient.newLoaderExecutor(); loadDocument(le, "/foo1", "This is only a test. Do not panic. This is only a test."); Assert.assertEquals(new PhraseInfo(2, 1), getPhraseInfo(fluoClient, "is only a test")); Assert.assertEquals(new PhraseInfo(1, 1), getPhraseInfo(fluoClient, "test do not panic")); // add new document w/ different content and overlapping phrase.. should change some counts loadDocument(le, "/foo2", "This is only a test"); Assert.assertEquals(new PhraseInfo(3, 2), getPhraseInfo(fluoClient, "is only a test")); Assert.assertEquals(new PhraseInfo(1, 1), getPhraseInfo(fluoClient, "test do not panic")); // add new document w/ same content, should not change any counts loadDocument(le, "/foo3", "This is only a test"); Assert.assertEquals(new PhraseInfo(3, 2), getPhraseInfo(fluoClient, "is only a test")); Assert.assertEquals(new PhraseInfo(1, 1), getPhraseInfo(fluoClient, "test do not panic")); // change the content of /foo1, should change counts loadDocument(le, "/foo1", "The test is over, for now."); Assert.assertEquals(new PhraseInfo(1, 1), getPhraseInfo(fluoClient, "the test is over")); Assert.assertEquals(new PhraseInfo(1, 1), getPhraseInfo(fluoClient, "is only a test")); Assert.assertNull(getPhraseInfo(fluoClient, "test do not panic")); // change content of foo2, should not change anything loadDocument(le, "/foo2", "The test is over, for now."); Assert.assertEquals(new PhraseInfo(1, 1), getPhraseInfo(fluoClient, "the test is over")); Assert.assertEquals(new PhraseInfo(1, 1), getPhraseInfo(fluoClient, "is only a test")); Assert.assertNull(getPhraseInfo(fluoClient, "test do not panic")); String oldHash = new Document("/foo3", "This is only a test").getHash(); TypedSnapshot tsnap = TYPEL.wrap(fluoClient.newSnapshot()); Assert.assertNotNull(tsnap.get().row("doc:" + oldHash).col(DOC_CONTENT_COL).toString()); Assert.assertEquals(1, tsnap.get().row("doc:" + oldHash).col(DOC_REF_COUNT_COL).toInteger(0)); // dereference document that foo3 was referencing loadDocument(le, "/foo3", "The test is over, for now."); Assert.assertEquals(new PhraseInfo(1, 1), getPhraseInfo(fluoClient, "the test is over")); Assert.assertNull(getPhraseInfo(fluoClient, "is only a test")); Assert.assertNull(getPhraseInfo(fluoClient, "test do not panic")); tsnap = TYPEL.wrap(fluoClient.newSnapshot()); Assert.assertNull(tsnap.get().row("doc:" + oldHash).col(DOC_CONTENT_COL).toString()); Assert.assertNull(tsnap.get().row("doc:" + oldHash).col(DOC_REF_COUNT_COL).toInteger()); le.close(); fluoClient.close(); } @Test public void testHighCardinality() throws Exception { FluoConfiguration lep = new FluoConfiguration(props); lep.setLoaderThreads(0); lep.setLoaderQueueSize(0); FluoClient fluoClient = FluoFactory.newClient(lep); LoaderExecutor le = fluoClient.newLoaderExecutor(); Random rand = new Random(); loadDocsWithRandomWords(le, rand, "This is only a test", 0, 100); Assert.assertEquals(new PhraseInfo(100, 100), getPhraseInfo(fluoClient, "this is only a")); Assert.assertEquals(new PhraseInfo(100, 100), getPhraseInfo(fluoClient, "is only a test")); loadDocsWithRandomWords(le, rand, "This is not a test", 0, 2); Assert.assertEquals(new PhraseInfo(2, 2), getPhraseInfo(fluoClient, "this is not a")); Assert.assertEquals(new PhraseInfo(2, 2), getPhraseInfo(fluoClient, "is not a test")); Assert.assertEquals(new PhraseInfo(98, 98), getPhraseInfo(fluoClient, "this is only a")); Assert.assertEquals(new PhraseInfo(98, 98), getPhraseInfo(fluoClient, "is only a test")); loadDocsWithRandomWords(le, rand, "This is not a test", 2, 100); Assert.assertEquals(new PhraseInfo(100, 100), getPhraseInfo(fluoClient, "this is not a")); Assert.assertEquals(new PhraseInfo(100, 100), getPhraseInfo(fluoClient, "is not a test")); Assert.assertEquals(new PhraseInfo(0, 0), getPhraseInfo(fluoClient, "this is only a")); Assert.assertEquals(new PhraseInfo(0, 0), getPhraseInfo(fluoClient, "is only a test")); loadDocsWithRandomWords(le, rand, "This is only a test", 0, 50); Assert.assertEquals(new PhraseInfo(50, 50), getPhraseInfo(fluoClient, "this is not a")); Assert.assertEquals(new PhraseInfo(50, 50), getPhraseInfo(fluoClient, "is not a test")); Assert.assertEquals(new PhraseInfo(50, 50), getPhraseInfo(fluoClient, "this is only a")); Assert.assertEquals(new PhraseInfo(50, 50), getPhraseInfo(fluoClient, "is only a test")); le.close(); fluoClient.close(); } void loadDocsWithRandomWords(LoaderExecutor le, Random rand, String phrase, int start, int end) { // load many documents that share the same phrase for (int i = start; i < end; i++) { String uri = "/foo" + i; StringBuilder content = new StringBuilder(phrase); // add a bunch of random words for (int j = 0; j < 20; j++) { content.append(' '); content.append(Integer.toString(rand.nextInt(10000), 36)); } Document doc = new Document(uri, content.toString()); le.execute(new DocumentLoader(doc)); } miniFluo.waitForObservers(); } }
9,680
0.715984
0.703474
254
37.074802
33.069931
150
false
false
0
0
0
0
0
0
1.086614
false
false
7
253f3f26bd4983b8f408612bffbdcdbd4449a6ba
38,147,899,523,096
cc16de383b8d4ea97d21a1b43bf4fd35b5114d19
/flow-server/src/main/java/com/vaadin/flow/internal/Range.java
8d5a60217967d56e57e7ce4549fe6336c7b84b80
[ "Apache-2.0" ]
permissive
vaadin/flow
https://github.com/vaadin/flow
2c1e446473a2f7d53bde4e5e41c36c96189b50f0
9f14bcd948457c44dfc1f5cf2ad27a43153775cf
refs/heads/main
2023-09-04T04:26:45.702000
2023-09-01T12:52:14
2023-09-01T12:52:14
34,809,191
561
234
Apache-2.0
false
2023-09-14T15:11:05
2015-04-29T17:54:35
2023-09-12T15:14:18
2023-09-14T15:11:03
189,270
517
151
1,056
Java
false
false
/* * Copyright 2000-2023 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.vaadin.flow.internal; import java.io.Serializable; import java.util.stream.IntStream; /** * An immutable representation of a range, marked by start and end points. * <p> * The range is treated as inclusive at the start, and exclusive at the end. * I.e. the range [0..1[ has the length 1, and represents one integer: 0. * <p> * The range is considered {@link #isEmpty() empty} if the start is the same as * the end. * <p> * For internal use only. May be renamed or removed in a future release. * * @author Vaadin Ltd * @since 1.0 */ public final class Range implements Serializable { private final int start; private final int end; /** * Overlay this range with another one, and partition the ranges according * to how they position relative to each other. * <p> * The three partitions are returned as a three-element Range array: * <ul> * <li>Elements in this range that occur before elements in * <code>other</code>. * <li>Elements that are shared between the two ranges. * <li>Elements in this range that occur after elements in * <code>other</code>. * </ul> * * @param other * the other range to act as delimiters. * @return a three-element Range array of partitions depicting the elements * before (index 0), shared/inside (index 1) and after (index 2). */ public Range[] partitionWith(final Range other) { final Range[] splitBefore = splitAt(other.getStart()); final Range rangeBefore = splitBefore[0]; final Range[] splitAfter = splitBefore[1].splitAt(other.getEnd()); final Range rangeInside = splitAfter[0]; final Range rangeAfter = splitAfter[1]; return new Range[] { rangeBefore, rangeInside, rangeAfter }; } /** * Get a range that is based on this one, but offset by a number. * * @param offset * the number to offset by * @return a copy of this range, offset by <code>offset</code> */ public Range offsetBy(final int offset) { if (offset == 0) { return this; } else { return new Range(start + offset, end + offset); } } /** * Creates a range object representing a single integer. * * @param integer * the number to represent as a range * @return the range represented by <code>integer</code> */ public static Range withOnly(final int integer) { return new Range(integer, integer + 1); } /** * Creates a range between two integers. * <p> * The range start is <em>inclusive</em> and the end is <em>exclusive</em>. * So, a range "between" 0 and 5 represents the numbers 0, 1, 2, 3 and 4, * but not 5. * * @param start * the start of the range, inclusive * @param end * the end of the range, exclusive * @return a range representing <code>[start..end[</code> * @throws IllegalArgumentException * if <code>start &gt; end</code> */ public static Range between(final int start, final int end) throws IllegalArgumentException { return new Range(start, end); } /** * Creates a range from a start point, with a given length. * * @param start * the first integer to include in the range * @param length * the length of the resulting range * @return a range starting from <code>start</code>, with * <code>length</code> number of integers following * @throws IllegalArgumentException * if length &lt; 0 */ public static Range withLength(final int start, final int length) throws IllegalArgumentException { if (length < 0) { /* * The constructor of Range will throw an exception if start > * start+length (i.e. if length is negative). We're throwing the * same exception type, just with a more descriptive message. */ throw new IllegalArgumentException("length must not be negative"); } return new Range(start, start + length); } /** * Creates a new range between two numbers: <code>[start..end[</code>. * * @param start * the start integer, inclusive * @param end * the end integer, exclusive * @throws IllegalArgumentException * if <code>start &gt; end</code> */ private Range(final int start, final int end) throws IllegalArgumentException { if (start > end) { throw new IllegalArgumentException( "start must not be greater than end"); } this.start = start; this.end = end; } /** * Returns the <em>inclusive</em> start point of this range. * * @return the start point of this range */ public int getStart() { return start; } /** * Returns the <em>exclusive</em> end point of this range. * * @return the end point of this range */ public int getEnd() { return end; } /** * The number of integers contained in the range. * * @return the number of integers contained in the range */ public int length() { return getEnd() - getStart(); } /** * Checks whether the range has no elements between the start and end. * * @return <code>true</code> if and only if the range contains no elements. */ public boolean isEmpty() { return getStart() >= getEnd(); } /** * Checks whether this range and another range are at least partially * covering the same values. * * @param other * the other range to check against * @return <code>true</code> if this and <code>other</code> intersect */ public boolean intersects(final Range other) { return getStart() < other.getEnd() && other.getStart() < getEnd(); } /** * Checks whether an integer is found within this range. * * @param integer * an integer to test for presence in this range * @return <code>true</code> if and only if <code>integer</code> is in this * range */ public boolean contains(final int integer) { return getStart() <= integer && integer < getEnd(); } /** * Checks whether this range is a subset of another range. * * @param other * the range to check against of * @return <code>true</code> if and only if <code>other</code> completely * wraps this range */ public boolean isSubsetOf(final Range other) { if (isEmpty() && other.isEmpty()) { return true; } return other.getStart() <= getStart() && getEnd() <= other.getEnd(); } @Override public String toString() { return getClass().getSimpleName() + " [" + getStart() + ".." + getEnd() + "]" + (isEmpty() ? " (empty)" : ""); } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + end; result = prime * result + start; return result; } @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Range other = (Range) obj; if (end != other.end) { return false; } if (start != other.start) { return false; } return true; } /** * Checks whether this range starts before the start of another range. * * @param other * the other range to compare against * @return <code>true</code> if and only if this range starts before the * <code>other</code> */ public boolean startsBefore(final Range other) { return getStart() < other.getStart(); } /** * Checks whether this range ends before the start of another range. * * @param other * the other range to compare against * @return <code>true</code> if and only if this range ends before the * <code>other</code> */ public boolean endsBefore(final Range other) { return getEnd() <= other.getStart(); } /** * Checks whether this range ends after the end of another range. * * @param other * the other range to compare against * @return <code>true</code> if and only if this range ends after the * <code>other</code> */ public boolean endsAfter(final Range other) { return getEnd() > other.getEnd(); } /** * Checks whether this range starts after the end of another range. * * @param other * the other range to compare against * @return <code>true</code> if and only if this range starts after the * <code>other</code> */ public boolean startsAfter(final Range other) { return getStart() >= other.getEnd(); } /** * Split the range into two at a certain integer. * <p> * <em>Example:</em> <code>[5..10[.splitAt(7) == [5..7[, [7..10[</code> * * @param integer * the integer at which to split the range into two * @return an array of two ranges, with <code>[start..integer[</code> in the * first element, and <code>[integer..end[</code> in the second * element. * <p> * If {@code integer} is less than {@code start}, [empty, * {@code this} ] is returned. if <code>integer</code> is equal to * or greater than {@code end}, [{@code this}, empty] is returned * instead. */ public Range[] splitAt(final int integer) { if (integer < start) { return new Range[] { Range.withLength(start, 0), this }; } else if (integer >= end) { return new Range[] { this, Range.withLength(end, 0) }; } else { return new Range[] { new Range(start, integer), new Range(integer, end) }; } } /** * Split the range into two after a certain number of integers into the * range. * <p> * Calling this method is equivalent to calling * <code>{@link #splitAt(int) splitAt}({@link #getStart()}+length);</code> * <p> * <em>Example:</em> * <code>[5..10[.splitAtFromStart(2) == [5..7[, [7..10[</code> * * @param length * the length at which to split this range into two * @return an array of two ranges, having the <code>length</code>-first * elements of this range, and the second range having the rest. If * <code>length</code> &le; 0, the first element will be empty, and * the second element will be this range. If <code>length</code> * &ge; {@link #length()}, the first element will be this range, and * the second element will be empty. */ public Range[] splitAtFromStart(final int length) { return splitAt(getStart() + length); } /** * Combines two ranges to create a range containing all values in both * ranges, provided there are no gaps between the ranges. * * @param other * the range to combine with this range * * @return the combined range * * @throws IllegalArgumentException * if the two ranges aren't connected */ public Range combineWith(Range other) throws IllegalArgumentException { if (getStart() > other.getEnd() || other.getStart() > getEnd()) { throw new IllegalArgumentException( "There is a gap between " + this + " and " + other); } return Range.between(Math.min(getStart(), other.getStart()), Math.max(getEnd(), other.getEnd())); } /** * Creates a range that is expanded the given amounts in both ends. * * @param startDelta * the amount to expand by in the beginning of the range * @param endDelta * the amount to expand by in the end of the range * * @return an expanded range * * @throws IllegalArgumentException * if the new range would have <code>start &gt; end</code> */ public Range expand(int startDelta, int endDelta) throws IllegalArgumentException { return Range.between(getStart() - startDelta, getEnd() + endDelta); } /** * Limits this range to be within the bounds of the provided range. * <p> * This is basically an optimized way of calculating * <code>{@link #partitionWith(Range)}[1]</code> without the overhead of * defining the parts that do not overlap. * <p> * If the two ranges do not intersect, an empty range is returned. There are * no guarantees about the position of that range. * * @param bounds * the bounds that the returned range should be limited to * @return a bounded range */ public Range restrictTo(Range bounds) { boolean startWithin = bounds.contains(getStart()); boolean endWithin = bounds.contains(getEnd()); boolean boundsWithin = getStart() < bounds.getStart() && getEnd() >= bounds.getEnd(); if (startWithin) { if (endWithin) { return this; } else { return Range.between(getStart(), bounds.getEnd()); } } else { if (endWithin) { return Range.between(bounds.getStart(), getEnd()); } else if (boundsWithin) { return bounds; } else { return Range.withLength(getStart(), 0); } } } /** * Returns the range as a stream of integers. * <p> * The first element of the stream is the {@link #getStart()} return value * and the last one is the {@link #getEnd()} return value. * * @see #getStart() * @see #getEnd() * * @return the range as a stream */ public IntStream stream() { return IntStream.range(getStart(), getEnd()); } }
UTF-8
Java
15,193
java
Range.java
Java
[ { "context": "/*\n * Copyright 2000-2023 Vaadin Ltd.\n *\n * Licensed under the Apache License, Version", "end": 36, "score": 0.8817700743675232, "start": 26, "tag": "NAME", "value": "Vaadin Ltd" }, { "context": "amed or removed in a future release.\n *\n * @author Vaadin Ltd\n * @since 1.0\n */\npublic final class Range implem", "end": 1137, "score": 0.884610652923584, "start": 1127, "tag": "NAME", "value": "Vaadin Ltd" } ]
null
[]
/* * Copyright 2000-2023 <NAME>. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.vaadin.flow.internal; import java.io.Serializable; import java.util.stream.IntStream; /** * An immutable representation of a range, marked by start and end points. * <p> * The range is treated as inclusive at the start, and exclusive at the end. * I.e. the range [0..1[ has the length 1, and represents one integer: 0. * <p> * The range is considered {@link #isEmpty() empty} if the start is the same as * the end. * <p> * For internal use only. May be renamed or removed in a future release. * * @author <NAME> * @since 1.0 */ public final class Range implements Serializable { private final int start; private final int end; /** * Overlay this range with another one, and partition the ranges according * to how they position relative to each other. * <p> * The three partitions are returned as a three-element Range array: * <ul> * <li>Elements in this range that occur before elements in * <code>other</code>. * <li>Elements that are shared between the two ranges. * <li>Elements in this range that occur after elements in * <code>other</code>. * </ul> * * @param other * the other range to act as delimiters. * @return a three-element Range array of partitions depicting the elements * before (index 0), shared/inside (index 1) and after (index 2). */ public Range[] partitionWith(final Range other) { final Range[] splitBefore = splitAt(other.getStart()); final Range rangeBefore = splitBefore[0]; final Range[] splitAfter = splitBefore[1].splitAt(other.getEnd()); final Range rangeInside = splitAfter[0]; final Range rangeAfter = splitAfter[1]; return new Range[] { rangeBefore, rangeInside, rangeAfter }; } /** * Get a range that is based on this one, but offset by a number. * * @param offset * the number to offset by * @return a copy of this range, offset by <code>offset</code> */ public Range offsetBy(final int offset) { if (offset == 0) { return this; } else { return new Range(start + offset, end + offset); } } /** * Creates a range object representing a single integer. * * @param integer * the number to represent as a range * @return the range represented by <code>integer</code> */ public static Range withOnly(final int integer) { return new Range(integer, integer + 1); } /** * Creates a range between two integers. * <p> * The range start is <em>inclusive</em> and the end is <em>exclusive</em>. * So, a range "between" 0 and 5 represents the numbers 0, 1, 2, 3 and 4, * but not 5. * * @param start * the start of the range, inclusive * @param end * the end of the range, exclusive * @return a range representing <code>[start..end[</code> * @throws IllegalArgumentException * if <code>start &gt; end</code> */ public static Range between(final int start, final int end) throws IllegalArgumentException { return new Range(start, end); } /** * Creates a range from a start point, with a given length. * * @param start * the first integer to include in the range * @param length * the length of the resulting range * @return a range starting from <code>start</code>, with * <code>length</code> number of integers following * @throws IllegalArgumentException * if length &lt; 0 */ public static Range withLength(final int start, final int length) throws IllegalArgumentException { if (length < 0) { /* * The constructor of Range will throw an exception if start > * start+length (i.e. if length is negative). We're throwing the * same exception type, just with a more descriptive message. */ throw new IllegalArgumentException("length must not be negative"); } return new Range(start, start + length); } /** * Creates a new range between two numbers: <code>[start..end[</code>. * * @param start * the start integer, inclusive * @param end * the end integer, exclusive * @throws IllegalArgumentException * if <code>start &gt; end</code> */ private Range(final int start, final int end) throws IllegalArgumentException { if (start > end) { throw new IllegalArgumentException( "start must not be greater than end"); } this.start = start; this.end = end; } /** * Returns the <em>inclusive</em> start point of this range. * * @return the start point of this range */ public int getStart() { return start; } /** * Returns the <em>exclusive</em> end point of this range. * * @return the end point of this range */ public int getEnd() { return end; } /** * The number of integers contained in the range. * * @return the number of integers contained in the range */ public int length() { return getEnd() - getStart(); } /** * Checks whether the range has no elements between the start and end. * * @return <code>true</code> if and only if the range contains no elements. */ public boolean isEmpty() { return getStart() >= getEnd(); } /** * Checks whether this range and another range are at least partially * covering the same values. * * @param other * the other range to check against * @return <code>true</code> if this and <code>other</code> intersect */ public boolean intersects(final Range other) { return getStart() < other.getEnd() && other.getStart() < getEnd(); } /** * Checks whether an integer is found within this range. * * @param integer * an integer to test for presence in this range * @return <code>true</code> if and only if <code>integer</code> is in this * range */ public boolean contains(final int integer) { return getStart() <= integer && integer < getEnd(); } /** * Checks whether this range is a subset of another range. * * @param other * the range to check against of * @return <code>true</code> if and only if <code>other</code> completely * wraps this range */ public boolean isSubsetOf(final Range other) { if (isEmpty() && other.isEmpty()) { return true; } return other.getStart() <= getStart() && getEnd() <= other.getEnd(); } @Override public String toString() { return getClass().getSimpleName() + " [" + getStart() + ".." + getEnd() + "]" + (isEmpty() ? " (empty)" : ""); } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + end; result = prime * result + start; return result; } @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Range other = (Range) obj; if (end != other.end) { return false; } if (start != other.start) { return false; } return true; } /** * Checks whether this range starts before the start of another range. * * @param other * the other range to compare against * @return <code>true</code> if and only if this range starts before the * <code>other</code> */ public boolean startsBefore(final Range other) { return getStart() < other.getStart(); } /** * Checks whether this range ends before the start of another range. * * @param other * the other range to compare against * @return <code>true</code> if and only if this range ends before the * <code>other</code> */ public boolean endsBefore(final Range other) { return getEnd() <= other.getStart(); } /** * Checks whether this range ends after the end of another range. * * @param other * the other range to compare against * @return <code>true</code> if and only if this range ends after the * <code>other</code> */ public boolean endsAfter(final Range other) { return getEnd() > other.getEnd(); } /** * Checks whether this range starts after the end of another range. * * @param other * the other range to compare against * @return <code>true</code> if and only if this range starts after the * <code>other</code> */ public boolean startsAfter(final Range other) { return getStart() >= other.getEnd(); } /** * Split the range into two at a certain integer. * <p> * <em>Example:</em> <code>[5..10[.splitAt(7) == [5..7[, [7..10[</code> * * @param integer * the integer at which to split the range into two * @return an array of two ranges, with <code>[start..integer[</code> in the * first element, and <code>[integer..end[</code> in the second * element. * <p> * If {@code integer} is less than {@code start}, [empty, * {@code this} ] is returned. if <code>integer</code> is equal to * or greater than {@code end}, [{@code this}, empty] is returned * instead. */ public Range[] splitAt(final int integer) { if (integer < start) { return new Range[] { Range.withLength(start, 0), this }; } else if (integer >= end) { return new Range[] { this, Range.withLength(end, 0) }; } else { return new Range[] { new Range(start, integer), new Range(integer, end) }; } } /** * Split the range into two after a certain number of integers into the * range. * <p> * Calling this method is equivalent to calling * <code>{@link #splitAt(int) splitAt}({@link #getStart()}+length);</code> * <p> * <em>Example:</em> * <code>[5..10[.splitAtFromStart(2) == [5..7[, [7..10[</code> * * @param length * the length at which to split this range into two * @return an array of two ranges, having the <code>length</code>-first * elements of this range, and the second range having the rest. If * <code>length</code> &le; 0, the first element will be empty, and * the second element will be this range. If <code>length</code> * &ge; {@link #length()}, the first element will be this range, and * the second element will be empty. */ public Range[] splitAtFromStart(final int length) { return splitAt(getStart() + length); } /** * Combines two ranges to create a range containing all values in both * ranges, provided there are no gaps between the ranges. * * @param other * the range to combine with this range * * @return the combined range * * @throws IllegalArgumentException * if the two ranges aren't connected */ public Range combineWith(Range other) throws IllegalArgumentException { if (getStart() > other.getEnd() || other.getStart() > getEnd()) { throw new IllegalArgumentException( "There is a gap between " + this + " and " + other); } return Range.between(Math.min(getStart(), other.getStart()), Math.max(getEnd(), other.getEnd())); } /** * Creates a range that is expanded the given amounts in both ends. * * @param startDelta * the amount to expand by in the beginning of the range * @param endDelta * the amount to expand by in the end of the range * * @return an expanded range * * @throws IllegalArgumentException * if the new range would have <code>start &gt; end</code> */ public Range expand(int startDelta, int endDelta) throws IllegalArgumentException { return Range.between(getStart() - startDelta, getEnd() + endDelta); } /** * Limits this range to be within the bounds of the provided range. * <p> * This is basically an optimized way of calculating * <code>{@link #partitionWith(Range)}[1]</code> without the overhead of * defining the parts that do not overlap. * <p> * If the two ranges do not intersect, an empty range is returned. There are * no guarantees about the position of that range. * * @param bounds * the bounds that the returned range should be limited to * @return a bounded range */ public Range restrictTo(Range bounds) { boolean startWithin = bounds.contains(getStart()); boolean endWithin = bounds.contains(getEnd()); boolean boundsWithin = getStart() < bounds.getStart() && getEnd() >= bounds.getEnd(); if (startWithin) { if (endWithin) { return this; } else { return Range.between(getStart(), bounds.getEnd()); } } else { if (endWithin) { return Range.between(bounds.getStart(), getEnd()); } else if (boundsWithin) { return bounds; } else { return Range.withLength(getStart(), 0); } } } /** * Returns the range as a stream of integers. * <p> * The first element of the stream is the {@link #getStart()} return value * and the last one is the {@link #getEnd()} return value. * * @see #getStart() * @see #getEnd() * * @return the range as a stream */ public IntStream stream() { return IntStream.range(getStart(), getEnd()); } }
15,185
0.571776
0.56763
460
32.028259
26.250244
80
false
false
0
0
0
0
0
0
0.293478
false
false
7
c9b020faae3d1cbaf4a5828a4fe4d29c50942a09
19,928,648,300,257
7765a099755511bef079595c1741b035851b1e8d
/src/com/kh/groumoa/group/model/service/ReplyService.java
2114cc30b504b1cabbfe79d8680b710115c2920d
[]
no_license
SurrealView/SemiGroumoa
https://github.com/SurrealView/SemiGroumoa
c142a1940fd1326e4e5034defea6a1e41c59e020
538903fd99126aa92ad57f94feff86cd8f8010ae
refs/heads/master
2022-12-23T22:58:18.517000
2020-10-04T14:09:21
2020-10-04T14:09:21
277,715,344
0
0
null
false
2020-07-28T05:46:59
2020-07-07T04:21:36
2020-07-28T05:46:25
2020-07-28T05:46:58
12,210
0
0
0
JavaScript
false
false
package com.kh.groumoa.group.model.service; import static com.kh.groumoa.common.JDBCTemplate.close; import static com.kh.groumoa.common.JDBCTemplate.commit; import static com.kh.groumoa.common.JDBCTemplate.getConnection; import static com.kh.groumoa.common.JDBCTemplate.rollback; import java.sql.Connection; import java.util.ArrayList; import com.kh.groumoa.group.model.dao.BoardDao; import com.kh.groumoa.group.model.dao.ReplyDao; import com.kh.groumoa.group.model.vo.ReplyVO; public class ReplyService { public ArrayList<ReplyVO> insertReply(ReplyVO reply) { Connection con = getConnection(); int result = new ReplyDao().insertReply(con, reply); ArrayList<ReplyVO> replyList = new ReplyDao().selectReplyList(con, reply.getPostCode()); if(result > 0 && replyList != null) { commit(con); } else { rollback(con); replyList = null; } close(con); return replyList; } public ArrayList<ReplyVO> selectReplyList(int num) { Connection con = getConnection(); ArrayList<ReplyVO> replyList = new ReplyDao().selectReplyList(con, num); close(con); return replyList; } }
UTF-8
Java
1,171
java
ReplyService.java
Java
[]
null
[]
package com.kh.groumoa.group.model.service; import static com.kh.groumoa.common.JDBCTemplate.close; import static com.kh.groumoa.common.JDBCTemplate.commit; import static com.kh.groumoa.common.JDBCTemplate.getConnection; import static com.kh.groumoa.common.JDBCTemplate.rollback; import java.sql.Connection; import java.util.ArrayList; import com.kh.groumoa.group.model.dao.BoardDao; import com.kh.groumoa.group.model.dao.ReplyDao; import com.kh.groumoa.group.model.vo.ReplyVO; public class ReplyService { public ArrayList<ReplyVO> insertReply(ReplyVO reply) { Connection con = getConnection(); int result = new ReplyDao().insertReply(con, reply); ArrayList<ReplyVO> replyList = new ReplyDao().selectReplyList(con, reply.getPostCode()); if(result > 0 && replyList != null) { commit(con); } else { rollback(con); replyList = null; } close(con); return replyList; } public ArrayList<ReplyVO> selectReplyList(int num) { Connection con = getConnection(); ArrayList<ReplyVO> replyList = new ReplyDao().selectReplyList(con, num); close(con); return replyList; } }
1,171
0.70965
0.708796
44
24.5
24.298803
90
false
false
0
0
0
0
0
0
1.727273
false
false
7
fb3bc92bf911149f49111e9922a88c3f7f7ccc50
23,570,780,563,437
5d76a028d691d84506b7c5779aa0213fa5132b1f
/src/main/java/classes/Collection.java
87059ef3c189cc91e497f4041e8bc00da0f6761a
[]
no_license
pablocloud/MongoSync
https://github.com/pablocloud/MongoSync
bb32a9f5c1b9f25299629974fb5967c8e344779c
c1a3602a41e7586c4ac60f129858a7fc3bb9ef80
refs/heads/master
2021-01-22T00:32:46.249000
2016-10-16T23:37:23
2016-10-16T23:37:23
68,279,576
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package classes; import com.google.gson.annotations.SerializedName; import java.io.Serializable; public class Collection implements Serializable { @SerializedName("databaseOrigin") private String databaseOrigin; @SerializedName("databaseFinal") private String databaseFinal; @SerializedName("nameOrigin") private String nameOrigin; @SerializedName("nameFinal") private String nameFinal; @SerializedName("fieldOrigin") private String fieldOrigin; @SerializedName("fieldFinal") private String fieldFinal; @SerializedName("indexes") private IndexField[] indexes; private Object resultFrom; private Object resultTo; private int diff; public Collection() { } public Collection(String databaseOrigin, String databaseFinal, String nameOrigin, String nameFinal, String fieldOrigin, String fieldFinal, IndexField[] indexes) { this.databaseOrigin = databaseOrigin; this.databaseFinal = databaseFinal; this.nameOrigin = nameOrigin; this.nameFinal = nameFinal; this.fieldOrigin = fieldOrigin; this.fieldFinal = fieldFinal; this.indexes = indexes; } public String getDatabaseOrigin() { return databaseOrigin; } public void setDatabaseOrigin(String databaseOrigin) { this.databaseOrigin = databaseOrigin; } public String getDatabaseFinal() { return databaseFinal; } public void setDatabaseFinal(String databaseFinal) { this.databaseFinal = databaseFinal; } public String getNameOrigin() { return nameOrigin; } public void setNameOrigin(String nameOrigin) { this.nameOrigin = nameOrigin; } public String getNameFinal() { return nameFinal; } public void setNameFinal(String nameFinal) { this.nameFinal = nameFinal; } public String getFieldOrigin() { return fieldOrigin; } public void setFieldOrigin(String fieldOrigin) { this.fieldOrigin = fieldOrigin; } public String getFieldFinal() { return fieldFinal; } public void setFieldFinal(String fieldFinal) { this.fieldFinal = fieldFinal; } public Object getResultFrom() { return resultFrom; } public void setResultFrom(Object resultFrom) { this.resultFrom = resultFrom; } public Object getResultTo() { return resultTo; } public void setResultTo(Object resultTo) { this.resultTo = resultTo; } public int getDiff() { return diff; } public void setDiff(int diff) { this.diff = diff; } public IndexField[] getIndexes() { return indexes; } public void setIndexes(IndexField[] indexes) { this.indexes = indexes; } }
UTF-8
Java
2,831
java
Collection.java
Java
[]
null
[]
package classes; import com.google.gson.annotations.SerializedName; import java.io.Serializable; public class Collection implements Serializable { @SerializedName("databaseOrigin") private String databaseOrigin; @SerializedName("databaseFinal") private String databaseFinal; @SerializedName("nameOrigin") private String nameOrigin; @SerializedName("nameFinal") private String nameFinal; @SerializedName("fieldOrigin") private String fieldOrigin; @SerializedName("fieldFinal") private String fieldFinal; @SerializedName("indexes") private IndexField[] indexes; private Object resultFrom; private Object resultTo; private int diff; public Collection() { } public Collection(String databaseOrigin, String databaseFinal, String nameOrigin, String nameFinal, String fieldOrigin, String fieldFinal, IndexField[] indexes) { this.databaseOrigin = databaseOrigin; this.databaseFinal = databaseFinal; this.nameOrigin = nameOrigin; this.nameFinal = nameFinal; this.fieldOrigin = fieldOrigin; this.fieldFinal = fieldFinal; this.indexes = indexes; } public String getDatabaseOrigin() { return databaseOrigin; } public void setDatabaseOrigin(String databaseOrigin) { this.databaseOrigin = databaseOrigin; } public String getDatabaseFinal() { return databaseFinal; } public void setDatabaseFinal(String databaseFinal) { this.databaseFinal = databaseFinal; } public String getNameOrigin() { return nameOrigin; } public void setNameOrigin(String nameOrigin) { this.nameOrigin = nameOrigin; } public String getNameFinal() { return nameFinal; } public void setNameFinal(String nameFinal) { this.nameFinal = nameFinal; } public String getFieldOrigin() { return fieldOrigin; } public void setFieldOrigin(String fieldOrigin) { this.fieldOrigin = fieldOrigin; } public String getFieldFinal() { return fieldFinal; } public void setFieldFinal(String fieldFinal) { this.fieldFinal = fieldFinal; } public Object getResultFrom() { return resultFrom; } public void setResultFrom(Object resultFrom) { this.resultFrom = resultFrom; } public Object getResultTo() { return resultTo; } public void setResultTo(Object resultTo) { this.resultTo = resultTo; } public int getDiff() { return diff; } public void setDiff(int diff) { this.diff = diff; } public IndexField[] getIndexes() { return indexes; } public void setIndexes(IndexField[] indexes) { this.indexes = indexes; } }
2,831
0.660544
0.660544
123
22.01626
22.000732
166
false
false
0
0
0
0
0
0
0.373984
false
false
7
bf6c9705da714bb6e287bdc1da3371e9d356a2b0
31,112,743,134,481
27589488144a2844284185963aed686d1d7b2169
/src/Pokemon/Skill/D/DragonAscent.java
2fd19e5867a6445844e59d110bcdaca4e1b9fa50
[]
no_license
EternalVenus/Deep-Atlas
https://github.com/EternalVenus/Deep-Atlas
f07794da3e875881226b29cd4ed83877d1706719
facf24fff202fc844a548e916092cd44aead9171
refs/heads/master
2021-08-23T03:52:21.917000
2017-12-03T02:37:02
2017-12-03T02:37:02
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Pokemon.Skill.D; import Pokemon.Type; import Pokemon.Skill.*; import Pokemon.Pokemons.Pokemon; public class DragonAscent extends Skill { public DragonAscent() { super("Draco Ascent", new Type("Dragon"), "none", 120, "Dragon Ascent deals damage but lowers the user's Defense and\n" + "Special Defense by one stage each after attacking.\n" + "It is the signature move of Rayquaza, and once learned allows Rayquaza to Mega-Evolve.", 5, "Physical" ); } @Override public int effect(Pokemon pokemon) { return super.effect(pokemon); } @Override public int defenseEffect(Pokemon pokemon) { return super.defenseEffect(pokemon); } @Override public int speedEffect(Pokemon pokemon) { return super.speedEffect(pokemon); } }
UTF-8
Java
990
java
DragonAscent.java
Java
[]
null
[]
package Pokemon.Skill.D; import Pokemon.Type; import Pokemon.Skill.*; import Pokemon.Pokemons.Pokemon; public class DragonAscent extends Skill { public DragonAscent() { super("Draco Ascent", new Type("Dragon"), "none", 120, "Dragon Ascent deals damage but lowers the user's Defense and\n" + "Special Defense by one stage each after attacking.\n" + "It is the signature move of Rayquaza, and once learned allows Rayquaza to Mega-Evolve.", 5, "Physical" ); } @Override public int effect(Pokemon pokemon) { return super.effect(pokemon); } @Override public int defenseEffect(Pokemon pokemon) { return super.defenseEffect(pokemon); } @Override public int speedEffect(Pokemon pokemon) { return super.speedEffect(pokemon); } }
990
0.557576
0.553535
36
25.5
25.292181
113
false
false
0
0
0
0
0
0
0.416667
false
false
7
933f2c3d93484e42302ede79ade88dfe9e039329
24,601,572,730,132
42534ea8f2848964e0b58755f338a4de65db5b44
/src/com/cooksys/dtms/ListServices.java
34bf997c730f89a1bc84d65f4c72b61a980e16e1
[]
no_license
pradeeptabhattacharya/DT-Rest-Playground
https://github.com/pradeeptabhattacharya/DT-Rest-Playground
99c9b44f3a06652b86dbb789552f4dd763b805d7
fe161539fe1a530f507c31a648749f77ce0a4aaf
refs/heads/master
2016-04-19T19:17:47.906000
2015-06-05T03:47:23
2015-06-05T03:47:23
36,851,670
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cooksys.dtms; import static spark.Spark.get; import java.util.List; import org.codehaus.jackson.map.ObjectMapper; import com.cooksys.dao.ListUtilDAO; import com.cooksys.dto.LineOfBusiness; import com.cooksys.dto.ValueHolder; import com.cooksys.factory.DAOConstants; import com.cooksys.factory.DAOFactory; public class ListServices { public static void setUp(){ get("/lob", (request, response) -> { ListUtilDAO dao = (ListUtilDAO) DAOFactory.getInstance().getDAOForFunction(DAOConstants.LIST); List<LineOfBusiness> listLoB = dao.getLineOfBusiness(); ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(listLoB); }); get("/spoc", (request, response) -> { ListUtilDAO dao = (ListUtilDAO) DAOFactory.getInstance().getDAOForFunction(DAOConstants.LIST); List<ValueHolder> listSpoc = dao.getSpocs(); ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(listSpoc); }); get("/techvp", (request, response) -> { ListUtilDAO dao = (ListUtilDAO) DAOFactory.getInstance().getDAOForFunction(DAOConstants.LIST); List<ValueHolder> listSpoc = dao.getTechVP(); ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(listSpoc); }); get("/svp", (request, response) -> { ListUtilDAO dao = (ListUtilDAO) DAOFactory.getInstance().getDAOForFunction(DAOConstants.LIST); List<ValueHolder> listSpoc = dao.getSVP(); ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(listSpoc); }); get("/platform", (request, response) -> { ListUtilDAO dao = (ListUtilDAO) DAOFactory.getInstance().getDAOForFunction(DAOConstants.LIST); List<ValueHolder> listSpoc = dao.getPlatforms(); ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(listSpoc); }); get("/location", (request, response) -> { ListUtilDAO dao = (ListUtilDAO) DAOFactory.getInstance().getDAOForFunction(DAOConstants.LIST); List<ValueHolder> listSpoc = dao.getLocations(); ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(listSpoc); }); get("/lob", (request, response) -> { ListUtilDAO dao = (ListUtilDAO) DAOFactory.getInstance().getDAOForFunction(DAOConstants.LIST); List<ValueHolder> listSpoc = dao.getLOBs(); ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(listSpoc); }); get("/channel", (request, response) -> { ListUtilDAO dao = (ListUtilDAO) DAOFactory.getInstance().getDAOForFunction(DAOConstants.LIST); List<ValueHolder> listSpoc = dao.getHiringChannels(); ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(listSpoc); }); get("/roles", (request, response) -> { ListUtilDAO dao = (ListUtilDAO) DAOFactory.getInstance().getDAOForFunction(DAOConstants.LIST); List<ValueHolder> listSpoc = dao.getRoles(); ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(listSpoc); }); get("/hireroles", (request, response) -> { ListUtilDAO dao = (ListUtilDAO) DAOFactory.getInstance().getDAOForFunction(DAOConstants.LIST); List<ValueHolder> listHireRoles = dao.getHiringRoles(); ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(listHireRoles); }); } }
UTF-8
Java
3,387
java
ListServices.java
Java
[]
null
[]
package com.cooksys.dtms; import static spark.Spark.get; import java.util.List; import org.codehaus.jackson.map.ObjectMapper; import com.cooksys.dao.ListUtilDAO; import com.cooksys.dto.LineOfBusiness; import com.cooksys.dto.ValueHolder; import com.cooksys.factory.DAOConstants; import com.cooksys.factory.DAOFactory; public class ListServices { public static void setUp(){ get("/lob", (request, response) -> { ListUtilDAO dao = (ListUtilDAO) DAOFactory.getInstance().getDAOForFunction(DAOConstants.LIST); List<LineOfBusiness> listLoB = dao.getLineOfBusiness(); ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(listLoB); }); get("/spoc", (request, response) -> { ListUtilDAO dao = (ListUtilDAO) DAOFactory.getInstance().getDAOForFunction(DAOConstants.LIST); List<ValueHolder> listSpoc = dao.getSpocs(); ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(listSpoc); }); get("/techvp", (request, response) -> { ListUtilDAO dao = (ListUtilDAO) DAOFactory.getInstance().getDAOForFunction(DAOConstants.LIST); List<ValueHolder> listSpoc = dao.getTechVP(); ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(listSpoc); }); get("/svp", (request, response) -> { ListUtilDAO dao = (ListUtilDAO) DAOFactory.getInstance().getDAOForFunction(DAOConstants.LIST); List<ValueHolder> listSpoc = dao.getSVP(); ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(listSpoc); }); get("/platform", (request, response) -> { ListUtilDAO dao = (ListUtilDAO) DAOFactory.getInstance().getDAOForFunction(DAOConstants.LIST); List<ValueHolder> listSpoc = dao.getPlatforms(); ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(listSpoc); }); get("/location", (request, response) -> { ListUtilDAO dao = (ListUtilDAO) DAOFactory.getInstance().getDAOForFunction(DAOConstants.LIST); List<ValueHolder> listSpoc = dao.getLocations(); ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(listSpoc); }); get("/lob", (request, response) -> { ListUtilDAO dao = (ListUtilDAO) DAOFactory.getInstance().getDAOForFunction(DAOConstants.LIST); List<ValueHolder> listSpoc = dao.getLOBs(); ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(listSpoc); }); get("/channel", (request, response) -> { ListUtilDAO dao = (ListUtilDAO) DAOFactory.getInstance().getDAOForFunction(DAOConstants.LIST); List<ValueHolder> listSpoc = dao.getHiringChannels(); ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(listSpoc); }); get("/roles", (request, response) -> { ListUtilDAO dao = (ListUtilDAO) DAOFactory.getInstance().getDAOForFunction(DAOConstants.LIST); List<ValueHolder> listSpoc = dao.getRoles(); ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(listSpoc); }); get("/hireroles", (request, response) -> { ListUtilDAO dao = (ListUtilDAO) DAOFactory.getInstance().getDAOForFunction(DAOConstants.LIST); List<ValueHolder> listHireRoles = dao.getHiringRoles(); ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(listHireRoles); }); } }
3,387
0.715973
0.715973
94
35.031914
29.271456
97
false
false
0
0
0
0
0
0
2.712766
false
false
7
c5ccdcf7550d6e21cf11af5728e53f6c0d17412d
5,420,248,750,003
dc62831624992de25e9ebbb16f80d6ef6612d18b
/app/src/main/java/com/mounacheikhna/reactiveapp/ui/search/SearchPresenter.java
8440f3c8504c5a551f0eb18ae6e353097658c2d8
[]
no_license
chemouna/ReactiveApp
https://github.com/chemouna/ReactiveApp
cc7db8ad25b85165ffb42ab2ca8aff91fca8b05e
678edce35aa19a655a41675a322bd5a66c044342
refs/heads/master
2021-01-10T13:36:52.298000
2016-03-29T02:55:08
2016-03-29T02:55:08
53,825,600
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mounacheikhna.reactiveapp.ui.search; import com.mounacheikhna.reactiveapp.annotation.ScopeSingleton; import com.mounacheikhna.reactiveapp.api.geonames.GeonamesApi; import com.mounacheikhna.reactiveapp.api.geonames.model.Geoname; import com.mounacheikhna.reactiveapp.data.TripsSource; import com.mounacheikhna.reactiveapp.data.model.Trip; import com.mounacheikhna.reactiveapp.ui.base.BasePresenter; import java.util.List; import javax.inject.Inject; import rx.Observable; /** * Created by cheikhnamouna on 3/14/16. */ @ScopeSingleton(SearchView.SearchComponent.class) public class SearchPresenter extends BasePresenter<SearchScreen> { private GeonamesApi api; @Inject public SearchPresenter(GeonamesApi api) { this.api = api; } public Observable<List<Geoname>> searchPlace(String query) { return api.search(query); } public Observable<List<Trip>> searchRides(String departure, String arrival) { return Observable.just(TripsSource.getTrips()); } }
UTF-8
Java
995
java
SearchPresenter.java
Java
[ { "context": "t.Inject;\nimport rx.Observable;\n\n/**\n * Created by cheikhnamouna on 3/14/16.\n */\n@ScopeSingleton(SearchView.Search", "end": 516, "score": 0.9996191263198853, "start": 503, "tag": "USERNAME", "value": "cheikhnamouna" } ]
null
[]
package com.mounacheikhna.reactiveapp.ui.search; import com.mounacheikhna.reactiveapp.annotation.ScopeSingleton; import com.mounacheikhna.reactiveapp.api.geonames.GeonamesApi; import com.mounacheikhna.reactiveapp.api.geonames.model.Geoname; import com.mounacheikhna.reactiveapp.data.TripsSource; import com.mounacheikhna.reactiveapp.data.model.Trip; import com.mounacheikhna.reactiveapp.ui.base.BasePresenter; import java.util.List; import javax.inject.Inject; import rx.Observable; /** * Created by cheikhnamouna on 3/14/16. */ @ScopeSingleton(SearchView.SearchComponent.class) public class SearchPresenter extends BasePresenter<SearchScreen> { private GeonamesApi api; @Inject public SearchPresenter(GeonamesApi api) { this.api = api; } public Observable<List<Geoname>> searchPlace(String query) { return api.search(query); } public Observable<List<Trip>> searchRides(String departure, String arrival) { return Observable.just(TripsSource.getTrips()); } }
995
0.792965
0.78794
33
29.121212
25.764383
79
false
false
0
0
0
0
0
0
0.454545
false
false
7
66f0c8a828c66e4e5eafb4f79a042c2d942c4c31
25,838,523,278,334
5ee31eb19eaf07830f1c050b3552c8ed573540a5
/src/main/java/at/lingu/sqlcompose/restriction/OrRestriction.java
9a398b31fde93e6fc1b396f7c9fe2749e00eb4fb
[ "MIT" ]
permissive
flof/sqlcompose
https://github.com/flof/sqlcompose
a1fc3993e0e972837b9bb591e6bf32c60202b349
d012506e2546476f41cdc748afd6334465289609
refs/heads/master
2016-09-05T17:14:32.477000
2014-12-22T23:09:34
2014-12-22T23:09:34
26,605,787
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package at.lingu.sqlcompose.restriction; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * * @author flo */ public class OrRestriction extends Restriction { private List<Restriction> restrictions = new ArrayList<>(); public OrRestriction(Restriction... restrictions) { this.restrictions.addAll(Arrays.asList(restrictions)); } public List<Restriction> getRestrictions() { return restrictions; } @Override public void acceptVisitor(RestrictionVisitor visitor) { visitor.visit(this); } }
UTF-8
Java
540
java
OrRestriction.java
Java
[ { "context": ".Arrays;\nimport java.util.List;\n\n/**\n *\n * @author flo\n */\npublic class OrRestriction extends Restrictio", "end": 140, "score": 0.9774596095085144, "start": 137, "tag": "USERNAME", "value": "flo" } ]
null
[]
package at.lingu.sqlcompose.restriction; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * * @author flo */ public class OrRestriction extends Restriction { private List<Restriction> restrictions = new ArrayList<>(); public OrRestriction(Restriction... restrictions) { this.restrictions.addAll(Arrays.asList(restrictions)); } public List<Restriction> getRestrictions() { return restrictions; } @Override public void acceptVisitor(RestrictionVisitor visitor) { visitor.visit(this); } }
540
0.753704
0.753704
27
19
20.946138
60
false
false
0
0
0
0
0
0
0.814815
false
false
7
ecc876e0c8447fcc643ceed53cbf9e5204e7f18c
2,276,332,695,076
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/alibaba--druid/ffeb629f0d80e95f74b02c37a7141659d4e28b97/before/MockConnectionFactory.java
f43ce5a38d8e9d85531b1400e393d538dbfcbe26
[]
no_license
fracz/refactor-extractor
https://github.com/fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211000
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.alibaba.druid.mock; import java.util.Properties; public interface MockConnectionFactory { MockConnection createConnection(MockDriver driver, String url, Properties connectProperties); }
UTF-8
Java
204
java
MockConnectionFactory.java
Java
[]
null
[]
package com.alibaba.druid.mock; import java.util.Properties; public interface MockConnectionFactory { MockConnection createConnection(MockDriver driver, String url, Properties connectProperties); }
204
0.823529
0.823529
8
24.625
31.432219
97
false
false
0
0
0
0
0
0
0.625
false
false
7
ac90e3a6aea3c0955d8a1f3cd4c49288fb4ca963
13,726,715,514,429
8591cd64ef287c9efffbc8a253ed3898f2e3bd01
/app/src/main/java/com/example/androidspiritgame/adapter/MyRecyclerAdapter.java
a564e4ac1fcd4305a4497076b66ecb5ef425dd1c
[]
no_license
OuFungWah/AndroidSpiritGame
https://github.com/OuFungWah/AndroidSpiritGame
678b398db377aaf80f89b2374200e4c2591bdc96
fe49a25c13357180d8d41ac678523ffa225e455e
refs/heads/master
2022-04-10T04:45:21.837000
2022-04-08T03:30:54
2022-04-08T03:30:54
92,178,907
2
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.androidspiritgame.adapter; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.example.androidspiritgame.R; import com.example.androidspiritgame.bean.Hero; import java.util.List; /** * Created by 区枫华 on 2017/a5/24. */ public class MyRecyclerAdapter extends RecyclerView.Adapter<MyRecyclerAdapter.ViewHolder> { private List<Hero> list; public MyRecyclerAdapter(List<Hero> list) { this.list = list; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.recycle_view_item, parent, false); return new ViewHolder(view); } @Override public void onBindViewHolder(ViewHolder holder, int position) { Hero bean = list.get(position); holder.background.setImageResource(bean.getBackgroundRes()); holder.heroHead.setImageResource(bean.getHeadRes()); holder.rank.setImageResource(bean.getRankRes()); holder.nature.setImageResource(bean.getNatureRes()); holder.lv_tv.setText("Lv." + bean.getLv()); for (int i = 4; i > bean.getStars(); i--) { holder.stars[i].setVisibility(View.INVISIBLE); } } @Override public int getItemCount() { return list.size(); } protected final static class ViewHolder extends RecyclerView.ViewHolder { protected ImageView background; protected ImageView nature; protected ImageView stars[] = new ImageView[5]; protected ImageView rank; protected ImageView heroHead; protected TextView lv_tv; public ViewHolder(View itemView) { super(itemView); this.background = (ImageView) itemView.findViewById(R.id.background_img); this.nature = (ImageView) itemView.findViewById(R.id.nature_img); this.stars[0] = (ImageView) itemView.findViewById(R.id.star1_img); this.stars[1] = (ImageView) itemView.findViewById(R.id.star2_img); this.stars[2] = (ImageView) itemView.findViewById(R.id.star3_img); this.stars[3] = (ImageView) itemView.findViewById(R.id.star4_img); this.stars[4] = (ImageView) itemView.findViewById(R.id.star5_img); this.rank = (ImageView) itemView.findViewById(R.id.rank_img); this.heroHead = (ImageView) itemView.findViewById(R.id.hero_img); this.lv_tv = (TextView) itemView.findViewById(R.id.lv_tv); } } }
UTF-8
Java
2,690
java
MyRecyclerAdapter.java
Java
[ { "context": "Hero;\n\n\nimport java.util.List;\n\n/**\n * Created by 区枫华 on 2017/a5/24.\n */\n\npublic class MyRecyclerAdapte", "end": 389, "score": 0.9422745704650879, "start": 386, "tag": "USERNAME", "value": "区枫华" } ]
null
[]
package com.example.androidspiritgame.adapter; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.example.androidspiritgame.R; import com.example.androidspiritgame.bean.Hero; import java.util.List; /** * Created by 区枫华 on 2017/a5/24. */ public class MyRecyclerAdapter extends RecyclerView.Adapter<MyRecyclerAdapter.ViewHolder> { private List<Hero> list; public MyRecyclerAdapter(List<Hero> list) { this.list = list; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.recycle_view_item, parent, false); return new ViewHolder(view); } @Override public void onBindViewHolder(ViewHolder holder, int position) { Hero bean = list.get(position); holder.background.setImageResource(bean.getBackgroundRes()); holder.heroHead.setImageResource(bean.getHeadRes()); holder.rank.setImageResource(bean.getRankRes()); holder.nature.setImageResource(bean.getNatureRes()); holder.lv_tv.setText("Lv." + bean.getLv()); for (int i = 4; i > bean.getStars(); i--) { holder.stars[i].setVisibility(View.INVISIBLE); } } @Override public int getItemCount() { return list.size(); } protected final static class ViewHolder extends RecyclerView.ViewHolder { protected ImageView background; protected ImageView nature; protected ImageView stars[] = new ImageView[5]; protected ImageView rank; protected ImageView heroHead; protected TextView lv_tv; public ViewHolder(View itemView) { super(itemView); this.background = (ImageView) itemView.findViewById(R.id.background_img); this.nature = (ImageView) itemView.findViewById(R.id.nature_img); this.stars[0] = (ImageView) itemView.findViewById(R.id.star1_img); this.stars[1] = (ImageView) itemView.findViewById(R.id.star2_img); this.stars[2] = (ImageView) itemView.findViewById(R.id.star3_img); this.stars[3] = (ImageView) itemView.findViewById(R.id.star4_img); this.stars[4] = (ImageView) itemView.findViewById(R.id.star5_img); this.rank = (ImageView) itemView.findViewById(R.id.rank_img); this.heroHead = (ImageView) itemView.findViewById(R.id.hero_img); this.lv_tv = (TextView) itemView.findViewById(R.id.lv_tv); } } }
2,690
0.673249
0.665797
78
33.410255
29.508554
112
false
false
0
0
0
0
0
0
0.576923
false
false
7
db973f72576b2af8ccfcfe93be40f054930fbf4c
18,330,920,447,022
a26e854d2fdceb7b83aa036d180894f8ab39b76d
/yc-ucenter-core/src/main/java/com/ai/yc/ucenter/constants/eunm/EditPassResultCodeConstantsEnum.java
384d8815a9bfda7fbca4e1884151423430233808
[]
no_license
newSue/yc-ucenter
https://github.com/newSue/yc-ucenter
efbaca888f450e8908601853ea4d0c4c6b9615aa
7ee7f72db9454713204fd46c2557a2a2757df284
refs/heads/master
2018-05-02T02:54:20.619000
2017-05-24T09:06:55
2017-05-24T09:06:55
92,350,716
0
1
null
true
2017-05-25T01:10:40
2017-05-25T01:10:40
2017-05-23T15:56:03
2017-05-24T09:07:03
2,790
0
0
0
null
null
null
package com.ai.yc.ucenter.constants.eunm; public enum EditPassResultCodeConstantsEnum implements IConstantsEnum{ OLDPASS_ERROR("旧密码输入有误,修改失败",-1), NONERECORD_ERROR("没有生效记录,修改失败",-7), OVERDUE_ERROR("验证码过期,修改/绑定失败",0); EditPassResultCodeConstantsEnum(String value,int idx) { this.value = value; this.index = idx; } private int index; private String value; // 普通方法 public static String getName(int index) { for (EditPassResultCodeConstantsEnum c : EditPassResultCodeConstantsEnum .values()) { if (c.getIndex() == index) { return c.value; } } return null; } public int getIndex() { return index; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public void setIndex(int index) { this.index = index; } }
UTF-8
Java
987
java
EditPassResultCodeConstantsEnum.java
Java
[]
null
[]
package com.ai.yc.ucenter.constants.eunm; public enum EditPassResultCodeConstantsEnum implements IConstantsEnum{ OLDPASS_ERROR("旧密码输入有误,修改失败",-1), NONERECORD_ERROR("没有生效记录,修改失败",-7), OVERDUE_ERROR("验证码过期,修改/绑定失败",0); EditPassResultCodeConstantsEnum(String value,int idx) { this.value = value; this.index = idx; } private int index; private String value; // 普通方法 public static String getName(int index) { for (EditPassResultCodeConstantsEnum c : EditPassResultCodeConstantsEnum .values()) { if (c.getIndex() == index) { return c.value; } } return null; } public int getIndex() { return index; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public void setIndex(int index) { this.index = index; } }
987
0.625963
0.622662
44
19.681818
20.418098
92
false
false
0
0
0
0
0
0
1.75
false
false
7
1895eb442c890103b83dccdf86782284ba0409da
12,378,095,775,496
013e83b707fe5cd48f58af61e392e3820d370c36
/spring-tx/src/main/java/org/springframework/transaction/interceptor/AbstractFallbackTransactionAttributeSource.java
246917641b756b6b1b5f9f29c6dd92eaedabba0a
[]
no_license
yuexiaoguang/spring4
https://github.com/yuexiaoguang/spring4
8376f551fefd33206adc3e04bc58d6d32a825c37
95ea25bbf46ee7bad48307e41dcd027f1a0c67ae
refs/heads/master
2020-05-27T20:27:54.768000
2019-09-02T03:39:57
2019-09-02T03:39:57
188,770,867
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.springframework.transaction.interceptor; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.core.BridgeMethodResolver; import org.springframework.core.MethodClassKey; import org.springframework.util.ClassUtils; /** * {@link TransactionAttributeSource}的抽象实现, 它缓存方法的属性并实现回退策略: * 1. 具体目标方法; * 2. 目标类; * 3. 声明方法; * 4. 声明类/接口. * * <p>如果没有与目标方法关联, 则默认使用目标类的事务属性. * 与目标方法关联的任何事务属性都会完全覆盖类事务属性. * 如果在目标类上找不到, 则将检查已调用调用方法的接口 (如果是JDK代理). * * <p>此实现在首次使用后按方法缓存属性. * 如果希望允许动态更改事务属性 (这是非常不可能的), 则可以使缓存可配置. * 由于评估回滚规则的成本, 缓存是可取的. */ public abstract class AbstractFallbackTransactionAttributeSource implements TransactionAttributeSource { /** * 缓存中保存的规范值表示没有找到此方法的事务属性, 不需要再查看. */ @SuppressWarnings("serial") private static final TransactionAttribute NULL_TRANSACTION_ATTRIBUTE = new DefaultTransactionAttribute() { @Override public String toString() { return "null"; } }; /** * Logger available to subclasses. * <p>由于此基类未标记为Serializable, 因此在序列化后将重新创建记录器 - 前提是具体子类为Serializable. */ protected final Log logger = LogFactory.getLog(getClass()); /** * TransactionAttributes的缓存, 由特定目标类的方法作为键. * <p>由于此基类未标记为Serializable, 因此在序列化后将重新创建缓存 - 前提是具体子类为Serializable. */ private final Map<Object, TransactionAttribute> attributeCache = new ConcurrentHashMap<Object, TransactionAttribute>(1024); /** * 确定此方法调用的事务属性. * <p>如果未找到方法属性, 则默认为类的事务属性. * * @param method 当前调用的方法 (never {@code null}) * @param targetClass 此调用的目标类 (may be {@code null}) * * @return 此方法的TransactionAttribute, 或{@code null} 如果方法不是事务性的 */ @Override public TransactionAttribute getTransactionAttribute(Method method, Class<?> targetClass) { if (method.getDeclaringClass() == Object.class) { return null; } // 首先, 看看是否有缓存值. Object cacheKey = getCacheKey(method, targetClass); TransactionAttribute cached = this.attributeCache.get(cacheKey); if (cached != null) { // 值将是规范值, 表示没有事务属性或实际事务属性. if (cached == NULL_TRANSACTION_ATTRIBUTE) { return null; } else { return cached; } } else { // 需要解决这个问题. TransactionAttribute txAttr = computeTransactionAttribute(method, targetClass); // 把它放在缓存中. if (txAttr == null) { this.attributeCache.put(cacheKey, NULL_TRANSACTION_ATTRIBUTE); } else { String methodIdentification = ClassUtils.getQualifiedMethodName(method, targetClass); if (txAttr instanceof DefaultTransactionAttribute) { ((DefaultTransactionAttribute) txAttr).setDescriptor(methodIdentification); } if (logger.isDebugEnabled()) { logger.debug("Adding transactional method '" + methodIdentification + "' with attribute: " + txAttr); } this.attributeCache.put(cacheKey, txAttr); } return txAttr; } } /** * 确定给定方法和目标类的缓存键. * <p>不得为重载方法生成相同的键. * 必须为同一方法的不同实例生成相同的键. * * @param method 方法 (never {@code null}) * @param targetClass 目标类 (may be {@code null}) * * @return 缓存键 (never {@code null}) */ protected Object getCacheKey(Method method, Class<?> targetClass) { return new MethodClassKey(method, targetClass); } /** * 与{@link #getTransactionAttribute}相同的签名, 但不缓存结果. * {@link #getTransactionAttribute}实际上是此方法的缓存装饰器. * <p>从4.1.8开始, 可以覆盖此方法. */ protected TransactionAttribute computeTransactionAttribute(Method method, Class<?> targetClass) { // 不允许非public方法. if (allowPublicMethodsOnly() && !Modifier.isPublic(method.getModifiers())) { return null; } // 忽略CGLIB子类 - 内省实际的用户类. Class<?> userClass = ClassUtils.getUserClass(targetClass); // 该方法可以在接口上, 但需要来自目标类的属性. // 如果目标类为null, 则方法将保持不变. Method specificMethod = ClassUtils.getMostSpecificMethod(method, userClass); // 如果使用泛型参数处理方法, 找到原始方法. specificMethod = BridgeMethodResolver.findBridgedMethod(specificMethod); // 首先尝试的是目标类中的方法. TransactionAttribute txAttr = findTransactionAttribute(specificMethod); if (txAttr != null) { return txAttr; } // 第二次尝试是目标类的事务属性. txAttr = findTransactionAttribute(specificMethod.getDeclaringClass()); if (txAttr != null && ClassUtils.isUserLevelMethod(method)) { return txAttr; } if (specificMethod != method) { // 回退是看原始方法. txAttr = findTransactionAttribute(method); if (txAttr != null) { return txAttr; } // 最后一个回退是原始方法的类. txAttr = findTransactionAttribute(method.getDeclaringClass()); if (txAttr != null && ClassUtils.isUserLevelMethod(method)) { return txAttr; } } return null; } /** * 子类需要实现它来返回给定类的事务属性. * * @param clazz 要检索属性的类 * * @return 与此类关联的所有事务属性, 或{@code null} */ protected abstract TransactionAttribute findTransactionAttribute(Class<?> clazz); /** * 子类需要实现它来返回给定方法的事务属性. * * @param method 要检索属性的方法 * * @return 与此方法关联的所有事务属性, 或{@code null} */ protected abstract TransactionAttribute findTransactionAttribute(Method method); /** * 应该只允许public方法具有事务语义? * <p>默认实现返回{@code false}. */ protected boolean allowPublicMethodsOnly() { return false; } }
UTF-8
Java
6,536
java
AbstractFallbackTransactionAttributeSource.java
Java
[]
null
[]
package org.springframework.transaction.interceptor; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.core.BridgeMethodResolver; import org.springframework.core.MethodClassKey; import org.springframework.util.ClassUtils; /** * {@link TransactionAttributeSource}的抽象实现, 它缓存方法的属性并实现回退策略: * 1. 具体目标方法; * 2. 目标类; * 3. 声明方法; * 4. 声明类/接口. * * <p>如果没有与目标方法关联, 则默认使用目标类的事务属性. * 与目标方法关联的任何事务属性都会完全覆盖类事务属性. * 如果在目标类上找不到, 则将检查已调用调用方法的接口 (如果是JDK代理). * * <p>此实现在首次使用后按方法缓存属性. * 如果希望允许动态更改事务属性 (这是非常不可能的), 则可以使缓存可配置. * 由于评估回滚规则的成本, 缓存是可取的. */ public abstract class AbstractFallbackTransactionAttributeSource implements TransactionAttributeSource { /** * 缓存中保存的规范值表示没有找到此方法的事务属性, 不需要再查看. */ @SuppressWarnings("serial") private static final TransactionAttribute NULL_TRANSACTION_ATTRIBUTE = new DefaultTransactionAttribute() { @Override public String toString() { return "null"; } }; /** * Logger available to subclasses. * <p>由于此基类未标记为Serializable, 因此在序列化后将重新创建记录器 - 前提是具体子类为Serializable. */ protected final Log logger = LogFactory.getLog(getClass()); /** * TransactionAttributes的缓存, 由特定目标类的方法作为键. * <p>由于此基类未标记为Serializable, 因此在序列化后将重新创建缓存 - 前提是具体子类为Serializable. */ private final Map<Object, TransactionAttribute> attributeCache = new ConcurrentHashMap<Object, TransactionAttribute>(1024); /** * 确定此方法调用的事务属性. * <p>如果未找到方法属性, 则默认为类的事务属性. * * @param method 当前调用的方法 (never {@code null}) * @param targetClass 此调用的目标类 (may be {@code null}) * * @return 此方法的TransactionAttribute, 或{@code null} 如果方法不是事务性的 */ @Override public TransactionAttribute getTransactionAttribute(Method method, Class<?> targetClass) { if (method.getDeclaringClass() == Object.class) { return null; } // 首先, 看看是否有缓存值. Object cacheKey = getCacheKey(method, targetClass); TransactionAttribute cached = this.attributeCache.get(cacheKey); if (cached != null) { // 值将是规范值, 表示没有事务属性或实际事务属性. if (cached == NULL_TRANSACTION_ATTRIBUTE) { return null; } else { return cached; } } else { // 需要解决这个问题. TransactionAttribute txAttr = computeTransactionAttribute(method, targetClass); // 把它放在缓存中. if (txAttr == null) { this.attributeCache.put(cacheKey, NULL_TRANSACTION_ATTRIBUTE); } else { String methodIdentification = ClassUtils.getQualifiedMethodName(method, targetClass); if (txAttr instanceof DefaultTransactionAttribute) { ((DefaultTransactionAttribute) txAttr).setDescriptor(methodIdentification); } if (logger.isDebugEnabled()) { logger.debug("Adding transactional method '" + methodIdentification + "' with attribute: " + txAttr); } this.attributeCache.put(cacheKey, txAttr); } return txAttr; } } /** * 确定给定方法和目标类的缓存键. * <p>不得为重载方法生成相同的键. * 必须为同一方法的不同实例生成相同的键. * * @param method 方法 (never {@code null}) * @param targetClass 目标类 (may be {@code null}) * * @return 缓存键 (never {@code null}) */ protected Object getCacheKey(Method method, Class<?> targetClass) { return new MethodClassKey(method, targetClass); } /** * 与{@link #getTransactionAttribute}相同的签名, 但不缓存结果. * {@link #getTransactionAttribute}实际上是此方法的缓存装饰器. * <p>从4.1.8开始, 可以覆盖此方法. */ protected TransactionAttribute computeTransactionAttribute(Method method, Class<?> targetClass) { // 不允许非public方法. if (allowPublicMethodsOnly() && !Modifier.isPublic(method.getModifiers())) { return null; } // 忽略CGLIB子类 - 内省实际的用户类. Class<?> userClass = ClassUtils.getUserClass(targetClass); // 该方法可以在接口上, 但需要来自目标类的属性. // 如果目标类为null, 则方法将保持不变. Method specificMethod = ClassUtils.getMostSpecificMethod(method, userClass); // 如果使用泛型参数处理方法, 找到原始方法. specificMethod = BridgeMethodResolver.findBridgedMethod(specificMethod); // 首先尝试的是目标类中的方法. TransactionAttribute txAttr = findTransactionAttribute(specificMethod); if (txAttr != null) { return txAttr; } // 第二次尝试是目标类的事务属性. txAttr = findTransactionAttribute(specificMethod.getDeclaringClass()); if (txAttr != null && ClassUtils.isUserLevelMethod(method)) { return txAttr; } if (specificMethod != method) { // 回退是看原始方法. txAttr = findTransactionAttribute(method); if (txAttr != null) { return txAttr; } // 最后一个回退是原始方法的类. txAttr = findTransactionAttribute(method.getDeclaringClass()); if (txAttr != null && ClassUtils.isUserLevelMethod(method)) { return txAttr; } } return null; } /** * 子类需要实现它来返回给定类的事务属性. * * @param clazz 要检索属性的类 * * @return 与此类关联的所有事务属性, 或{@code null} */ protected abstract TransactionAttribute findTransactionAttribute(Class<?> clazz); /** * 子类需要实现它来返回给定方法的事务属性. * * @param method 要检索属性的方法 * * @return 与此方法关联的所有事务属性, 或{@code null} */ protected abstract TransactionAttribute findTransactionAttribute(Method method); /** * 应该只允许public方法具有事务语义? * <p>默认实现返回{@code false}. */ protected boolean allowPublicMethodsOnly() { return false; } }
6,536
0.71762
0.71548
193
25.642487
26.391073
107
false
false
0
0
0
0
0
0
1.823834
false
false
7
87928af4a20dd50c866e8a03fb096d095937fa6e
17,368,847,771,275
b5436b52146df4589e8708b8f2a3db380f5a1506
/app/src/main/java/org/p072b/p073a/p074a/p075a/p078c/cz$b.java
35ad495d46db65aa4cf952c92c92df972ac77a4c
[]
no_license
KobeGong/AzarDev2
https://github.com/KobeGong/AzarDev2
3af539544a69ea62de64b0ffd3d42c7a2c96fc0e
93549dce7a675c6ba4992590f8313b5ca679e6c7
refs/heads/master
2018-02-09T15:11:24.821000
2017-07-10T13:18:21
2017-07-10T13:18:21
96,779,211
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.p072b.p073a.p074a.p075a.p078c; import javax.annotation.Nullable; final class cz$b<K, V> extends bo<K, V> { private final bo<K, V> f8174c; cz$b(K k, V v, bo<K, V> boVar) { super(k, v); this.c = boVar; } cz$b(bo<K, V> boVar, bo<K, V> boVar2) { super(boVar); this.c = boVar2; } bo<K, V> mo4147a() { return this.c; } @Nullable bo<K, V> mo4148b() { return null; } }
UTF-8
Java
467
java
cz$b.java
Java
[]
null
[]
package org.p072b.p073a.p074a.p075a.p078c; import javax.annotation.Nullable; final class cz$b<K, V> extends bo<K, V> { private final bo<K, V> f8174c; cz$b(K k, V v, bo<K, V> boVar) { super(k, v); this.c = boVar; } cz$b(bo<K, V> boVar, bo<K, V> boVar2) { super(boVar); this.c = boVar2; } bo<K, V> mo4147a() { return this.c; } @Nullable bo<K, V> mo4148b() { return null; } }
467
0.511777
0.449679
26
16.961538
14.685107
43
false
false
0
0
0
0
0
0
0.807692
false
false
7
d3b638fce2996ff327326d7c2c6a5866e352c8a0
24,524,263,296,845
20e6c083bb944902d50d63c59eac37ea31d6ca8d
/app/src/main/java/com/huebelancer/ccscreener/Activities/StockDetails/StockDetailsFragment.java
e9070a86e01f2c901a2857e883b8d3b75b20f3b5
[]
no_license
mahuebel/ccscreener-android
https://github.com/mahuebel/ccscreener-android
1f2298f5c7af79887f3da322fc9a018eff4927b8
d15e3feda503e10567e003b9effa415133a81181
refs/heads/master
2021-01-22T20:26:43.832000
2017-08-18T10:23:05
2017-08-18T10:23:05
100,701,216
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.huebelancer.ccscreener.Activities.StockDetails; import android.content.Context; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.format.DateUtils; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import android.widget.Toast; import com.huebelancer.ccscreener.Activities.StockList.StockListActivity; import com.huebelancer.ccscreener.Coordinators.RootCoordinator; import com.huebelancer.ccscreener.Dependencies.DependencyRegistry; import com.huebelancer.ccscreener.Helpers.ActivityTitleCallback; import com.huebelancer.ccscreener.Helpers.Helpers; import com.huebelancer.ccscreener.ModelLayer.Database.Models.Stock; import com.huebelancer.ccscreener.ModelLayer.Enums.Frame; import com.huebelancer.ccscreener.ModelLayer.ModelLayer; import com.huebelancer.ccscreener.R; import java.util.ArrayList; import java.util.List; public class StockDetailsFragment extends Fragment implements ModelLayer.LoadStockCallback { private static final String KEY_STOCK_ID = "stock_id"; private static final String TAG = "StockDetailsFragment"; private RecyclerView recyclerView; private TextView symbol, price, updated, priceUpdated, optionsUpdated, earnings; private StockDetailsPresenter presenter; private RootCoordinator coordinator; private String stockId; private Stock stock; private List<String> frames; private ActivityTitleCallback callback; public StockDetailsFragment() {} public static StockDetailsFragment newInstance(String id) { StockDetailsFragment fragment = new StockDetailsFragment(); Bundle args = new Bundle(); args.putString(KEY_STOCK_ID, id); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { stockId = getArguments().getString(KEY_STOCK_ID); Log.d(TAG, stockId); } callback = (StockListActivity)getActivity(); frames = getFrames(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View root = inflater.inflate(R.layout.fragment_stock_details, container, false); attachUI(root); DependencyRegistry.shared.inject(this, stockId); return root; } public void configureWith(StockDetailsPresenter presenter, RootCoordinator coordinator) { this.presenter = presenter; this.coordinator = coordinator; loadData(); } private void loadData() { presenter.loadData(this); } private void attachUI(View root) { //region Attach TextViews symbol = (TextView) root.findViewById(R.id.details_symbol); price = (TextView) root.findViewById(R.id.details_price); updated = (TextView) root.findViewById(R.id.details_updated); priceUpdated = (TextView) root.findViewById(R.id.details_price_updated); optionsUpdated = (TextView) root.findViewById(R.id.details_options_updated); earnings = (TextView) root.findViewById(R.id.details_earnings); //endregion //region Attach RecyclerView LinearLayoutManager manager = new LinearLayoutManager(getActivity()); recyclerView = (RecyclerView) root.findViewById(R.id.recyclerView); recyclerView.setLayoutManager(manager); recyclerView.setHasFixedSize(true); initializeListView(); //endregion } private void initializeListView() { DetailViewAdapter adapter = new DetailViewAdapter(stock, frames); recyclerView.setAdapter(adapter); } private List<String> getFrames() { List<String> frames = new ArrayList<>(); for (Frame frame : Frame.values()) { frames.add(Helpers.frameToLabel(frame)); } return frames; } @Override public void onAttach(Context context) { super.onAttach(context); } @Override public void onDetach() { super.onDetach(); } @Override public void onLoading() { //show loading screen } @Override public void onStockFound(Stock stock) { //hide loading screen callback.onNewTitle(stock.symbol); updateTextViews(stock); updateListView(stock); } //region Update UI methods private void updateTextViews(Stock stock) { Log.d(TAG, "updating TextViews"); symbol.setText(stock.symbol); price.setText(String.valueOf(stock.price)); updated.setText( DateUtils.getRelativeTimeSpanString( stock.updatedAt.getTime() ) ); priceUpdated.setText( DateUtils.getRelativeTimeSpanString( stock.priceUpdatedAt.getTime() ) ); optionsUpdated.setText( DateUtils.getRelativeTimeSpanString( stock.chainUpdatedAt.getTime() ) ); if (stock.earningsRptDate != null) earnings.setText( DateUtils.getRelativeTimeSpanString( stock.earningsRptDate.getTime() ) ); } private void updateListView(Stock stock) { this.stock = stock; DetailViewAdapter adapter = (DetailViewAdapter) recyclerView.getAdapter(); adapter.stock = this.stock; adapter.notifyDataSetChanged(); } //endregion @Override public void onStockNotFound() { Toast.makeText(getActivity(), "No Stock Found", Toast.LENGTH_LONG).show(); } }
UTF-8
Java
6,144
java
StockDetailsFragment.java
Java
[]
null
[]
package com.huebelancer.ccscreener.Activities.StockDetails; import android.content.Context; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.format.DateUtils; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import android.widget.Toast; import com.huebelancer.ccscreener.Activities.StockList.StockListActivity; import com.huebelancer.ccscreener.Coordinators.RootCoordinator; import com.huebelancer.ccscreener.Dependencies.DependencyRegistry; import com.huebelancer.ccscreener.Helpers.ActivityTitleCallback; import com.huebelancer.ccscreener.Helpers.Helpers; import com.huebelancer.ccscreener.ModelLayer.Database.Models.Stock; import com.huebelancer.ccscreener.ModelLayer.Enums.Frame; import com.huebelancer.ccscreener.ModelLayer.ModelLayer; import com.huebelancer.ccscreener.R; import java.util.ArrayList; import java.util.List; public class StockDetailsFragment extends Fragment implements ModelLayer.LoadStockCallback { private static final String KEY_STOCK_ID = "stock_id"; private static final String TAG = "StockDetailsFragment"; private RecyclerView recyclerView; private TextView symbol, price, updated, priceUpdated, optionsUpdated, earnings; private StockDetailsPresenter presenter; private RootCoordinator coordinator; private String stockId; private Stock stock; private List<String> frames; private ActivityTitleCallback callback; public StockDetailsFragment() {} public static StockDetailsFragment newInstance(String id) { StockDetailsFragment fragment = new StockDetailsFragment(); Bundle args = new Bundle(); args.putString(KEY_STOCK_ID, id); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { stockId = getArguments().getString(KEY_STOCK_ID); Log.d(TAG, stockId); } callback = (StockListActivity)getActivity(); frames = getFrames(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View root = inflater.inflate(R.layout.fragment_stock_details, container, false); attachUI(root); DependencyRegistry.shared.inject(this, stockId); return root; } public void configureWith(StockDetailsPresenter presenter, RootCoordinator coordinator) { this.presenter = presenter; this.coordinator = coordinator; loadData(); } private void loadData() { presenter.loadData(this); } private void attachUI(View root) { //region Attach TextViews symbol = (TextView) root.findViewById(R.id.details_symbol); price = (TextView) root.findViewById(R.id.details_price); updated = (TextView) root.findViewById(R.id.details_updated); priceUpdated = (TextView) root.findViewById(R.id.details_price_updated); optionsUpdated = (TextView) root.findViewById(R.id.details_options_updated); earnings = (TextView) root.findViewById(R.id.details_earnings); //endregion //region Attach RecyclerView LinearLayoutManager manager = new LinearLayoutManager(getActivity()); recyclerView = (RecyclerView) root.findViewById(R.id.recyclerView); recyclerView.setLayoutManager(manager); recyclerView.setHasFixedSize(true); initializeListView(); //endregion } private void initializeListView() { DetailViewAdapter adapter = new DetailViewAdapter(stock, frames); recyclerView.setAdapter(adapter); } private List<String> getFrames() { List<String> frames = new ArrayList<>(); for (Frame frame : Frame.values()) { frames.add(Helpers.frameToLabel(frame)); } return frames; } @Override public void onAttach(Context context) { super.onAttach(context); } @Override public void onDetach() { super.onDetach(); } @Override public void onLoading() { //show loading screen } @Override public void onStockFound(Stock stock) { //hide loading screen callback.onNewTitle(stock.symbol); updateTextViews(stock); updateListView(stock); } //region Update UI methods private void updateTextViews(Stock stock) { Log.d(TAG, "updating TextViews"); symbol.setText(stock.symbol); price.setText(String.valueOf(stock.price)); updated.setText( DateUtils.getRelativeTimeSpanString( stock.updatedAt.getTime() ) ); priceUpdated.setText( DateUtils.getRelativeTimeSpanString( stock.priceUpdatedAt.getTime() ) ); optionsUpdated.setText( DateUtils.getRelativeTimeSpanString( stock.chainUpdatedAt.getTime() ) ); if (stock.earningsRptDate != null) earnings.setText( DateUtils.getRelativeTimeSpanString( stock.earningsRptDate.getTime() ) ); } private void updateListView(Stock stock) { this.stock = stock; DetailViewAdapter adapter = (DetailViewAdapter) recyclerView.getAdapter(); adapter.stock = this.stock; adapter.notifyDataSetChanged(); } //endregion @Override public void onStockNotFound() { Toast.makeText(getActivity(), "No Stock Found", Toast.LENGTH_LONG).show(); } }
6,144
0.665365
0.664714
204
29.117647
24.971865
93
false
false
0
0
0
0
0
0
0.509804
false
false
7
d682f4ed6ce4c36aa9b48cf62882ea58ce92f34f
30,597,347,048,900
8f69f0376bef2d9b364c902d9ed56e77a828d1ee
/src/main/java/org/gnuhpc/interview/leetcode/solutions/MaxSubArrayLen.java
a57195b464b8a7df9b1177e2a7643ba6030c1e58
[]
no_license
datainsect/All-About-SDE-Interview
https://github.com/datainsect/All-About-SDE-Interview
58a3e803374355026b2c8fc8670f49509ef5e4e5
1114e0445be28ebda4228ea4dd190121317092b3
refs/heads/master
2022-05-28T23:11:13.180000
2020-04-22T06:27:26
2020-04-22T06:27:26
259,385,255
0
3
null
true
2020-04-27T16:13:42
2020-04-27T16:13:41
2020-04-27T16:13:40
2020-04-22T06:27:33
27,180
0
0
0
null
false
false
package org.gnuhpc.interview.leetcode.solutions; import org.junit.Test; import java.util.HashMap; import java.util.Map; public class MaxSubArrayLen { public int maxSubArrayLen(int[] nums, int k) { int ans = 0; //相要的值 -- 和终止的对应位置 Map<Integer, Integer> map = new HashMap<Integer, Integer>(); int n = nums.length; int[] sums = new int[n + 1]; for (int i = 0; i < n; ++i) { sums[i + 1] = sums[i] + nums[i]; map.put(sums[i + 1] - k, i + 1); } for (int i = 0; i < n; ++i) { Integer j = map.get(sums[i]); if (j != null) { ans = Math.max(ans, j - i); } } return ans; } public int maxSubArrayLen2(int[] nums, int k) { int n = nums.length, ans = 0, sum = 0; Map<Integer, Integer> map = new HashMap<>(); for (int i = 0; i < n; ++i) { map.putIfAbsent(sum, i); sum += nums[i]; ans = Math.max(ans, i + 1 - map.getOrDefault(sum - k, i + 1)); } return ans; } @Test public void test() { System.out.println(maxSubArrayLen(new int[]{1, 2, 3, 2}, 6)); } }
UTF-8
Java
1,241
java
MaxSubArrayLen.java
Java
[]
null
[]
package org.gnuhpc.interview.leetcode.solutions; import org.junit.Test; import java.util.HashMap; import java.util.Map; public class MaxSubArrayLen { public int maxSubArrayLen(int[] nums, int k) { int ans = 0; //相要的值 -- 和终止的对应位置 Map<Integer, Integer> map = new HashMap<Integer, Integer>(); int n = nums.length; int[] sums = new int[n + 1]; for (int i = 0; i < n; ++i) { sums[i + 1] = sums[i] + nums[i]; map.put(sums[i + 1] - k, i + 1); } for (int i = 0; i < n; ++i) { Integer j = map.get(sums[i]); if (j != null) { ans = Math.max(ans, j - i); } } return ans; } public int maxSubArrayLen2(int[] nums, int k) { int n = nums.length, ans = 0, sum = 0; Map<Integer, Integer> map = new HashMap<>(); for (int i = 0; i < n; ++i) { map.putIfAbsent(sum, i); sum += nums[i]; ans = Math.max(ans, i + 1 - map.getOrDefault(sum - k, i + 1)); } return ans; } @Test public void test() { System.out.println(maxSubArrayLen(new int[]{1, 2, 3, 2}, 6)); } }
1,241
0.476582
0.461791
51
22.862745
20.844917
74
false
false
0
0
0
0
0
0
0.823529
false
false
7
a0022a86752e7058b557ca97392fdee21192a258
523,986,065,120
bca9fde0d821394e51c8b29ba9d5696b2e32ebeb
/src/com/kvlahov/client/components/ReceiptItemListComponent.java
61b273ace91be8ab06e6941a56b1788a4e153cff
[]
no_license
kvlahov/JavaProjekt
https://github.com/kvlahov/JavaProjekt
63da8d5795998894c5db366cd74b4563f699c1c6
74cb0e55772c8276bc488223b3f7e65627f13a06
refs/heads/master
2020-06-11T19:27:40.100000
2019-09-17T10:07:53
2019-09-17T10:07:53
194,060,567
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.kvlahov.client.components; import com.kvlahov.model.ReceiptItem; import java.awt.Color; import java.util.ArrayList; import java.util.List; import javax.swing.BorderFactory; import javax.swing.JLabel; import javax.swing.SwingConstants; import javax.swing.border.MatteBorder; /** * * @author lordo */ public class ReceiptItemListComponent extends javax.swing.JPanel { private List<ReceiptItem> receiptItems; private int rowCounter = 1; public ReceiptItemListComponent() { initComponents(); } public List<ReceiptItem> getReceiptItems() { return receiptItems; } public void setReceiptItems(List<ReceiptItem> receiptItems) { this.receiptItems = receiptItems; updateReceiptItemUI(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); setLayout(new java.awt.GridLayout(0, 6)); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setText("#"); jLabel1.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 3, 1, new java.awt.Color(0, 0, 0))); jLabel1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); add(jLabel1); jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel2.setText("Service"); jLabel2.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 3, 1, new java.awt.Color(0, 0, 0))); jLabel2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); add(jLabel2); jLabel3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel3.setText("Price Per Item"); jLabel3.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 3, 1, new java.awt.Color(0, 0, 0))); jLabel3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); add(jLabel3); jLabel4.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel4.setText("Quantity"); jLabel4.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 3, 1, new java.awt.Color(0, 0, 0))); jLabel4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); add(jLabel4); jLabel5.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel5.setText("Discount"); jLabel5.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 3, 1, new java.awt.Color(0, 0, 0))); jLabel5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); add(jLabel5); jLabel6.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel6.setText("Total"); jLabel6.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 3, 0, new java.awt.Color(0, 0, 0))); jLabel6.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); add(jLabel6); }// </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; // End of variables declaration//GEN-END:variables private void updateReceiptItemUI() { if(receiptItems == null) return; receiptItems.forEach(ri -> addReceiptItem(ri)); } private void addReceiptItem(ReceiptItem ri) { List<JLabel> labels = new ArrayList<>(); labels.add(new JLabel(String.valueOf(rowCounter++))); labels.add(new JLabel(ri.getService().toString())); labels.add(new JLabel(String.valueOf(ri.getPricePerItem()))); labels.add(new JLabel(String.valueOf(ri.getQuantity()))); labels.add(new JLabel(String.valueOf(ri.getDiscount()))); labels.add(new JLabel(String.valueOf(ri.getTotalPrice()))); labels.forEach(l -> { l.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, Color.black)); l.setHorizontalAlignment(SwingConstants.CENTER); l.setVerticalTextPosition(SwingConstants.CENTER); add(l); }); } }
UTF-8
Java
5,360
java
ReceiptItemListComponent.java
Java
[ { "context": "javax.swing.border.MatteBorder;\n\n/**\n *\n * @author lordo\n */\npublic class ReceiptItemListComponent extends", "end": 496, "score": 0.7056029438972473, "start": 491, "tag": "USERNAME", "value": "lordo" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.kvlahov.client.components; import com.kvlahov.model.ReceiptItem; import java.awt.Color; import java.util.ArrayList; import java.util.List; import javax.swing.BorderFactory; import javax.swing.JLabel; import javax.swing.SwingConstants; import javax.swing.border.MatteBorder; /** * * @author lordo */ public class ReceiptItemListComponent extends javax.swing.JPanel { private List<ReceiptItem> receiptItems; private int rowCounter = 1; public ReceiptItemListComponent() { initComponents(); } public List<ReceiptItem> getReceiptItems() { return receiptItems; } public void setReceiptItems(List<ReceiptItem> receiptItems) { this.receiptItems = receiptItems; updateReceiptItemUI(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); setLayout(new java.awt.GridLayout(0, 6)); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setText("#"); jLabel1.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 3, 1, new java.awt.Color(0, 0, 0))); jLabel1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); add(jLabel1); jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel2.setText("Service"); jLabel2.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 3, 1, new java.awt.Color(0, 0, 0))); jLabel2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); add(jLabel2); jLabel3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel3.setText("Price Per Item"); jLabel3.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 3, 1, new java.awt.Color(0, 0, 0))); jLabel3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); add(jLabel3); jLabel4.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel4.setText("Quantity"); jLabel4.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 3, 1, new java.awt.Color(0, 0, 0))); jLabel4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); add(jLabel4); jLabel5.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel5.setText("Discount"); jLabel5.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 3, 1, new java.awt.Color(0, 0, 0))); jLabel5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); add(jLabel5); jLabel6.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel6.setText("Total"); jLabel6.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 3, 0, new java.awt.Color(0, 0, 0))); jLabel6.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); add(jLabel6); }// </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; // End of variables declaration//GEN-END:variables private void updateReceiptItemUI() { if(receiptItems == null) return; receiptItems.forEach(ri -> addReceiptItem(ri)); } private void addReceiptItem(ReceiptItem ri) { List<JLabel> labels = new ArrayList<>(); labels.add(new JLabel(String.valueOf(rowCounter++))); labels.add(new JLabel(ri.getService().toString())); labels.add(new JLabel(String.valueOf(ri.getPricePerItem()))); labels.add(new JLabel(String.valueOf(ri.getQuantity()))); labels.add(new JLabel(String.valueOf(ri.getDiscount()))); labels.add(new JLabel(String.valueOf(ri.getTotalPrice()))); labels.forEach(l -> { l.setBorder(BorderFactory.createMatteBorder(0, 0, 2, 0, Color.black)); l.setHorizontalAlignment(SwingConstants.CENTER); l.setVerticalTextPosition(SwingConstants.CENTER); add(l); }); } }
5,360
0.682276
0.658582
135
38.703705
30.870836
112
false
false
0
0
0
0
0
0
0.992593
false
false
7
3224d96de139a01f7926eefbfd77a66ae2fddfa7
27,092,653,751,370
bb255f11f1fff04e4fc4d2ac5f7ce000979bca30
/src/data/impl/NodeDataImpl.java
d808fc579adc0ef8507cbd1096995662f6047f1a
[]
no_license
Londane/1
https://github.com/Londane/1
22fd2a2f88e996807a58a284e3fc8cf9528776f8
977e089a8a510d17632d6b5778f8046ebc209234
refs/heads/master
2016-09-11T10:55:58.088000
2015-06-18T22:56:47
2015-06-18T22:56:47
32,801,699
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package data.impl; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import parameter.FeatureEntity; import data.NodeData; public class NodeDataImpl implements NodeData { private String name; private final List<FeatureEntity<?>> features; public NodeDataImpl(NodeData dataToCopy) { this.name = new String(dataToCopy.getName()); this.features = new LinkedList<>(dataToCopy.getFeatures()); } public NodeDataImpl(String name) { this.name = name; this.features = new LinkedList<FeatureEntity<?>>(); } private NodeDataImpl(String name, List<FeatureEntity<?>> copyFeatures) { this.name = name; this.features = new LinkedList<FeatureEntity<?>>(copyFeatures); } public static NodeData makeCopyFromTemplate(NodeData data, String copyName) { // return new NodeDataImpl(copyName, data.getFeatures()); NodeData result = new NodeDataImpl(copyName, data.getFeatures()); return result; } @Override public String getName() { return this.name; } public void setName(String name) { this.name = name; } @Override public void addFeature(FeatureEntity<?> feature) { this.features.add(feature); } @Override public List<FeatureEntity<?>> getFeatures() { return this.features; } @Override public List<String> getFeatureNames() { List<String> result = new ArrayList<String>(this.features.size()); for (FeatureEntity<?> feature : this.features) { result.add(feature.getName()); } return result; } @Override public FeatureEntity<?> getFeature(String name) { if (name == null) { throw new IllegalArgumentException("NULL value is not ok!"); } for (FeatureEntity<?> feature : this.features) { if (name.equals(feature.getName())) { return feature; } } return null; } @Override public String toString() { return this.getName(); } @Override public List<Class<?>> getFeatureClasses() { List<Class<?>> result = new LinkedList<Class<?>>(); for (FeatureEntity<?> feature : this.features) { result.add(feature.getFeatureClass()); } return result; } }
UTF-8
Java
2,090
java
NodeDataImpl.java
Java
[]
null
[]
package data.impl; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import parameter.FeatureEntity; import data.NodeData; public class NodeDataImpl implements NodeData { private String name; private final List<FeatureEntity<?>> features; public NodeDataImpl(NodeData dataToCopy) { this.name = new String(dataToCopy.getName()); this.features = new LinkedList<>(dataToCopy.getFeatures()); } public NodeDataImpl(String name) { this.name = name; this.features = new LinkedList<FeatureEntity<?>>(); } private NodeDataImpl(String name, List<FeatureEntity<?>> copyFeatures) { this.name = name; this.features = new LinkedList<FeatureEntity<?>>(copyFeatures); } public static NodeData makeCopyFromTemplate(NodeData data, String copyName) { // return new NodeDataImpl(copyName, data.getFeatures()); NodeData result = new NodeDataImpl(copyName, data.getFeatures()); return result; } @Override public String getName() { return this.name; } public void setName(String name) { this.name = name; } @Override public void addFeature(FeatureEntity<?> feature) { this.features.add(feature); } @Override public List<FeatureEntity<?>> getFeatures() { return this.features; } @Override public List<String> getFeatureNames() { List<String> result = new ArrayList<String>(this.features.size()); for (FeatureEntity<?> feature : this.features) { result.add(feature.getName()); } return result; } @Override public FeatureEntity<?> getFeature(String name) { if (name == null) { throw new IllegalArgumentException("NULL value is not ok!"); } for (FeatureEntity<?> feature : this.features) { if (name.equals(feature.getName())) { return feature; } } return null; } @Override public String toString() { return this.getName(); } @Override public List<Class<?>> getFeatureClasses() { List<Class<?>> result = new LinkedList<Class<?>>(); for (FeatureEntity<?> feature : this.features) { result.add(feature.getFeatureClass()); } return result; } }
2,090
0.7
0.7
110
18
20.872774
76
false
false
0
0
0
0
0
0
1.490909
false
false
7
3093973aea89122ca68d5491e1d12cb5d50424a4
240,518,211,789
eb8462bdd33422dc28639e84409ec931a60589b0
/src/main/java/com/wanggang/service/ForumService.java
b7e651a2a092d22afd60c74b09586f6b770a75f2
[]
no_license
BraveGang/hellomvn
https://github.com/BraveGang/hellomvn
00befa990968bcce03e03b595d0365e9ddef91f7
cb740bea9cf117d81633873e0cc42e6627803a7c
refs/heads/master
2016-12-19T14:14:21.278000
2016-08-19T14:13:56
2016-08-19T14:13:56
65,869,327
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wanggang.service; import com.wanggang.dao.PostDao; import com.wanggang.dao.TopicDao; import com.wanggang.dao.UserDao; import com.wanggang.domain.Board; import com.wanggang.domain.Post; import com.wanggang.domain.Topic; import java.util.List; /** * Created by 200939 on 2016/8/17. */ public class ForumService { private TopicDao topicDao = new TopicDao(); private BoardDao boardDao = new BoardDao(); private PostDao postDao = new PostDao(); private UserDao userDao = new UserDao(); public void addTopic(Topic topic){ } public void remove(int topicId){ } public void addPost(Post post){ } public void removePost(int postId){ } public void addBoard(Board board){ } public void removeBoard(int boardId){ } public void makeDigestTopic(int topicId){ } public List<Board> getAllBoards(){ return null; } }
UTF-8
Java
931
java
ForumService.java
Java
[ { "context": "Topic;\n\nimport java.util.List;\n\n/**\n * Created by 200939 on 2016/8/17.\n */\npublic class ForumService {\n\n ", "end": 281, "score": 0.9974601864814758, "start": 275, "tag": "USERNAME", "value": "200939" } ]
null
[]
package com.wanggang.service; import com.wanggang.dao.PostDao; import com.wanggang.dao.TopicDao; import com.wanggang.dao.UserDao; import com.wanggang.domain.Board; import com.wanggang.domain.Post; import com.wanggang.domain.Topic; import java.util.List; /** * Created by 200939 on 2016/8/17. */ public class ForumService { private TopicDao topicDao = new TopicDao(); private BoardDao boardDao = new BoardDao(); private PostDao postDao = new PostDao(); private UserDao userDao = new UserDao(); public void addTopic(Topic topic){ } public void remove(int topicId){ } public void addPost(Post post){ } public void removePost(int postId){ } public void addBoard(Board board){ } public void removeBoard(int boardId){ } public void makeDigestTopic(int topicId){ } public List<Board> getAllBoards(){ return null; } }
931
0.670247
0.656284
65
13.323077
17.097105
47
false
false
0
0
0
0
0
0
0.2
false
false
7
a1cc36d20583d84884d2fd015e0ae1f465808088
26,542,897,930,407
1f627f828a4a32ba8fa619e43c6306fa2b664d50
/evoting-auth/auth-security/src/main/java/ua/org/code4ua/evoting/auth/security/validation/RemoteTokenValidator.java
32fa16b4b0b1dc66d449307f75bd9e598f85cc1b
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
code4ua/evoting
https://github.com/code4ua/evoting
6dbebe045fea894fbcf328a58c9868393d382e17
feac687f7282e86d019872c5c885560e91d2a786
HEAD
2016-05-09T17:33:39.861000
2016-03-08T01:54:37
2016-03-07T22:55:04
50,483,075
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ua.org.code4ua.evoting.auth.security.validation; import ua.org.code4ua.evoting.auth.repository.domain.Token; import ua.org.code4ua.evoting.auth.security.validation.api.TokenValidator; /** * @author &lt;<a href="mailto:illia.ovchynnikov@gmail.com">illia.ovchynnikov@gmail.com</a>&gt; */ public class RemoteTokenValidator implements TokenValidator { @Override public boolean validateToken(Token token) throws SecurityException { // TODO: implement using service discovering return false; } }
UTF-8
Java
530
java
RemoteTokenValidator.java
Java
[ { "context": "kenValidator;\n\n/**\n * @author &lt;<a href=\"mailto:illia.ovchynnikov@gmail.com\">illia.ovchynnikov@gmail.com</a>&gt;\n */\npublic c", "end": 256, "score": 0.9999234676361084, "start": 229, "tag": "EMAIL", "value": "illia.ovchynnikov@gmail.com" }, { "context": " &lt;<a href=\"mailto:illia.ovchynnikov@gmail.com\">illia.ovchynnikov@gmail.com</a>&gt;\n */\npublic class RemoteTokenValidator imp", "end": 285, "score": 0.9999229907989502, "start": 258, "tag": "EMAIL", "value": "illia.ovchynnikov@gmail.com" } ]
null
[]
package ua.org.code4ua.evoting.auth.security.validation; import ua.org.code4ua.evoting.auth.repository.domain.Token; import ua.org.code4ua.evoting.auth.security.validation.api.TokenValidator; /** * @author &lt;<a href="mailto:<EMAIL>"><EMAIL></a>&gt; */ public class RemoteTokenValidator implements TokenValidator { @Override public boolean validateToken(Token token) throws SecurityException { // TODO: implement using service discovering return false; } }
490
0.756604
0.750943
15
34.333332
32.35154
95
false
false
0
0
0
0
0
0
0.4
false
false
7
e772abd595c8e6210c567813c559e7cd94b99b4c
17,987,323,082,111
d656855d543c5a15fe0c8c908548a7adc9b8f8a9
/src/samuraiAI/Battleaxplayer.java
7e590420fd478a714f8bc97d186dddf806110a93
[]
no_license
subZHS/wushiai
https://github.com/subZHS/wushiai
1fbc49ffb6fb5733bffa71062817d3f5184331f2
568f40dde82d43260c7afc00f7bba9cbb9994544
refs/heads/master
2021-01-01T03:42:19.419000
2016-05-08T04:03:05
2016-05-08T04:03:05
58,295,232
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package samuraiAI; public class Battleaxplayer extends Player { @Override public GameInfo play(GameInfo info) { // TODO Auto-generated method stub return null; } }
UTF-8
Java
174
java
Battleaxplayer.java
Java
[]
null
[]
package samuraiAI; public class Battleaxplayer extends Player { @Override public GameInfo play(GameInfo info) { // TODO Auto-generated method stub return null; } }
174
0.741379
0.741379
11
14.818182
16.196623
44
false
false
0
0
0
0
0
0
0.818182
false
false
7
97625bb0c13930104fdb0ae60a5bf51e048bda87
5,420,248,772,782
a38b675e97dc36e27934d3001221b4c1bdeb4264
/src/main/java/com/example/model/AcessoModel.java
93bf0106071dc5b5904b5b90c6636510257f95a3
[]
no_license
DyeslenSilva/imetricsDesafio
https://github.com/DyeslenSilva/imetricsDesafio
716b8bfe839492324bfc0f2bd0b8e787b1dcba51
4c04f64b9059516ab82be4505000d1948ba3e355
refs/heads/master
2023-02-14T00:59:25.345000
2021-01-06T18:17:56
2021-01-06T18:17:56
327,315,631
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.model; public class AcessoModel { /* * Classe de modelo de acesso do empregado */ private Integer acessoId; private String email; private EmpregadoModel empregado; private String password; public Integer getAcessoId() { return acessoId; } public void setAcessoId(Integer acessoId) { this.acessoId = acessoId; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public EmpregadoModel getEmpregado() { return empregado; } public void setEmpregado(EmpregadoModel empregado) { this.empregado = empregado; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
UTF-8
Java
775
java
AcessoModel.java
Java
[]
null
[]
package com.example.model; public class AcessoModel { /* * Classe de modelo de acesso do empregado */ private Integer acessoId; private String email; private EmpregadoModel empregado; private String password; public Integer getAcessoId() { return acessoId; } public void setAcessoId(Integer acessoId) { this.acessoId = acessoId; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public EmpregadoModel getEmpregado() { return empregado; } public void setEmpregado(EmpregadoModel empregado) { this.empregado = empregado; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
775
0.699355
0.699355
39
18.871796
15.684681
54
false
false
0
0
0
0
0
0
2.153846
false
false
7
a659cc8b1e2ac354cdc2396ea3ce88424492e48e
17,042,430,281,097
da0c234d86e5dd4d97aee320a966606778f83e6e
/code/bones/java/tulin/netty/hotkey/client/src/main/java/com/jd/platform/hotkey/client/core/worker/WorkerRetryConnector.java
5a35e26ce7da791be086477a642c95f86a170033
[ "Apache-2.0" ]
permissive
legendsf/life
https://github.com/legendsf/life
db6fe837d7476cfe08ba0ab26063cbe08b1caa73
3cc3aaaf9cbbdb1c6dd68c505deba33a906a3c05
refs/heads/master
2022-08-13T10:39:00.026000
2022-07-28T03:02:44
2022-07-28T03:02:44
190,318,814
3
3
null
false
2022-07-21T06:34:05
2019-06-05T03:21:46
2022-03-14T01:03:01
2022-07-21T06:34:05
150,299
2
3
40
Java
false
false
package com.jd.platform.hotkey.client.core.worker; import cn.hutool.core.thread.NamedThreadFactory; import com.jd.platform.hotkey.client.log.JdLogger; import com.jd.platform.hotkey.client.netty.NettyClient; import java.util.List; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; /** * worker重连器 * @author wuweifeng * @version 1.0 * @date 2020-04-28 */ public class WorkerRetryConnector { /** * 定时去重连没连上的workers */ public static void retryConnectWorkers() { @SuppressWarnings("PMD.ThreadPoolCreationRule") ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("worker-retry-connector-service-executor", true)); //开启拉取etcd的worker信息,如果拉取失败,则定时继续拉取 scheduledExecutorService.scheduleAtFixedRate(WorkerRetryConnector::reConnectWorkers, 30, 30, TimeUnit.SECONDS); } private static void reConnectWorkers() { List<String> nonList = WorkerInfoHolder.getNonConnectedWorkers(); if (nonList.size() == 0) { return; } JdLogger.info(WorkerRetryConnector.class, "trying to reConnect to these workers :" + nonList); NettyClient.getInstance().connect(nonList); } }
UTF-8
Java
1,384
java
WorkerRetryConnector.java
Java
[ { "context": ".concurrent.TimeUnit;\n\n/**\n * worker重连器\n * @author wuweifeng\n * @version 1.0\n * @date 2020-04-28\n */\npublic cl", "end": 401, "score": 0.9992456436157227, "start": 392, "tag": "USERNAME", "value": "wuweifeng" } ]
null
[]
package com.jd.platform.hotkey.client.core.worker; import cn.hutool.core.thread.NamedThreadFactory; import com.jd.platform.hotkey.client.log.JdLogger; import com.jd.platform.hotkey.client.netty.NettyClient; import java.util.List; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; /** * worker重连器 * @author wuweifeng * @version 1.0 * @date 2020-04-28 */ public class WorkerRetryConnector { /** * 定时去重连没连上的workers */ public static void retryConnectWorkers() { @SuppressWarnings("PMD.ThreadPoolCreationRule") ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("worker-retry-connector-service-executor", true)); //开启拉取etcd的worker信息,如果拉取失败,则定时继续拉取 scheduledExecutorService.scheduleAtFixedRate(WorkerRetryConnector::reConnectWorkers, 30, 30, TimeUnit.SECONDS); } private static void reConnectWorkers() { List<String> nonList = WorkerInfoHolder.getNonConnectedWorkers(); if (nonList.size() == 0) { return; } JdLogger.info(WorkerRetryConnector.class, "trying to reConnect to these workers :" + nonList); NettyClient.getInstance().connect(nonList); } }
1,384
0.735562
0.724164
38
33.63158
36.423981
176
false
false
0
0
0
0
0
0
0.5
false
false
7
0024227d550ef9cedb8421e4c1eed0d1e746c682
32,023,276,201,708
d480801f891456c4041a875984d4ff21dd985477
/src/main/java/com/fromme/mapper/BoardMapper.java
7da3add91518b11c0d2b870db6e2b6be9efaecc7
[]
no_license
angie102/FROmme_spring
https://github.com/angie102/FROmme_spring
e479e35d17774f4cdb8c3d806d2cc38c10279d2c
4d3e48f29de3014d79ad7e6f3c86f8fde283c3c9
refs/heads/master
2023-02-23T20:40:11.808000
2021-01-29T15:06:33
2021-01-29T15:06:33
334,175,855
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.fromme.mapper; import java.util.List; import org.apache.ibatis.annotations.Param; import com.fromme.domain.Criteria; import com.fromme.domain.PostVO; import com.fromme.domain.PostViewVO; public interface BoardMapper { //회원 권한 public int getAuthority(String users_id); //전체 게시물 public List<PostViewVO> listAll(@Param("cri") Criteria cri); //회원 게시물 public List<PostViewVO> getBoardListByUser(@Param("cri") Criteria cri, @Param("users_id") String users_id); //회원 게시물 개수 public int getBoardListCountByUser(@Param("cri") Criteria cri, @Param("users_id") String users_id); //회원이 작성한 댓글이 있는 게시글 개수 public int getBoardCountByUserReply(String users_id); //회원 댓글 개수 public int getReplyCountByUser(String users_id); //게시글 이미지 리스트 public List<PostViewVO> getBoardImageList(@Param("cri") Criteria cri); //게시글 개수 public int boardListCount(@Param("cri") Criteria cri); //카테고리 이름 public String getBoardCategoryName(int categoryNum); //현재 게시글 번호 public int getCurrentBoardSeq(); //게시글 조회수 증가 public void updateReadCount(int post_no); //게시글 삽입 public int insertBoard(PostVO post); //게시글 삽입(전에 post_no 가져오기) public int insertSelectKey_post_no(PostVO post); //게시글 수정 public int updateBoard(PostVO post); //게시글 삭제 public int deleteBoard(int post_no); //게시글 상세보기 public PostVO getDetail(int post_no); //게시글 숨기기 public void updateHideBoard(int post_no); //게시글 보여주기 public void updateShowBoardAll(int start_no, int end_no); public PostVO getNextBoardByUserboard(@Param("cri") Criteria cri, @Param("post_no") int post_no); public PostVO getPrevBoardByUserboard(@Param("cri") Criteria cri, @Param("post_no") int post_no); public PostVO getNextBoardByUserreply(@Param("cri") Criteria cri, @Param("post_no") int post_no, @Param("users_id") String users_id); public PostVO getPrevBoardByUserreply(@Param("cri") Criteria cri, @Param("post_no") int post_no, @Param("users_id") String users_id); public PostVO getNextBoardSearchedAndSortedBydate(@Param("cri") Criteria cri, @Param("post_no") int post_no); public PostVO getPrevBoardSearchedAndSortedBydate(@Param("cri") Criteria cri, @Param("post_no") int post_no); public PostVO getNextBoardSearchedAndSortedByviews(@Param("cri") Criteria cri, @Param("post_no") int post_no); public PostVO getPrevBoardSearchedAndSortedByviews(@Param("cri") Criteria cri, @Param("post_no") int post_no); public PostVO getNextBoardSortedBydate(@Param("cri") Criteria cri, @Param("post_no") int post_no); public PostVO getPrevBoardSortedBydate(@Param("cri") Criteria cri, @Param("post_no") int post_no); public PostVO getNextBoardSortedByviews(@Param("cri") Criteria cri, @Param("post_no") int post_no); public PostVO getPrevBoardSortedByviews(@Param("cri") Criteria cri, @Param("post_no") int post_no); }
UTF-8
Java
3,083
java
BoardMapper.java
Java
[]
null
[]
package com.fromme.mapper; import java.util.List; import org.apache.ibatis.annotations.Param; import com.fromme.domain.Criteria; import com.fromme.domain.PostVO; import com.fromme.domain.PostViewVO; public interface BoardMapper { //회원 권한 public int getAuthority(String users_id); //전체 게시물 public List<PostViewVO> listAll(@Param("cri") Criteria cri); //회원 게시물 public List<PostViewVO> getBoardListByUser(@Param("cri") Criteria cri, @Param("users_id") String users_id); //회원 게시물 개수 public int getBoardListCountByUser(@Param("cri") Criteria cri, @Param("users_id") String users_id); //회원이 작성한 댓글이 있는 게시글 개수 public int getBoardCountByUserReply(String users_id); //회원 댓글 개수 public int getReplyCountByUser(String users_id); //게시글 이미지 리스트 public List<PostViewVO> getBoardImageList(@Param("cri") Criteria cri); //게시글 개수 public int boardListCount(@Param("cri") Criteria cri); //카테고리 이름 public String getBoardCategoryName(int categoryNum); //현재 게시글 번호 public int getCurrentBoardSeq(); //게시글 조회수 증가 public void updateReadCount(int post_no); //게시글 삽입 public int insertBoard(PostVO post); //게시글 삽입(전에 post_no 가져오기) public int insertSelectKey_post_no(PostVO post); //게시글 수정 public int updateBoard(PostVO post); //게시글 삭제 public int deleteBoard(int post_no); //게시글 상세보기 public PostVO getDetail(int post_no); //게시글 숨기기 public void updateHideBoard(int post_no); //게시글 보여주기 public void updateShowBoardAll(int start_no, int end_no); public PostVO getNextBoardByUserboard(@Param("cri") Criteria cri, @Param("post_no") int post_no); public PostVO getPrevBoardByUserboard(@Param("cri") Criteria cri, @Param("post_no") int post_no); public PostVO getNextBoardByUserreply(@Param("cri") Criteria cri, @Param("post_no") int post_no, @Param("users_id") String users_id); public PostVO getPrevBoardByUserreply(@Param("cri") Criteria cri, @Param("post_no") int post_no, @Param("users_id") String users_id); public PostVO getNextBoardSearchedAndSortedBydate(@Param("cri") Criteria cri, @Param("post_no") int post_no); public PostVO getPrevBoardSearchedAndSortedBydate(@Param("cri") Criteria cri, @Param("post_no") int post_no); public PostVO getNextBoardSearchedAndSortedByviews(@Param("cri") Criteria cri, @Param("post_no") int post_no); public PostVO getPrevBoardSearchedAndSortedByviews(@Param("cri") Criteria cri, @Param("post_no") int post_no); public PostVO getNextBoardSortedBydate(@Param("cri") Criteria cri, @Param("post_no") int post_no); public PostVO getPrevBoardSortedBydate(@Param("cri") Criteria cri, @Param("post_no") int post_no); public PostVO getNextBoardSortedByviews(@Param("cri") Criteria cri, @Param("post_no") int post_no); public PostVO getPrevBoardSortedByviews(@Param("cri") Criteria cri, @Param("post_no") int post_no); }
3,083
0.734744
0.734744
92
29.815218
37.805836
134
false
false
0
0
0
0
0
0
1.456522
false
false
7
2e802730b69f3de1569f71532d1b7091a655d390
13,683,765,867,468
be39b5d60c0dc9894f744fda160176a77d5984be
/BD-Labs/Exercise13/src/main/java/it/polito/bigdata/hadoop/E13Mapper.java
2f1780f302d4c5e355b083f7535056ce51e8275f
[ "MIT" ]
permissive
AndreaCossio/PoliTo-Projects
https://github.com/AndreaCossio/PoliTo-Projects
2f67e7f8026a074428cf6547105292fc93934fc6
f89c8ce1e04d54e38a1309a01c7e3a9aa67d5a81
refs/heads/master
2023-01-04T23:35:24.092000
2020-11-02T11:10:02
2020-11-02T11:10:02
309,335,038
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package it.polito.bigdata.hadoop; import java.io.IOException; import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Mapper; import it.polito.bigdata.hadoop.DateIncome; public class E13Mapper extends Mapper<Text, Text, NullWritable, DateIncome> { private DateIncome top; protected void setup(Context context) { top = new DateIncome(null, Integer.MIN_VALUE); } @Override protected void map(Text key, Text value, Context context) throws IOException, InterruptedException { String date = key.toString(); Integer income = Integer.parseInt(value.toString()); if (income > top.getIncome() || (income == top.getIncome() && date.compareTo(top.getDate()) < 0)) { top = new DateIncome(date, income); } } protected void cleanup(Context context) throws IOException, InterruptedException { context.write(NullWritable.get(), top); } }
UTF-8
Java
987
java
E13Mapper.java
Java
[]
null
[]
package it.polito.bigdata.hadoop; import java.io.IOException; import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Mapper; import it.polito.bigdata.hadoop.DateIncome; public class E13Mapper extends Mapper<Text, Text, NullWritable, DateIncome> { private DateIncome top; protected void setup(Context context) { top = new DateIncome(null, Integer.MIN_VALUE); } @Override protected void map(Text key, Text value, Context context) throws IOException, InterruptedException { String date = key.toString(); Integer income = Integer.parseInt(value.toString()); if (income > top.getIncome() || (income == top.getIncome() && date.compareTo(top.getDate()) < 0)) { top = new DateIncome(date, income); } } protected void cleanup(Context context) throws IOException, InterruptedException { context.write(NullWritable.get(), top); } }
987
0.68693
0.683891
34
28.058823
30.819151
107
false
false
0
0
0
0
0
0
0.705882
false
false
7
35406d0bd3c78955bb0af05c4a4e4a0da227e6f8
24,627,342,523,346
28890fe3b37a4e54b8ad9abb2add1d431227b73b
/integration-test/src/main/java/com/sequenceiq/it/cloudbreak/util/storagelocation/AzureTestStorageLocation.java
a8e0fc3b35a24faf0d07a006c77fba7b3c5db1d0
[ "LicenseRef-scancode-warranty-disclaimer", "ANTLR-PD", "CDDL-1.0", "bzip2-1.0.6", "Zlib", "BSD-3-Clause", "MIT", "EPL-1.0", "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-jdbm-1.00", "Apache-2.0" ]
permissive
joshelser/cloudbreak
https://github.com/joshelser/cloudbreak
10d270fa5d23bdfe1f893c22d064c14ae0156a97
b2d3cad71f68f9f2ddbd283fe82e29aea51596dd
refs/heads/master
2023-08-14T14:39:12.903000
2019-07-19T17:37:26
2019-07-19T18:38:47
197,847,531
0
0
Apache-2.0
true
2019-07-19T22:01:40
2019-07-19T22:01:40
2019-07-19T18:38:52
2019-07-19T18:42:44
69,867
0
0
0
null
false
false
package com.sequenceiq.it.cloudbreak.util.storagelocation; import java.util.Arrays; import java.util.LinkedHashSet; import java.util.Set; import javax.annotation.Nonnull; import com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.storage.location.StorageLocationV4Request; public class AzureTestStorageLocation extends TestStorageLocation { private final String storageAccountName; public AzureTestStorageLocation(String storageAccountName, String clusterName, String baseStorageLocationName) { super(baseStorageLocationName, clusterName); this.storageAccountName = storageAccountName; } public Set<StorageLocationV4Request> getAdlsGen2(@Nonnull StorageComponent... components) { Set<StorageLocationV4Request> locations = new LinkedHashSet<>(); Arrays.asList(components).forEach(storageComponent -> locations.addAll(storageComponent.getLocations(this))); return locations; } @Override public String getStorageTypePrefix() { return "abfs"; } @Override public String getPathInfix() { return super.getBaseStorageLocationName() + "@" + storageAccountName + ".blob.core.windows.net"; } }
UTF-8
Java
1,206
java
AzureTestStorageLocation.java
Java
[]
null
[]
package com.sequenceiq.it.cloudbreak.util.storagelocation; import java.util.Arrays; import java.util.LinkedHashSet; import java.util.Set; import javax.annotation.Nonnull; import com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.storage.location.StorageLocationV4Request; public class AzureTestStorageLocation extends TestStorageLocation { private final String storageAccountName; public AzureTestStorageLocation(String storageAccountName, String clusterName, String baseStorageLocationName) { super(baseStorageLocationName, clusterName); this.storageAccountName = storageAccountName; } public Set<StorageLocationV4Request> getAdlsGen2(@Nonnull StorageComponent... components) { Set<StorageLocationV4Request> locations = new LinkedHashSet<>(); Arrays.asList(components).forEach(storageComponent -> locations.addAll(storageComponent.getLocations(this))); return locations; } @Override public String getStorageTypePrefix() { return "abfs"; } @Override public String getPathInfix() { return super.getBaseStorageLocationName() + "@" + storageAccountName + ".blob.core.windows.net"; } }
1,206
0.75539
0.751244
36
32.5
37.235363
117
false
false
0
0
0
0
0
0
0.472222
false
false
7
c6726b42ee83b60286474681df3985d5398681ca
12,687,333,447,814
7eb35ae5b46d644dabbc6e9f4423aad1488dab40
/app/src/main/java/cn/net/cc/weibo/ui/view/emojitextview/WeiBoContentTextUtil.java
46312b46fddca9f6a6bd9709e960d532f320b9e4
[ "Apache-2.0" ]
permissive
ckenergy/MaterialDesignWeibo
https://github.com/ckenergy/MaterialDesignWeibo
6d6a5f40a38498b52426de32a37eebbd98e62f72
779beedda71335f371f6a5f032cb0b3dfde0dfba
refs/heads/master
2021-01-21T06:42:15.986000
2017-05-03T06:06:17
2017-05-03T06:06:17
82,869,357
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.net.cc.weibo.ui.view.emojitextview; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.drawable.Drawable; import android.support.v4.view.MotionEventCompat; import android.text.Layout; import android.text.Spannable; import android.text.SpannableStringBuilder; import android.text.TextUtils; import android.text.style.BackgroundColorSpan; import android.text.style.ForegroundColorSpan; import android.text.style.ImageSpan; import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; import cn.net.cc.weibo.R; import cn.net.cc.weibo.ui.user.UserActivity; import cn.net.cc.weibo.util.DensityUtil; //TODO callback public class WeiBoContentTextUtil { public static class Section { public static final int AT = 1; public static final int TOPIC = 2;// ##话题 public static final int URL = 3;// url public static final int EMOJI = 4;//emoji 表情 private int start; private int end; private int type; private String name; Section(int start, int end, int type, String name) { this.start = start; this.end = end; this.type = type; this.name = name; } @Override public String toString() { return "start:"+start+",end:"+end; } } private static final String TAG = "WeiBoContentTextUtil"; private static final String AT = "@[\\w\\p{InCJKUnifiedIdeographs}-]{1,26}";// @人 private static final String TOPIC = "#[\\p{Print}\\p{InCJKUnifiedIdeographs}&&[^#]]+#";// ##话题 private static final String URL = "http://[a-zA-Z0-9+&@#/%?=~_\\-|!:,\\.;]*[a-zA-Z0-9+&@#/%=~_|]";// url private static final String EMOJI = "\\[(\\S+?)\\]";//emoji 表情 private static final String ALL = "(" + AT + ")" + "|" + "(" + TOPIC + ")" + "|" + "(" + URL + ")" + "|" + "(" + EMOJI + ")"; public static SpannableStringBuilder getWeiBoContent(final String source, final Context context, final TextView textView, final OnClickListener onClickListener) { final ArrayList<Section> sections = new ArrayList<>(); final SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(source); //设置正则 Pattern pattern = Pattern.compile(ALL); Matcher matcher = pattern.matcher(spannableStringBuilder); if (matcher.find()) { if (!(textView instanceof EditText)) { textView.setMovementMethod(ClickableMovementMethod.getInstance()); textView.setFocusable(false); textView.setClickable(false); textView.setLongClickable(false); } matcher.reset(); } while (matcher.find()) { final String at = matcher.group(1); final String topic = matcher.group(2); final String url = matcher.group(3); final String emoji = matcher.group(4); //处理@用户 if (at != null) { int start = matcher.start(1); int end = start + at.length(); Section section = new Section(start,end,Section.AT,at); sections.add(section); ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(context.getResources().getColor(R.color.navigation_green)); spannableStringBuilder.setSpan(foregroundColorSpan, start, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE); } //处理##话题 if (topic != null) { int start = matcher.start(2); int end = start + topic.length(); Section section = new Section(start,end,Section.TOPIC,topic); sections.add(section); ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(context.getResources().getColor(R.color.navigation_green)); spannableStringBuilder.setSpan(foregroundColorSpan, start, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE); } // 处理url地址 if (url != null) { int start = matcher.start(3); int end = start + url.length(); Section section = new Section(start,end,Section.URL,url); sections.add(section); Drawable websiteDrawable = context.getResources().getDrawable(R.drawable.button_web); websiteDrawable.setBounds(0, 0, websiteDrawable.getIntrinsicWidth(), websiteDrawable.getIntrinsicHeight()); ImageSpan imageSpan = new ImageSpan(websiteDrawable, ImageSpan.ALIGN_BOTTOM) { public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) { Drawable b = getDrawable(); canvas.save(); int transY = bottom - b.getBounds().bottom; transY -= paint.getFontMetricsInt().descent / 2; canvas.translate(x, transY); b.draw(canvas); canvas.restore(); } }; spannableStringBuilder.setSpan(imageSpan, start, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE); } //emoji if (emoji != null) { int start = matcher.start(4); int end = start + emoji.length(); String imgName = Emoticons.getImgName(emoji); if (!TextUtils.isEmpty(imgName)) { int resId = context.getResources().getIdentifier(imgName, "drawable", context.getPackageName()); if (resId != 0){ Drawable emojiDrawable = context.getResources().getDrawable(resId); if (emojiDrawable != null) { emojiDrawable.setBounds(0, 0, DensityUtil.sp2px(context, 17), DensityUtil.sp2px(context, 17)); ImageSpan imageSpan = new ImageSpan(emojiDrawable, ImageSpan.ALIGN_BOTTOM) { public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) { Drawable b = getDrawable(); canvas.save(); int transY = bottom - b.getBounds().bottom; transY -= paint.getFontMetricsInt().descent / 2; canvas.translate(x, transY); b.draw(canvas); canvas.restore(); } }; spannableStringBuilder.setSpan(imageSpan, start, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE); } } } } } final BackgroundColorSpan span = new BackgroundColorSpan(context.getResources().getColor(R.color.light_blue)); final int slop = ViewConfiguration.get(context).getScaledTouchSlop(); textView.setOnTouchListener(new View.OnTouchListener() { int downX,downY; Section downSection = null; int id; @Override public boolean onTouch(View v, MotionEvent event) { int action = MotionEventCompat.getActionMasked(event); Layout layout = textView.getLayout(); if (layout == null) { Log.d(TAG,"layout is null"); return false; } int line = 0; int index = 0; switch(action) { case MotionEvent.ACTION_DOWN://TODO 最后一行点击问题 网址链接 int actionIndex = event.getActionIndex(); id = event.getPointerId(actionIndex); downX = (int) event.getX(actionIndex); downY = (int) event.getY(actionIndex); Log.d(TAG, "ACTION_down,x:"+event.getX()+",y:"+event.getY()); line = layout.getLineForVertical(textView.getScrollY() + (int)event.getY()); index = layout.getOffsetForHorizontal(line, (int)event.getX()); int lastRight = (int) layout.getLineRight(line); Log.d(TAG,"lastRight:"+lastRight); if (lastRight < event.getX()) { //文字最后为话题时,如果点击在最后一行话题之后,也会造成话题被选中效果 return false; } Log.d(TAG," index:"+ index+",sections:"+sections.size()); for (Section section : sections) { if (index >= section.start && index <= section.end) { spannableStringBuilder.setSpan(span,section.start,section.end,Spannable.SPAN_INCLUSIVE_INCLUSIVE); downSection = section; textView.setText(spannableStringBuilder); textView.getParent().requestDisallowInterceptTouchEvent(true);//不允许父view拦截 Log.d(TAG,"downSection"+downSection.toString()); return true; } } return false; case MotionEvent.ACTION_MOVE: int indexMove = event.findPointerIndex(id); int currentX = (int) event.getX(indexMove); int currentY = (int) event.getY(indexMove); Log.d(TAG, "ACTION_MOVE,x:"+currentX+",y:"+currentY); if (Math.abs(currentX-downX) < slop && Math.abs(currentY-downY) < slop) { if (downSection == null) { return false; } break; } downSection = null; textView.getParent().requestDisallowInterceptTouchEvent(false);//允许父view拦截 case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: int indexUp = event.findPointerIndex(id); spannableStringBuilder.removeSpan(span); textView.setText(spannableStringBuilder); int upX = (int) event.getX(indexUp); int upY = (int) event.getY(indexUp); Log.d(TAG, "ACTION_UP,x:"+upX+",y:"+upY); if (Math.abs(upX-downX) < slop && Math.abs(upY-downY) < slop) { //TODO startActivity or whatever if (downSection != null) { String name = downSection.name; if (onClickListener != null) { onClickListener.onClick(downSection.type, name); } Toast.makeText(context,name,Toast.LENGTH_SHORT).show(); downSection = null; }else { return false; } }else { downSection = null; return false; } break; } Log.d(TAG,"true"); return true; } }); return spannableStringBuilder; } public static class SimpleClickListener implements OnClickListener { Context context; public SimpleClickListener(Context context) { this.context = context; } @Override public void onClick(int type, String name) { switch (type) { case Section.AT: if (name.startsWith("@")) { name = name.substring(1); } UserActivity.startThis(context, name); break; } } } public interface OnClickListener { public void onClick(int type, String name); } }
UTF-8
Java
12,882
java
WeiBoContentTextUtil.java
Java
[]
null
[]
package cn.net.cc.weibo.ui.view.emojitextview; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.drawable.Drawable; import android.support.v4.view.MotionEventCompat; import android.text.Layout; import android.text.Spannable; import android.text.SpannableStringBuilder; import android.text.TextUtils; import android.text.style.BackgroundColorSpan; import android.text.style.ForegroundColorSpan; import android.text.style.ImageSpan; import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; import cn.net.cc.weibo.R; import cn.net.cc.weibo.ui.user.UserActivity; import cn.net.cc.weibo.util.DensityUtil; //TODO callback public class WeiBoContentTextUtil { public static class Section { public static final int AT = 1; public static final int TOPIC = 2;// ##话题 public static final int URL = 3;// url public static final int EMOJI = 4;//emoji 表情 private int start; private int end; private int type; private String name; Section(int start, int end, int type, String name) { this.start = start; this.end = end; this.type = type; this.name = name; } @Override public String toString() { return "start:"+start+",end:"+end; } } private static final String TAG = "WeiBoContentTextUtil"; private static final String AT = "@[\\w\\p{InCJKUnifiedIdeographs}-]{1,26}";// @人 private static final String TOPIC = "#[\\p{Print}\\p{InCJKUnifiedIdeographs}&&[^#]]+#";// ##话题 private static final String URL = "http://[a-zA-Z0-9+&@#/%?=~_\\-|!:,\\.;]*[a-zA-Z0-9+&@#/%=~_|]";// url private static final String EMOJI = "\\[(\\S+?)\\]";//emoji 表情 private static final String ALL = "(" + AT + ")" + "|" + "(" + TOPIC + ")" + "|" + "(" + URL + ")" + "|" + "(" + EMOJI + ")"; public static SpannableStringBuilder getWeiBoContent(final String source, final Context context, final TextView textView, final OnClickListener onClickListener) { final ArrayList<Section> sections = new ArrayList<>(); final SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(source); //设置正则 Pattern pattern = Pattern.compile(ALL); Matcher matcher = pattern.matcher(spannableStringBuilder); if (matcher.find()) { if (!(textView instanceof EditText)) { textView.setMovementMethod(ClickableMovementMethod.getInstance()); textView.setFocusable(false); textView.setClickable(false); textView.setLongClickable(false); } matcher.reset(); } while (matcher.find()) { final String at = matcher.group(1); final String topic = matcher.group(2); final String url = matcher.group(3); final String emoji = matcher.group(4); //处理@用户 if (at != null) { int start = matcher.start(1); int end = start + at.length(); Section section = new Section(start,end,Section.AT,at); sections.add(section); ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(context.getResources().getColor(R.color.navigation_green)); spannableStringBuilder.setSpan(foregroundColorSpan, start, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE); } //处理##话题 if (topic != null) { int start = matcher.start(2); int end = start + topic.length(); Section section = new Section(start,end,Section.TOPIC,topic); sections.add(section); ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(context.getResources().getColor(R.color.navigation_green)); spannableStringBuilder.setSpan(foregroundColorSpan, start, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE); } // 处理url地址 if (url != null) { int start = matcher.start(3); int end = start + url.length(); Section section = new Section(start,end,Section.URL,url); sections.add(section); Drawable websiteDrawable = context.getResources().getDrawable(R.drawable.button_web); websiteDrawable.setBounds(0, 0, websiteDrawable.getIntrinsicWidth(), websiteDrawable.getIntrinsicHeight()); ImageSpan imageSpan = new ImageSpan(websiteDrawable, ImageSpan.ALIGN_BOTTOM) { public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) { Drawable b = getDrawable(); canvas.save(); int transY = bottom - b.getBounds().bottom; transY -= paint.getFontMetricsInt().descent / 2; canvas.translate(x, transY); b.draw(canvas); canvas.restore(); } }; spannableStringBuilder.setSpan(imageSpan, start, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE); } //emoji if (emoji != null) { int start = matcher.start(4); int end = start + emoji.length(); String imgName = Emoticons.getImgName(emoji); if (!TextUtils.isEmpty(imgName)) { int resId = context.getResources().getIdentifier(imgName, "drawable", context.getPackageName()); if (resId != 0){ Drawable emojiDrawable = context.getResources().getDrawable(resId); if (emojiDrawable != null) { emojiDrawable.setBounds(0, 0, DensityUtil.sp2px(context, 17), DensityUtil.sp2px(context, 17)); ImageSpan imageSpan = new ImageSpan(emojiDrawable, ImageSpan.ALIGN_BOTTOM) { public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint) { Drawable b = getDrawable(); canvas.save(); int transY = bottom - b.getBounds().bottom; transY -= paint.getFontMetricsInt().descent / 2; canvas.translate(x, transY); b.draw(canvas); canvas.restore(); } }; spannableStringBuilder.setSpan(imageSpan, start, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE); } } } } } final BackgroundColorSpan span = new BackgroundColorSpan(context.getResources().getColor(R.color.light_blue)); final int slop = ViewConfiguration.get(context).getScaledTouchSlop(); textView.setOnTouchListener(new View.OnTouchListener() { int downX,downY; Section downSection = null; int id; @Override public boolean onTouch(View v, MotionEvent event) { int action = MotionEventCompat.getActionMasked(event); Layout layout = textView.getLayout(); if (layout == null) { Log.d(TAG,"layout is null"); return false; } int line = 0; int index = 0; switch(action) { case MotionEvent.ACTION_DOWN://TODO 最后一行点击问题 网址链接 int actionIndex = event.getActionIndex(); id = event.getPointerId(actionIndex); downX = (int) event.getX(actionIndex); downY = (int) event.getY(actionIndex); Log.d(TAG, "ACTION_down,x:"+event.getX()+",y:"+event.getY()); line = layout.getLineForVertical(textView.getScrollY() + (int)event.getY()); index = layout.getOffsetForHorizontal(line, (int)event.getX()); int lastRight = (int) layout.getLineRight(line); Log.d(TAG,"lastRight:"+lastRight); if (lastRight < event.getX()) { //文字最后为话题时,如果点击在最后一行话题之后,也会造成话题被选中效果 return false; } Log.d(TAG," index:"+ index+",sections:"+sections.size()); for (Section section : sections) { if (index >= section.start && index <= section.end) { spannableStringBuilder.setSpan(span,section.start,section.end,Spannable.SPAN_INCLUSIVE_INCLUSIVE); downSection = section; textView.setText(spannableStringBuilder); textView.getParent().requestDisallowInterceptTouchEvent(true);//不允许父view拦截 Log.d(TAG,"downSection"+downSection.toString()); return true; } } return false; case MotionEvent.ACTION_MOVE: int indexMove = event.findPointerIndex(id); int currentX = (int) event.getX(indexMove); int currentY = (int) event.getY(indexMove); Log.d(TAG, "ACTION_MOVE,x:"+currentX+",y:"+currentY); if (Math.abs(currentX-downX) < slop && Math.abs(currentY-downY) < slop) { if (downSection == null) { return false; } break; } downSection = null; textView.getParent().requestDisallowInterceptTouchEvent(false);//允许父view拦截 case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: int indexUp = event.findPointerIndex(id); spannableStringBuilder.removeSpan(span); textView.setText(spannableStringBuilder); int upX = (int) event.getX(indexUp); int upY = (int) event.getY(indexUp); Log.d(TAG, "ACTION_UP,x:"+upX+",y:"+upY); if (Math.abs(upX-downX) < slop && Math.abs(upY-downY) < slop) { //TODO startActivity or whatever if (downSection != null) { String name = downSection.name; if (onClickListener != null) { onClickListener.onClick(downSection.type, name); } Toast.makeText(context,name,Toast.LENGTH_SHORT).show(); downSection = null; }else { return false; } }else { downSection = null; return false; } break; } Log.d(TAG,"true"); return true; } }); return spannableStringBuilder; } public static class SimpleClickListener implements OnClickListener { Context context; public SimpleClickListener(Context context) { this.context = context; } @Override public void onClick(int type, String name) { switch (type) { case Section.AT: if (name.startsWith("@")) { name = name.substring(1); } UserActivity.startThis(context, name); break; } } } public interface OnClickListener { public void onClick(int type, String name); } }
12,882
0.514232
0.511401
280
44.421429
32.249931
154
false
false
0
0
0
0
0
0
0.907143
false
false
7
1e3b12a48d4f95596968b327cba212ebd9c7bd24
1,176,821,101,251
c3e757bc567fb251c2b63b2e04c3fc75022b645f
/imixpark-demo/imixpark-demo-provider/src/main/java/cn/ebatech/imixpark/demo/rest/UserRestService2Impl.java
805fee242da87ddc8596ef766698bda89a951928
[]
no_license
heaunter/imixpark
https://github.com/heaunter/imixpark
02c01f9e1390a12579b11c4290f91c05eff29991
5a06e28612c29406a6429734bbef23b82f213f1a
refs/heads/master
2018-01-15T11:52:02.713000
2016-02-24T08:33:55
2016-02-24T08:33:55
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.ebatech.imixpark.demo.rest; import cn.ebatech.imixpark.demo.model.User; import cn.ebatech.imixpark.demo.service.UserService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; public class UserRestService2Impl implements UserRestService2 { private static final Logger logger = LoggerFactory.getLogger(UserRestService2Impl.class); @Autowired private UserService userService; public User getUser(Long id) { return userService.getUser(id); } public Long registerUser(User user) { return userService.registerUser(user); } }
UTF-8
Java
651
java
UserRestService2Impl.java
Java
[]
null
[]
package cn.ebatech.imixpark.demo.rest; import cn.ebatech.imixpark.demo.model.User; import cn.ebatech.imixpark.demo.service.UserService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; public class UserRestService2Impl implements UserRestService2 { private static final Logger logger = LoggerFactory.getLogger(UserRestService2Impl.class); @Autowired private UserService userService; public User getUser(Long id) { return userService.getUser(id); } public Long registerUser(User user) { return userService.registerUser(user); } }
651
0.766513
0.758833
24
26.125
25.521744
93
false
false
0
0
0
0
0
0
0.416667
false
false
7
c19789f643731c5fdce1a470af51a0f813d975d6
23,235,773,122,337
ab38746e32cd56f84f18ba75fafbd9bf73b4e999
/app/src/main/java/com/baicizhan/online/bs_words/BBWordMediaHalftimeList.java
4844ecb294d4c9066850951cc58a9142131e8c55
[]
no_license
jack15177089002/mybcz_5_0_1
https://github.com/jack15177089002/mybcz_5_0_1
8c51a9785713046dc8ffffeff0bf8257d2af9013
ab47049b95ab69fe62ff5fd093d2204e00506bd5
refs/heads/master
2021-03-15T09:01:29.235000
2020-03-12T13:20:06
2020-03-12T13:20:06
246,839,031
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
//package com.baicizhan.online.bs_words; // //import com.p052e.p053a.p054a.JceStruct; //import java.io.IOException; //import java.io.InputStream; //import java.io.ObjectInputStream; //import java.io.ObjectOutputStream; //import java.io.OutputStream; //import java.io.Serializable; //import java.util.ArrayList; //import java.util.Collections; //import java.util.EnumMap; //import java.util.EnumSet; //import java.util.HashMap; //import java.util.Iterator; //import java.util.List; //import java.util.Map; //import org.p100a.p101a.C2116f; //import org.p100a.p101a.C2121h; //import org.p100a.p101a.C2123l; //import org.p100a.p101a.C2124m; //import org.p100a.p101a.p103b.C2091a; //import org.p100a.p101a.p103b.C2092b; //import org.p100a.p101a.p103b.C2093c; //import org.p100a.p101a.p104c.C2096a; //import org.p100a.p101a.p104c.C2097b; //import org.p100a.p101a.p104c.C2098c; //import org.p100a.p101a.p104c.C2100f; //import org.p100a.p101a.p104c.C2101g; //import org.p100a.p101a.p104c.C2103i; //import org.p100a.p101a.p104c.C2105k; //import org.p100a.p101a.p104c.C2106l; //import org.p100a.p101a.p105d.C2108a; //import org.p100a.p101a.p105d.C2109b; //import org.p100a.p101a.p105d.C2110c; //import org.p100a.p101a.p105d.C2111d; //import org.p100a.p101a.p107f.C2117b; // //public class BBWordMediaHalftimeList implements Serializable, Cloneable, Comparable<BBWordMediaHalftimeList>, C2116f<BBWordMediaHalftimeList, _Fields> { // /* access modifiers changed from: private */ // public static final C2105k STRUCT_DESC = new C2105k("BBWordMediaHalftimeList"); // /* access modifiers changed from: private */ // public static final C2097b WORD_FM_HALFTIME_LIST_FIELD_DESC = new C2097b("word_fm_halftime_list", 15, 1); // /* access modifiers changed from: private */ // public static final C2097b WORD_FM_HEAD_LIST_FIELD_DESC = new C2097b("word_fm_head_list", 15, 3); // /* access modifiers changed from: private */ // public static final C2097b WORD_FM_TAIL_LIST_FIELD_DESC = new C2097b("word_fm_tail_list", 15, 4); // /* access modifiers changed from: private */ // public static final C2097b WORD_TV_HALFTIME_LIST_FIELD_DESC = new C2097b("word_tv_halftime_list", 15, 2); // public static final Map<_Fields, C2091a> metaDataMap; // private static final Map<Class<? extends C2108a>, C2109b> schemes; // public List<String> word_fm_halftime_list; // public List<String> word_fm_head_list; // public List<String> word_fm_tail_list; // public List<String> word_tv_halftime_list; // // class BBWordMediaHalftimeListStandardScheme extends C2110c<BBWordMediaHalftimeList> { // private BBWordMediaHalftimeListStandardScheme() { // } // // public void read(C2100f fVar, BBWordMediaHalftimeList bBWordMediaHalftimeList) { // fVar.mo18504e(); // while (true) { // C2097b g = fVar.mo18506g(); // if (g.f5835b != 0) { // switch (g.f5836c) { // case 1: // if (g.f5835b != 15) { // C2103i.m5498a(fVar, g.f5835b); // break; // } else { // C2098c i = fVar.mo18508i(); // bBWordMediaHalftimeList.word_fm_halftime_list = new ArrayList(i.f5838b); // for (int i2 = 0; i2 < i.f5838b; i2++) { // bBWordMediaHalftimeList.word_fm_halftime_list.add(fVar.mo18516q()); // } // bBWordMediaHalftimeList.setWord_fm_halftime_listIsSet(true); // break; // } // case 2: // if (g.f5835b != 15) { // C2103i.m5498a(fVar, g.f5835b); // break; // } else { // C2098c i3 = fVar.mo18508i(); // bBWordMediaHalftimeList.word_tv_halftime_list = new ArrayList(i3.f5838b); // for (int i4 = 0; i4 < i3.f5838b; i4++) { // bBWordMediaHalftimeList.word_tv_halftime_list.add(fVar.mo18516q()); // } // bBWordMediaHalftimeList.setWord_tv_halftime_listIsSet(true); // break; // } // case 3: // if (g.f5835b != 15) { // C2103i.m5498a(fVar, g.f5835b); // break; // } else { // C2098c i5 = fVar.mo18508i(); // bBWordMediaHalftimeList.word_fm_head_list = new ArrayList(i5.f5838b); // for (int i6 = 0; i6 < i5.f5838b; i6++) { // bBWordMediaHalftimeList.word_fm_head_list.add(fVar.mo18516q()); // } // bBWordMediaHalftimeList.setWord_fm_head_listIsSet(true); // break; // } // case 4: // if (g.f5835b != 15) { // C2103i.m5498a(fVar, g.f5835b); // break; // } else { // C2098c i7 = fVar.mo18508i(); // bBWordMediaHalftimeList.word_fm_tail_list = new ArrayList(i7.f5838b); // for (int i8 = 0; i8 < i7.f5838b; i8++) { // bBWordMediaHalftimeList.word_fm_tail_list.add(fVar.mo18516q()); // } // bBWordMediaHalftimeList.setWord_fm_tail_listIsSet(true); // break; // } // default: // C2103i.m5498a(fVar, g.f5835b); // break; // } // } else { // fVar.mo18505f(); // bBWordMediaHalftimeList.validate(); // return; // } // } // } // // public void write(C2100f fVar, BBWordMediaHalftimeList bBWordMediaHalftimeList) { // bBWordMediaHalftimeList.validate(); // BBWordMediaHalftimeList.STRUCT_DESC; // fVar.mo18490a(); // if (bBWordMediaHalftimeList.word_fm_halftime_list != null) { // fVar.mo18496a(BBWordMediaHalftimeList.WORD_FM_HALFTIME_LIST_FIELD_DESC); // fVar.mo18497a(new C2098c(JceStruct.STRUCT_END, bBWordMediaHalftimeList.word_fm_halftime_list.size())); // for (String a : bBWordMediaHalftimeList.word_fm_halftime_list) { // fVar.mo18495a(a); // } // } // if (bBWordMediaHalftimeList.word_tv_halftime_list != null) { // fVar.mo18496a(BBWordMediaHalftimeList.WORD_TV_HALFTIME_LIST_FIELD_DESC); // fVar.mo18497a(new C2098c(JceStruct.STRUCT_END, bBWordMediaHalftimeList.word_tv_halftime_list.size())); // for (String a2 : bBWordMediaHalftimeList.word_tv_halftime_list) { // fVar.mo18495a(a2); // } // } // if (bBWordMediaHalftimeList.word_fm_head_list != null) { // fVar.mo18496a(BBWordMediaHalftimeList.WORD_FM_HEAD_LIST_FIELD_DESC); // fVar.mo18497a(new C2098c(JceStruct.STRUCT_END, bBWordMediaHalftimeList.word_fm_head_list.size())); // for (String a3 : bBWordMediaHalftimeList.word_fm_head_list) { // fVar.mo18495a(a3); // } // } // if (bBWordMediaHalftimeList.word_fm_tail_list != null) { // fVar.mo18496a(BBWordMediaHalftimeList.WORD_FM_TAIL_LIST_FIELD_DESC); // fVar.mo18497a(new C2098c(JceStruct.STRUCT_END, bBWordMediaHalftimeList.word_fm_tail_list.size())); // for (String a4 : bBWordMediaHalftimeList.word_fm_tail_list) { // fVar.mo18495a(a4); // } // } // fVar.mo18502c(); // fVar.mo18501b(); // } // } // // class BBWordMediaHalftimeListStandardSchemeFactory implements C2109b { // private BBWordMediaHalftimeListStandardSchemeFactory() { // } // // public BBWordMediaHalftimeListStandardScheme getScheme() { // return new BBWordMediaHalftimeListStandardScheme(); // } // } // // class BBWordMediaHalftimeListTupleScheme extends C2111d<BBWordMediaHalftimeList> { // private BBWordMediaHalftimeListTupleScheme() { // } // // public void write(C2100f fVar, BBWordMediaHalftimeList bBWordMediaHalftimeList) { // C2106l lVar = (C2106l) fVar; // lVar.mo18493a(bBWordMediaHalftimeList.word_fm_halftime_list.size()); // for (String a : bBWordMediaHalftimeList.word_fm_halftime_list) { // lVar.mo18495a(a); // } // lVar.mo18493a(bBWordMediaHalftimeList.word_tv_halftime_list.size()); // for (String a2 : bBWordMediaHalftimeList.word_tv_halftime_list) { // lVar.mo18495a(a2); // } // lVar.mo18493a(bBWordMediaHalftimeList.word_fm_head_list.size()); // for (String a3 : bBWordMediaHalftimeList.word_fm_head_list) { // lVar.mo18495a(a3); // } // lVar.mo18493a(bBWordMediaHalftimeList.word_fm_tail_list.size()); // for (String a4 : bBWordMediaHalftimeList.word_fm_tail_list) { // lVar.mo18495a(a4); // } // } // // public void read(C2100f fVar, BBWordMediaHalftimeList bBWordMediaHalftimeList) { // C2106l lVar = (C2106l) fVar; // C2098c cVar = new C2098c(JceStruct.STRUCT_END, lVar.mo18513n()); // bBWordMediaHalftimeList.word_fm_halftime_list = new ArrayList(cVar.f5838b); // for (int i = 0; i < cVar.f5838b; i++) { // bBWordMediaHalftimeList.word_fm_halftime_list.add(lVar.mo18516q()); // } // bBWordMediaHalftimeList.setWord_fm_halftime_listIsSet(true); // C2098c cVar2 = new C2098c(JceStruct.STRUCT_END, lVar.mo18513n()); // bBWordMediaHalftimeList.word_tv_halftime_list = new ArrayList(cVar2.f5838b); // for (int i2 = 0; i2 < cVar2.f5838b; i2++) { // bBWordMediaHalftimeList.word_tv_halftime_list.add(lVar.mo18516q()); // } // bBWordMediaHalftimeList.setWord_tv_halftime_listIsSet(true); // C2098c cVar3 = new C2098c(JceStruct.STRUCT_END, lVar.mo18513n()); // bBWordMediaHalftimeList.word_fm_head_list = new ArrayList(cVar3.f5838b); // for (int i3 = 0; i3 < cVar3.f5838b; i3++) { // bBWordMediaHalftimeList.word_fm_head_list.add(lVar.mo18516q()); // } // bBWordMediaHalftimeList.setWord_fm_head_listIsSet(true); // C2098c cVar4 = new C2098c(JceStruct.STRUCT_END, lVar.mo18513n()); // bBWordMediaHalftimeList.word_fm_tail_list = new ArrayList(cVar4.f5838b); // for (int i4 = 0; i4 < cVar4.f5838b; i4++) { // bBWordMediaHalftimeList.word_fm_tail_list.add(lVar.mo18516q()); // } // bBWordMediaHalftimeList.setWord_fm_tail_listIsSet(true); // } // } // // class BBWordMediaHalftimeListTupleSchemeFactory implements C2109b { // private BBWordMediaHalftimeListTupleSchemeFactory() { // } // // public BBWordMediaHalftimeListTupleScheme getScheme() { // return new BBWordMediaHalftimeListTupleScheme(); // } // } // // public enum _Fields implements C2124m { // WORD_FM_HALFTIME_LIST(1, "word_fm_halftime_list"), // WORD_TV_HALFTIME_LIST(2, "word_tv_halftime_list"), // WORD_FM_HEAD_LIST(3, "word_fm_head_list"), // WORD_FM_TAIL_LIST(4, "word_fm_tail_list"); // // private static final Map<String, _Fields> byName = null; // private final String _fieldName; // private final short _thriftId; // // static { // byName = new HashMap(); // Iterator it = EnumSet.allOf(_Fields.class).iterator(); // while (it.hasNext()) { // _Fields _fields = (_Fields) it.next(); // byName.put(_fields.getFieldName(), _fields); // } // } // // public static _Fields findByThriftId(int i) { // switch (i) { // case 1: // return WORD_FM_HALFTIME_LIST; // case 2: // return WORD_TV_HALFTIME_LIST; // case 3: // return WORD_FM_HEAD_LIST; // case 4: // return WORD_FM_TAIL_LIST; // default: // return null; // } // } // // public static _Fields findByThriftIdOrThrow(int i) { // _Fields findByThriftId = findByThriftId(i); // if (findByThriftId != null) { // return findByThriftId; // } // throw new IllegalArgumentException("Field " + i + " doesn't exist!"); // } // // public static _Fields findByName(String str) { // return (_Fields) byName.get(str); // } // // private _Fields(short s, String str) { // this._thriftId = s; // this._fieldName = str; // } // // public final short getThriftFieldId() { // return this._thriftId; // } // // public final String getFieldName() { // return this._fieldName; // } // } // // static { // HashMap hashMap = new HashMap(); // schemes = hashMap; // hashMap.put(C2110c.class, new BBWordMediaHalftimeListStandardSchemeFactory()); // schemes.put(C2111d.class, new BBWordMediaHalftimeListTupleSchemeFactory()); // EnumMap enumMap = new EnumMap(_Fields.class); // enumMap.put(_Fields.WORD_FM_HALFTIME_LIST, new C2091a("word_fm_halftime_list", 1, new C2093c(new C2092b(JceStruct.STRUCT_END, 0)))); // enumMap.put(_Fields.WORD_TV_HALFTIME_LIST, new C2091a("word_tv_halftime_list", 1, new C2093c(new C2092b(JceStruct.STRUCT_END, 0)))); // enumMap.put(_Fields.WORD_FM_HEAD_LIST, new C2091a("word_fm_head_list", 1, new C2093c(new C2092b(JceStruct.STRUCT_END, 0)))); // enumMap.put(_Fields.WORD_FM_TAIL_LIST, new C2091a("word_fm_tail_list", 1, new C2093c(new C2092b(JceStruct.STRUCT_END, 0)))); // metaDataMap = Collections.unmodifiableMap(enumMap); // C2091a.m5430a(BBWordMediaHalftimeList.class, metaDataMap); // } // // public BBWordMediaHalftimeList() { // } // // public BBWordMediaHalftimeList(List<String> list, List<String> list2, List<String> list3, List<String> list4) { // this(); // this.word_fm_halftime_list = list; // this.word_tv_halftime_list = list2; // this.word_fm_head_list = list3; // this.word_fm_tail_list = list4; // } // // public BBWordMediaHalftimeList(BBWordMediaHalftimeList bBWordMediaHalftimeList) { // if (bBWordMediaHalftimeList.isSetWord_fm_halftime_list()) { // this.word_fm_halftime_list = new ArrayList(bBWordMediaHalftimeList.word_fm_halftime_list); // } // if (bBWordMediaHalftimeList.isSetWord_tv_halftime_list()) { // this.word_tv_halftime_list = new ArrayList(bBWordMediaHalftimeList.word_tv_halftime_list); // } // if (bBWordMediaHalftimeList.isSetWord_fm_head_list()) { // this.word_fm_head_list = new ArrayList(bBWordMediaHalftimeList.word_fm_head_list); // } // if (bBWordMediaHalftimeList.isSetWord_fm_tail_list()) { // this.word_fm_tail_list = new ArrayList(bBWordMediaHalftimeList.word_fm_tail_list); // } // } // // public BBWordMediaHalftimeList deepCopy() { // return new BBWordMediaHalftimeList(this); // } // // public void clear() { // this.word_fm_halftime_list = null; // this.word_tv_halftime_list = null; // this.word_fm_head_list = null; // this.word_fm_tail_list = null; // } // // public int getWord_fm_halftime_listSize() { // if (this.word_fm_halftime_list == null) { // return 0; // } // return this.word_fm_halftime_list.size(); // } // // public Iterator<String> getWord_fm_halftime_listIterator() { // if (this.word_fm_halftime_list == null) { // return null; // } // return this.word_fm_halftime_list.iterator(); // } // // public void addToWord_fm_halftime_list(String str) { // if (this.word_fm_halftime_list == null) { // this.word_fm_halftime_list = new ArrayList(); // } // this.word_fm_halftime_list.add(str); // } // // public List<String> getWord_fm_halftime_list() { // return this.word_fm_halftime_list; // } // // public BBWordMediaHalftimeList setWord_fm_halftime_list(List<String> list) { // this.word_fm_halftime_list = list; // return this; // } // // public void unsetWord_fm_halftime_list() { // this.word_fm_halftime_list = null; // } // // public boolean isSetWord_fm_halftime_list() { // return this.word_fm_halftime_list != null; // } // // public void setWord_fm_halftime_listIsSet(boolean z) { // if (!z) { // this.word_fm_halftime_list = null; // } // } // // public int getWord_tv_halftime_listSize() { // if (this.word_tv_halftime_list == null) { // return 0; // } // return this.word_tv_halftime_list.size(); // } // // public Iterator<String> getWord_tv_halftime_listIterator() { // if (this.word_tv_halftime_list == null) { // return null; // } // return this.word_tv_halftime_list.iterator(); // } // // public void addToWord_tv_halftime_list(String str) { // if (this.word_tv_halftime_list == null) { // this.word_tv_halftime_list = new ArrayList(); // } // this.word_tv_halftime_list.add(str); // } // // public List<String> getWord_tv_halftime_list() { // return this.word_tv_halftime_list; // } // // public BBWordMediaHalftimeList setWord_tv_halftime_list(List<String> list) { // this.word_tv_halftime_list = list; // return this; // } // // public void unsetWord_tv_halftime_list() { // this.word_tv_halftime_list = null; // } // // public boolean isSetWord_tv_halftime_list() { // return this.word_tv_halftime_list != null; // } // // public void setWord_tv_halftime_listIsSet(boolean z) { // if (!z) { // this.word_tv_halftime_list = null; // } // } // // public int getWord_fm_head_listSize() { // if (this.word_fm_head_list == null) { // return 0; // } // return this.word_fm_head_list.size(); // } // // public Iterator<String> getWord_fm_head_listIterator() { // if (this.word_fm_head_list == null) { // return null; // } // return this.word_fm_head_list.iterator(); // } // // public void addToWord_fm_head_list(String str) { // if (this.word_fm_head_list == null) { // this.word_fm_head_list = new ArrayList(); // } // this.word_fm_head_list.add(str); // } // // public List<String> getWord_fm_head_list() { // return this.word_fm_head_list; // } // // public BBWordMediaHalftimeList setWord_fm_head_list(List<String> list) { // this.word_fm_head_list = list; // return this; // } // // public void unsetWord_fm_head_list() { // this.word_fm_head_list = null; // } // // public boolean isSetWord_fm_head_list() { // return this.word_fm_head_list != null; // } // // public void setWord_fm_head_listIsSet(boolean z) { // if (!z) { // this.word_fm_head_list = null; // } // } // // public int getWord_fm_tail_listSize() { // if (this.word_fm_tail_list == null) { // return 0; // } // return this.word_fm_tail_list.size(); // } // // public Iterator<String> getWord_fm_tail_listIterator() { // if (this.word_fm_tail_list == null) { // return null; // } // return this.word_fm_tail_list.iterator(); // } // // public void addToWord_fm_tail_list(String str) { // if (this.word_fm_tail_list == null) { // this.word_fm_tail_list = new ArrayList(); // } // this.word_fm_tail_list.add(str); // } // // public List<String> getWord_fm_tail_list() { // return this.word_fm_tail_list; // } // // public BBWordMediaHalftimeList setWord_fm_tail_list(List<String> list) { // this.word_fm_tail_list = list; // return this; // } // // public void unsetWord_fm_tail_list() { // this.word_fm_tail_list = null; // } // // public boolean isSetWord_fm_tail_list() { // return this.word_fm_tail_list != null; // } // // public void setWord_fm_tail_listIsSet(boolean z) { // if (!z) { // this.word_fm_tail_list = null; // } // } // // public void setFieldValue(_Fields _fields, Object obj) { // switch (_fields) { // case WORD_FM_HALFTIME_LIST: // if (obj == null) { // unsetWord_fm_halftime_list(); // return; // } else { // setWord_fm_halftime_list((List) obj); // return; // } // case WORD_TV_HALFTIME_LIST: // if (obj == null) { // unsetWord_tv_halftime_list(); // return; // } else { // setWord_tv_halftime_list((List) obj); // return; // } // case WORD_FM_HEAD_LIST: // if (obj == null) { // unsetWord_fm_head_list(); // return; // } else { // setWord_fm_head_list((List) obj); // return; // } // case WORD_FM_TAIL_LIST: // if (obj == null) { // unsetWord_fm_tail_list(); // return; // } else { // setWord_fm_tail_list((List) obj); // return; // } // default: // return; // } // } // // public Object getFieldValue(_Fields _fields) { // switch (_fields) { // case WORD_FM_HALFTIME_LIST: // return getWord_fm_halftime_list(); // case WORD_TV_HALFTIME_LIST: // return getWord_tv_halftime_list(); // case WORD_FM_HEAD_LIST: // return getWord_fm_head_list(); // case WORD_FM_TAIL_LIST: // return getWord_fm_tail_list(); // default: // throw new IllegalStateException(); // } // } // // public boolean isSet(_Fields _fields) { // if (_fields == null) { // throw new IllegalArgumentException(); // } // switch (_fields) { // case WORD_FM_HALFTIME_LIST: // return isSetWord_fm_halftime_list(); // case WORD_TV_HALFTIME_LIST: // return isSetWord_tv_halftime_list(); // case WORD_FM_HEAD_LIST: // return isSetWord_fm_head_list(); // case WORD_FM_TAIL_LIST: // return isSetWord_fm_tail_list(); // default: // throw new IllegalStateException(); // } // } // // public boolean equals(Object obj) { // if (obj != null && (obj instanceof BBWordMediaHalftimeList)) { // return equals((BBWordMediaHalftimeList) obj); // } // return false; // } // // public boolean equals(BBWordMediaHalftimeList bBWordMediaHalftimeList) { // if (bBWordMediaHalftimeList == null) { // return false; // } // boolean isSetWord_fm_halftime_list = isSetWord_fm_halftime_list(); // boolean isSetWord_fm_halftime_list2 = bBWordMediaHalftimeList.isSetWord_fm_halftime_list(); // if ((isSetWord_fm_halftime_list || isSetWord_fm_halftime_list2) && (!isSetWord_fm_halftime_list || !isSetWord_fm_halftime_list2 || !this.word_fm_halftime_list.equals(bBWordMediaHalftimeList.word_fm_halftime_list))) { // return false; // } // boolean isSetWord_tv_halftime_list = isSetWord_tv_halftime_list(); // boolean isSetWord_tv_halftime_list2 = bBWordMediaHalftimeList.isSetWord_tv_halftime_list(); // if ((isSetWord_tv_halftime_list || isSetWord_tv_halftime_list2) && (!isSetWord_tv_halftime_list || !isSetWord_tv_halftime_list2 || !this.word_tv_halftime_list.equals(bBWordMediaHalftimeList.word_tv_halftime_list))) { // return false; // } // boolean isSetWord_fm_head_list = isSetWord_fm_head_list(); // boolean isSetWord_fm_head_list2 = bBWordMediaHalftimeList.isSetWord_fm_head_list(); // if ((isSetWord_fm_head_list || isSetWord_fm_head_list2) && (!isSetWord_fm_head_list || !isSetWord_fm_head_list2 || !this.word_fm_head_list.equals(bBWordMediaHalftimeList.word_fm_head_list))) { // return false; // } // boolean isSetWord_fm_tail_list = isSetWord_fm_tail_list(); // boolean isSetWord_fm_tail_list2 = bBWordMediaHalftimeList.isSetWord_fm_tail_list(); // if ((isSetWord_fm_tail_list || isSetWord_fm_tail_list2) && (!isSetWord_fm_tail_list || !isSetWord_fm_tail_list2 || !this.word_fm_tail_list.equals(bBWordMediaHalftimeList.word_fm_tail_list))) { // return false; // } // return true; // } // // public int hashCode() { // return 0; // } // // public int compareTo(BBWordMediaHalftimeList bBWordMediaHalftimeList) { // if (!getClass().equals(bBWordMediaHalftimeList.getClass())) { // return getClass().getName().compareTo(bBWordMediaHalftimeList.getClass().getName()); // } // int compareTo = Boolean.valueOf(isSetWord_fm_halftime_list()).compareTo(Boolean.valueOf(bBWordMediaHalftimeList.isSetWord_fm_halftime_list())); // if (compareTo != 0) { // return compareTo; // } // if (isSetWord_fm_halftime_list()) { // int a = C2121h.m5526a((List) this.word_fm_halftime_list, (List) bBWordMediaHalftimeList.word_fm_halftime_list); // if (a != 0) { // return a; // } // } // int compareTo2 = Boolean.valueOf(isSetWord_tv_halftime_list()).compareTo(Boolean.valueOf(bBWordMediaHalftimeList.isSetWord_tv_halftime_list())); // if (compareTo2 != 0) { // return compareTo2; // } // if (isSetWord_tv_halftime_list()) { // int a2 = C2121h.m5526a((List) this.word_tv_halftime_list, (List) bBWordMediaHalftimeList.word_tv_halftime_list); // if (a2 != 0) { // return a2; // } // } // int compareTo3 = Boolean.valueOf(isSetWord_fm_head_list()).compareTo(Boolean.valueOf(bBWordMediaHalftimeList.isSetWord_fm_head_list())); // if (compareTo3 != 0) { // return compareTo3; // } // if (isSetWord_fm_head_list()) { // int a3 = C2121h.m5526a((List) this.word_fm_head_list, (List) bBWordMediaHalftimeList.word_fm_head_list); // if (a3 != 0) { // return a3; // } // } // int compareTo4 = Boolean.valueOf(isSetWord_fm_tail_list()).compareTo(Boolean.valueOf(bBWordMediaHalftimeList.isSetWord_fm_tail_list())); // if (compareTo4 != 0) { // return compareTo4; // } // if (isSetWord_fm_tail_list()) { // int a4 = C2121h.m5526a((List) this.word_fm_tail_list, (List) bBWordMediaHalftimeList.word_fm_tail_list); // if (a4 != 0) { // return a4; // } // } // return 0; // } // // public _Fields fieldForId(int i) { // return _Fields.findByThriftId(i); // } // // public void read(C2100f fVar) { // ((C2109b) schemes.get(fVar.mo18525t())).getScheme().read(fVar, this); // } // // public void write(C2100f fVar) { // ((C2109b) schemes.get(fVar.mo18525t())).getScheme().write(fVar, this); // } // // public String toString() { // StringBuilder sb = new StringBuilder("BBWordMediaHalftimeList("); // sb.append("word_fm_halftime_list:"); // if (this.word_fm_halftime_list == null) { // sb.append("null"); // } else { // sb.append(this.word_fm_halftime_list); // } // sb.append(", "); // sb.append("word_tv_halftime_list:"); // if (this.word_tv_halftime_list == null) { // sb.append("null"); // } else { // sb.append(this.word_tv_halftime_list); // } // sb.append(", "); // sb.append("word_fm_head_list:"); // if (this.word_fm_head_list == null) { // sb.append("null"); // } else { // sb.append(this.word_fm_head_list); // } // sb.append(", "); // sb.append("word_fm_tail_list:"); // if (this.word_fm_tail_list == null) { // sb.append("null"); // } else { // sb.append(this.word_fm_tail_list); // } // sb.append(")"); // return sb.toString(); // } // // public void validate() { // if (this.word_fm_halftime_list == null) { // throw new C2101g("Required field 'word_fm_halftime_list' was not present! Struct: " + toString()); // } else if (this.word_tv_halftime_list == null) { // throw new C2101g("Required field 'word_tv_halftime_list' was not present! Struct: " + toString()); // } else if (this.word_fm_head_list == null) { // throw new C2101g("Required field 'word_fm_head_list' was not present! Struct: " + toString()); // } else if (this.word_fm_tail_list == null) { // throw new C2101g("Required field 'word_fm_tail_list' was not present! Struct: " + toString()); // } // } // // private void writeObject(ObjectOutputStream objectOutputStream) { // try { // write(new C2096a(new C2117b((OutputStream) objectOutputStream), 0)); // } catch (C2123l e) { // throw new IOException(e); // } // } // // private void readObject(ObjectInputStream objectInputStream) { // try { // read(new C2096a(new C2117b((InputStream) objectInputStream), 0)); // } catch (C2123l e) { // throw new IOException(e); // } // } //}
UTF-8
Java
31,307
java
BBWordMediaHalftimeList.java
Java
[]
null
[]
//package com.baicizhan.online.bs_words; // //import com.p052e.p053a.p054a.JceStruct; //import java.io.IOException; //import java.io.InputStream; //import java.io.ObjectInputStream; //import java.io.ObjectOutputStream; //import java.io.OutputStream; //import java.io.Serializable; //import java.util.ArrayList; //import java.util.Collections; //import java.util.EnumMap; //import java.util.EnumSet; //import java.util.HashMap; //import java.util.Iterator; //import java.util.List; //import java.util.Map; //import org.p100a.p101a.C2116f; //import org.p100a.p101a.C2121h; //import org.p100a.p101a.C2123l; //import org.p100a.p101a.C2124m; //import org.p100a.p101a.p103b.C2091a; //import org.p100a.p101a.p103b.C2092b; //import org.p100a.p101a.p103b.C2093c; //import org.p100a.p101a.p104c.C2096a; //import org.p100a.p101a.p104c.C2097b; //import org.p100a.p101a.p104c.C2098c; //import org.p100a.p101a.p104c.C2100f; //import org.p100a.p101a.p104c.C2101g; //import org.p100a.p101a.p104c.C2103i; //import org.p100a.p101a.p104c.C2105k; //import org.p100a.p101a.p104c.C2106l; //import org.p100a.p101a.p105d.C2108a; //import org.p100a.p101a.p105d.C2109b; //import org.p100a.p101a.p105d.C2110c; //import org.p100a.p101a.p105d.C2111d; //import org.p100a.p101a.p107f.C2117b; // //public class BBWordMediaHalftimeList implements Serializable, Cloneable, Comparable<BBWordMediaHalftimeList>, C2116f<BBWordMediaHalftimeList, _Fields> { // /* access modifiers changed from: private */ // public static final C2105k STRUCT_DESC = new C2105k("BBWordMediaHalftimeList"); // /* access modifiers changed from: private */ // public static final C2097b WORD_FM_HALFTIME_LIST_FIELD_DESC = new C2097b("word_fm_halftime_list", 15, 1); // /* access modifiers changed from: private */ // public static final C2097b WORD_FM_HEAD_LIST_FIELD_DESC = new C2097b("word_fm_head_list", 15, 3); // /* access modifiers changed from: private */ // public static final C2097b WORD_FM_TAIL_LIST_FIELD_DESC = new C2097b("word_fm_tail_list", 15, 4); // /* access modifiers changed from: private */ // public static final C2097b WORD_TV_HALFTIME_LIST_FIELD_DESC = new C2097b("word_tv_halftime_list", 15, 2); // public static final Map<_Fields, C2091a> metaDataMap; // private static final Map<Class<? extends C2108a>, C2109b> schemes; // public List<String> word_fm_halftime_list; // public List<String> word_fm_head_list; // public List<String> word_fm_tail_list; // public List<String> word_tv_halftime_list; // // class BBWordMediaHalftimeListStandardScheme extends C2110c<BBWordMediaHalftimeList> { // private BBWordMediaHalftimeListStandardScheme() { // } // // public void read(C2100f fVar, BBWordMediaHalftimeList bBWordMediaHalftimeList) { // fVar.mo18504e(); // while (true) { // C2097b g = fVar.mo18506g(); // if (g.f5835b != 0) { // switch (g.f5836c) { // case 1: // if (g.f5835b != 15) { // C2103i.m5498a(fVar, g.f5835b); // break; // } else { // C2098c i = fVar.mo18508i(); // bBWordMediaHalftimeList.word_fm_halftime_list = new ArrayList(i.f5838b); // for (int i2 = 0; i2 < i.f5838b; i2++) { // bBWordMediaHalftimeList.word_fm_halftime_list.add(fVar.mo18516q()); // } // bBWordMediaHalftimeList.setWord_fm_halftime_listIsSet(true); // break; // } // case 2: // if (g.f5835b != 15) { // C2103i.m5498a(fVar, g.f5835b); // break; // } else { // C2098c i3 = fVar.mo18508i(); // bBWordMediaHalftimeList.word_tv_halftime_list = new ArrayList(i3.f5838b); // for (int i4 = 0; i4 < i3.f5838b; i4++) { // bBWordMediaHalftimeList.word_tv_halftime_list.add(fVar.mo18516q()); // } // bBWordMediaHalftimeList.setWord_tv_halftime_listIsSet(true); // break; // } // case 3: // if (g.f5835b != 15) { // C2103i.m5498a(fVar, g.f5835b); // break; // } else { // C2098c i5 = fVar.mo18508i(); // bBWordMediaHalftimeList.word_fm_head_list = new ArrayList(i5.f5838b); // for (int i6 = 0; i6 < i5.f5838b; i6++) { // bBWordMediaHalftimeList.word_fm_head_list.add(fVar.mo18516q()); // } // bBWordMediaHalftimeList.setWord_fm_head_listIsSet(true); // break; // } // case 4: // if (g.f5835b != 15) { // C2103i.m5498a(fVar, g.f5835b); // break; // } else { // C2098c i7 = fVar.mo18508i(); // bBWordMediaHalftimeList.word_fm_tail_list = new ArrayList(i7.f5838b); // for (int i8 = 0; i8 < i7.f5838b; i8++) { // bBWordMediaHalftimeList.word_fm_tail_list.add(fVar.mo18516q()); // } // bBWordMediaHalftimeList.setWord_fm_tail_listIsSet(true); // break; // } // default: // C2103i.m5498a(fVar, g.f5835b); // break; // } // } else { // fVar.mo18505f(); // bBWordMediaHalftimeList.validate(); // return; // } // } // } // // public void write(C2100f fVar, BBWordMediaHalftimeList bBWordMediaHalftimeList) { // bBWordMediaHalftimeList.validate(); // BBWordMediaHalftimeList.STRUCT_DESC; // fVar.mo18490a(); // if (bBWordMediaHalftimeList.word_fm_halftime_list != null) { // fVar.mo18496a(BBWordMediaHalftimeList.WORD_FM_HALFTIME_LIST_FIELD_DESC); // fVar.mo18497a(new C2098c(JceStruct.STRUCT_END, bBWordMediaHalftimeList.word_fm_halftime_list.size())); // for (String a : bBWordMediaHalftimeList.word_fm_halftime_list) { // fVar.mo18495a(a); // } // } // if (bBWordMediaHalftimeList.word_tv_halftime_list != null) { // fVar.mo18496a(BBWordMediaHalftimeList.WORD_TV_HALFTIME_LIST_FIELD_DESC); // fVar.mo18497a(new C2098c(JceStruct.STRUCT_END, bBWordMediaHalftimeList.word_tv_halftime_list.size())); // for (String a2 : bBWordMediaHalftimeList.word_tv_halftime_list) { // fVar.mo18495a(a2); // } // } // if (bBWordMediaHalftimeList.word_fm_head_list != null) { // fVar.mo18496a(BBWordMediaHalftimeList.WORD_FM_HEAD_LIST_FIELD_DESC); // fVar.mo18497a(new C2098c(JceStruct.STRUCT_END, bBWordMediaHalftimeList.word_fm_head_list.size())); // for (String a3 : bBWordMediaHalftimeList.word_fm_head_list) { // fVar.mo18495a(a3); // } // } // if (bBWordMediaHalftimeList.word_fm_tail_list != null) { // fVar.mo18496a(BBWordMediaHalftimeList.WORD_FM_TAIL_LIST_FIELD_DESC); // fVar.mo18497a(new C2098c(JceStruct.STRUCT_END, bBWordMediaHalftimeList.word_fm_tail_list.size())); // for (String a4 : bBWordMediaHalftimeList.word_fm_tail_list) { // fVar.mo18495a(a4); // } // } // fVar.mo18502c(); // fVar.mo18501b(); // } // } // // class BBWordMediaHalftimeListStandardSchemeFactory implements C2109b { // private BBWordMediaHalftimeListStandardSchemeFactory() { // } // // public BBWordMediaHalftimeListStandardScheme getScheme() { // return new BBWordMediaHalftimeListStandardScheme(); // } // } // // class BBWordMediaHalftimeListTupleScheme extends C2111d<BBWordMediaHalftimeList> { // private BBWordMediaHalftimeListTupleScheme() { // } // // public void write(C2100f fVar, BBWordMediaHalftimeList bBWordMediaHalftimeList) { // C2106l lVar = (C2106l) fVar; // lVar.mo18493a(bBWordMediaHalftimeList.word_fm_halftime_list.size()); // for (String a : bBWordMediaHalftimeList.word_fm_halftime_list) { // lVar.mo18495a(a); // } // lVar.mo18493a(bBWordMediaHalftimeList.word_tv_halftime_list.size()); // for (String a2 : bBWordMediaHalftimeList.word_tv_halftime_list) { // lVar.mo18495a(a2); // } // lVar.mo18493a(bBWordMediaHalftimeList.word_fm_head_list.size()); // for (String a3 : bBWordMediaHalftimeList.word_fm_head_list) { // lVar.mo18495a(a3); // } // lVar.mo18493a(bBWordMediaHalftimeList.word_fm_tail_list.size()); // for (String a4 : bBWordMediaHalftimeList.word_fm_tail_list) { // lVar.mo18495a(a4); // } // } // // public void read(C2100f fVar, BBWordMediaHalftimeList bBWordMediaHalftimeList) { // C2106l lVar = (C2106l) fVar; // C2098c cVar = new C2098c(JceStruct.STRUCT_END, lVar.mo18513n()); // bBWordMediaHalftimeList.word_fm_halftime_list = new ArrayList(cVar.f5838b); // for (int i = 0; i < cVar.f5838b; i++) { // bBWordMediaHalftimeList.word_fm_halftime_list.add(lVar.mo18516q()); // } // bBWordMediaHalftimeList.setWord_fm_halftime_listIsSet(true); // C2098c cVar2 = new C2098c(JceStruct.STRUCT_END, lVar.mo18513n()); // bBWordMediaHalftimeList.word_tv_halftime_list = new ArrayList(cVar2.f5838b); // for (int i2 = 0; i2 < cVar2.f5838b; i2++) { // bBWordMediaHalftimeList.word_tv_halftime_list.add(lVar.mo18516q()); // } // bBWordMediaHalftimeList.setWord_tv_halftime_listIsSet(true); // C2098c cVar3 = new C2098c(JceStruct.STRUCT_END, lVar.mo18513n()); // bBWordMediaHalftimeList.word_fm_head_list = new ArrayList(cVar3.f5838b); // for (int i3 = 0; i3 < cVar3.f5838b; i3++) { // bBWordMediaHalftimeList.word_fm_head_list.add(lVar.mo18516q()); // } // bBWordMediaHalftimeList.setWord_fm_head_listIsSet(true); // C2098c cVar4 = new C2098c(JceStruct.STRUCT_END, lVar.mo18513n()); // bBWordMediaHalftimeList.word_fm_tail_list = new ArrayList(cVar4.f5838b); // for (int i4 = 0; i4 < cVar4.f5838b; i4++) { // bBWordMediaHalftimeList.word_fm_tail_list.add(lVar.mo18516q()); // } // bBWordMediaHalftimeList.setWord_fm_tail_listIsSet(true); // } // } // // class BBWordMediaHalftimeListTupleSchemeFactory implements C2109b { // private BBWordMediaHalftimeListTupleSchemeFactory() { // } // // public BBWordMediaHalftimeListTupleScheme getScheme() { // return new BBWordMediaHalftimeListTupleScheme(); // } // } // // public enum _Fields implements C2124m { // WORD_FM_HALFTIME_LIST(1, "word_fm_halftime_list"), // WORD_TV_HALFTIME_LIST(2, "word_tv_halftime_list"), // WORD_FM_HEAD_LIST(3, "word_fm_head_list"), // WORD_FM_TAIL_LIST(4, "word_fm_tail_list"); // // private static final Map<String, _Fields> byName = null; // private final String _fieldName; // private final short _thriftId; // // static { // byName = new HashMap(); // Iterator it = EnumSet.allOf(_Fields.class).iterator(); // while (it.hasNext()) { // _Fields _fields = (_Fields) it.next(); // byName.put(_fields.getFieldName(), _fields); // } // } // // public static _Fields findByThriftId(int i) { // switch (i) { // case 1: // return WORD_FM_HALFTIME_LIST; // case 2: // return WORD_TV_HALFTIME_LIST; // case 3: // return WORD_FM_HEAD_LIST; // case 4: // return WORD_FM_TAIL_LIST; // default: // return null; // } // } // // public static _Fields findByThriftIdOrThrow(int i) { // _Fields findByThriftId = findByThriftId(i); // if (findByThriftId != null) { // return findByThriftId; // } // throw new IllegalArgumentException("Field " + i + " doesn't exist!"); // } // // public static _Fields findByName(String str) { // return (_Fields) byName.get(str); // } // // private _Fields(short s, String str) { // this._thriftId = s; // this._fieldName = str; // } // // public final short getThriftFieldId() { // return this._thriftId; // } // // public final String getFieldName() { // return this._fieldName; // } // } // // static { // HashMap hashMap = new HashMap(); // schemes = hashMap; // hashMap.put(C2110c.class, new BBWordMediaHalftimeListStandardSchemeFactory()); // schemes.put(C2111d.class, new BBWordMediaHalftimeListTupleSchemeFactory()); // EnumMap enumMap = new EnumMap(_Fields.class); // enumMap.put(_Fields.WORD_FM_HALFTIME_LIST, new C2091a("word_fm_halftime_list", 1, new C2093c(new C2092b(JceStruct.STRUCT_END, 0)))); // enumMap.put(_Fields.WORD_TV_HALFTIME_LIST, new C2091a("word_tv_halftime_list", 1, new C2093c(new C2092b(JceStruct.STRUCT_END, 0)))); // enumMap.put(_Fields.WORD_FM_HEAD_LIST, new C2091a("word_fm_head_list", 1, new C2093c(new C2092b(JceStruct.STRUCT_END, 0)))); // enumMap.put(_Fields.WORD_FM_TAIL_LIST, new C2091a("word_fm_tail_list", 1, new C2093c(new C2092b(JceStruct.STRUCT_END, 0)))); // metaDataMap = Collections.unmodifiableMap(enumMap); // C2091a.m5430a(BBWordMediaHalftimeList.class, metaDataMap); // } // // public BBWordMediaHalftimeList() { // } // // public BBWordMediaHalftimeList(List<String> list, List<String> list2, List<String> list3, List<String> list4) { // this(); // this.word_fm_halftime_list = list; // this.word_tv_halftime_list = list2; // this.word_fm_head_list = list3; // this.word_fm_tail_list = list4; // } // // public BBWordMediaHalftimeList(BBWordMediaHalftimeList bBWordMediaHalftimeList) { // if (bBWordMediaHalftimeList.isSetWord_fm_halftime_list()) { // this.word_fm_halftime_list = new ArrayList(bBWordMediaHalftimeList.word_fm_halftime_list); // } // if (bBWordMediaHalftimeList.isSetWord_tv_halftime_list()) { // this.word_tv_halftime_list = new ArrayList(bBWordMediaHalftimeList.word_tv_halftime_list); // } // if (bBWordMediaHalftimeList.isSetWord_fm_head_list()) { // this.word_fm_head_list = new ArrayList(bBWordMediaHalftimeList.word_fm_head_list); // } // if (bBWordMediaHalftimeList.isSetWord_fm_tail_list()) { // this.word_fm_tail_list = new ArrayList(bBWordMediaHalftimeList.word_fm_tail_list); // } // } // // public BBWordMediaHalftimeList deepCopy() { // return new BBWordMediaHalftimeList(this); // } // // public void clear() { // this.word_fm_halftime_list = null; // this.word_tv_halftime_list = null; // this.word_fm_head_list = null; // this.word_fm_tail_list = null; // } // // public int getWord_fm_halftime_listSize() { // if (this.word_fm_halftime_list == null) { // return 0; // } // return this.word_fm_halftime_list.size(); // } // // public Iterator<String> getWord_fm_halftime_listIterator() { // if (this.word_fm_halftime_list == null) { // return null; // } // return this.word_fm_halftime_list.iterator(); // } // // public void addToWord_fm_halftime_list(String str) { // if (this.word_fm_halftime_list == null) { // this.word_fm_halftime_list = new ArrayList(); // } // this.word_fm_halftime_list.add(str); // } // // public List<String> getWord_fm_halftime_list() { // return this.word_fm_halftime_list; // } // // public BBWordMediaHalftimeList setWord_fm_halftime_list(List<String> list) { // this.word_fm_halftime_list = list; // return this; // } // // public void unsetWord_fm_halftime_list() { // this.word_fm_halftime_list = null; // } // // public boolean isSetWord_fm_halftime_list() { // return this.word_fm_halftime_list != null; // } // // public void setWord_fm_halftime_listIsSet(boolean z) { // if (!z) { // this.word_fm_halftime_list = null; // } // } // // public int getWord_tv_halftime_listSize() { // if (this.word_tv_halftime_list == null) { // return 0; // } // return this.word_tv_halftime_list.size(); // } // // public Iterator<String> getWord_tv_halftime_listIterator() { // if (this.word_tv_halftime_list == null) { // return null; // } // return this.word_tv_halftime_list.iterator(); // } // // public void addToWord_tv_halftime_list(String str) { // if (this.word_tv_halftime_list == null) { // this.word_tv_halftime_list = new ArrayList(); // } // this.word_tv_halftime_list.add(str); // } // // public List<String> getWord_tv_halftime_list() { // return this.word_tv_halftime_list; // } // // public BBWordMediaHalftimeList setWord_tv_halftime_list(List<String> list) { // this.word_tv_halftime_list = list; // return this; // } // // public void unsetWord_tv_halftime_list() { // this.word_tv_halftime_list = null; // } // // public boolean isSetWord_tv_halftime_list() { // return this.word_tv_halftime_list != null; // } // // public void setWord_tv_halftime_listIsSet(boolean z) { // if (!z) { // this.word_tv_halftime_list = null; // } // } // // public int getWord_fm_head_listSize() { // if (this.word_fm_head_list == null) { // return 0; // } // return this.word_fm_head_list.size(); // } // // public Iterator<String> getWord_fm_head_listIterator() { // if (this.word_fm_head_list == null) { // return null; // } // return this.word_fm_head_list.iterator(); // } // // public void addToWord_fm_head_list(String str) { // if (this.word_fm_head_list == null) { // this.word_fm_head_list = new ArrayList(); // } // this.word_fm_head_list.add(str); // } // // public List<String> getWord_fm_head_list() { // return this.word_fm_head_list; // } // // public BBWordMediaHalftimeList setWord_fm_head_list(List<String> list) { // this.word_fm_head_list = list; // return this; // } // // public void unsetWord_fm_head_list() { // this.word_fm_head_list = null; // } // // public boolean isSetWord_fm_head_list() { // return this.word_fm_head_list != null; // } // // public void setWord_fm_head_listIsSet(boolean z) { // if (!z) { // this.word_fm_head_list = null; // } // } // // public int getWord_fm_tail_listSize() { // if (this.word_fm_tail_list == null) { // return 0; // } // return this.word_fm_tail_list.size(); // } // // public Iterator<String> getWord_fm_tail_listIterator() { // if (this.word_fm_tail_list == null) { // return null; // } // return this.word_fm_tail_list.iterator(); // } // // public void addToWord_fm_tail_list(String str) { // if (this.word_fm_tail_list == null) { // this.word_fm_tail_list = new ArrayList(); // } // this.word_fm_tail_list.add(str); // } // // public List<String> getWord_fm_tail_list() { // return this.word_fm_tail_list; // } // // public BBWordMediaHalftimeList setWord_fm_tail_list(List<String> list) { // this.word_fm_tail_list = list; // return this; // } // // public void unsetWord_fm_tail_list() { // this.word_fm_tail_list = null; // } // // public boolean isSetWord_fm_tail_list() { // return this.word_fm_tail_list != null; // } // // public void setWord_fm_tail_listIsSet(boolean z) { // if (!z) { // this.word_fm_tail_list = null; // } // } // // public void setFieldValue(_Fields _fields, Object obj) { // switch (_fields) { // case WORD_FM_HALFTIME_LIST: // if (obj == null) { // unsetWord_fm_halftime_list(); // return; // } else { // setWord_fm_halftime_list((List) obj); // return; // } // case WORD_TV_HALFTIME_LIST: // if (obj == null) { // unsetWord_tv_halftime_list(); // return; // } else { // setWord_tv_halftime_list((List) obj); // return; // } // case WORD_FM_HEAD_LIST: // if (obj == null) { // unsetWord_fm_head_list(); // return; // } else { // setWord_fm_head_list((List) obj); // return; // } // case WORD_FM_TAIL_LIST: // if (obj == null) { // unsetWord_fm_tail_list(); // return; // } else { // setWord_fm_tail_list((List) obj); // return; // } // default: // return; // } // } // // public Object getFieldValue(_Fields _fields) { // switch (_fields) { // case WORD_FM_HALFTIME_LIST: // return getWord_fm_halftime_list(); // case WORD_TV_HALFTIME_LIST: // return getWord_tv_halftime_list(); // case WORD_FM_HEAD_LIST: // return getWord_fm_head_list(); // case WORD_FM_TAIL_LIST: // return getWord_fm_tail_list(); // default: // throw new IllegalStateException(); // } // } // // public boolean isSet(_Fields _fields) { // if (_fields == null) { // throw new IllegalArgumentException(); // } // switch (_fields) { // case WORD_FM_HALFTIME_LIST: // return isSetWord_fm_halftime_list(); // case WORD_TV_HALFTIME_LIST: // return isSetWord_tv_halftime_list(); // case WORD_FM_HEAD_LIST: // return isSetWord_fm_head_list(); // case WORD_FM_TAIL_LIST: // return isSetWord_fm_tail_list(); // default: // throw new IllegalStateException(); // } // } // // public boolean equals(Object obj) { // if (obj != null && (obj instanceof BBWordMediaHalftimeList)) { // return equals((BBWordMediaHalftimeList) obj); // } // return false; // } // // public boolean equals(BBWordMediaHalftimeList bBWordMediaHalftimeList) { // if (bBWordMediaHalftimeList == null) { // return false; // } // boolean isSetWord_fm_halftime_list = isSetWord_fm_halftime_list(); // boolean isSetWord_fm_halftime_list2 = bBWordMediaHalftimeList.isSetWord_fm_halftime_list(); // if ((isSetWord_fm_halftime_list || isSetWord_fm_halftime_list2) && (!isSetWord_fm_halftime_list || !isSetWord_fm_halftime_list2 || !this.word_fm_halftime_list.equals(bBWordMediaHalftimeList.word_fm_halftime_list))) { // return false; // } // boolean isSetWord_tv_halftime_list = isSetWord_tv_halftime_list(); // boolean isSetWord_tv_halftime_list2 = bBWordMediaHalftimeList.isSetWord_tv_halftime_list(); // if ((isSetWord_tv_halftime_list || isSetWord_tv_halftime_list2) && (!isSetWord_tv_halftime_list || !isSetWord_tv_halftime_list2 || !this.word_tv_halftime_list.equals(bBWordMediaHalftimeList.word_tv_halftime_list))) { // return false; // } // boolean isSetWord_fm_head_list = isSetWord_fm_head_list(); // boolean isSetWord_fm_head_list2 = bBWordMediaHalftimeList.isSetWord_fm_head_list(); // if ((isSetWord_fm_head_list || isSetWord_fm_head_list2) && (!isSetWord_fm_head_list || !isSetWord_fm_head_list2 || !this.word_fm_head_list.equals(bBWordMediaHalftimeList.word_fm_head_list))) { // return false; // } // boolean isSetWord_fm_tail_list = isSetWord_fm_tail_list(); // boolean isSetWord_fm_tail_list2 = bBWordMediaHalftimeList.isSetWord_fm_tail_list(); // if ((isSetWord_fm_tail_list || isSetWord_fm_tail_list2) && (!isSetWord_fm_tail_list || !isSetWord_fm_tail_list2 || !this.word_fm_tail_list.equals(bBWordMediaHalftimeList.word_fm_tail_list))) { // return false; // } // return true; // } // // public int hashCode() { // return 0; // } // // public int compareTo(BBWordMediaHalftimeList bBWordMediaHalftimeList) { // if (!getClass().equals(bBWordMediaHalftimeList.getClass())) { // return getClass().getName().compareTo(bBWordMediaHalftimeList.getClass().getName()); // } // int compareTo = Boolean.valueOf(isSetWord_fm_halftime_list()).compareTo(Boolean.valueOf(bBWordMediaHalftimeList.isSetWord_fm_halftime_list())); // if (compareTo != 0) { // return compareTo; // } // if (isSetWord_fm_halftime_list()) { // int a = C2121h.m5526a((List) this.word_fm_halftime_list, (List) bBWordMediaHalftimeList.word_fm_halftime_list); // if (a != 0) { // return a; // } // } // int compareTo2 = Boolean.valueOf(isSetWord_tv_halftime_list()).compareTo(Boolean.valueOf(bBWordMediaHalftimeList.isSetWord_tv_halftime_list())); // if (compareTo2 != 0) { // return compareTo2; // } // if (isSetWord_tv_halftime_list()) { // int a2 = C2121h.m5526a((List) this.word_tv_halftime_list, (List) bBWordMediaHalftimeList.word_tv_halftime_list); // if (a2 != 0) { // return a2; // } // } // int compareTo3 = Boolean.valueOf(isSetWord_fm_head_list()).compareTo(Boolean.valueOf(bBWordMediaHalftimeList.isSetWord_fm_head_list())); // if (compareTo3 != 0) { // return compareTo3; // } // if (isSetWord_fm_head_list()) { // int a3 = C2121h.m5526a((List) this.word_fm_head_list, (List) bBWordMediaHalftimeList.word_fm_head_list); // if (a3 != 0) { // return a3; // } // } // int compareTo4 = Boolean.valueOf(isSetWord_fm_tail_list()).compareTo(Boolean.valueOf(bBWordMediaHalftimeList.isSetWord_fm_tail_list())); // if (compareTo4 != 0) { // return compareTo4; // } // if (isSetWord_fm_tail_list()) { // int a4 = C2121h.m5526a((List) this.word_fm_tail_list, (List) bBWordMediaHalftimeList.word_fm_tail_list); // if (a4 != 0) { // return a4; // } // } // return 0; // } // // public _Fields fieldForId(int i) { // return _Fields.findByThriftId(i); // } // // public void read(C2100f fVar) { // ((C2109b) schemes.get(fVar.mo18525t())).getScheme().read(fVar, this); // } // // public void write(C2100f fVar) { // ((C2109b) schemes.get(fVar.mo18525t())).getScheme().write(fVar, this); // } // // public String toString() { // StringBuilder sb = new StringBuilder("BBWordMediaHalftimeList("); // sb.append("word_fm_halftime_list:"); // if (this.word_fm_halftime_list == null) { // sb.append("null"); // } else { // sb.append(this.word_fm_halftime_list); // } // sb.append(", "); // sb.append("word_tv_halftime_list:"); // if (this.word_tv_halftime_list == null) { // sb.append("null"); // } else { // sb.append(this.word_tv_halftime_list); // } // sb.append(", "); // sb.append("word_fm_head_list:"); // if (this.word_fm_head_list == null) { // sb.append("null"); // } else { // sb.append(this.word_fm_head_list); // } // sb.append(", "); // sb.append("word_fm_tail_list:"); // if (this.word_fm_tail_list == null) { // sb.append("null"); // } else { // sb.append(this.word_fm_tail_list); // } // sb.append(")"); // return sb.toString(); // } // // public void validate() { // if (this.word_fm_halftime_list == null) { // throw new C2101g("Required field 'word_fm_halftime_list' was not present! Struct: " + toString()); // } else if (this.word_tv_halftime_list == null) { // throw new C2101g("Required field 'word_tv_halftime_list' was not present! Struct: " + toString()); // } else if (this.word_fm_head_list == null) { // throw new C2101g("Required field 'word_fm_head_list' was not present! Struct: " + toString()); // } else if (this.word_fm_tail_list == null) { // throw new C2101g("Required field 'word_fm_tail_list' was not present! Struct: " + toString()); // } // } // // private void writeObject(ObjectOutputStream objectOutputStream) { // try { // write(new C2096a(new C2117b((OutputStream) objectOutputStream), 0)); // } catch (C2123l e) { // throw new IOException(e); // } // } // // private void readObject(ObjectInputStream objectInputStream) { // try { // read(new C2096a(new C2117b((InputStream) objectInputStream), 0)); // } catch (C2123l e) { // throw new IOException(e); // } // } //}
31,307
0.539879
0.504584
755
40.466225
32.712147
226
false
false
0
0
0
0
0
0
0.566887
false
false
7
06e1e3bddef1258a1d10303029a63d3d53d95af7
3,152,506,037,653
e4b9b0e4602b4366cbea1b2224397e055da63e2d
/app/src/main/java/com/sunmeng/myapplication/fragment/chatFragment.java
a156a742832e5155a99514963759e9c48b8222a4
[]
no_license
yuzhiyun/MyApplication
https://github.com/yuzhiyun/MyApplication
30f4e7d9109e689d16e7e1cc4387f9897a89d498
355ad15bfb00a7ed2659f81f93ca52d3df8dc9cc
refs/heads/master
2021-01-12T03:49:55.447000
2017-01-12T13:10:35
2017-01-12T13:10:35
78,270,348
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sunmeng.myapplication.fragment; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Matrix; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.view.ViewPager; import android.util.DisplayMetrics; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.TranslateAnimation; import android.widget.AdapterView; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.sunmeng.myapplication.MainActivity; import com.sunmeng.myapplication.R; import com.sunmeng.myapplication.adapter.ChatItem; import com.sunmeng.myapplication.adapter.ChatItemAdapter; import com.sunmeng.myapplication.adapter.ChatPgAdapter; import com.sunmeng.myapplication.adapter.ContentItem; import com.sunmeng.myapplication.adapter.ContentItemAdapter; import java.util.ArrayList; import java.util.List; /** * A simple {@link Fragment} subclass. */ public class chatFragment extends BaseFragment implements AdapterView.OnItemClickListener,ViewPager.OnPageChangeListener,View.OnClickListener { private List<ChatItem> activityItems = new ArrayList<ChatItem>(); private List<ContentItem> studyItems = new ArrayList<ContentItem>(); private TextView tvChat ; private TextView tvStudy ; private ViewPager viewPager; private ImageView imageView; private ChatPgAdapter adapter ; private List<View> viewItems = new ArrayList<View>(); private Bitmap cursor; private int offSet; private int currentItem; private Matrix matrix = new Matrix(); private int bmWidth; private Animation animation; private View view ; private ListView lv_chat; private ListView lv_study ; @Override protected void setActivity() { activity = this.getActivity(); } @Override protected void setLayoutId() { layout_id = R.layout.fragment_chat ; } @Override protected void findView(View view) { tvChat = (TextView)(view.findViewById(R.id.tv_chat)); tvStudy = (TextView)(view.findViewById(R.id.tv_study)); imageView = (ImageView)(view.findViewById(R.id.cursor1)); viewPager = (ViewPager) (view.findViewById(R.id.vp_chat)); viewItems.add(inflater.inflate(R.layout.content_activity, null)); viewItems.add(inflater.inflate(R.layout.content_study, null)); lv_chat = (ListView)(viewItems.get(0).findViewById(R.id.content_chat_activity)) ; lv_study = (ListView)(viewItems.get(1).findViewById(R.id.content_study)) ; } @Override protected void setListener() { tvChat.setOnClickListener(this); tvStudy.setOnClickListener(this); viewPager.setOnPageChangeListener(this); lv_study.setOnItemClickListener(this); lv_chat.setOnItemClickListener(this); } @Override protected void initOther() { initeCursor(); } @Override protected void initView() { showChatItems(); showStudyItems(); } @Override protected void setAdapter() { adapter = new ChatPgAdapter(viewItems); viewPager.setAdapter(adapter); } @Override public void onClick(View view) { switch (view.getId()){ case R.id.tv_chat : viewPager.setCurrentItem(0); break; case R.id.tv_study : viewPager.setCurrentItem(1); break; } } @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { switch (adapterView.getId()){ case R.id.content_chat_activity : Toast.makeText(activity,"岳麓沙龙",Toast.LENGTH_SHORT).show(); break; case R.id.content_study : Toast.makeText(activity,"在线学习",Toast.LENGTH_SHORT).show(); break; } } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int arg0) { resetTextColor(); switch (arg0) { case 0: tvChat.setTextColor(getResources().getColor(R.color.main_color)); if (currentItem == 1) { animation = new TranslateAnimation(offSet * 3 + bmWidth, offSet, 0, 0); } break; case 1: tvStudy.setTextColor(getResources().getColor(R.color.main_color)); if (currentItem == 0) { animation = new TranslateAnimation(offSet, offSet * 3 + bmWidth, 0, 0); } break; } currentItem = arg0; animation.setDuration(150); // 光标滑动速度 animation.setFillAfter(true); imageView.startAnimation(animation); } @Override public void onPageScrollStateChanged(int state) { } private void initeCursor() { cursor = BitmapFactory.decodeResource(getResources(), R.drawable.cursor); bmWidth = cursor.getWidth(); DisplayMetrics dm = getResources().getDisplayMetrics(); // 设置图标的起始位置(4个textview。) offSet = (dm.widthPixels - 2 * bmWidth) / 4; matrix.setTranslate(offSet, 0); tvChat.setTextColor(getResources().getColor(R.color.main_color)); imageView.setImageMatrix(matrix); // 需要imageView的scaleType为matrix currentItem = 0; } public void resetTextColor(){ tvChat.setTextColor(getResources().getColor(R.color.black)); tvStudy.setTextColor(getResources().getColor(R.color.black)); } // @Override // public void onActivityCreated(Bundle savedInstanceState){ // super.onActivityCreated(savedInstanceState); // init(); // MainActivity activity = (MainActivity) getActivity(); // ChatItemAdapter adapter = new ChatItemAdapter(activity.context ,R.layout.chat_item , items); // ListView listView = (ListView)this.getView().findViewById(R.id.broadcast); // listView.setAdapter(adapter); // } public void showChatItems(){ initChatItems(); MainActivity activity = (MainActivity) getActivity(); ChatItemAdapter adapter = new ChatItemAdapter(activity.getApplicationContext() ,R.layout.chat_item , activityItems); lv_chat.setAdapter(adapter); } public void showStudyItems(){ initStudyItems(); MainActivity activity = (MainActivity) getActivity(); ContentItemAdapter adapter = new ContentItemAdapter(activity.getApplicationContext() ,R.layout.content_item , studyItems); lv_study.setAdapter(adapter); } public void initChatItems(){ ChatItem item1 = new ChatItem(R.drawable.chat1,"2017全国大学生英语竞赛", "2016-12-07 17:20","高等学校大学外语教学指导委员会","全国"); activityItems.add(item1); activityItems.add(item1); activityItems.add(item1); activityItems.add(item1); activityItems.add(item1); activityItems.add(item1); activityItems.add(item1); activityItems.add(item1); activityItems.add(item1); } public void initStudyItems(){ ContentItem item1 = new ContentItem(R.drawable.chat1,"格林童话背后的智慧", "2015-11-11","颖儿老师"); studyItems.add(item1); studyItems.add(item1); studyItems.add(item1); studyItems.add(item1); studyItems.add(item1); studyItems.add(item1); studyItems.add(item1); studyItems.add(item1); studyItems.add(item1); studyItems.add(item1); studyItems.add(item1); studyItems.add(item1); } }
UTF-8
Java
7,959
java
chatFragment.java
Java
[ { "context": "tivity :\n Toast.makeText(activity,\"岳麓沙龙\",Toast.LENGTH_SHORT).show();\n brea", "end": 3856, "score": 0.95968097448349, "start": 3852, "tag": "NAME", "value": "岳麓沙龙" }, { "context": "entItem item1 = new ContentItem(R.drawable.chat1,\"格林童话背后的智慧\", \"2015-11-11\",\"颖儿老师\");\n studyItems.a", "end": 7410, "score": 0.997050404548645, "start": 7406, "tag": "NAME", "value": "格林童话" }, { "context": "tItem(R.drawable.chat1,\"格林童话背后的智慧\", \"2015-11-11\",\"颖儿老师\");\n studyItems.add(item1);\n studyIt", "end": 7436, "score": 0.9975677728652954, "start": 7432, "tag": "NAME", "value": "颖儿老师" } ]
null
[]
package com.sunmeng.myapplication.fragment; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Matrix; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.view.ViewPager; import android.util.DisplayMetrics; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.TranslateAnimation; import android.widget.AdapterView; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.sunmeng.myapplication.MainActivity; import com.sunmeng.myapplication.R; import com.sunmeng.myapplication.adapter.ChatItem; import com.sunmeng.myapplication.adapter.ChatItemAdapter; import com.sunmeng.myapplication.adapter.ChatPgAdapter; import com.sunmeng.myapplication.adapter.ContentItem; import com.sunmeng.myapplication.adapter.ContentItemAdapter; import java.util.ArrayList; import java.util.List; /** * A simple {@link Fragment} subclass. */ public class chatFragment extends BaseFragment implements AdapterView.OnItemClickListener,ViewPager.OnPageChangeListener,View.OnClickListener { private List<ChatItem> activityItems = new ArrayList<ChatItem>(); private List<ContentItem> studyItems = new ArrayList<ContentItem>(); private TextView tvChat ; private TextView tvStudy ; private ViewPager viewPager; private ImageView imageView; private ChatPgAdapter adapter ; private List<View> viewItems = new ArrayList<View>(); private Bitmap cursor; private int offSet; private int currentItem; private Matrix matrix = new Matrix(); private int bmWidth; private Animation animation; private View view ; private ListView lv_chat; private ListView lv_study ; @Override protected void setActivity() { activity = this.getActivity(); } @Override protected void setLayoutId() { layout_id = R.layout.fragment_chat ; } @Override protected void findView(View view) { tvChat = (TextView)(view.findViewById(R.id.tv_chat)); tvStudy = (TextView)(view.findViewById(R.id.tv_study)); imageView = (ImageView)(view.findViewById(R.id.cursor1)); viewPager = (ViewPager) (view.findViewById(R.id.vp_chat)); viewItems.add(inflater.inflate(R.layout.content_activity, null)); viewItems.add(inflater.inflate(R.layout.content_study, null)); lv_chat = (ListView)(viewItems.get(0).findViewById(R.id.content_chat_activity)) ; lv_study = (ListView)(viewItems.get(1).findViewById(R.id.content_study)) ; } @Override protected void setListener() { tvChat.setOnClickListener(this); tvStudy.setOnClickListener(this); viewPager.setOnPageChangeListener(this); lv_study.setOnItemClickListener(this); lv_chat.setOnItemClickListener(this); } @Override protected void initOther() { initeCursor(); } @Override protected void initView() { showChatItems(); showStudyItems(); } @Override protected void setAdapter() { adapter = new ChatPgAdapter(viewItems); viewPager.setAdapter(adapter); } @Override public void onClick(View view) { switch (view.getId()){ case R.id.tv_chat : viewPager.setCurrentItem(0); break; case R.id.tv_study : viewPager.setCurrentItem(1); break; } } @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { switch (adapterView.getId()){ case R.id.content_chat_activity : Toast.makeText(activity,"岳麓沙龙",Toast.LENGTH_SHORT).show(); break; case R.id.content_study : Toast.makeText(activity,"在线学习",Toast.LENGTH_SHORT).show(); break; } } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int arg0) { resetTextColor(); switch (arg0) { case 0: tvChat.setTextColor(getResources().getColor(R.color.main_color)); if (currentItem == 1) { animation = new TranslateAnimation(offSet * 3 + bmWidth, offSet, 0, 0); } break; case 1: tvStudy.setTextColor(getResources().getColor(R.color.main_color)); if (currentItem == 0) { animation = new TranslateAnimation(offSet, offSet * 3 + bmWidth, 0, 0); } break; } currentItem = arg0; animation.setDuration(150); // 光标滑动速度 animation.setFillAfter(true); imageView.startAnimation(animation); } @Override public void onPageScrollStateChanged(int state) { } private void initeCursor() { cursor = BitmapFactory.decodeResource(getResources(), R.drawable.cursor); bmWidth = cursor.getWidth(); DisplayMetrics dm = getResources().getDisplayMetrics(); // 设置图标的起始位置(4个textview。) offSet = (dm.widthPixels - 2 * bmWidth) / 4; matrix.setTranslate(offSet, 0); tvChat.setTextColor(getResources().getColor(R.color.main_color)); imageView.setImageMatrix(matrix); // 需要imageView的scaleType为matrix currentItem = 0; } public void resetTextColor(){ tvChat.setTextColor(getResources().getColor(R.color.black)); tvStudy.setTextColor(getResources().getColor(R.color.black)); } // @Override // public void onActivityCreated(Bundle savedInstanceState){ // super.onActivityCreated(savedInstanceState); // init(); // MainActivity activity = (MainActivity) getActivity(); // ChatItemAdapter adapter = new ChatItemAdapter(activity.context ,R.layout.chat_item , items); // ListView listView = (ListView)this.getView().findViewById(R.id.broadcast); // listView.setAdapter(adapter); // } public void showChatItems(){ initChatItems(); MainActivity activity = (MainActivity) getActivity(); ChatItemAdapter adapter = new ChatItemAdapter(activity.getApplicationContext() ,R.layout.chat_item , activityItems); lv_chat.setAdapter(adapter); } public void showStudyItems(){ initStudyItems(); MainActivity activity = (MainActivity) getActivity(); ContentItemAdapter adapter = new ContentItemAdapter(activity.getApplicationContext() ,R.layout.content_item , studyItems); lv_study.setAdapter(adapter); } public void initChatItems(){ ChatItem item1 = new ChatItem(R.drawable.chat1,"2017全国大学生英语竞赛", "2016-12-07 17:20","高等学校大学外语教学指导委员会","全国"); activityItems.add(item1); activityItems.add(item1); activityItems.add(item1); activityItems.add(item1); activityItems.add(item1); activityItems.add(item1); activityItems.add(item1); activityItems.add(item1); activityItems.add(item1); } public void initStudyItems(){ ContentItem item1 = new ContentItem(R.drawable.chat1,"格林童话背后的智慧", "2015-11-11","颖儿老师"); studyItems.add(item1); studyItems.add(item1); studyItems.add(item1); studyItems.add(item1); studyItems.add(item1); studyItems.add(item1); studyItems.add(item1); studyItems.add(item1); studyItems.add(item1); studyItems.add(item1); studyItems.add(item1); studyItems.add(item1); } }
7,959
0.654097
0.644254
246
30.800814
26.381754
143
false
false
0
0
0
0
0
0
0.666667
false
false
7
1b57d373806ae17c694e0a2e89839ac1b441769d
17,205,639,043,363
b8c342697596362b0b502d3c925445c5a9d4a910
/colecoes/Mapa.java
93be66c5da00ab10801e3cc86c930a9aaf0fd443
[]
no_license
sfarinas/src
https://github.com/sfarinas/src
8ee17e85af10c59b5823df70aab6af8088ff9872
07555513a53e02db6075bd50099e5940e1f6988a
refs/heads/master
2020-04-13T17:03:33.535000
2019-01-03T04:03:54
2019-01-03T04:03:54
163,337,829
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package colecoes; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; public class Mapa { public static void main(String[] args) { Map<Integer, String> aprovados = new HashMap<>(); aprovados.put(1, "Salomao"); aprovados.put(2, "Simone"); aprovados.put(3, "Ana"); aprovados.put(4, "Zeze"); System.out.println(aprovados.keySet()); // AQUI ELE MOSTRA SÓ OS SET'S System.out.println(aprovados.values()); // AQUI SOMENTE OS VALORES System.out.println(aprovados.entrySet()); // AQUI OS 2 //VENDO TODOS OS INDICES A SUA ESCOLHA System.out.println("Me mostre o indice 2: " + aprovados.get(2)); System.out.println("Me mostre o indice 1: " + aprovados.get(1)); System.out.println("Me mostre o indice 3: " + aprovados.get(3)); System.out.println("Me mostre o indice 4: " + aprovados.get(4)); //ALTERANDO O INDEX 3 // aprovados.put(3, Beatriz); System.out.println("Mudando o index 3: " + aprovados.put(3, "Beatriz")); System.out.println("Me mostre o indice 3: " + aprovados.get(3)); System.out.println(aprovados.containsKey(3)); //TESTANDO PARA SABER DE TEM CONTEUDO System.out.println(aprovados.containsValue("Ana")); // COMPARANDO A VARIAVEL COM O VALOR BIA // MOSTRANDO TODOS OS INDEX System.out.println("Chaves... "); for(Integer codigo: aprovados.keySet()) { System.out.println(codigo); } // MOSTRANDO TODOS OS VALORES System.out.println("Valores... "); for(String nome: aprovados.values()) { System.out.println(nome); } // MOSTRANDO TODOS OS INDEX E VALORES System.out.println("INDEX / Valores... "); for(Entry<Integer, String> registro: aprovados.entrySet()) { System.out.println(registro); } } }
ISO-8859-2
Java
1,738
java
Mapa.java
Java
[ { "context": " aprovados = new HashMap<>();\n\t\taprovados.put(1, \"Salomao\");\n\t\taprovados.put(2, \"Simone\");\n\t\taprovados.put(", "end": 241, "score": 0.9998251795768738, "start": 234, "tag": "NAME", "value": "Salomao" }, { "context": "\taprovados.put(1, \"Salomao\");\n\t\taprovados.put(2, \"Simone\");\n\t\taprovados.put(3, \"Ana\");\n\t\taprovados.put(4, ", "end": 271, "score": 0.9998123645782471, "start": 265, "tag": "NAME", "value": "Simone" }, { "context": "\t\taprovados.put(2, \"Simone\");\n\t\taprovados.put(3, \"Ana\");\n\t\taprovados.put(4, \"Zeze\");\n\t\t\n\t\tSystem.out.pr", "end": 298, "score": 0.9997487664222717, "start": 295, "tag": "NAME", "value": "Ana" }, { "context": ");\n\t\taprovados.put(3, \"Ana\");\n\t\taprovados.put(4, \"Zeze\");\n\t\t\n\t\tSystem.out.println(aprovados.keySet()); /", "end": 326, "score": 0.9997973442077637, "start": 322, "tag": "NAME", "value": "Zeze" }, { "context": "println(\"Mudando o index 3: \" + aprovados.put(3, \"Beatriz\"));\n\t\tSystem.out.println(\"Me mostre o indice 3: \"", "end": 971, "score": 0.9996926784515381, "start": 964, "tag": "NAME", "value": "Beatriz" } ]
null
[]
package colecoes; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; public class Mapa { public static void main(String[] args) { Map<Integer, String> aprovados = new HashMap<>(); aprovados.put(1, "Salomao"); aprovados.put(2, "Simone"); aprovados.put(3, "Ana"); aprovados.put(4, "Zeze"); System.out.println(aprovados.keySet()); // AQUI ELE MOSTRA SÓ OS SET'S System.out.println(aprovados.values()); // AQUI SOMENTE OS VALORES System.out.println(aprovados.entrySet()); // AQUI OS 2 //VENDO TODOS OS INDICES A SUA ESCOLHA System.out.println("Me mostre o indice 2: " + aprovados.get(2)); System.out.println("Me mostre o indice 1: " + aprovados.get(1)); System.out.println("Me mostre o indice 3: " + aprovados.get(3)); System.out.println("Me mostre o indice 4: " + aprovados.get(4)); //ALTERANDO O INDEX 3 // aprovados.put(3, Beatriz); System.out.println("Mudando o index 3: " + aprovados.put(3, "Beatriz")); System.out.println("Me mostre o indice 3: " + aprovados.get(3)); System.out.println(aprovados.containsKey(3)); //TESTANDO PARA SABER DE TEM CONTEUDO System.out.println(aprovados.containsValue("Ana")); // COMPARANDO A VARIAVEL COM O VALOR BIA // MOSTRANDO TODOS OS INDEX System.out.println("Chaves... "); for(Integer codigo: aprovados.keySet()) { System.out.println(codigo); } // MOSTRANDO TODOS OS VALORES System.out.println("Valores... "); for(String nome: aprovados.values()) { System.out.println(nome); } // MOSTRANDO TODOS OS INDEX E VALORES System.out.println("INDEX / Valores... "); for(Entry<Integer, String> registro: aprovados.entrySet()) { System.out.println(registro); } } }
1,738
0.671848
0.660334
55
30.581818
25.882034
94
false
false
0
0
0
0
0
0
2.6
false
false
7
1a643126da88e73958d9c26e50ee8dfeb87e1c4a
7,791,070,737,401
2fdbd72c739a00753546c2c7a8028bedbc68ee4a
/Vehicle/src/com/company/Traffic.java
78c3f7a9cb9bd6251e61a1015b47e2240b828f62
[]
no_license
muller93/Java_Practice
https://github.com/muller93/Java_Practice
b1c2528028e1737b08388d4c24af5eb8d17b9683
2bffd14efb3e71d4475260a7a85feeef8e864bca
refs/heads/master
2021-04-09T11:20:08.922000
2018-06-06T19:43:17
2018-06-06T19:43:17
125,410,222
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.company; import java.util.ArrayList; public class Traffic { static Traffic traffic = new Traffic(); static ArrayList<Vehicle> vehicles = new ArrayList<>(); public static void main(String[] args) { vehicles.add(new Bicycle(7)); Bicycle csepel = new Bicycle(5); csepel.setBad(true); vehicles.add(csepel); vehicles.add(new Car(1235, 204)); vehicles.add(new Car(1055, 186)); Vehicle vehicle1 = new Car(1300, 200); for (Vehicle vehicle : vehicles) { try { vehicle.starting(); } catch (Bad bad) { bad.printStackTrace(); } while (true) { try { vehicle1.starting(); } catch (Bad bad) { bad.printStackTrace(); break; } } } } }
UTF-8
Java
925
java
Traffic.java
Java
[]
null
[]
package com.company; import java.util.ArrayList; public class Traffic { static Traffic traffic = new Traffic(); static ArrayList<Vehicle> vehicles = new ArrayList<>(); public static void main(String[] args) { vehicles.add(new Bicycle(7)); Bicycle csepel = new Bicycle(5); csepel.setBad(true); vehicles.add(csepel); vehicles.add(new Car(1235, 204)); vehicles.add(new Car(1055, 186)); Vehicle vehicle1 = new Car(1300, 200); for (Vehicle vehicle : vehicles) { try { vehicle.starting(); } catch (Bad bad) { bad.printStackTrace(); } while (true) { try { vehicle1.starting(); } catch (Bad bad) { bad.printStackTrace(); break; } } } } }
925
0.485405
0.458378
37
24
16.796074
59
false
false
0
0
0
0
0
0
0.513514
false
false
7
fbde8e87871704c9c6416bcbdc9c71347e6c37b5
26,053,271,621,693
4d43cbd9c6cb87aa102baf55b49ba7668ba4ae5b
/src/main/java/me/sores/impulse/util/cmdfrmwrk/BaseCommand.java
68100a3d3e07e330486ccb39fd948a8e172d4ade
[]
no_license
itsfrosted/Impulse
https://github.com/itsfrosted/Impulse
3152d6f99b7a45dc5388b5f5e36ca9089a0093c0
e065738049d7a192d2ae9390911fab6c4d4382a9
refs/heads/master
2023-08-14T23:44:38.905000
2021-09-18T00:33:18
2021-09-18T00:33:18
407,713,450
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package me.sores.impulse.util.cmdfrmwrk; import me.sores.impulse.util.MessageUtil; import me.sores.impulse.util.StringUtil; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.command.TabExecutor; import org.bukkit.entity.Player; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; /** * Created by LavaisWatery on 10/24/2016. */ public abstract class BaseCommand implements TabExecutor { String name; String permission; CommandUsageBy usageBy; String[] aliases; String usage; int maxArgs; int minArgs; public BaseCommand(String name, String permission, CommandUsageBy usageBy, String... aliases) { this.name = name; this.permission = permission; this.usageBy = usageBy; this.aliases = aliases; } public boolean onCommand(CommandSender sender, Command command, String s, String[] strings) { if ((!this.permission.isEmpty()) && (this.permission != null) && (!sender.hasPermission(this.permission) && !sender.hasPermission("*"))) { MessageUtil.noPermission(sender); return false; } if(sender instanceof Player && usageBy == CommandUsageBy.CONSOLE) { mustExecuteFromConsole(sender); return true; } else if(!(sender instanceof Player) && usageBy == CommandUsageBy.PLAYER) { mustExecuteByPlayer(sender); return true; } if ((this.maxArgs >= 0) && (strings.length > this.maxArgs)) { if (getUsage() != null) { sender.sendMessage(StringUtil.getDefaultUsage() + getUsage().replace("<command>", s)); } return true; } if ((this.minArgs >= 0) && (strings.length < this.minArgs)) { if (getUsage() != null) { sender.sendMessage(StringUtil.getDefaultUsage() + getUsage().replace("<command>", s)); } return true; } execute(sender, strings); return true; } public static boolean containsFlag(String[] args, String flag) { return Arrays.asList(args).contains(flag); } public static String[] filterFlags(String[] args) { List<String> aids = new ArrayList<>(); for(String str : args) { if(!str.startsWith("-")) aids.add(str); } return aids.toArray(new String[aids.size()]); } public static HashMap<String, CommandFlag> getFlags(String[] args) { HashMap<String, CommandFlag> flags = new HashMap<>(); for(String str : args) { if(str.startsWith("-")) { CommandFlag flag = new CommandFlag(str); if(flag.isValid()) flags.put(flag.getFlagName(), flag); } } return flags; } public List<String> onTabComplete(CommandSender sender, Command command, String s, String[] strings) { return null; } public abstract void execute(CommandSender paramCommandSender, String[] paramArrayOfString); public String getName() { return this.name; } public String getPermission() { return this.permission; } public String[] getAliases() { return this.aliases; } public void setUsage(String usage) { this.usage = usage; } public String getUsage() { return this.usage; } public void setMaxArgs(int maxArgs) { this.maxArgs = maxArgs; } public void setMinArgs(int minArgs) { this.minArgs = minArgs; } public void setArgRange(int minArgs, int maxArgs) { this.maxArgs = maxArgs; this.minArgs = minArgs; } public void mustExecuteFromConsole(CommandSender sender){ MessageUtil.message(sender, ChatColor.RED + "You must execute this command VIA console."); } public void mustExecuteByPlayer(CommandSender sender) { MessageUtil.message(sender, "You must execute this command in-game."); } }
UTF-8
Java
4,133
java
BaseCommand.java
Java
[ { "context": "HashMap;\nimport java.util.List;\n\n/**\n * Created by LavaisWatery on 10/24/2016.\n */\npublic abstract class BaseComm", "end": 436, "score": 0.8814646601676941, "start": 424, "tag": "USERNAME", "value": "LavaisWatery" } ]
null
[]
package me.sores.impulse.util.cmdfrmwrk; import me.sores.impulse.util.MessageUtil; import me.sores.impulse.util.StringUtil; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.command.TabExecutor; import org.bukkit.entity.Player; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; /** * Created by LavaisWatery on 10/24/2016. */ public abstract class BaseCommand implements TabExecutor { String name; String permission; CommandUsageBy usageBy; String[] aliases; String usage; int maxArgs; int minArgs; public BaseCommand(String name, String permission, CommandUsageBy usageBy, String... aliases) { this.name = name; this.permission = permission; this.usageBy = usageBy; this.aliases = aliases; } public boolean onCommand(CommandSender sender, Command command, String s, String[] strings) { if ((!this.permission.isEmpty()) && (this.permission != null) && (!sender.hasPermission(this.permission) && !sender.hasPermission("*"))) { MessageUtil.noPermission(sender); return false; } if(sender instanceof Player && usageBy == CommandUsageBy.CONSOLE) { mustExecuteFromConsole(sender); return true; } else if(!(sender instanceof Player) && usageBy == CommandUsageBy.PLAYER) { mustExecuteByPlayer(sender); return true; } if ((this.maxArgs >= 0) && (strings.length > this.maxArgs)) { if (getUsage() != null) { sender.sendMessage(StringUtil.getDefaultUsage() + getUsage().replace("<command>", s)); } return true; } if ((this.minArgs >= 0) && (strings.length < this.minArgs)) { if (getUsage() != null) { sender.sendMessage(StringUtil.getDefaultUsage() + getUsage().replace("<command>", s)); } return true; } execute(sender, strings); return true; } public static boolean containsFlag(String[] args, String flag) { return Arrays.asList(args).contains(flag); } public static String[] filterFlags(String[] args) { List<String> aids = new ArrayList<>(); for(String str : args) { if(!str.startsWith("-")) aids.add(str); } return aids.toArray(new String[aids.size()]); } public static HashMap<String, CommandFlag> getFlags(String[] args) { HashMap<String, CommandFlag> flags = new HashMap<>(); for(String str : args) { if(str.startsWith("-")) { CommandFlag flag = new CommandFlag(str); if(flag.isValid()) flags.put(flag.getFlagName(), flag); } } return flags; } public List<String> onTabComplete(CommandSender sender, Command command, String s, String[] strings) { return null; } public abstract void execute(CommandSender paramCommandSender, String[] paramArrayOfString); public String getName() { return this.name; } public String getPermission() { return this.permission; } public String[] getAliases() { return this.aliases; } public void setUsage(String usage) { this.usage = usage; } public String getUsage() { return this.usage; } public void setMaxArgs(int maxArgs) { this.maxArgs = maxArgs; } public void setMinArgs(int minArgs) { this.minArgs = minArgs; } public void setArgRange(int minArgs, int maxArgs) { this.maxArgs = maxArgs; this.minArgs = minArgs; } public void mustExecuteFromConsole(CommandSender sender){ MessageUtil.message(sender, ChatColor.RED + "You must execute this command VIA console."); } public void mustExecuteByPlayer(CommandSender sender) { MessageUtil.message(sender, "You must execute this command in-game."); } }
4,133
0.610694
0.608275
142
28.105635
29.865829
154
false
false
0
0
0
0
0
0
0.535211
false
false
7
752c58c8e3543ef4b04f649d832f5eafdd0c2da6
28,260,884,835,868
4831cde669867e43dd7c84d48715e3a3da46be90
/src/test/java/com/brasilprev/customermanagement/search/entrypoint/SearchClientEntrypointTest.java
25b478528eb8003728d09c49558c3495a0fdb574
[]
no_license
MichaeldaSilvaSeS/customer-management
https://github.com/MichaeldaSilvaSeS/customer-management
ba65d8f60d6f038fec3d9fa94ed7f2d17ed5084d
07fb5aa9865214cecd1fad019d687f7191073ff1
refs/heads/master
2022-12-28T15:38:10.848000
2020-10-13T00:09:30
2020-10-13T00:09:30
295,039,692
0
0
null
false
2020-09-14T01:08:28
2020-09-12T22:55:13
2020-09-13T22:27:15
2020-09-14T01:08:28
56
0
0
0
Java
false
false
package com.brasilprev.customermanagement.search.entrypoint; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import java.util.Arrays; import java.util.Collection; import java.util.List; import org.apache.http.HttpStatus; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.ResultActions; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import com.brasilprev.customermanagement.commons.entrypoint.dto.client.ClientDTO; import com.brasilprev.customermanagement.commons.usecase.domain.AddressDomain; import com.brasilprev.customermanagement.commons.usecase.domain.ClientDomain; import com.brasilprev.customermanagement.commons.usecase.domain.IdentityDocumentDomain; import com.brasilprev.customermanagement.commons.usecase.domain.IdentityType; import com.brasilprev.customermanagement.search.entrypoint.SearchClientEntrypoint; import com.brasilprev.customermanagement.search.usecase.SearchClientUseCase; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; @SpringBootTest @AutoConfigureMockMvc public class SearchClientEntrypointTest { @Autowired private MockMvc mockMvc; @MockBean private SearchClientUseCase searchClientUseCase; private static final String CLIENT_NAME = "MICHAEL"; @Test public void searchClientSucess() throws Exception { Mockito.when(searchClientUseCase.searchByCPF(Mockito.anyString())).thenReturn(Arrays.<ClientDomain>asList(createClientDomain())); ResultActions andExpect = mockMvc.perform(get(SearchClientEntrypoint.CREATE_CLIENT_URL) .contentType(MediaType.APPLICATION_JSON_VALUE) .queryParam(SearchClientEntrypoint.QUERY_PARAM_SEARCH, SearchClientEntrypoint.QUERY_PARAM_SEARCH_VALUE) .queryParam(SearchClientEntrypoint.QUERY_PARAM_IDENTITY, "53107862010") ).andDo(print()) .andExpect(status().is(HttpStatus.SC_OK)); List<ClientDTO> listOfClients = new ObjectMapper().readValue(andExpect.andReturn().getResponse().getContentAsString(), new TypeReference<List<ClientDTO>>(){}); Assertions.assertNotNull(listOfClients.size()); Assertions.assertEquals(listOfClients.size(), 1); Assertions.assertEquals(listOfClients.get(0).getName(), CLIENT_NAME); } @Test public void searchClientSearchMissingParam() throws Exception { Mockito.when(searchClientUseCase.searchByCPF(Mockito.anyString())).thenReturn(Arrays.<ClientDomain>asList(createClientDomain())); mockMvc.perform(get(SearchClientEntrypoint.CREATE_CLIENT_URL) .contentType(MediaType.APPLICATION_JSON_VALUE) .queryParam(SearchClientEntrypoint.QUERY_PARAM_SEARCH, SearchClientEntrypoint.QUERY_PARAM_SEARCH_VALUE) ).andDo(print()) .andExpect(status().is(HttpStatus.SC_BAD_REQUEST)) .andExpect(MockMvcResultMatchers.jsonPath("$.description").value(SearchClientEntrypoint.QUERY_PARAM_MISSING_IDENTITY)); } private ClientDomain createClientDomain() { return ClientDomain.builder() .id(1L) .name(CLIENT_NAME) .identityDocument(createIdentityDocuments()) .address(createAddress()) .build(); } private Collection<AddressDomain> createAddress() { AddressDomain address = AddressDomain.builder() .thoroughfare("thoroughfare") .number(1L) .complement("complement") .neighborhood("neighborhood") .city("city") .state("state") .postalCode("09100200") .build(); return Arrays.<AddressDomain>asList(address); } private Collection<IdentityDocumentDomain> createIdentityDocuments() { IdentityDocumentDomain identity = IdentityDocumentDomain.builder() .identity("53107862010") .identityType(IdentityType.CPF) .build(); return Arrays.<IdentityDocumentDomain>asList(identity); } }
UTF-8
Java
4,568
java
SearchClientEntrypointTest.java
Java
[ { "context": "se;\n\t\n\tprivate static final String CLIENT_NAME = \"MICHAEL\";\n\n\t@Test\t\n\tpublic void searchClientSucess() thro", "end": 1949, "score": 0.9990071654319763, "start": 1942, "tag": "NAME", "value": "MICHAEL" } ]
null
[]
package com.brasilprev.customermanagement.search.entrypoint; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import java.util.Arrays; import java.util.Collection; import java.util.List; import org.apache.http.HttpStatus; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.ResultActions; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import com.brasilprev.customermanagement.commons.entrypoint.dto.client.ClientDTO; import com.brasilprev.customermanagement.commons.usecase.domain.AddressDomain; import com.brasilprev.customermanagement.commons.usecase.domain.ClientDomain; import com.brasilprev.customermanagement.commons.usecase.domain.IdentityDocumentDomain; import com.brasilprev.customermanagement.commons.usecase.domain.IdentityType; import com.brasilprev.customermanagement.search.entrypoint.SearchClientEntrypoint; import com.brasilprev.customermanagement.search.usecase.SearchClientUseCase; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; @SpringBootTest @AutoConfigureMockMvc public class SearchClientEntrypointTest { @Autowired private MockMvc mockMvc; @MockBean private SearchClientUseCase searchClientUseCase; private static final String CLIENT_NAME = "MICHAEL"; @Test public void searchClientSucess() throws Exception { Mockito.when(searchClientUseCase.searchByCPF(Mockito.anyString())).thenReturn(Arrays.<ClientDomain>asList(createClientDomain())); ResultActions andExpect = mockMvc.perform(get(SearchClientEntrypoint.CREATE_CLIENT_URL) .contentType(MediaType.APPLICATION_JSON_VALUE) .queryParam(SearchClientEntrypoint.QUERY_PARAM_SEARCH, SearchClientEntrypoint.QUERY_PARAM_SEARCH_VALUE) .queryParam(SearchClientEntrypoint.QUERY_PARAM_IDENTITY, "53107862010") ).andDo(print()) .andExpect(status().is(HttpStatus.SC_OK)); List<ClientDTO> listOfClients = new ObjectMapper().readValue(andExpect.andReturn().getResponse().getContentAsString(), new TypeReference<List<ClientDTO>>(){}); Assertions.assertNotNull(listOfClients.size()); Assertions.assertEquals(listOfClients.size(), 1); Assertions.assertEquals(listOfClients.get(0).getName(), CLIENT_NAME); } @Test public void searchClientSearchMissingParam() throws Exception { Mockito.when(searchClientUseCase.searchByCPF(Mockito.anyString())).thenReturn(Arrays.<ClientDomain>asList(createClientDomain())); mockMvc.perform(get(SearchClientEntrypoint.CREATE_CLIENT_URL) .contentType(MediaType.APPLICATION_JSON_VALUE) .queryParam(SearchClientEntrypoint.QUERY_PARAM_SEARCH, SearchClientEntrypoint.QUERY_PARAM_SEARCH_VALUE) ).andDo(print()) .andExpect(status().is(HttpStatus.SC_BAD_REQUEST)) .andExpect(MockMvcResultMatchers.jsonPath("$.description").value(SearchClientEntrypoint.QUERY_PARAM_MISSING_IDENTITY)); } private ClientDomain createClientDomain() { return ClientDomain.builder() .id(1L) .name(CLIENT_NAME) .identityDocument(createIdentityDocuments()) .address(createAddress()) .build(); } private Collection<AddressDomain> createAddress() { AddressDomain address = AddressDomain.builder() .thoroughfare("thoroughfare") .number(1L) .complement("complement") .neighborhood("neighborhood") .city("city") .state("state") .postalCode("09100200") .build(); return Arrays.<AddressDomain>asList(address); } private Collection<IdentityDocumentDomain> createIdentityDocuments() { IdentityDocumentDomain identity = IdentityDocumentDomain.builder() .identity("53107862010") .identityType(IdentityType.CPF) .build(); return Arrays.<IdentityDocumentDomain>asList(identity); } }
4,568
0.768827
0.761384
106
42.094341
34.6828
162
false
false
0
0
0
0
0
0
2.971698
false
false
7
36a1e0010189c70037c67e825dfd9997cece8d82
20,023,137,573,404
d98c4d893f1d673c9f8519d250ed519fb7a55aea
/OnlineCheckersTypes/src/main/java/com/ulacit/ocheckers/types/CheckersBoard.java
7349c88cf20cc12882834cd305793da398a2f532
[]
no_license
pedroguzmanb/OnlineCheckersG5
https://github.com/pedroguzmanb/OnlineCheckersG5
fd20783d6115d85ed42e5b5a64379263bd5e1aa5
08478e00113334e166ab8e8162c063d7de558618
refs/heads/master
2016-08-20T09:57:45.661000
2016-08-19T03:33:36
2016-08-19T03:33:36
65,811,592
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * ============================================================================= * APACHE 2.0 LICENSE * ============================================================================= * Copyright (c) 2016 CICC-ULACIT. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.ulacit.ocheckers.types; // ----------------------------------------------------------------------------- // // CLASS CHECKERS BOARD // // ----------------------------------------------------------------------------- // /** * Este es el modelo que implementa el tablero de juego de Checkers. Esta clase * además implementa el patrón de singleton (http://www.oodesign.com/singleton-pattern.html) * con el objetivo de limitar las instancias a solo una dentro de cada aplicación * para que así solo exista un tablero * @author Pedro Guzmán (pguzmanb498@ulacit.ed.cr) */ public class CheckersBoard { // ------------------------------------------------------------------------- // // CONSTANTES DE LA CLASE // // ------------------------------------------------------------------------- // public static final int BOARD_LENGTH = 8; // Valor cuando una casilla está vacía. public static final int EMPTY = 0; // ------------------------------------------------------------------------- // // ATRIBUTOS DE LA CLASE // // ------------------------------------------------------------------------- // // Única instancia del singleton. Cualquier otra instancia que haga uso de // este recurso, utilizará unicamente una referencia. private static CheckersBoard checkers; // Tablero de checkers private final int[][] board; // ------------------------------------------------------------------------- // // CONSTRUCTOR // // ------------------------------------------------------------------------- // /** * Crea instancias de CheckersBoard. Sin embargo somo implementa el patrón de * singleton. Entonces existe con el fin del evitar que más instancias de esta * clase puedan ser creadas por otras clases. */ private CheckersBoard(){ this.board = new int[BOARD_LENGTH][BOARD_LENGTH]; } // CONSTRUCTOR METHOD ENDS ----------------------------------------------- // // ------------------------------------------------------------------------- // // METHOD GET INSTANCE // // ------------------------------------------------------------------------- // /** * Permite obtener una referencia al tablero de checkers * @return */ public static synchronized CheckersBoard getInstance(){ if(checkers == null){ checkers = new CheckersBoard(); } // if ends return checkers; } // METHOD GET INSTANCE ENDS ---------------------------------------------- // // ------------------------------------------------------------------------- // // METHOD UPDATE // // ------------------------------------------------------------------------- // /** * Este método recibe un snapshot con una versión de estado del tablero más * actualizado, por lo que éste método debe actualizar o sincronizar la * matriz interna con el estado del snapshot. * @param snapshot */ public void update(final int[][] snapshot){ for (int i = 0; i < this.board.length; i++) { for (int j = 0; j < this.board[i].length; j++) { this.board[i][j] = snapshot[i][j]; } //for j ENDS } // for i ENDS } // METHOD UPDATE ENDS ---------------------------------------------------- // // ------------------------------------------------------------------------- // // METHOD INIT // // ------------------------------------------------------------------------- // /** * Inicializa el tablero colocando las fichas en su modo inicial */ public void init(){ } //METHOD INIT ENDS ------------------------------------------------------- // } // CLASS CHECKERS BOARD ENDS ------------------------------------------------- //
UTF-8
Java
5,064
java
CheckersBoard.java
Java
[ { "context": " * para que así solo exista un tablero \n * @author Pedro Guzmán (pguzmanb498@ulacit.ed.cr)\n */\npublic class Check", "end": 1397, "score": 0.9998114705085754, "start": 1385, "tag": "NAME", "value": "Pedro Guzmán" }, { "context": " solo exista un tablero \n * @author Pedro Guzmán (pguzmanb498@ulacit.ed.cr)\n */\npublic class CheckersBoard {\n \n // ---", "end": 1423, "score": 0.9999370574951172, "start": 1399, "tag": "EMAIL", "value": "pguzmanb498@ulacit.ed.cr" } ]
null
[]
/* * ============================================================================= * APACHE 2.0 LICENSE * ============================================================================= * Copyright (c) 2016 CICC-ULACIT. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.ulacit.ocheckers.types; // ----------------------------------------------------------------------------- // // CLASS CHECKERS BOARD // // ----------------------------------------------------------------------------- // /** * Este es el modelo que implementa el tablero de juego de Checkers. Esta clase * además implementa el patrón de singleton (http://www.oodesign.com/singleton-pattern.html) * con el objetivo de limitar las instancias a solo una dentro de cada aplicación * para que así solo exista un tablero * @author <NAME> (<EMAIL>) */ public class CheckersBoard { // ------------------------------------------------------------------------- // // CONSTANTES DE LA CLASE // // ------------------------------------------------------------------------- // public static final int BOARD_LENGTH = 8; // Valor cuando una casilla está vacía. public static final int EMPTY = 0; // ------------------------------------------------------------------------- // // ATRIBUTOS DE LA CLASE // // ------------------------------------------------------------------------- // // Única instancia del singleton. Cualquier otra instancia que haga uso de // este recurso, utilizará unicamente una referencia. private static CheckersBoard checkers; // Tablero de checkers private final int[][] board; // ------------------------------------------------------------------------- // // CONSTRUCTOR // // ------------------------------------------------------------------------- // /** * Crea instancias de CheckersBoard. Sin embargo somo implementa el patrón de * singleton. Entonces existe con el fin del evitar que más instancias de esta * clase puedan ser creadas por otras clases. */ private CheckersBoard(){ this.board = new int[BOARD_LENGTH][BOARD_LENGTH]; } // CONSTRUCTOR METHOD ENDS ----------------------------------------------- // // ------------------------------------------------------------------------- // // METHOD GET INSTANCE // // ------------------------------------------------------------------------- // /** * Permite obtener una referencia al tablero de checkers * @return */ public static synchronized CheckersBoard getInstance(){ if(checkers == null){ checkers = new CheckersBoard(); } // if ends return checkers; } // METHOD GET INSTANCE ENDS ---------------------------------------------- // // ------------------------------------------------------------------------- // // METHOD UPDATE // // ------------------------------------------------------------------------- // /** * Este método recibe un snapshot con una versión de estado del tablero más * actualizado, por lo que éste método debe actualizar o sincronizar la * matriz interna con el estado del snapshot. * @param snapshot */ public void update(final int[][] snapshot){ for (int i = 0; i < this.board.length; i++) { for (int j = 0; j < this.board[i].length; j++) { this.board[i][j] = snapshot[i][j]; } //for j ENDS } // for i ENDS } // METHOD UPDATE ENDS ---------------------------------------------------- // // ------------------------------------------------------------------------- // // METHOD INIT // // ------------------------------------------------------------------------- // /** * Inicializa el tablero colocando las fichas en su modo inicial */ public void init(){ } //METHOD INIT ENDS ------------------------------------------------------- // } // CLASS CHECKERS BOARD ENDS ------------------------------------------------- //
5,040
0.388867
0.385499
108
45.740742
32.204605
92
false
false
0
0
0
0
78
0.030903
0.185185
false
false
7
f9896f22da25e0aeb164a43dcb518805b7643325
20,023,137,576,937
affe6341e5b2c66c21287aba339d965d9ed04d8f
/src/main/java/com/project/transactionApi/Swagger/SwaggerConfig.java
0240675ec1aa2c54d7431b2c04b8c632bd4c1b79
[]
no_license
luizframbach/TransactionApi
https://github.com/luizframbach/TransactionApi
f0fdad23073a03b8f31ab8b59e60addcc2d58ab7
7659c7caa22ca927cd1c9b40638b0d3bc09c5501
refs/heads/master
2022-04-09T15:03:18.953000
2020-03-20T00:48:25
2020-03-20T00:48:25
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.project.transactionApi.Swagger; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; import static springfox.documentation.builders.PathSelectors.regex; import static springfox.documentation.builders.RequestHandlerSelectors.basePackage; import static springfox.documentation.spi.DocumentationType.SWAGGER_2; @Configuration @EnableSwagger2 public class SwaggerConfig extends WebMvcConfigurationSupport { @Bean public Docket productApi() { return new Docket(SWAGGER_2) .select() .apis(basePackage("com.project.transactionApi.Controllers")) .paths(regex("/api/.*")) .build(); } @Override protected void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("swagger-ui.html") .addResourceLocations("classpath:/META-INF/resources/"); registry.addResourceHandler("/webjars/**") .addResourceLocations("classpath:/META-INF/resources/webjars/"); } }
UTF-8
Java
1,384
java
SwaggerConfig.java
Java
[]
null
[]
package com.project.transactionApi.Swagger; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; import static springfox.documentation.builders.PathSelectors.regex; import static springfox.documentation.builders.RequestHandlerSelectors.basePackage; import static springfox.documentation.spi.DocumentationType.SWAGGER_2; @Configuration @EnableSwagger2 public class SwaggerConfig extends WebMvcConfigurationSupport { @Bean public Docket productApi() { return new Docket(SWAGGER_2) .select() .apis(basePackage("com.project.transactionApi.Controllers")) .paths(regex("/api/.*")) .build(); } @Override protected void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("swagger-ui.html") .addResourceLocations("classpath:/META-INF/resources/"); registry.addResourceHandler("/webjars/**") .addResourceLocations("classpath:/META-INF/resources/webjars/"); } }
1,384
0.75289
0.749277
33
40.969696
29.338655
84
false
false
0
0
0
0
0
0
0.393939
false
false
7
2d4c789e249a80b8fb37f87ddfb1d1a44b6e0693
31,877,247,295,471
a96e88cdb0646faa3fd3e82de155e646ba5eb79a
/production/src/main/java/com/cskaoyan/erp/service/ProcessMonitoringService.java
4aa9818cddab0415749f804fcbf6c73db8345aed
[]
no_license
hlfvngr/production_ssm
https://github.com/hlfvngr/production_ssm
a75100e32f8b7e333fc3b2a0393bec7369028c76
c82c6eaa6522e5b0bfe44bcdd7d081f2c712bf02
refs/heads/master
2020-04-09T17:41:21.874000
2018-12-10T07:35:47
2018-12-10T07:35:47
160,487,941
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cskaoyan.erp.service; import com.cskaoyan.erp.bean.Technology; import com.cskaoyan.erp.bean.TechnologyPlan; import com.cskaoyan.erp.bean.TechnologyRequirement; import com.cskaoyan.erp.bean.VO.TechnologyPlanVO; import com.cskaoyan.erp.bean.VO.TechnologyRequirementVO; import com.cskaoyan.erp.bean.Process; import com.cskaoyan.erp.util.PageModel; import java.util.List; import java.util.Map; /** * @Description: java类作用描述 * @Author: l * @CreateDate: 2018/12/6 10:31 * @需求: * @思路说明: */ public interface ProcessMonitoringService { public Map<String,Object> findTechnologyList(PageModel pageModel); public Map<String,Object> findTechnologyRequirementList(PageModel pageModel); public Map<String,Object> findTechnologyPlanList(PageModel pageModel); public Map<String,Object> findProcessList(PageModel pageModel); public boolean insertTechnology(Technology technology); public boolean updateByPrimaryKey(Technology technology); public boolean deleteTechnology(String[] ids); public Map<String,Object> searchTechnologyByTechnologyId(String searchValue,PageModel pageModel); public Map<String,Object> searchTechnologyByTechnologyName(String searchValue,PageModel pageModel); public Map<String,Object> searchRequirementByRequirementId(String searchValue,PageModel pageModel); public Map<String,Object> searchRequirementByTechnologyName(String searchValue,PageModel pageModel); public Map<String,Object> searchPlanByPlanId(String searchValue,PageModel pageModel); public Map<String,Object> searchPlanByTechnologyName(String searchValue,PageModel pageModel); public Map<String,Object> searchProcessByProcessId(String searchValue,PageModel pageModel); public Map<String,Object> searchProcessByPlanId(String searchValue,PageModel pageModel); public List<Technology> findAllTechnology(); public boolean insertTechnologyRequirement(TechnologyRequirement requirement); public boolean updateTechnologyRequirement(TechnologyRequirement requirement); public boolean deleteTechnologyRequirement(String[] ids); public boolean insertTechnologyPlan(TechnologyPlan technologyPlan); public boolean updateTechnologyPlan(TechnologyPlan technologyPlan); public boolean deleteTechnologyPlan(String[] ids); public List<TechnologyPlanVO> findAllTechnologyPlan(); public boolean insertProcess(Process process); public boolean updateProcess(Process process); public boolean deleteProcess(String[] ids); public boolean updateRequirement(String technologyRequirementId,String requirement); public Technology getTechnologyById(String technologyId); public TechnologyPlanVO getTechnologyPlanById(String technologyPlanId); public Process getProcessById(String processId); }
UTF-8
Java
2,828
java
ProcessMonitoringService.java
Java
[ { "context": "l.Map;\n\n/**\n * @Description: java类作用描述\n * @Author: l\n * @CreateDate: 2018/12/6 10:31\n * @需求:\n * @思路说明:", "end": 449, "score": 0.9630091786384583, "start": 448, "tag": "USERNAME", "value": "l" } ]
null
[]
package com.cskaoyan.erp.service; import com.cskaoyan.erp.bean.Technology; import com.cskaoyan.erp.bean.TechnologyPlan; import com.cskaoyan.erp.bean.TechnologyRequirement; import com.cskaoyan.erp.bean.VO.TechnologyPlanVO; import com.cskaoyan.erp.bean.VO.TechnologyRequirementVO; import com.cskaoyan.erp.bean.Process; import com.cskaoyan.erp.util.PageModel; import java.util.List; import java.util.Map; /** * @Description: java类作用描述 * @Author: l * @CreateDate: 2018/12/6 10:31 * @需求: * @思路说明: */ public interface ProcessMonitoringService { public Map<String,Object> findTechnologyList(PageModel pageModel); public Map<String,Object> findTechnologyRequirementList(PageModel pageModel); public Map<String,Object> findTechnologyPlanList(PageModel pageModel); public Map<String,Object> findProcessList(PageModel pageModel); public boolean insertTechnology(Technology technology); public boolean updateByPrimaryKey(Technology technology); public boolean deleteTechnology(String[] ids); public Map<String,Object> searchTechnologyByTechnologyId(String searchValue,PageModel pageModel); public Map<String,Object> searchTechnologyByTechnologyName(String searchValue,PageModel pageModel); public Map<String,Object> searchRequirementByRequirementId(String searchValue,PageModel pageModel); public Map<String,Object> searchRequirementByTechnologyName(String searchValue,PageModel pageModel); public Map<String,Object> searchPlanByPlanId(String searchValue,PageModel pageModel); public Map<String,Object> searchPlanByTechnologyName(String searchValue,PageModel pageModel); public Map<String,Object> searchProcessByProcessId(String searchValue,PageModel pageModel); public Map<String,Object> searchProcessByPlanId(String searchValue,PageModel pageModel); public List<Technology> findAllTechnology(); public boolean insertTechnologyRequirement(TechnologyRequirement requirement); public boolean updateTechnologyRequirement(TechnologyRequirement requirement); public boolean deleteTechnologyRequirement(String[] ids); public boolean insertTechnologyPlan(TechnologyPlan technologyPlan); public boolean updateTechnologyPlan(TechnologyPlan technologyPlan); public boolean deleteTechnologyPlan(String[] ids); public List<TechnologyPlanVO> findAllTechnologyPlan(); public boolean insertProcess(Process process); public boolean updateProcess(Process process); public boolean deleteProcess(String[] ids); public boolean updateRequirement(String technologyRequirementId,String requirement); public Technology getTechnologyById(String technologyId); public TechnologyPlanVO getTechnologyPlanById(String technologyPlanId); public Process getProcessById(String processId); }
2,828
0.805417
0.801497
82
33.219513
35.080402
104
false
false
0
0
0
0
0
0
0.743902
false
false
7
ff3700b6f0139a2cdeb90e96533f5d355a3e4cc5
31,877,247,299,320
e7c107e211140b1f62dd23c8374e4755464d103b
/src/main/java/com/andersen/study/chap7/ovcon1/OverloadCons.java
4b049fb61fa97d58cd73d17ecf6985c6dab5f9df
[]
no_license
ponamorev/JavaCore
https://github.com/ponamorev/JavaCore
e42e4d0b283783d2b3b05fd3cc1b929b925c4e7d
604d288ecb45e2ad379bedf7c070a39b7db8649b
refs/heads/master
2021-08-26T08:12:34.852000
2017-11-22T11:55:14
2017-11-22T11:55:14
106,783,458
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.andersen.study.chap7.ovcon1; // В данном примере конструкторы определяются в классе Box для // инициализации размеров параллелепипеда тремя разными способами class Box { double width; double height; double depth; // конструктор, используемый при указании всех размеров Box(double w, double h, double d) { width = w; height = h; depth = d; } // конструктор, используемый, когда ни один из размеров не указан Box() { width = -1; // значение -1 используется height = -1; // для неинициализированного depth = -1; // параллелепипеда } // конструктор, используемый при создании куба Box(double len) { width = height = depth = len; } // рассчитать и возвратить объём double volume() { return width * height * depth; } } class OverloadCons { public static void main(String[] args) { // создаём параллелепипеды, используя // разные конструкторы Box box1 = new Box(10, 20, 15); Box box2 = new Box(); Box cube = new Box(7); double vol; // получить объём первого параллелипипеда vol = box1.volume(); System.out.println("Объём box1 равен: " + vol); // получить объём второго параллелипипеда vol = box2.volume(); System.out.println("Объём box2 равен: " + vol); // получить объём куба vol = cube.volume(); System.out.println("Объём cube равен: " + vol); } }
UTF-8
Java
2,009
java
OverloadCons.java
Java
[]
null
[]
package com.andersen.study.chap7.ovcon1; // В данном примере конструкторы определяются в классе Box для // инициализации размеров параллелепипеда тремя разными способами class Box { double width; double height; double depth; // конструктор, используемый при указании всех размеров Box(double w, double h, double d) { width = w; height = h; depth = d; } // конструктор, используемый, когда ни один из размеров не указан Box() { width = -1; // значение -1 используется height = -1; // для неинициализированного depth = -1; // параллелепипеда } // конструктор, используемый при создании куба Box(double len) { width = height = depth = len; } // рассчитать и возвратить объём double volume() { return width * height * depth; } } class OverloadCons { public static void main(String[] args) { // создаём параллелепипеды, используя // разные конструкторы Box box1 = new Box(10, 20, 15); Box box2 = new Box(); Box cube = new Box(7); double vol; // получить объём первого параллелипипеда vol = box1.volume(); System.out.println("Объём box1 равен: " + vol); // получить объём второго параллелипипеда vol = box2.volume(); System.out.println("Объём box2 равен: " + vol); // получить объём куба vol = cube.volume(); System.out.println("Объём cube равен: " + vol); } }
2,009
0.601187
0.588662
55
26.581818
20.261644
69
false
false
0
0
0
0
0
0
0.563636
false
false
7
e2f4801da2293bd0310362a83c00e2877c45b6b8
13,142,599,938,137
fa1ad2e2ac7e376fc7cb3b3a6e1bb88eed3e80be
/lake/paimon/paimon-core/src/main/java/org/apache/paimon/utils/VersionedObjectSerializer.java
30047afdf88659e678051bb15399136889c6d976
[ "BSD-3-Clause", "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "LicenseRef-scancode-unknown" ]
permissive
alldatacenter/alldata
https://github.com/alldatacenter/alldata
7bc7713c9f1d56ad6b8e59ea03206d1073b7e047
8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6
refs/heads/master
2023-08-05T07:32:25.442000
2023-08-03T13:17:24
2023-08-03T13:17:24
213,321,771
774
250
Apache-2.0
false
2023-09-06T17:35:32
2019-10-07T07:36:18
2023-09-06T07:35:48
2023-09-06T17:35:30
1,610,032
1,898
711
14
null
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.paimon.utils; import org.apache.paimon.data.GenericRow; import org.apache.paimon.data.InternalRow; import org.apache.paimon.data.JoinedRow; import org.apache.paimon.types.DataField; import org.apache.paimon.types.IntType; import org.apache.paimon.types.RowType; import java.util.ArrayList; import java.util.List; /** A {@link ObjectSerializer} for versioned serialization. */ public abstract class VersionedObjectSerializer<T> extends ObjectSerializer<T> { private static final long serialVersionUID = 1L; public VersionedObjectSerializer(RowType rowType) { super(versionType(rowType)); } public static RowType versionType(RowType rowType) { List<DataField> fields = new ArrayList<>(); fields.add(new DataField(-1, "_VERSION", new IntType(false))); fields.addAll(rowType.getFields()); return new RowType(fields); } /** * Gets the version with which this serializer serializes. * * @return The version of the serialization schema. */ public abstract int getVersion(); public abstract InternalRow convertTo(T record); public abstract T convertFrom(int version, InternalRow row); @Override public final InternalRow toRow(T record) { return new JoinedRow().replace(GenericRow.of(getVersion()), convertTo(record)); } @Override public final T fromRow(InternalRow row) { return convertFrom(row.getInt(0), new OffsetRow(row.getFieldCount() - 1, 1).replace(row)); } }
UTF-8
Java
2,332
java
VersionedObjectSerializer.java
Java
[]
null
[]
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.paimon.utils; import org.apache.paimon.data.GenericRow; import org.apache.paimon.data.InternalRow; import org.apache.paimon.data.JoinedRow; import org.apache.paimon.types.DataField; import org.apache.paimon.types.IntType; import org.apache.paimon.types.RowType; import java.util.ArrayList; import java.util.List; /** A {@link ObjectSerializer} for versioned serialization. */ public abstract class VersionedObjectSerializer<T> extends ObjectSerializer<T> { private static final long serialVersionUID = 1L; public VersionedObjectSerializer(RowType rowType) { super(versionType(rowType)); } public static RowType versionType(RowType rowType) { List<DataField> fields = new ArrayList<>(); fields.add(new DataField(-1, "_VERSION", new IntType(false))); fields.addAll(rowType.getFields()); return new RowType(fields); } /** * Gets the version with which this serializer serializes. * * @return The version of the serialization schema. */ public abstract int getVersion(); public abstract InternalRow convertTo(T record); public abstract T convertFrom(int version, InternalRow row); @Override public final InternalRow toRow(T record) { return new JoinedRow().replace(GenericRow.of(getVersion()), convertTo(record)); } @Override public final T fromRow(InternalRow row) { return convertFrom(row.getInt(0), new OffsetRow(row.getFieldCount() - 1, 1).replace(row)); } }
2,332
0.7247
0.72084
67
33.805969
27.74954
98
false
false
0
0
0
0
0
0
0.462687
false
false
7
f1f16dbb703f8a368cecf522d40edad2943998cc
13,142,599,938,403
25f733963478c37e9a6bd20ee51b9f5d7c72ec2e
/src/main/java/com/giannistsakiris/codegenerator/TypeEntity.java
7835f316f500816705156699bfcaa02fa0db3e14
[]
no_license
afasias/CodeGenerator
https://github.com/afasias/CodeGenerator
10056bed0833dea8bde2f76773335928cf068f56
0dd5e35b5a90944b958755d245a2cdbc19dacdce
refs/heads/master
2021-05-13T22:08:55.764000
2018-01-06T12:32:50
2018-01-06T12:32:50
116,481,075
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.giannistsakiris.codegenerator; public interface TypeEntity { public String getName(); public String getFullyQualifiedName(); }
UTF-8
Java
145
java
TypeEntity.java
Java
[]
null
[]
package com.giannistsakiris.codegenerator; public interface TypeEntity { public String getName(); public String getFullyQualifiedName(); }
145
0.793103
0.793103
9
15.111111
17.310526
42
false
false
0
0
0
0
0
0
0.555556
false
false
7
daac9d4a3e7c203e05ba25841fe52f1c76bffbe8
30,709,016,232,034
5c1d53b106586ff07bb9e62d8b09970a44c7149e
/java1/panels.java
bd28228e47b075a92e0e99feb1a612cdc9ccdf65
[]
no_license
knotverygood/CollegeCode
https://github.com/knotverygood/CollegeCode
93de0021cc601989dbded8dee0d686ece15a77d3
dc96f63d7a635942ce519ff42d53b8da93c63a64
refs/heads/master
2020-12-29T03:19:40.111000
2011-07-01T06:41:48
2011-07-01T06:41:48
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import javax.swing.*; import java.awt.event.*; import java.awt.*; //import javax.swing. class madhur { public static void main(String args[]) { new myframe(); } } class myframe { JFrame md; GridBagLayout gbl=new GridBagLayout(); GridBagConstraints gbc=new GridBagConstraints(); JButton c,e,d; myframe() { md=new JFrame(); //md.getContentPane().setLayout(); JButton a=new JButton("Dffd"); JButton c=new JButton("Dffd1"); JButton e=new JButton("Dffd2"); JButton d=new JButton("Dffd3"); JPanel md1=new JPanel(gbl); ButtonGroup bg=new ButtonGroup(); final JRadioButton br=new JRadioButton("Windows",false); final JRadioButton br1=new JRadioButton("java",false); final JRadioButton br2=new JRadioButton("motif",false); JTextField madhur=new JTextField(4); madhur.add(a); bg.add(br); bg.add(br1); bg.add(br2); final JComboBox combo=new JComboBox(new DefaultComboBoxModel()); combo.addItem("madhur"); combo.addItem(new Boolean(true)); combo.setEditable(true); combo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println(combo.getSelectedItem()); } }); String data[]={"madhur","ahuja","sdsd","dd" }; JList mylist=new JList(data); gbc.fill=gbc.NONE; Layout.buildConstraints(md1,gbl,a,gbc,0,0,1,1,50,50); Layout.buildConstraints(md1,gbl,c,gbc,1,0,1,1,50,0); Layout.buildConstraints(md1,gbl,e,gbc,0,1,1,1,0,50); Layout.buildConstraints(md1,gbl,d,gbc,1,1,1,1,0,0); Layout.buildConstraints(md1,gbl,br,gbc,0,2,1,1,0,0); Layout.buildConstraints(md1,gbl,br1,gbc,1,2,1,1,0,0); Layout.buildConstraints(md1,gbl,br2,gbc,2,2,1,1,0,0); Layout.buildConstraints(md1,gbl,madhur,gbc,3,0,1,1,0,0); Layout.buildConstraints(md1,gbl,combo,gbc,0,4,1,1,0,0); Layout.buildConstraints(md1,gbl,mylist,gbc,1,4,1,1,0,0); md.getContentPane().add(md1); md1.setBorder(BorderFactory.createTitledBorder("dfdf")); a.setBorder(BorderFactory.createTitledBorder("hello madhur")); md.pack(); a.setMnemonic(KeyEvent.VK_5); a.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser a=new JFileChooser() ; a.setMultiSelectionEnabled(true); a.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); a.showOpenDialog(null); try { System.out.println(a.getSelectedFile().getCanonicalPath()); } catch(Exception ee) { ee.printStackTrace(); } //a.show(true); } }); md.setVisible(true); } } class Layout { static void buildConstraints(JPanel win,GridBagLayout gbl,Component cmp, GridBagConstraints gbc, int gx, int gy, int gw, int gh, int wx, int wy) { gbc.gridx = gx; gbc.gridy = gy; gbc.gridwidth = gw; gbc.gridheight = gh; gbc.weightx = wx; gbc.weighty = wy; gbl.setConstraints(cmp,gbc); JPanel jd=(JPanel)win; jd.add(cmp); } }
UTF-8
Java
2,998
java
panels.java
Java
[]
null
[]
import javax.swing.*; import java.awt.event.*; import java.awt.*; //import javax.swing. class madhur { public static void main(String args[]) { new myframe(); } } class myframe { JFrame md; GridBagLayout gbl=new GridBagLayout(); GridBagConstraints gbc=new GridBagConstraints(); JButton c,e,d; myframe() { md=new JFrame(); //md.getContentPane().setLayout(); JButton a=new JButton("Dffd"); JButton c=new JButton("Dffd1"); JButton e=new JButton("Dffd2"); JButton d=new JButton("Dffd3"); JPanel md1=new JPanel(gbl); ButtonGroup bg=new ButtonGroup(); final JRadioButton br=new JRadioButton("Windows",false); final JRadioButton br1=new JRadioButton("java",false); final JRadioButton br2=new JRadioButton("motif",false); JTextField madhur=new JTextField(4); madhur.add(a); bg.add(br); bg.add(br1); bg.add(br2); final JComboBox combo=new JComboBox(new DefaultComboBoxModel()); combo.addItem("madhur"); combo.addItem(new Boolean(true)); combo.setEditable(true); combo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println(combo.getSelectedItem()); } }); String data[]={"madhur","ahuja","sdsd","dd" }; JList mylist=new JList(data); gbc.fill=gbc.NONE; Layout.buildConstraints(md1,gbl,a,gbc,0,0,1,1,50,50); Layout.buildConstraints(md1,gbl,c,gbc,1,0,1,1,50,0); Layout.buildConstraints(md1,gbl,e,gbc,0,1,1,1,0,50); Layout.buildConstraints(md1,gbl,d,gbc,1,1,1,1,0,0); Layout.buildConstraints(md1,gbl,br,gbc,0,2,1,1,0,0); Layout.buildConstraints(md1,gbl,br1,gbc,1,2,1,1,0,0); Layout.buildConstraints(md1,gbl,br2,gbc,2,2,1,1,0,0); Layout.buildConstraints(md1,gbl,madhur,gbc,3,0,1,1,0,0); Layout.buildConstraints(md1,gbl,combo,gbc,0,4,1,1,0,0); Layout.buildConstraints(md1,gbl,mylist,gbc,1,4,1,1,0,0); md.getContentPane().add(md1); md1.setBorder(BorderFactory.createTitledBorder("dfdf")); a.setBorder(BorderFactory.createTitledBorder("hello madhur")); md.pack(); a.setMnemonic(KeyEvent.VK_5); a.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser a=new JFileChooser() ; a.setMultiSelectionEnabled(true); a.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); a.showOpenDialog(null); try { System.out.println(a.getSelectedFile().getCanonicalPath()); } catch(Exception ee) { ee.printStackTrace(); } //a.show(true); } }); md.setVisible(true); } } class Layout { static void buildConstraints(JPanel win,GridBagLayout gbl,Component cmp, GridBagConstraints gbc, int gx, int gy, int gw, int gh, int wx, int wy) { gbc.gridx = gx; gbc.gridy = gy; gbc.gridwidth = gw; gbc.gridheight = gh; gbc.weightx = wx; gbc.weighty = wy; gbl.setConstraints(cmp,gbc); JPanel jd=(JPanel)win; jd.add(cmp); } }
2,998
0.665777
0.636424
137
20.883211
22.648718
149
false
false
0
0
0
0
0
0
3.160584
false
false
7
c0b10add9fa260c29828da5e2a231872b3ae0d9f
18,159,121,760,856
de507b0db3ffc68db6f925fc3bc13092d21742b2
/src/api/com/skycloud/api/domain/action/ActionExistsRequest.java
f240cf7efbaf521720c30ce3ef75a8ecb01c390a
[ "Apache-2.0" ]
permissive
xiwc/jkb
https://github.com/xiwc/jkb
c6a37abb1eebbbfdbc2fb14537dfea36d44673d8
834f19247b88a867eede277e3267089d72040e65
refs/heads/master
2021-01-10T01:21:16.335000
2015-06-03T11:15:01
2015-06-03T11:15:01
36,797,511
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.skycloud.api.domain.action; import java.util.ArrayList; import java.util.List; import com.skycloud.api.domain.base.RequestBase; public class ActionExistsRequest extends RequestBase{ public ActionExistsRequest() { super("action.exists"); } private ActionExistsParams params = new ActionExistsParams(); public void setParams(ActionExistsParams params) { this.params = params; } public ActionExistsParams getParams() { return params; } public static class ActionExistsParams{ private List<String> actionid; private List<String> name; private String node; private List<String> nodeids; public void setActionid(List<String> actionid) { this.actionid = actionid; } public List<String> getActionid() { if(actionid==null){ actionid = new ArrayList<String>(); return actionid; } return actionid; } public void setName(List<String> name) { this.name = name; } public List<String> getName() { if(name==null){ name = new ArrayList<String>(); return name; } return name; } public void setNode(String node) { this.node = node; } public String getNode() { return node; } public void setNodeids(List<String> nodeids) { this.nodeids = nodeids; } public List<String> getNodeids() { if(nodeids==null){ nodeids = new ArrayList<String>(); return nodeids; } return nodeids; } } }
UTF-8
Java
1,404
java
ActionExistsRequest.java
Java
[]
null
[]
package com.skycloud.api.domain.action; import java.util.ArrayList; import java.util.List; import com.skycloud.api.domain.base.RequestBase; public class ActionExistsRequest extends RequestBase{ public ActionExistsRequest() { super("action.exists"); } private ActionExistsParams params = new ActionExistsParams(); public void setParams(ActionExistsParams params) { this.params = params; } public ActionExistsParams getParams() { return params; } public static class ActionExistsParams{ private List<String> actionid; private List<String> name; private String node; private List<String> nodeids; public void setActionid(List<String> actionid) { this.actionid = actionid; } public List<String> getActionid() { if(actionid==null){ actionid = new ArrayList<String>(); return actionid; } return actionid; } public void setName(List<String> name) { this.name = name; } public List<String> getName() { if(name==null){ name = new ArrayList<String>(); return name; } return name; } public void setNode(String node) { this.node = node; } public String getNode() { return node; } public void setNodeids(List<String> nodeids) { this.nodeids = nodeids; } public List<String> getNodeids() { if(nodeids==null){ nodeids = new ArrayList<String>(); return nodeids; } return nodeids; } } }
1,404
0.689459
0.689459
59
22.79661
16.198744
62
false
false
0
0
0
0
0
0
2.491525
false
false
7
859ba55b7eba01db6e411c24d9633096c8a031e4
32,770,600,493,876
45d91461e82e0399887f11f37dd1f429e7c119df
/modules/dbclient-plugins/tool/tool-record-editor/src/main/java/net/vpc/dbclient/plugin/tool/recordeditor/DefaultTableList.java
98b55000dde45ef5c53f10b587ec0d588c92925f
[]
no_license
thevpc/dbclient
https://github.com/thevpc/dbclient
14d51cfc4dd0f946d3f6f278a272e8b43ba1365e
942048bad8c73d82ddf4a7dd445d1c10f95d4e63
refs/heads/master
2021-01-12T16:19:14.543000
2019-11-14T19:38:04
2019-11-14T19:38:04
71,977,064
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * ==================================================================== * DBClient yet another Jdbc client tool * * DBClient is a new Open Source Tool for connecting to jdbc * compliant relational databases. Specific extensions will take care of * each RDBMS implementation. * * Copyright (C) 2006-2008 Taha BEN SALAH * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * ==================================================================== */ package net.vpc.dbclient.plugin.tool.recordeditor; import net.vpc.dbclient.api.sessionmanager.DBCResultTable; import net.vpc.dbclient.api.sessionmanager.DBCTableModel; import net.vpc.dbclient.api.sql.SQLRecord; import net.vpc.dbclient.api.sql.TypeWrapperFactory; import net.vpc.dbclient.api.sql.objects.DBTable; import net.vpc.dbclient.api.sql.objects.DBTableColumn; import net.vpc.dbclient.api.sql.util.SQLUtils; import net.vpc.dbclient.api.viewmanager.DBCTable; import net.vpc.swingext.PRSManager; import javax.swing.*; import java.awt.*; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.logging.Level; /** * @author Taha Ben Salah (taha.bensalah@gmail.com) * @creationtime 6 mai 2007 22:14:16 */ public class DefaultTableList extends JPanel { DBCTable jtable; DBTable table; RecordEditorPluginSession pluginSession; DBCResultTable tablePane; public DefaultTableList(RecordEditorPluginSession pluginSession, DBTable table) { this.pluginSession = pluginSession; this.table = table; tablePane = pluginSession.getSession().getFactory().newInstance(DBCResultTable.class); tablePane.getTableComponent().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); add(tablePane.getComponent()); PRSManager.setComponentResourceSetHolder(this, pluginSession); PRSManager.update(this, pluginSession); } public SQLRecord showDialog() { DBTableColumn[] columns = table.getColumns(); StringBuilder sb = new StringBuilder("Select "); int count = 0; for (int i = 0; i < columns.length; i++) { DBTableColumn column = columns[i]; if (column.isPk() || pluginSession.isSelector(column)) { if (count > 0) { sb.append(", "); } else { sb.append(" "); } sb.append(column.getName()); count++; } } sb.append(" From "); sb.append(table.getFullName()); try { DBCTableModel dbcTableModel = tablePane.getModel(); dbcTableModel.executeStatement(sb.toString()); int index = 0; for (int i = 0; i < columns.length; i++) { DBTableColumn column = columns[i]; if (column.isPk() || pluginSession.isSelector(column)) { dbcTableModel.setColumnName(index, pluginSession.getColumnTitle(column)); index++; } } } catch (SQLException e) { //ex = e; } tablePane.getComponent().setPreferredSize(new Dimension(500, 300)); int r = JOptionPane.showConfirmDialog(null, this, "Select Row...", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (r == JOptionPane.OK_OPTION) { int index = tablePane.getTableComponent().getSelectedRow(); index = tablePane.getTableComponent().convertRowIndexToModel(index); if (index >= 0) { SQLRecord record = tablePane.getRecord(index); sb = new StringBuilder("SELECT "); for (int i = 0; i < columns.length; i++) { DBTableColumn column = columns[i]; if (i > 0) { sb.append(", "); } sb.append(column.getName()); } sb.append(" FROM "); sb.append(table.getFullName()); sb.append(" WHERE "); count = 0; for (int i = 0; i < columns.length; i++) { DBTableColumn column = columns[i]; if (column.isPk()) { if (count > 0) { sb.append(" AND "); } sb.append(" "); sb.append(column.getName()); sb.append("=?"); count++; } } SQLRecord fullRecord = null; PreparedStatement stmt = null; ResultSet resultSet = null; try { try { stmt = pluginSession.getSession().getConnection().prepareStatement(sb.toString()); for (int i = 0; i < columns.length; i++) { DBTableColumn column = columns[i]; if (column.isPk()) { SQLUtils.saveValue(stmt, i + 1, record.get(column.getName()), column); } } resultSet = stmt.executeQuery(); fullRecord = new SQLRecord(); if (resultSet.next()) { TypeWrapperFactory twf = pluginSession.getSession().getConnection().getTypeWrapperFactory(); for (int i = 0; i < columns.length; i++) { DBTableColumn column = columns[i]; //fullRecord.put(column.getName(),SQLUtils.loadValue(resultSet,i+1,column)); fullRecord.put(column.getName(), twf.getTypeDesc(column.getSqlType()).getWrapper().getObject(resultSet, i + 1)); } } } finally { if (resultSet != null) { resultSet.close(); } if (stmt != null) { stmt.close(); } } } catch (SQLException ex) { pluginSession.getSession().getLogger(DefaultTableList.class.getName()).log(Level.SEVERE, "Internal Error", ex); } return fullRecord; } } return null; } }
UTF-8
Java
7,170
java
DefaultTableList.java
Java
[ { "context": "DBMS implementation.\n *\n * Copyright (C) 2006-2008 Taha BEN SALAH\n *\n * This program is free software; you can redi", "end": 340, "score": 0.9998416304588318, "start": 326, "tag": "NAME", "value": "Taha BEN SALAH" }, { "context": "n;\nimport java.util.logging.Level;\n\n/**\n * @author Taha Ben Salah (taha.bensalah@gmail.com)\n * @creationtime 6 mai ", "end": 1834, "score": 0.9998594522476196, "start": 1820, "tag": "NAME", "value": "Taha Ben Salah" }, { "context": "il.logging.Level;\n\n/**\n * @author Taha Ben Salah (taha.bensalah@gmail.com)\n * @creationtime 6 mai 2007 22:14:16\n */\npublic ", "end": 1859, "score": 0.9999327659606934, "start": 1836, "tag": "EMAIL", "value": "taha.bensalah@gmail.com" } ]
null
[]
/** * ==================================================================== * DBClient yet another Jdbc client tool * * DBClient is a new Open Source Tool for connecting to jdbc * compliant relational databases. Specific extensions will take care of * each RDBMS implementation. * * Copyright (C) 2006-2008 <NAME> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * ==================================================================== */ package net.vpc.dbclient.plugin.tool.recordeditor; import net.vpc.dbclient.api.sessionmanager.DBCResultTable; import net.vpc.dbclient.api.sessionmanager.DBCTableModel; import net.vpc.dbclient.api.sql.SQLRecord; import net.vpc.dbclient.api.sql.TypeWrapperFactory; import net.vpc.dbclient.api.sql.objects.DBTable; import net.vpc.dbclient.api.sql.objects.DBTableColumn; import net.vpc.dbclient.api.sql.util.SQLUtils; import net.vpc.dbclient.api.viewmanager.DBCTable; import net.vpc.swingext.PRSManager; import javax.swing.*; import java.awt.*; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.logging.Level; /** * @author <NAME> (<EMAIL>) * @creationtime 6 mai 2007 22:14:16 */ public class DefaultTableList extends JPanel { DBCTable jtable; DBTable table; RecordEditorPluginSession pluginSession; DBCResultTable tablePane; public DefaultTableList(RecordEditorPluginSession pluginSession, DBTable table) { this.pluginSession = pluginSession; this.table = table; tablePane = pluginSession.getSession().getFactory().newInstance(DBCResultTable.class); tablePane.getTableComponent().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); add(tablePane.getComponent()); PRSManager.setComponentResourceSetHolder(this, pluginSession); PRSManager.update(this, pluginSession); } public SQLRecord showDialog() { DBTableColumn[] columns = table.getColumns(); StringBuilder sb = new StringBuilder("Select "); int count = 0; for (int i = 0; i < columns.length; i++) { DBTableColumn column = columns[i]; if (column.isPk() || pluginSession.isSelector(column)) { if (count > 0) { sb.append(", "); } else { sb.append(" "); } sb.append(column.getName()); count++; } } sb.append(" From "); sb.append(table.getFullName()); try { DBCTableModel dbcTableModel = tablePane.getModel(); dbcTableModel.executeStatement(sb.toString()); int index = 0; for (int i = 0; i < columns.length; i++) { DBTableColumn column = columns[i]; if (column.isPk() || pluginSession.isSelector(column)) { dbcTableModel.setColumnName(index, pluginSession.getColumnTitle(column)); index++; } } } catch (SQLException e) { //ex = e; } tablePane.getComponent().setPreferredSize(new Dimension(500, 300)); int r = JOptionPane.showConfirmDialog(null, this, "Select Row...", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (r == JOptionPane.OK_OPTION) { int index = tablePane.getTableComponent().getSelectedRow(); index = tablePane.getTableComponent().convertRowIndexToModel(index); if (index >= 0) { SQLRecord record = tablePane.getRecord(index); sb = new StringBuilder("SELECT "); for (int i = 0; i < columns.length; i++) { DBTableColumn column = columns[i]; if (i > 0) { sb.append(", "); } sb.append(column.getName()); } sb.append(" FROM "); sb.append(table.getFullName()); sb.append(" WHERE "); count = 0; for (int i = 0; i < columns.length; i++) { DBTableColumn column = columns[i]; if (column.isPk()) { if (count > 0) { sb.append(" AND "); } sb.append(" "); sb.append(column.getName()); sb.append("=?"); count++; } } SQLRecord fullRecord = null; PreparedStatement stmt = null; ResultSet resultSet = null; try { try { stmt = pluginSession.getSession().getConnection().prepareStatement(sb.toString()); for (int i = 0; i < columns.length; i++) { DBTableColumn column = columns[i]; if (column.isPk()) { SQLUtils.saveValue(stmt, i + 1, record.get(column.getName()), column); } } resultSet = stmt.executeQuery(); fullRecord = new SQLRecord(); if (resultSet.next()) { TypeWrapperFactory twf = pluginSession.getSession().getConnection().getTypeWrapperFactory(); for (int i = 0; i < columns.length; i++) { DBTableColumn column = columns[i]; //fullRecord.put(column.getName(),SQLUtils.loadValue(resultSet,i+1,column)); fullRecord.put(column.getName(), twf.getTypeDesc(column.getSqlType()).getWrapper().getObject(resultSet, i + 1)); } } } finally { if (resultSet != null) { resultSet.close(); } if (stmt != null) { stmt.close(); } } } catch (SQLException ex) { pluginSession.getSession().getLogger(DefaultTableList.class.getName()).log(Level.SEVERE, "Internal Error", ex); } return fullRecord; } } return null; } }
7,138
0.530823
0.523431
170
41.182354
27.686411
144
false
false
0
0
0
0
70
0.019526
0.758824
false
false
7
b802cf1bdb7259a1c6116f42a3d84e8152720064
10,737,418,252,869
8ec8cba911c10fd1c6b24f1f27a93936428a9956
/src/main/java/com/cg/onlineeyeclinc/dao/TestRepositoryImpl.java
128d323693fc4d2a541b8b053629a04fb50bcb0d
[]
no_license
aktiwari/onlineeyeclinic
https://github.com/aktiwari/onlineeyeclinic
c2f28cd4a3365d2ec46e1b77b5c801fbd3d3dd0e
1aca4701c5be13cdbcb1a34da694a2d3ea83071a
refs/heads/master
2023-01-20T11:19:10.287000
2020-12-01T10:27:35
2020-12-01T10:27:35
317,502,119
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cg.onlineeyeclinc.dao; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.TypedQuery; import com.cg.onlineeyeclinc.entity.Tests; import com.cg.onlineeyeclinc.exeception.TestIdNotFoundException; public class TestRepositoryImpl implements ITestRepository{ private EntityManager entityManager; public TestRepositoryImpl() { entityManager = JPAUtil.getEntityManager(); } @Override public Tests addTest(Tests test) { entityManager.persist(test); return test; } @Override public Tests updateTest(Tests test) { Tests tests = entityManager.find(Tests.class, test.getTestId()); entityManager.merge(tests); return tests; } @Override public Tests removeTest(int testId) throws TestIdNotFoundException { Tests test = entityManager.find(Tests.class, testId); if(test == null) throw new TestIdNotFoundException("Test Not Found"); entityManager.remove(test); test = null; return test; } @Override public Tests viewTest(int testId) throws TestIdNotFoundException { Tests test = entityManager.find(Tests.class, testId); if(test == null) throw new TestIdNotFoundException("Test Not Found"); return test; } @Override public List<Tests> viewAllTests() { TypedQuery<Tests> query = entityManager.createQuery("select t from Tests t", Tests.class); List<Tests> allTests = query.getResultList(); return allTests; } @Override public void beginTransaction() { entityManager.getTransaction().begin(); } @Override public void commitTransaction() { entityManager.getTransaction().commit(); } }
UTF-8
Java
1,609
java
TestRepositoryImpl.java
Java
[]
null
[]
package com.cg.onlineeyeclinc.dao; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.TypedQuery; import com.cg.onlineeyeclinc.entity.Tests; import com.cg.onlineeyeclinc.exeception.TestIdNotFoundException; public class TestRepositoryImpl implements ITestRepository{ private EntityManager entityManager; public TestRepositoryImpl() { entityManager = JPAUtil.getEntityManager(); } @Override public Tests addTest(Tests test) { entityManager.persist(test); return test; } @Override public Tests updateTest(Tests test) { Tests tests = entityManager.find(Tests.class, test.getTestId()); entityManager.merge(tests); return tests; } @Override public Tests removeTest(int testId) throws TestIdNotFoundException { Tests test = entityManager.find(Tests.class, testId); if(test == null) throw new TestIdNotFoundException("Test Not Found"); entityManager.remove(test); test = null; return test; } @Override public Tests viewTest(int testId) throws TestIdNotFoundException { Tests test = entityManager.find(Tests.class, testId); if(test == null) throw new TestIdNotFoundException("Test Not Found"); return test; } @Override public List<Tests> viewAllTests() { TypedQuery<Tests> query = entityManager.createQuery("select t from Tests t", Tests.class); List<Tests> allTests = query.getResultList(); return allTests; } @Override public void beginTransaction() { entityManager.getTransaction().begin(); } @Override public void commitTransaction() { entityManager.getTransaction().commit(); } }
1,609
0.750777
0.750777
71
21.661972
22.556311
92
false
false
0
0
0
0
0
0
1.521127
false
false
7
66a2593f2742c7bc963302ac8f9f73c2a0b61cb2
15,187,004,398,315
6d411a8b46f1f61465d9bc59a6afa602c98dd50d
/AnnotationsPrj/src/com/genpact/training/onetomany/OneToManyTest.java
514595014ff6f5ec11fca93d7880cbc4a471e745
[]
no_license
psnirmala/SpringHibernateTraining
https://github.com/psnirmala/SpringHibernateTraining
78ab64e396f23c9b46e642229724f930e48dc90e
2415f788d95b4fd36077c4354ec3db19d2328854
refs/heads/master
2021-01-10T04:45:42.569000
2016-02-12T04:01:50
2016-02-12T04:01:50
51,128,520
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.genpact.training.onetomany; import java.util.HashSet; import java.util.Set; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; public class OneToManyTest { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Configuration configuration=new Configuration().configure(); SessionFactory factory=configuration.buildSessionFactory(); Session session=factory.openSession(); Customer customer1=new Customer(1, "Rajesh", 6000); Set<Address> set1=new HashSet<>(); set1.add(new Address(1001, "Bellandur", "Bangalore")); set1.add(new Address(1002, "Hinjewadi", "Pune")); customer1.setAddresses(set1); Customer customer2=new Customer(2, "Deva", 3000); Set<Address> set2=new HashSet<>(); set2.add(new Address(1003, "Punjakutta", "Hyderabad")); set2.add(new Address(1004, "Sector-17", "Noida")); customer2.setAddresses(set2); Transaction tx=session.beginTransaction(); session.save(customer1); session.save(customer2); tx.commit(); System.out.println("rows added"); /*Query query=session.createQuery("from Customer"); List<Customer> customers=query.list(); for(Customer customer:customers){ System.out.println(customer.getId()+"\t"+customer.getName()+"\t"+customer.getBalance()+"\t"+ customer.getAddress().getLocation()+"\t"+customer.getAddress().getCity()); } /*Query query=session.createQuery("select c.id,c.name from Customer as c"); List<Object[]> list=query.list(); for(Object[] array:list){ System.out.println(array[0]+" "+array[1]); }*/ } }
UTF-8
Java
1,668
java
OneToManyTest.java
Java
[ { "context": "enSession();\n\tCustomer customer1=new Customer(1, \"Rajesh\", 6000);\n\tSet<Address> set1=new HashSet<>();\n\tset", "end": 576, "score": 0.9997103214263916, "start": 570, "tag": "NAME", "value": "Rajesh" }, { "context": "es(set1);\n\t\n\t\tCustomer customer2=new Customer(2, \"Deva\", 3000);\n\t\tSet<Address> set2=new HashSet<>();\n\t\ts", "end": 804, "score": 0.9996348023414612, "start": 800, "tag": "NAME", "value": "Deva" } ]
null
[]
package com.genpact.training.onetomany; import java.util.HashSet; import java.util.Set; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; public class OneToManyTest { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Configuration configuration=new Configuration().configure(); SessionFactory factory=configuration.buildSessionFactory(); Session session=factory.openSession(); Customer customer1=new Customer(1, "Rajesh", 6000); Set<Address> set1=new HashSet<>(); set1.add(new Address(1001, "Bellandur", "Bangalore")); set1.add(new Address(1002, "Hinjewadi", "Pune")); customer1.setAddresses(set1); Customer customer2=new Customer(2, "Deva", 3000); Set<Address> set2=new HashSet<>(); set2.add(new Address(1003, "Punjakutta", "Hyderabad")); set2.add(new Address(1004, "Sector-17", "Noida")); customer2.setAddresses(set2); Transaction tx=session.beginTransaction(); session.save(customer1); session.save(customer2); tx.commit(); System.out.println("rows added"); /*Query query=session.createQuery("from Customer"); List<Customer> customers=query.list(); for(Customer customer:customers){ System.out.println(customer.getId()+"\t"+customer.getName()+"\t"+customer.getBalance()+"\t"+ customer.getAddress().getLocation()+"\t"+customer.getAddress().getCity()); } /*Query query=session.createQuery("select c.id,c.name from Customer as c"); List<Object[]> list=query.list(); for(Object[] array:list){ System.out.println(array[0]+" "+array[1]); }*/ } }
1,668
0.714628
0.688249
55
29.327272
23.335541
95
false
false
0
0
0
0
0
0
2.145455
false
false
7
78dd75e734bb35131fbd8659123e02e661cf3b17
429,496,741,586
ffeac00a220fd6162db3d8521d794da9fcbeecff
/demo180625-com370/src/main/java/com/example/demo/Demo180625Com370Application.java
d79c6ccc3b4a978adaa6924d03602b0c7ab412db
[]
no_license
LeeBaekHaeng/kosii2016
https://github.com/LeeBaekHaeng/kosii2016
97f60b8fa119ee41d89982f218668dbb7167d2f7
3c119507da6f3aa99e9f523e07d49c6e09042ab0
refs/heads/master
2022-12-07T01:26:01.507000
2019-07-13T00:01:24
2019-07-13T00:01:24
64,711,047
0
0
null
false
2022-12-06T00:06:06
2016-08-02T00:34:34
2019-07-13T00:01:31
2022-12-06T00:06:05
7,491
0
0
128
PLSQL
false
false
package com.example.demo; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.envers.repository.support.EnversRevisionRepositoryFactoryBean; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import com.example.demo.cmmnclcode.CmmnClCode; import com.example.demo.cmmnclcode.CmmnClCodeRepository; @SpringBootApplication @EnableJpaRepositories(repositoryFactoryBeanClass = EnversRevisionRepositoryFactoryBean.class) public class Demo180625Com370Application { public static void main(String[] args) { SpringApplication.run(Demo180625Com370Application.class, args); } // @Bean // public MappingJackson2HttpMessageConverter // mappingJackson2HttpMessageConverter() { // MappingJackson2HttpMessageConverter jsonConverter = new // MappingJackson2HttpMessageConverter(); // ObjectMapper objectMapper = new ObjectMapper(); // objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, // false); // jsonConverter.setObjectMapper(objectMapper); // return jsonConverter; // } @Bean public CommandLineRunner commandLineRunner(CmmnClCodeRepository cmmnClCodeRepository) { return (args) -> { Pageable pageable = PageRequest.of(0, 20); Page<CmmnClCode> findAll = cmmnClCodeRepository.findAll(pageable); System.out.println("findAll=" + findAll); }; } } // @RestController // class CmmnDetailCodeRestController { // // @Autowired // private CmmnDetailCodeRepo cmmnDetailCodeRepo; // // @GetMapping(path = "/cmmn-detail-codes") // public @ResponseBody Page<CmmnDetailCode> getCmmnDetailCodes(@RequestParam // String name, @RequestParam String email, // Pageable pageable) { // // // Map<String, Object> map = new HashMap<>(); // // System.out.println("name=" + name); // System.out.println("email=" + email); // // Page<CmmnDetailCode> results = cmmnDetailCodeRepo.findAll(pageable); // // for (CmmnDetailCode result : results) { // System.out.println("result=" + result); // System.out.println("result=" + result); // } // // return results; // } // // @GetMapping(path = "/v1/cmmn-detail-codes") // public @ResponseBody Iterable<CmmnDetailCode> getV1CmmnDetailCodes() { // // Iterable<CmmnDetailCode> results = cmmnDetailCodeRepo.findAll(); // // for (CmmnDetailCode result : results) { // System.out.println("result=" + result); // System.out.println("result=" + result); // } // // return results; // } // // @GetMapping(path = "/v2/cmmn-detail-codes") // public @ResponseBody Iterable<CmmnDetailCode> getV2CmmnDetailCodes() { // // List<CmmnDetailCode> results = cmmnDetailCodeRepo.findByCodeId("COM001"); // // for (CmmnDetailCode result : results) { // System.out.println("result=" + result); // System.out.println("codeId=" + result.getCodeId()); // } // // return results; // } // // } // // @SuppressWarnings("serial") // @Data // class CmmnDetailCodeId implements Serializable { // // private String codeId; // private String code; // // } // // @Entity // @Table(name = "comtccmmndetailcode") // @IdClass(CmmnDetailCodeId.class) // @Data // class CmmnDetailCode { // // @Id // private String codeId; // @Id // private String code; // // private String codeNm; // // } // // interface CmmnDetailCodeRepo extends // PagingAndSortingRepository<CmmnDetailCode, CmmnDetailCodeId> { // // List<CmmnDetailCode> findByCodeId(String codeId); // // }
UTF-8
Java
3,668
java
Demo180625Com370Application.java
Java
[]
null
[]
package com.example.demo; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.envers.repository.support.EnversRevisionRepositoryFactoryBean; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import com.example.demo.cmmnclcode.CmmnClCode; import com.example.demo.cmmnclcode.CmmnClCodeRepository; @SpringBootApplication @EnableJpaRepositories(repositoryFactoryBeanClass = EnversRevisionRepositoryFactoryBean.class) public class Demo180625Com370Application { public static void main(String[] args) { SpringApplication.run(Demo180625Com370Application.class, args); } // @Bean // public MappingJackson2HttpMessageConverter // mappingJackson2HttpMessageConverter() { // MappingJackson2HttpMessageConverter jsonConverter = new // MappingJackson2HttpMessageConverter(); // ObjectMapper objectMapper = new ObjectMapper(); // objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, // false); // jsonConverter.setObjectMapper(objectMapper); // return jsonConverter; // } @Bean public CommandLineRunner commandLineRunner(CmmnClCodeRepository cmmnClCodeRepository) { return (args) -> { Pageable pageable = PageRequest.of(0, 20); Page<CmmnClCode> findAll = cmmnClCodeRepository.findAll(pageable); System.out.println("findAll=" + findAll); }; } } // @RestController // class CmmnDetailCodeRestController { // // @Autowired // private CmmnDetailCodeRepo cmmnDetailCodeRepo; // // @GetMapping(path = "/cmmn-detail-codes") // public @ResponseBody Page<CmmnDetailCode> getCmmnDetailCodes(@RequestParam // String name, @RequestParam String email, // Pageable pageable) { // // // Map<String, Object> map = new HashMap<>(); // // System.out.println("name=" + name); // System.out.println("email=" + email); // // Page<CmmnDetailCode> results = cmmnDetailCodeRepo.findAll(pageable); // // for (CmmnDetailCode result : results) { // System.out.println("result=" + result); // System.out.println("result=" + result); // } // // return results; // } // // @GetMapping(path = "/v1/cmmn-detail-codes") // public @ResponseBody Iterable<CmmnDetailCode> getV1CmmnDetailCodes() { // // Iterable<CmmnDetailCode> results = cmmnDetailCodeRepo.findAll(); // // for (CmmnDetailCode result : results) { // System.out.println("result=" + result); // System.out.println("result=" + result); // } // // return results; // } // // @GetMapping(path = "/v2/cmmn-detail-codes") // public @ResponseBody Iterable<CmmnDetailCode> getV2CmmnDetailCodes() { // // List<CmmnDetailCode> results = cmmnDetailCodeRepo.findByCodeId("COM001"); // // for (CmmnDetailCode result : results) { // System.out.println("result=" + result); // System.out.println("codeId=" + result.getCodeId()); // } // // return results; // } // // } // // @SuppressWarnings("serial") // @Data // class CmmnDetailCodeId implements Serializable { // // private String codeId; // private String code; // // } // // @Entity // @Table(name = "comtccmmndetailcode") // @IdClass(CmmnDetailCodeId.class) // @Data // class CmmnDetailCode { // // @Id // private String codeId; // @Id // private String code; // // private String codeNm; // // } // // interface CmmnDetailCodeRepo extends // PagingAndSortingRepository<CmmnDetailCode, CmmnDetailCodeId> { // // List<CmmnDetailCode> findByCodeId(String codeId); // // }
3,668
0.744002
0.735278
134
26.373135
25.64094
94
false
false
0
0
0
0
0
0
0.61194
false
false
7
8900eacf73c167157d65811161e48f4312b678d2
29,532,195,166,890
5ea6c12897011be37db26f4eebc0d36fa8177fbd
/src/testsomething/HavingRank.java
b70778f0b946b44606e123144f369843c2bf8276
[]
no_license
dendevjv/core-java-examples
https://github.com/dendevjv/core-java-examples
ebc7fddd95133bfc6a9fa00cf2147dc8691785c1
2539374df3180fcec69075394d47bdbf1d06b0e5
refs/heads/master
2016-09-11T03:11:50
2014-09-24T20:01:44
2014-09-24T20:01:44
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package testsomething; public interface HavingRank { int rank(); int DEFAULT_SCALE = 2; }
UTF-8
Java
93
java
HavingRank.java
Java
[]
null
[]
package testsomething; public interface HavingRank { int rank(); int DEFAULT_SCALE = 2; }
93
0.731183
0.72043
6
14.5
11.086779
29
false
false
0
0
0
0
0
0
0.833333
false
false
7
077c97db757ea42f683e5aee4c3c36c9bab1d035
8,684,423,872,717
1be4474813b07b6210dd648f4efbbf67877b5b56
/GLBank/src/main/Card.java
e10363cf1312bc190cbb45805c83911e788c4ad8
[]
no_license
domiNik4/GLBank
https://github.com/domiNik4/GLBank
717f6ac0a5ab25ed453107da62691bebdef6e98f
7b7f81e66ef3d255bbf4e8b06bbf88e9e7fc4816
refs/heads/master
2021-01-18T03:40:39.338000
2017-05-29T07:35:14
2017-05-29T07:35:14
85,796,678
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 main; /** * * @author pc */ public class Card { private int idCard; private long cardNumber; private long idacc; private char blocked; private int pin; private int idc; public Card(int idCard,int idc, long cardNumber,long idacc, char blocked){ this.idCard=idCard; this.cardNumber=cardNumber; this.idacc=idacc; this.blocked=blocked; this.pin=1234; this.idc=idc; } public Card(int idCard,int idc, long cardNumber,long idacc, char blocked,int pin){ this.idCard=idCard; this.cardNumber=cardNumber; this.idacc=idacc; this.blocked=blocked; this.pin=pin; this.idc=idc; } //setters public void setIdCard(int idCard) { this.idCard = idCard; } public void setCardNumber(long cardNumber) { this.cardNumber = cardNumber; } public void setIdacc(long idacc) { this.idacc = idacc; } public void setBlocked(char blocked) { this.blocked = blocked; } public void setPin(int pin) { this.pin = pin; } //getters public int getIdCard() { return idCard; } public long getCardNumber() { return cardNumber; } public long getIdacc() { return idacc; } public char getBlocked() { return blocked; } public int getPin() { return pin; } public int getIdc() { return idc; } }
UTF-8
Java
1,710
java
Card.java
Java
[ { "context": "n the editor.\n */\npackage main;\n\n/**\n *\n * @author pc\n */\npublic class Card {\n \n private int idCa", "end": 220, "score": 0.9992210865020752, "start": 218, "tag": "USERNAME", "value": "pc" } ]
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 main; /** * * @author pc */ public class Card { private int idCard; private long cardNumber; private long idacc; private char blocked; private int pin; private int idc; public Card(int idCard,int idc, long cardNumber,long idacc, char blocked){ this.idCard=idCard; this.cardNumber=cardNumber; this.idacc=idacc; this.blocked=blocked; this.pin=1234; this.idc=idc; } public Card(int idCard,int idc, long cardNumber,long idacc, char blocked,int pin){ this.idCard=idCard; this.cardNumber=cardNumber; this.idacc=idacc; this.blocked=blocked; this.pin=pin; this.idc=idc; } //setters public void setIdCard(int idCard) { this.idCard = idCard; } public void setCardNumber(long cardNumber) { this.cardNumber = cardNumber; } public void setIdacc(long idacc) { this.idacc = idacc; } public void setBlocked(char blocked) { this.blocked = blocked; } public void setPin(int pin) { this.pin = pin; } //getters public int getIdCard() { return idCard; } public long getCardNumber() { return cardNumber; } public long getIdacc() { return idacc; } public char getBlocked() { return blocked; } public int getPin() { return pin; } public int getIdc() { return idc; } }
1,710
0.583041
0.580702
87
18.655172
17.896141
86
false
false
0
0
0
0
0
0
0.482759
false
false
7
55962864e19bca65da8764bb32abb80b41459217
12,034,498,390,304
f382dff22e5a465fd5c698426df42f7fffdb6f5e
/ChinaTutors/src/com/lulech/entity/ClassScore.java
4d08c40b18e60ce015f6f6b4918ac82cc0eb331d
[]
no_license
LulechSnarpy/Isky
https://github.com/LulechSnarpy/Isky
155e8addc2d11556409a3af3d1f24dfff8397b6f
331df294f053ed18171281f0fba7c8508caf5b2f
refs/heads/master
2021-01-01T15:48:39.132000
2018-11-27T07:18:14
2018-11-27T07:18:14
97,708,378
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lulech.entity; import com.lulech.pojo.Classes; import java.io.Serializable; import java.util.List; public class ClassScore implements Serializable{ private Classes classes; private List<OneScore> classscores; public ClassScore() { } public ClassScore(Classes classes, List<OneScore> classscores) { this.classes = classes; this.classscores = classscores; } public Classes getClasses() { return classes; } public void setClasses(Classes classes) { this.classes = classes; } public List<OneScore> getClassscores() { return classscores; } public void setClassscores(List<OneScore> classscores) { this.classscores = classscores; } }
UTF-8
Java
761
java
ClassScore.java
Java
[]
null
[]
package com.lulech.entity; import com.lulech.pojo.Classes; import java.io.Serializable; import java.util.List; public class ClassScore implements Serializable{ private Classes classes; private List<OneScore> classscores; public ClassScore() { } public ClassScore(Classes classes, List<OneScore> classscores) { this.classes = classes; this.classscores = classscores; } public Classes getClasses() { return classes; } public void setClasses(Classes classes) { this.classes = classes; } public List<OneScore> getClassscores() { return classscores; } public void setClassscores(List<OneScore> classscores) { this.classscores = classscores; } }
761
0.666229
0.666229
35
20.742857
19.09277
68
false
false
0
0
0
0
0
0
0.371429
false
false
7
c31ca7a65aa9080a8d691ab37871dd14e9972a9c
18,245,021,107,962
c60a8fb67fedcbae08755d8125d97468a8aca24d
/Projet de UML Reverse/src/main/java/fr/univrouen/umlreverse/ui/view/usecase/UsecaseDiagramEditor.java
1d9bba8459d83a5ff76783436e34919624005676
[ "Apache-2.0" ]
permissive
BelkhousNabil/Projets-Informatiques
https://github.com/BelkhousNabil/Projets-Informatiques
6be114f6a8dbcf978ef67daffb1394ee023255cf
47ffd6526bb66ae263c34725fe2b515b751127bb
refs/heads/master
2021-01-17T07:12:08.050000
2017-02-26T17:03:56
2017-02-26T17:03:56
54,788,129
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 fr.univrouen.umlreverse.ui.view.usecase; import fr.univrouen.umlreverse.ui.view.common.ADiagramEditor; import fr.univrouen.umlreverse.ui.view.common.IDiagramEditorController; import fr.univrouen.umlreverse.model.diagram.usecase.IUsecaseDiagram; public class UsecaseDiagramEditor extends ADiagramEditor { // ATTRIBUTES private final UsecaseController controller; // CONSTRUCTORS public UsecaseDiagramEditor(IUsecaseDiagram usecaseDiagram) { super(); controller = new UsecaseController(this, usecaseDiagram); } // REQUEST @Override public IDiagramEditorController getController() { return controller; } // COMMANDES /** * Create an entity via the controller. * @param x the x position of the entity * @param y the y position of the entity */ public void createUsecase(double x, double y){ controller.createUsecase(x, y); } public void createActor(double x, double y){ controller.createActor(x, y); } }
UTF-8
Java
1,225
java
UsecaseDiagramEditor.java
Java
[]
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 fr.univrouen.umlreverse.ui.view.usecase; import fr.univrouen.umlreverse.ui.view.common.ADiagramEditor; import fr.univrouen.umlreverse.ui.view.common.IDiagramEditorController; import fr.univrouen.umlreverse.model.diagram.usecase.IUsecaseDiagram; public class UsecaseDiagramEditor extends ADiagramEditor { // ATTRIBUTES private final UsecaseController controller; // CONSTRUCTORS public UsecaseDiagramEditor(IUsecaseDiagram usecaseDiagram) { super(); controller = new UsecaseController(this, usecaseDiagram); } // REQUEST @Override public IDiagramEditorController getController() { return controller; } // COMMANDES /** * Create an entity via the controller. * @param x the x position of the entity * @param y the y position of the entity */ public void createUsecase(double x, double y){ controller.createUsecase(x, y); } public void createActor(double x, double y){ controller.createActor(x, y); } }
1,225
0.707755
0.707755
43
27.488373
24.92815
79
false
false
0
0
0
0
0
0
0.418605
false
false
7
6e5fc5153668bf9c553cd3d03f1bdf58713aa5e1
31,456,340,536,040
9ae0ce89538337688876508731519a25be3f3f35
/app/src/main/java/com/mkeys/restaurantbsp/adapter/RestaurantAdapter.java
8e54a0ca2197d31e1bb191e74264719f69cea5fd
[]
no_license
hauhachoc/restaurantBSP
https://github.com/hauhachoc/restaurantBSP
1e9fac21878363a35ed59e0ac63aeaea3b02c2d9
70bfe4060b480c2c582e642db54c63ff20e75169
refs/heads/master
2021-01-19T14:40:32.729000
2017-08-24T11:13:40
2017-08-24T11:13:40
100,911,360
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mkeys.restaurantbsp.adapter; import android.os.Bundle; import android.support.v7.widget.AppCompatTextView; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import android.widget.CheckBox; import android.widget.FrameLayout; import com.chauthai.swipereveallayout.SwipeRevealLayout; import com.chauthai.swipereveallayout.ViewBinderHelper; import com.mkeys.restaurantbsp.R; import com.mkeys.restaurantbsp.models.Food; import com.mkeys.restaurantbsp.presentation.AbstractActivity; import java.util.ArrayList; import butterknife.BindView; import butterknife.ButterKnife; /** * Created by hautran on 16/08/17. */ public class RestaurantAdapter extends AbstractAdapter { public ArrayList<Food> channels; public AbstractActivity activity; public boolean isCheckMode ; private final ViewBinderHelper binderHelper = new ViewBinderHelper(); public RestaurantAdapter(AbstractActivity mActivity) { super(mActivity); channels = new ArrayList<>(); isCheckMode = false; } public void setData(ArrayList<Food> data) { this.channels = data; } public void clearData() { this.channels.clear(); notifyDataSetChanged(); } public ArrayList<Food> getData() { return channels; } public interface setChannelItemClick { public void setChannelItemClickListener(int pos); public void setChannelDeleteClickListener(int position); public void setIsChecked(Food food); } public void setChannelItemClickListener(setChannelItemClick lis) { this.listener = lis; } public setChannelItemClick listener; public void saveStates(Bundle outState) { binderHelper.saveStates(outState); } /** * Only if you need to restore open/close state when the orientation is changed. * Call this method in {@link android.app.Activity#onRestoreInstanceState(Bundle)} */ public void restoreStates(Bundle inState) { binderHelper.restoreStates(inState); } @Override protected RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { View view = mInflater.inflate(R.layout.food_item, parent, false); return new ChannelsHolder(view); } @Override protected void OnBindViewHolder(final RecyclerView.ViewHolder holder, int position) { ChannelsHolder view = (ChannelsHolder) holder; Food restaurant = channels.get(position); view.tvTitle.setText(restaurant.getName()); view.tvEmail.setText(restaurant.getAddedByUser()); view.cb.setChecked(restaurant.isCompleted()); view.content_layout.setOnClickListener(view1 -> { if (listener != null) { listener.setChannelItemClickListener(position); } }); view.cb.setOnCheckedChangeListener((compoundButton, b) -> { restaurant.setCompleted(b); }); view.cb.setOnClickListener(view1 -> { listener.setIsChecked(restaurant); }); view.delete_layout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { listener.setChannelDeleteClickListener(position); } }); } @Override protected int setItemCount() { if (channels == null || channels.size() == 0) { return 0; } return channels.size(); } @Override public int getItemCount() { return channels.size(); } @Override protected int setItemViewType(int position) { return position; } static class ChannelsHolder extends RecyclerView.ViewHolder { @BindView(R.id.tvTitle) AppCompatTextView tvTitle; @BindView(R.id.tvEmail) AppCompatTextView tvEmail; @BindView(R.id.swipe_layout) SwipeRevealLayout swipe_layout; @BindView(R.id.delete_layout) FrameLayout delete_layout; @BindView(R.id.content_layout) FrameLayout content_layout; @BindView(R.id.check_layout) FrameLayout check_layout; @BindView(R.id.cb) CheckBox cb; public ChannelsHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); } } }
UTF-8
Java
4,392
java
RestaurantAdapter.java
Java
[ { "context": "import butterknife.ButterKnife;\n\n/**\n * Created by hautran on 16/08/17.\n */\n\npublic class RestaurantAdapter ", "end": 662, "score": 0.9996278882026672, "start": 655, "tag": "USERNAME", "value": "hautran" } ]
null
[]
package com.mkeys.restaurantbsp.adapter; import android.os.Bundle; import android.support.v7.widget.AppCompatTextView; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import android.widget.CheckBox; import android.widget.FrameLayout; import com.chauthai.swipereveallayout.SwipeRevealLayout; import com.chauthai.swipereveallayout.ViewBinderHelper; import com.mkeys.restaurantbsp.R; import com.mkeys.restaurantbsp.models.Food; import com.mkeys.restaurantbsp.presentation.AbstractActivity; import java.util.ArrayList; import butterknife.BindView; import butterknife.ButterKnife; /** * Created by hautran on 16/08/17. */ public class RestaurantAdapter extends AbstractAdapter { public ArrayList<Food> channels; public AbstractActivity activity; public boolean isCheckMode ; private final ViewBinderHelper binderHelper = new ViewBinderHelper(); public RestaurantAdapter(AbstractActivity mActivity) { super(mActivity); channels = new ArrayList<>(); isCheckMode = false; } public void setData(ArrayList<Food> data) { this.channels = data; } public void clearData() { this.channels.clear(); notifyDataSetChanged(); } public ArrayList<Food> getData() { return channels; } public interface setChannelItemClick { public void setChannelItemClickListener(int pos); public void setChannelDeleteClickListener(int position); public void setIsChecked(Food food); } public void setChannelItemClickListener(setChannelItemClick lis) { this.listener = lis; } public setChannelItemClick listener; public void saveStates(Bundle outState) { binderHelper.saveStates(outState); } /** * Only if you need to restore open/close state when the orientation is changed. * Call this method in {@link android.app.Activity#onRestoreInstanceState(Bundle)} */ public void restoreStates(Bundle inState) { binderHelper.restoreStates(inState); } @Override protected RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { View view = mInflater.inflate(R.layout.food_item, parent, false); return new ChannelsHolder(view); } @Override protected void OnBindViewHolder(final RecyclerView.ViewHolder holder, int position) { ChannelsHolder view = (ChannelsHolder) holder; Food restaurant = channels.get(position); view.tvTitle.setText(restaurant.getName()); view.tvEmail.setText(restaurant.getAddedByUser()); view.cb.setChecked(restaurant.isCompleted()); view.content_layout.setOnClickListener(view1 -> { if (listener != null) { listener.setChannelItemClickListener(position); } }); view.cb.setOnCheckedChangeListener((compoundButton, b) -> { restaurant.setCompleted(b); }); view.cb.setOnClickListener(view1 -> { listener.setIsChecked(restaurant); }); view.delete_layout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { listener.setChannelDeleteClickListener(position); } }); } @Override protected int setItemCount() { if (channels == null || channels.size() == 0) { return 0; } return channels.size(); } @Override public int getItemCount() { return channels.size(); } @Override protected int setItemViewType(int position) { return position; } static class ChannelsHolder extends RecyclerView.ViewHolder { @BindView(R.id.tvTitle) AppCompatTextView tvTitle; @BindView(R.id.tvEmail) AppCompatTextView tvEmail; @BindView(R.id.swipe_layout) SwipeRevealLayout swipe_layout; @BindView(R.id.delete_layout) FrameLayout delete_layout; @BindView(R.id.content_layout) FrameLayout content_layout; @BindView(R.id.check_layout) FrameLayout check_layout; @BindView(R.id.cb) CheckBox cb; public ChannelsHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); } } }
4,392
0.664845
0.662113
161
26.279503
23.341965
90
false
false
0
0
0
0
0
0
0.434783
false
false
7
c1c8f3ff0a171e99119e76799a554aff5d941736
31,456,340,537,567
4e30bf9f89c7e0aad69cbab46baf68399a90d8c2
/src/main/java/br/com/geradodor/validador/cpf/model/Cpf.java
d7ffaa1cfa8944007c92ef80fc511a46a7528f26
[]
no_license
M4rcioOliveira/apirest-gerador-validador-cpf
https://github.com/M4rcioOliveira/apirest-gerador-validador-cpf
dfbcba09cf72a97eacb350ade85e2ec1b3057220
4e914aec03b9b7e5af8b90438ca645f9968fcc58
refs/heads/master
2023-07-13T23:26:14.617000
2021-08-16T21:57:14
2021-08-16T21:57:14
389,624,320
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.geradodor.validador.cpf.model; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Random; public class Cpf implements Serializable { private static final long serialVersionUID = 1L; private String cpf; private Boolean situacao; public Cpf(String cpf, Boolean situacao) { super(); this.cpf = cpf; this.situacao = situacao; } public String getCpf() { return cpf; } public Boolean getSituacao() { return situacao; } /* * É tipico em algumas linguagens ao adicionar um um valor númerico que inicia * com 0 a esquerda a linguagem desconsiderar,então esse método identifica * quando falta o/os 0 a esquerda e valida fazendo o complemento */ public static List<Character> verifica(String cpf) { List<Character> list = new ArrayList<Character>(); if (cpf.length() < 11) { int a = 11 - cpf.length(); for (int i = 0; i < a; i++) { list.add(i, '0'); } for (int j = 0; j < cpf.length(); j++) { list.add(a++, cpf.charAt(j)); } } else { for (int i = 0; i < cpf.length(); i++) { list.add(i, cpf.charAt(i)); } } return list; } //OBS: Esse método aceita o cpf somente sem maskara! //No end points é retornado o cpf com maskara. //Faça a validação no front para que o método receba somente os números. public static boolean validador(String cpf) { if (cpf.equals("00000000000") | cpf.equals("11111111111") | cpf.equals("22222222222") | cpf.equals("33333333333") | cpf.equals("44444444444") | cpf.equals("55555555555") | cpf.equals("66666666666") | cpf.equals("77777777777") | cpf.equals("88888888888") | cpf.equals("99999999999")) { return false; } else { List<Integer> listInt = new ArrayList<Integer>(); for (Character character : verifica(cpf)) { listInt.add(Character.getNumericValue(character)); } int acumulador1 = 0; int d1 = 10; // decremento for (int i = 0; i < 9; i++) { acumulador1 = (listInt.get(i) * d1--) + acumulador1; } int primeiroDigito = 11 - (acumulador1 % 11); if (primeiroDigito >= 10) { primeiroDigito = 0; } int acumulador2 = 0; int d2 = 11; // decremento for (int i = 0; i < 10; i++) { acumulador2 = (listInt.get(i) * d2--) + acumulador2; } int segundoDigito = 11 - (acumulador2 % 11); if (segundoDigito >= 10) { segundoDigito = 0; } if (listInt.get(9) == primeiroDigito & listInt.get(10) == segundoDigito) { return true; } else { return false; } } } public static String gerador() { List<Integer> listInt = new ArrayList<Integer>(); Random random = new Random(); for (int i = 0; i < 9; i++) { int nAleatorio = random.nextInt(9); listInt.add(nAleatorio); } int acumulador1 = 0; int d1 = 10; // decremento for (int i = 0; i < 9; i++) { acumulador1 = (listInt.get(i) * d1--) + acumulador1; } int primeiroDigito = 11 - (acumulador1 % 11); if (primeiroDigito >= 10) { primeiroDigito = 0; } listInt.add(9, primeiroDigito); int acumulador2 = 0; int d2 = 11; // decremento for (int i = 0; i < 10; i++) { acumulador2 = (listInt.get(i) * d2--) + acumulador2; } int segundoDigito = 11 - (acumulador2 % 11); if (segundoDigito >= 10) { segundoDigito = 0; } listInt.add(10, segundoDigito); String cpfGerado = ""; for (Integer i : listInt) { cpfGerado = cpfGerado + Character.forDigit(i, 10); } return cpfGerado; } }
UTF-8
Java
3,492
java
Cpf.java
Java
[]
null
[]
package br.com.geradodor.validador.cpf.model; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Random; public class Cpf implements Serializable { private static final long serialVersionUID = 1L; private String cpf; private Boolean situacao; public Cpf(String cpf, Boolean situacao) { super(); this.cpf = cpf; this.situacao = situacao; } public String getCpf() { return cpf; } public Boolean getSituacao() { return situacao; } /* * É tipico em algumas linguagens ao adicionar um um valor númerico que inicia * com 0 a esquerda a linguagem desconsiderar,então esse método identifica * quando falta o/os 0 a esquerda e valida fazendo o complemento */ public static List<Character> verifica(String cpf) { List<Character> list = new ArrayList<Character>(); if (cpf.length() < 11) { int a = 11 - cpf.length(); for (int i = 0; i < a; i++) { list.add(i, '0'); } for (int j = 0; j < cpf.length(); j++) { list.add(a++, cpf.charAt(j)); } } else { for (int i = 0; i < cpf.length(); i++) { list.add(i, cpf.charAt(i)); } } return list; } //OBS: Esse método aceita o cpf somente sem maskara! //No end points é retornado o cpf com maskara. //Faça a validação no front para que o método receba somente os números. public static boolean validador(String cpf) { if (cpf.equals("00000000000") | cpf.equals("11111111111") | cpf.equals("22222222222") | cpf.equals("33333333333") | cpf.equals("44444444444") | cpf.equals("55555555555") | cpf.equals("66666666666") | cpf.equals("77777777777") | cpf.equals("88888888888") | cpf.equals("99999999999")) { return false; } else { List<Integer> listInt = new ArrayList<Integer>(); for (Character character : verifica(cpf)) { listInt.add(Character.getNumericValue(character)); } int acumulador1 = 0; int d1 = 10; // decremento for (int i = 0; i < 9; i++) { acumulador1 = (listInt.get(i) * d1--) + acumulador1; } int primeiroDigito = 11 - (acumulador1 % 11); if (primeiroDigito >= 10) { primeiroDigito = 0; } int acumulador2 = 0; int d2 = 11; // decremento for (int i = 0; i < 10; i++) { acumulador2 = (listInt.get(i) * d2--) + acumulador2; } int segundoDigito = 11 - (acumulador2 % 11); if (segundoDigito >= 10) { segundoDigito = 0; } if (listInt.get(9) == primeiroDigito & listInt.get(10) == segundoDigito) { return true; } else { return false; } } } public static String gerador() { List<Integer> listInt = new ArrayList<Integer>(); Random random = new Random(); for (int i = 0; i < 9; i++) { int nAleatorio = random.nextInt(9); listInt.add(nAleatorio); } int acumulador1 = 0; int d1 = 10; // decremento for (int i = 0; i < 9; i++) { acumulador1 = (listInt.get(i) * d1--) + acumulador1; } int primeiroDigito = 11 - (acumulador1 % 11); if (primeiroDigito >= 10) { primeiroDigito = 0; } listInt.add(9, primeiroDigito); int acumulador2 = 0; int d2 = 11; // decremento for (int i = 0; i < 10; i++) { acumulador2 = (listInt.get(i) * d2--) + acumulador2; } int segundoDigito = 11 - (acumulador2 % 11); if (segundoDigito >= 10) { segundoDigito = 0; } listInt.add(10, segundoDigito); String cpfGerado = ""; for (Integer i : listInt) { cpfGerado = cpfGerado + Character.forDigit(i, 10); } return cpfGerado; } }
3,492
0.626257
0.567078
167
19.844311
22.080141
87
false
false
0
0
0
0
0
0
2.035928
false
false
7
cc66d6b7df5964eded5e599ca8e502223d69a261
30,348,238,968,834
b6e387d02cdfe79c1f21688b44104cedc2e61620
/LwQueues/src/test/java/lw/queues/TestOutputQueue.java
c6dd4076a38ad6626904850a436f85536502e617
[]
no_license
wadelts/LwQueues
https://github.com/wadelts/LwQueues
84d403634fde8c8947515353ec7f049231e96529
fa1b6bf54d0d4d08bc5161c52175efd93d54d01d
refs/heads/master
2021-01-20T05:31:49.614000
2013-10-08T14:29:53
2013-10-08T14:29:53
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package lw.queues; import static org.junit.Assert.*; import org.junit.BeforeClass; import org.junit.Test; /** * @author wadel * */ public class TestOutputQueue { static String testQueueName = "LWqueue004"; static String urlJMSserver = "mq://localhost:7676"; String testMessage = "Am I the same message?"; @BeforeClass public static void purgeMessages() { InputQueue inQueue = new InputQueue(); try { inQueue.open(testQueueName, urlJMSserver); } catch (GenericQueueException e) { fail("GenericQueueException encountered opening Input queue: " + e); } try { String receivedMessage = null; do { int waitInterval = 1000; // how many milliseconds to wait for a message before returning nothing (0 = block indefinitely) receivedMessage = inQueue.getNextMessage(waitInterval); inQueue.sessionCommit(); } while (receivedMessage != null); } catch (GenericQueueException e) { fail("GenericQueueException encountered getting testMessage: " + e); } catch (NoMessageFoundException e) { // Ignore, we just want to empty queue, to ensure have clean slate to start with } inQueue.close(null); } @Test public void testSendMessage() { // I placed both tests in same Test as I want them run in order. (JUnit doesn't guarantee run-order.) // Place the message on the queue put(testMessage); // Remove the message again... String receivedMessage = getMessage(); assertEquals("Message different after retrieval", testMessage, receivedMessage); } /** * @param message the message to be sent to the queue */ public void put(String message) { OutputQueue outQueue = new OutputQueue(); try { outQueue.open(testQueueName, urlJMSserver); } catch (GenericQueueException e) { fail("GenericQueueException encountered opening Output queue: " + e); } try { outQueue.sendMessage(message); } catch (GenericQueueException e) { fail("GenericQueueException encountered sending testMessage: " + e); } outQueue.close(); } /** * @return the message received */ private String getMessage() { InputQueue inQueue = new InputQueue(); String receivedMessage = null; try { inQueue.open(testQueueName, urlJMSserver); } catch (GenericQueueException e) { fail("GenericQueueException encountered opening queue: " + e); } try { int waitInterval = 1000; // how many milliseconds to wait for a message before returning nothing (0 = block indefinitely) receivedMessage = inQueue.getNextMessage(waitInterval); inQueue.sessionCommit(); } catch (GenericQueueException e) { fail("GenericQueueException encountered getting testMessage: " + e); } catch (NoMessageFoundException e) { fail("NoMessageFoundException encountered getting testMessage: " + e); } inQueue.close(null); return receivedMessage; } }
UTF-8
Java
2,955
java
TestOutputQueue.java
Java
[ { "context": "eClass;\r\nimport org.junit.Test;\r\n\r\n/**\r\n * @author wadel\r\n *\r\n */\r\npublic class TestOutputQueue {\r\n\tstatic", "end": 137, "score": 0.9880682229995728, "start": 132, "tag": "USERNAME", "value": "wadel" } ]
null
[]
package lw.queues; import static org.junit.Assert.*; import org.junit.BeforeClass; import org.junit.Test; /** * @author wadel * */ public class TestOutputQueue { static String testQueueName = "LWqueue004"; static String urlJMSserver = "mq://localhost:7676"; String testMessage = "Am I the same message?"; @BeforeClass public static void purgeMessages() { InputQueue inQueue = new InputQueue(); try { inQueue.open(testQueueName, urlJMSserver); } catch (GenericQueueException e) { fail("GenericQueueException encountered opening Input queue: " + e); } try { String receivedMessage = null; do { int waitInterval = 1000; // how many milliseconds to wait for a message before returning nothing (0 = block indefinitely) receivedMessage = inQueue.getNextMessage(waitInterval); inQueue.sessionCommit(); } while (receivedMessage != null); } catch (GenericQueueException e) { fail("GenericQueueException encountered getting testMessage: " + e); } catch (NoMessageFoundException e) { // Ignore, we just want to empty queue, to ensure have clean slate to start with } inQueue.close(null); } @Test public void testSendMessage() { // I placed both tests in same Test as I want them run in order. (JUnit doesn't guarantee run-order.) // Place the message on the queue put(testMessage); // Remove the message again... String receivedMessage = getMessage(); assertEquals("Message different after retrieval", testMessage, receivedMessage); } /** * @param message the message to be sent to the queue */ public void put(String message) { OutputQueue outQueue = new OutputQueue(); try { outQueue.open(testQueueName, urlJMSserver); } catch (GenericQueueException e) { fail("GenericQueueException encountered opening Output queue: " + e); } try { outQueue.sendMessage(message); } catch (GenericQueueException e) { fail("GenericQueueException encountered sending testMessage: " + e); } outQueue.close(); } /** * @return the message received */ private String getMessage() { InputQueue inQueue = new InputQueue(); String receivedMessage = null; try { inQueue.open(testQueueName, urlJMSserver); } catch (GenericQueueException e) { fail("GenericQueueException encountered opening queue: " + e); } try { int waitInterval = 1000; // how many milliseconds to wait for a message before returning nothing (0 = block indefinitely) receivedMessage = inQueue.getNextMessage(waitInterval); inQueue.sessionCommit(); } catch (GenericQueueException e) { fail("GenericQueueException encountered getting testMessage: " + e); } catch (NoMessageFoundException e) { fail("NoMessageFoundException encountered getting testMessage: " + e); } inQueue.close(null); return receivedMessage; } }
2,955
0.683587
0.677834
108
25.361111
27.501669
125
false
false
0
0
0
0
0
0
2.027778
false
false
7
c3dffc44fe07ef8a11788e93411f34c8d62167b5
36,318,243,464,343
8a72822866a34ba283abe8cf7797ccd065fc0b54
/Bloomberg/WordSearch.java
38b011fc348a22b0c5e6f3d45698c2b4303b52aa
[]
no_license
WenyuZhang1992/LinkCode
https://github.com/WenyuZhang1992/LinkCode
ce35cff484e4e56e09b39a1fbb29600ed7cad4c4
8d6d69d3800dac15435273fbdd377e2f180f830f
refs/heads/master
2020-04-17T05:33:26.567000
2018-01-25T14:17:52
2018-01-25T14:17:52
67,233,458
1
0
null
false
2017-12-24T04:11:31
2016-09-02T15:21:20
2017-06-27T07:52:05
2017-12-24T04:11:31
120
1
0
0
Java
false
null
/** * 79. Word Search * https://leetcode.com/problems/word-search/description/ */ class WordSearch { /** * Version 1: Use DFS * Time: O(m*n*4^k) * Space: O(k) -> length of word since at most k stacks will exist */ public boolean exist(char[][] board, String word) { if (board == null || board.length == 0 || board[0].length == 0) { return false; } for (int i = 0; i < board.length; i++) { for (int j = 0; j < board[0].length; j++) { if (board[i][j] == word.charAt(0) && search(board, i, j, word, 0)) { return true; } } } return false; } private boolean search(char[][] board, int i, int j, String word, int index) { if (index == word.length()) { return true; } if (i < 0 || j < 0 || i >= board.length || j >= board[0].length || board[i][j] != word.charAt(index)) { return false; } board[i][j] = '&'; boolean result = search(board, i + 1, j, word, index + 1) || search(board, i - 1, j, word, index + 1) || search(board, i, j + 1, word, index + 1) || search(board, i, j - 1, word, index + 1); board[i][j] = word.charAt(index); return result; } }
UTF-8
Java
1,134
java
WordSearch.java
Java
[]
null
[]
/** * 79. Word Search * https://leetcode.com/problems/word-search/description/ */ class WordSearch { /** * Version 1: Use DFS * Time: O(m*n*4^k) * Space: O(k) -> length of word since at most k stacks will exist */ public boolean exist(char[][] board, String word) { if (board == null || board.length == 0 || board[0].length == 0) { return false; } for (int i = 0; i < board.length; i++) { for (int j = 0; j < board[0].length; j++) { if (board[i][j] == word.charAt(0) && search(board, i, j, word, 0)) { return true; } } } return false; } private boolean search(char[][] board, int i, int j, String word, int index) { if (index == word.length()) { return true; } if (i < 0 || j < 0 || i >= board.length || j >= board[0].length || board[i][j] != word.charAt(index)) { return false; } board[i][j] = '&'; boolean result = search(board, i + 1, j, word, index + 1) || search(board, i - 1, j, word, index + 1) || search(board, i, j + 1, word, index + 1) || search(board, i, j - 1, word, index + 1); board[i][j] = word.charAt(index); return result; } }
1,134
0.549383
0.529101
42
26.023809
30.49394
106
false
false
0
0
0
0
0
0
3.047619
false
false
7
0fb336c1b37c7a609ba616032e9792c014c36adb
30,382,598,679,026
5daea3805c30cc63a24266dbd728da8e7df110a0
/src/main/java/com/javacreed/api/sql/query/JoinTable.java
10638049a9037d5f905e47045f60e714626b85c0
[]
no_license
javacreed/sql-query-8
https://github.com/javacreed/sql-query-8
a8b662b6877de5b821da42ca69021044a0512f5b
ea93c056f41cebb4040882d1445753bc4971437d
refs/heads/master
2021-01-22T06:12:19.120000
2017-10-02T21:42:26
2017-10-02T21:42:26
81,746,839
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.javacreed.api.sql.query; public class JoinTable extends AbstractJoin { private final Table table; public JoinTable(final JoinType type, final String name) { this(type, new Table(name)); } public JoinTable(final JoinType type, final String name, final String alias) { this(type, new Table(name, alias)); } public JoinTable(final JoinType type, final Table table) { super(type); this.table = table; } public String getTableAlias() { return Table.getTableAlias(table); } public String getTableName() { return Table.getTableName(table); } public String getTableSchema() { return Table.getTableSchema(table); } @Override public QueryBuilder toSql(final QueryBuilder builder) { return builder.sql(" ").append(type).sql(" JOIN ").append(table).append(condition); } }
UTF-8
Java
881
java
JoinTable.java
Java
[]
null
[]
package com.javacreed.api.sql.query; public class JoinTable extends AbstractJoin { private final Table table; public JoinTable(final JoinType type, final String name) { this(type, new Table(name)); } public JoinTable(final JoinType type, final String name, final String alias) { this(type, new Table(name, alias)); } public JoinTable(final JoinType type, final Table table) { super(type); this.table = table; } public String getTableAlias() { return Table.getTableAlias(table); } public String getTableName() { return Table.getTableName(table); } public String getTableSchema() { return Table.getTableSchema(table); } @Override public QueryBuilder toSql(final QueryBuilder builder) { return builder.sql(" ").append(type).sql(" JOIN ").append(table).append(condition); } }
881
0.671964
0.671964
36
22.472221
24.415939
87
false
false
0
0
0
0
0
0
0.472222
false
false
7
0d00e3c0306d156b380dff8c00ac65ca5b681b11
7,799,660,678,318
7e11469ca5430a5bcdbfcde109ceb2d85bdf9b75
/MainApp/src/org/madprod/freeboxmobile/guide/GuideDetailsActivity.java
ee03c997fade75b91520858019f2c84b739a3360
[]
no_license
google-code-export/freeboxmobile
https://github.com/google-code-export/freeboxmobile
fa160b97aed852ad1f9270129ca199f20149865b
bd1e5ecaaf583d32bcaceda08bb4b6f20d0ef81e
refs/heads/master
2016-09-05T12:29:13.642000
2013-09-05T08:38:15
2013-09-05T08:38:15
32,133,370
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.madprod.freeboxmobile.guide; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import org.madprod.freeboxmobile.FBMNetTask; import org.madprod.freeboxmobile.R; import org.madprod.freeboxmobile.pvr.ChainesDbAdapter; import org.madprod.freeboxmobile.pvr.ProgrammationActivity; import static org.madprod.freeboxmobile.StaticConstants.TAG; import com.google.android.apps.analytics.GoogleAnalyticsTracker; import android.app.Activity; import android.app.AlertDialog; import android.app.SearchManager; import android.content.DialogInterface; import android.content.Intent; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.util.Log; import android.view.View; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; /** * * @author Olivier Rosello * $Id$ * */ public class GuideDetailsActivity extends Activity implements GuideConstants { GoogleAnalyticsTracker tracker; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); tracker = GoogleAnalyticsTracker.getInstance(); tracker.start(ANALYTICS_MAIN_TRACKER, 20, this); tracker.trackPageView("Guide/GuideDetails"); FBMNetTask.register(this); Log.i(TAG,"GUIDEDETAILS CREATE"); setContentView(R.layout.guide_details); final Bundle extras = getIntent().getExtras(); if (extras != null) { final TextView titreEmission = (TextView) findViewById(R.id.GuideDetailsTitre); final TextView dateHeureEmission = (TextView) findViewById(R.id.GuideDetailsDateHeure); TextView dureeEmission = (TextView) findViewById(R.id.GuideDetailsDuree); TextView descEmission = (TextView) findViewById(R.id.GuideDetailsDesc); TextView nomChaine = (TextView) findViewById(R.id.GuideDetailsNomChaine); final ImageButton partager = (ImageButton) findViewById(R.id.GuideDetailsButtonPartager); ImageButton enregistrer = (ImageButton) findViewById(R.id.GuideDetailsButtonEnregistrer); ImageButton regarder = (ImageButton) findViewById(R.id.GuideDetailsButtonRegarder); ImageView logoChaine = (ImageView) findViewById(R.id.GuideDetailsLogoChaine); ImageButton youTube = (ImageButton) findViewById(R.id.GuideDetailsYouTube); ImageButton alloCine = (ImageButton) findViewById(R.id.GuideDetailsAlloCine); titreEmission.setText(extras.getString(ChainesDbAdapter.KEY_PROG_TITLE)); descEmission.setText(extras.getString(ChainesDbAdapter.KEY_PROG_RESUM_L)); Integer duree = extras.getInt(ChainesDbAdapter.KEY_PROG_DUREE); dureeEmission.setText("Durée : "+(duree.toString())+" minute"+(duree > 1 ? "s":"")); String dt = extras.getString(ChainesDbAdapter.KEY_PROG_DATETIME_DEB); String date[] = dt.split(" "); String amj[] = date[0].split("-"); String hm[] = date[1].split(":"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Calendar c = Calendar.getInstance(); try { c.setTime(sdf.parse(date[0])); c.setFirstDayOfWeek(Calendar.MONDAY); String cdate = jours[c.get(Calendar.DAY_OF_WEEK)].toLowerCase()+" "; cdate += amj[2].length() == 1 ? "0" : ""; cdate += amj[2]; cdate += " "+mois[c.get(Calendar.MONTH)]; cdate += " "+amj[0]; cdate += " à "+hm[0]+"h"+hm[1]; dateHeureEmission.setText("Diffusé le "+cdate); } catch (ParseException e) { e.printStackTrace(); dateHeureEmission.setText("Diffusé le "+amj[2]+"/"+amj[1]+"/"+amj[0]+" à "+hm[0]+"h"+hm[1]); } youTube.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View arg0) { tracker.trackPageView("Guide/YouTube"); searchFilm( "com.google.android.youtube", null, (String) titreEmission.getText(), "http://m.youtube.com/results?search_query="+titreEmission.getText()+"&aq=f"); } } ); alloCine.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View arg0) { tracker.trackPageView("Guide/AlloCine"); // Si le programme est un film on peut chercher via l'appli AlloCiné, sinon on cherche via le site if (extras.getInt(ChainesDbAdapter.KEY_PROG_GENRE_ID) == 1) { searchFilm( "com.allocine.androidapp", ".activities.SearchActivity", (String) titreEmission.getText(), "http://mobile.allocine.fr/recherche/default.html?motcle="+titreEmission.getText()); } else { searchFilm( null, null, (String) titreEmission.getText(), "http://mobile.allocine.fr/recherche/default.html?motcle="+titreEmission.getText()); } } } ); partager.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View arg0) { String text = titreEmission.getText()+"\n"+dateHeureEmission.getText()+ " sur "+extras.getString(ChainesDbAdapter.KEY_GUIDECHAINE_NAME)+ "\n\n"+"Partagé par FreeboxMobile pour Android."; Intent i = new Intent(Intent.ACTION_SEND) .putExtra(Intent.EXTRA_TEXT, text).setType("text/plain") .putExtra(Intent.EXTRA_SUBJECT, "ProgrammeTV partagé par FreeboxMobile") // .addCategory(Intent.CATEGORY_DEFAULT) ; tracker.trackPageView("Guide/Share"); startActivityForResult(Intent.createChooser(i, "Partagez ce programme avec"),0); } } ); sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { Date dfin = sdf.parse(extras.getString(ChainesDbAdapter.KEY_PROG_DATETIME_FIN)); if (dfin.before(new Date())) { enregistrer.setFocusable(false); enregistrer.setClickable(false); } else { enregistrer.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View arg0) { proposerFin(extras); } } ); } } catch (ParseException e) { Log.e(TAG,"GUIDEDETAILSACTIVITY : pb parse date "+e.getMessage()); e.printStackTrace(); } nomChaine.setText(extras.getString(ChainesDbAdapter.KEY_GUIDECHAINE_NAME)+" (canal "+ ((Integer)extras.getInt(ChainesDbAdapter.KEY_GUIDECHAINE_CANAL)).toString()+")"); // regarder.setText("Regarder "/*+extras.getString(ChainesDbAdapter.KEY_GUIDECHAINE_NAME)*/); String filepath = Environment.getExternalStorageDirectory().toString()+DIR_FBM+DIR_CHAINES+extras.getString(ChainesDbAdapter.KEY_GUIDECHAINE_IMAGE); Bitmap bmp = BitmapFactory.decodeFile(filepath); if (bmp != null) { logoChaine.setImageBitmap(bmp); } else { logoChaine.setVisibility(View.GONE); } } else { Log.d(TAG,"GUIDEDETAILS ouvert sans données"); } setTitle(getString(R.string.app_name)+" - Détails du programme"); } @Override protected void onDestroy() { tracker.stop(); FBMNetTask.unregister(this); super.onDestroy(); } private void searchFilm(final String packageName, final String className, String query, String alternateURL) { if (packageName != null) { Intent i = new Intent("android.intent.action.SEARCH"); if (className == null) { i.setPackage(packageName); } else { i.setClassName(packageName, packageName+className); } i.putExtra(SearchManager.QUERY, query); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); try { startActivity(i); } catch (Exception e) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(alternateURL))); Log.e(TAG, e.getMessage()); } } else { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(alternateURL))); } } private void proposerFin(final Bundle extras) { AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle("Enregistrer"); alertDialog.setIcon(R.drawable.fm_magnetoscope); alertDialog.setMessage("Enregistrer plusieurs programmes à la suite ?"); alertDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "Non", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent i = new Intent(GuideDetailsActivity.this, ProgrammationActivity.class); i.putExtras(extras); startActivity(i); dialog.dismiss(); } }); alertDialog.setButton(DialogInterface.BUTTON_POSITIVE,"Oui", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { CharSequence[] iTitle = new CharSequence[PVR_MAX_PROGS]; final CharSequence[] iEnd = new CharSequence[PVR_MAX_PROGS]; int i = 0; String workString; ChainesDbAdapter mDbHelper = new ChainesDbAdapter(GuideDetailsActivity.this); mDbHelper.openRead(); Cursor c = mDbHelper.getNextProgs(extras.getInt(ChainesDbAdapter.KEY_PROG_CHANNEL_ID), extras.getString(ChainesDbAdapter.KEY_PROG_DATETIME_DEB), 5); if (c != null) { if (c.moveToFirst()) { do { workString = c.getString(c.getColumnIndexOrThrow(ChainesDbAdapter.KEY_PROG_DATETIME_DEB)).substring(11,16); iTitle[i] = workString+" "+c.getString(c.getColumnIndexOrThrow(ChainesDbAdapter.KEY_PROG_TITLE)); iEnd[i++] = c.getString(c.getColumnIndexOrThrow(ChainesDbAdapter.KEY_PROG_DATETIME_FIN)); } while (c.moveToNext()); } c.close(); } mDbHelper.close(); AlertDialog.Builder builder = new AlertDialog.Builder(GuideDetailsActivity.this); builder.setTitle("Sélectionnez le dernier programme à enregistrer :"); builder.setIcon(R.drawable.fm_magnetoscope); builder.setItems(iTitle, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { Intent i = new Intent(GuideDetailsActivity.this, ProgrammationActivity.class); i.putExtras(extras); i.putExtra(ChainesDbAdapter.KEY_PROG_TITLE, i.getStringExtra(ChainesDbAdapter.KEY_PROG_TITLE)+" et +"); i.putExtra(ChainesDbAdapter.KEY_PROG_DATETIME_FIN, iEnd[item]); startActivity(i); } }); builder.create().show(); } }); alertDialog.show(); } }
UTF-8
Java
11,067
java
GuideDetailsActivity.java
Java
[ { "context": ";\nimport android.widget.TextView;\n\n/**\n*\n* @author Olivier Rosello\n* $Id$\n* \n*/\n\npublic class GuideDetailsActivity e", "end": 1019, "score": 0.9998732209205627, "start": 1004, "tag": "NAME", "value": "Olivier Rosello" } ]
null
[]
package org.madprod.freeboxmobile.guide; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import org.madprod.freeboxmobile.FBMNetTask; import org.madprod.freeboxmobile.R; import org.madprod.freeboxmobile.pvr.ChainesDbAdapter; import org.madprod.freeboxmobile.pvr.ProgrammationActivity; import static org.madprod.freeboxmobile.StaticConstants.TAG; import com.google.android.apps.analytics.GoogleAnalyticsTracker; import android.app.Activity; import android.app.AlertDialog; import android.app.SearchManager; import android.content.DialogInterface; import android.content.Intent; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.util.Log; import android.view.View; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; /** * * @author <NAME> * $Id$ * */ public class GuideDetailsActivity extends Activity implements GuideConstants { GoogleAnalyticsTracker tracker; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); tracker = GoogleAnalyticsTracker.getInstance(); tracker.start(ANALYTICS_MAIN_TRACKER, 20, this); tracker.trackPageView("Guide/GuideDetails"); FBMNetTask.register(this); Log.i(TAG,"GUIDEDETAILS CREATE"); setContentView(R.layout.guide_details); final Bundle extras = getIntent().getExtras(); if (extras != null) { final TextView titreEmission = (TextView) findViewById(R.id.GuideDetailsTitre); final TextView dateHeureEmission = (TextView) findViewById(R.id.GuideDetailsDateHeure); TextView dureeEmission = (TextView) findViewById(R.id.GuideDetailsDuree); TextView descEmission = (TextView) findViewById(R.id.GuideDetailsDesc); TextView nomChaine = (TextView) findViewById(R.id.GuideDetailsNomChaine); final ImageButton partager = (ImageButton) findViewById(R.id.GuideDetailsButtonPartager); ImageButton enregistrer = (ImageButton) findViewById(R.id.GuideDetailsButtonEnregistrer); ImageButton regarder = (ImageButton) findViewById(R.id.GuideDetailsButtonRegarder); ImageView logoChaine = (ImageView) findViewById(R.id.GuideDetailsLogoChaine); ImageButton youTube = (ImageButton) findViewById(R.id.GuideDetailsYouTube); ImageButton alloCine = (ImageButton) findViewById(R.id.GuideDetailsAlloCine); titreEmission.setText(extras.getString(ChainesDbAdapter.KEY_PROG_TITLE)); descEmission.setText(extras.getString(ChainesDbAdapter.KEY_PROG_RESUM_L)); Integer duree = extras.getInt(ChainesDbAdapter.KEY_PROG_DUREE); dureeEmission.setText("Durée : "+(duree.toString())+" minute"+(duree > 1 ? "s":"")); String dt = extras.getString(ChainesDbAdapter.KEY_PROG_DATETIME_DEB); String date[] = dt.split(" "); String amj[] = date[0].split("-"); String hm[] = date[1].split(":"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Calendar c = Calendar.getInstance(); try { c.setTime(sdf.parse(date[0])); c.setFirstDayOfWeek(Calendar.MONDAY); String cdate = jours[c.get(Calendar.DAY_OF_WEEK)].toLowerCase()+" "; cdate += amj[2].length() == 1 ? "0" : ""; cdate += amj[2]; cdate += " "+mois[c.get(Calendar.MONTH)]; cdate += " "+amj[0]; cdate += " à "+hm[0]+"h"+hm[1]; dateHeureEmission.setText("Diffusé le "+cdate); } catch (ParseException e) { e.printStackTrace(); dateHeureEmission.setText("Diffusé le "+amj[2]+"/"+amj[1]+"/"+amj[0]+" à "+hm[0]+"h"+hm[1]); } youTube.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View arg0) { tracker.trackPageView("Guide/YouTube"); searchFilm( "com.google.android.youtube", null, (String) titreEmission.getText(), "http://m.youtube.com/results?search_query="+titreEmission.getText()+"&aq=f"); } } ); alloCine.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View arg0) { tracker.trackPageView("Guide/AlloCine"); // Si le programme est un film on peut chercher via l'appli AlloCiné, sinon on cherche via le site if (extras.getInt(ChainesDbAdapter.KEY_PROG_GENRE_ID) == 1) { searchFilm( "com.allocine.androidapp", ".activities.SearchActivity", (String) titreEmission.getText(), "http://mobile.allocine.fr/recherche/default.html?motcle="+titreEmission.getText()); } else { searchFilm( null, null, (String) titreEmission.getText(), "http://mobile.allocine.fr/recherche/default.html?motcle="+titreEmission.getText()); } } } ); partager.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View arg0) { String text = titreEmission.getText()+"\n"+dateHeureEmission.getText()+ " sur "+extras.getString(ChainesDbAdapter.KEY_GUIDECHAINE_NAME)+ "\n\n"+"Partagé par FreeboxMobile pour Android."; Intent i = new Intent(Intent.ACTION_SEND) .putExtra(Intent.EXTRA_TEXT, text).setType("text/plain") .putExtra(Intent.EXTRA_SUBJECT, "ProgrammeTV partagé par FreeboxMobile") // .addCategory(Intent.CATEGORY_DEFAULT) ; tracker.trackPageView("Guide/Share"); startActivityForResult(Intent.createChooser(i, "Partagez ce programme avec"),0); } } ); sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { Date dfin = sdf.parse(extras.getString(ChainesDbAdapter.KEY_PROG_DATETIME_FIN)); if (dfin.before(new Date())) { enregistrer.setFocusable(false); enregistrer.setClickable(false); } else { enregistrer.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View arg0) { proposerFin(extras); } } ); } } catch (ParseException e) { Log.e(TAG,"GUIDEDETAILSACTIVITY : pb parse date "+e.getMessage()); e.printStackTrace(); } nomChaine.setText(extras.getString(ChainesDbAdapter.KEY_GUIDECHAINE_NAME)+" (canal "+ ((Integer)extras.getInt(ChainesDbAdapter.KEY_GUIDECHAINE_CANAL)).toString()+")"); // regarder.setText("Regarder "/*+extras.getString(ChainesDbAdapter.KEY_GUIDECHAINE_NAME)*/); String filepath = Environment.getExternalStorageDirectory().toString()+DIR_FBM+DIR_CHAINES+extras.getString(ChainesDbAdapter.KEY_GUIDECHAINE_IMAGE); Bitmap bmp = BitmapFactory.decodeFile(filepath); if (bmp != null) { logoChaine.setImageBitmap(bmp); } else { logoChaine.setVisibility(View.GONE); } } else { Log.d(TAG,"GUIDEDETAILS ouvert sans données"); } setTitle(getString(R.string.app_name)+" - Détails du programme"); } @Override protected void onDestroy() { tracker.stop(); FBMNetTask.unregister(this); super.onDestroy(); } private void searchFilm(final String packageName, final String className, String query, String alternateURL) { if (packageName != null) { Intent i = new Intent("android.intent.action.SEARCH"); if (className == null) { i.setPackage(packageName); } else { i.setClassName(packageName, packageName+className); } i.putExtra(SearchManager.QUERY, query); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); try { startActivity(i); } catch (Exception e) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(alternateURL))); Log.e(TAG, e.getMessage()); } } else { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(alternateURL))); } } private void proposerFin(final Bundle extras) { AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle("Enregistrer"); alertDialog.setIcon(R.drawable.fm_magnetoscope); alertDialog.setMessage("Enregistrer plusieurs programmes à la suite ?"); alertDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "Non", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent i = new Intent(GuideDetailsActivity.this, ProgrammationActivity.class); i.putExtras(extras); startActivity(i); dialog.dismiss(); } }); alertDialog.setButton(DialogInterface.BUTTON_POSITIVE,"Oui", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { CharSequence[] iTitle = new CharSequence[PVR_MAX_PROGS]; final CharSequence[] iEnd = new CharSequence[PVR_MAX_PROGS]; int i = 0; String workString; ChainesDbAdapter mDbHelper = new ChainesDbAdapter(GuideDetailsActivity.this); mDbHelper.openRead(); Cursor c = mDbHelper.getNextProgs(extras.getInt(ChainesDbAdapter.KEY_PROG_CHANNEL_ID), extras.getString(ChainesDbAdapter.KEY_PROG_DATETIME_DEB), 5); if (c != null) { if (c.moveToFirst()) { do { workString = c.getString(c.getColumnIndexOrThrow(ChainesDbAdapter.KEY_PROG_DATETIME_DEB)).substring(11,16); iTitle[i] = workString+" "+c.getString(c.getColumnIndexOrThrow(ChainesDbAdapter.KEY_PROG_TITLE)); iEnd[i++] = c.getString(c.getColumnIndexOrThrow(ChainesDbAdapter.KEY_PROG_DATETIME_FIN)); } while (c.moveToNext()); } c.close(); } mDbHelper.close(); AlertDialog.Builder builder = new AlertDialog.Builder(GuideDetailsActivity.this); builder.setTitle("Sélectionnez le dernier programme à enregistrer :"); builder.setIcon(R.drawable.fm_magnetoscope); builder.setItems(iTitle, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { Intent i = new Intent(GuideDetailsActivity.this, ProgrammationActivity.class); i.putExtras(extras); i.putExtra(ChainesDbAdapter.KEY_PROG_TITLE, i.getStringExtra(ChainesDbAdapter.KEY_PROG_TITLE)+" et +"); i.putExtra(ChainesDbAdapter.KEY_PROG_DATETIME_FIN, iEnd[item]); startActivity(i); } }); builder.create().show(); } }); alertDialog.show(); } }
11,058
0.646734
0.64402
318
33.761005
30.981321
157
false
false
0
0
0
0
0
0
3.367924
false
false
7
604c67042d3f059eefeed9388e470711140f44d7
34,170,759,829,109
c960d96aeca661dd0adb5be6685bf0232c471ffa
/src/com/coupang/Main.java
5607d0537c3a50e1bb8e39366320fcaaa5d9b0dc
[]
no_license
wookkar/binfactory
https://github.com/wookkar/binfactory
ea68758325a4f0a3c32ad47264b7bb1693a9bab8
ca8f8b41242423fcf70dc0a41c4fc700f1dd1224
refs/heads/master
2020-04-05T23:29:46.316000
2014-12-22T00:38:12
2014-12-22T00:38:12
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.coupang; import com.coupang.beanfactory.*; import com.coupang.beans.*; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub //String configurationPath = "/com/coupang/c4/step16/"; BeanDefinitionLoader beanDefinitionLoader = new XmlFileBeanDefinitionLoader("/com/coupang/bean-definitions.xml"); //BeanDefinitionLoader beanDefinitionLoader = new PropertyFileBeanDefinitionLoader("/com/coupang/bean-definitions.properties"); BeanFactory beanFactory = new DefaultBeanFactory(beanDefinitionLoader.getBeanDefinitions()); Sample1 instance = beanFactory.getInstance(Sample1.class); System.out.println(instance != null); Sample1 instance1 = (Sample1)beanFactory.getInstance("sample1"); System.out.println(instance1 != null); System.out.println(instance1 == instance); /* DefaultBeanFactory defaultBeanFactory = DefaultBeanFactory.createScopedBeanBeanFactory( configurationPath + "bean-definitions.properties", configurationPath + "bean-definitions2.xml"); Sample1 instance = defaultBeanFactory.getInstance(Sample1.class); System.out.println(instance != null); Object instance2 = defaultBeanFactory.getInstance("sample2"); System.out.println(instance2 != null); System.out.println(Sample2.class.isAssignableFrom(instance2.getClass())); System.out.println(instance2 instanceof Sample2); */ } }
UTF-8
Java
1,442
java
Main.java
Java
[]
null
[]
package com.coupang; import com.coupang.beanfactory.*; import com.coupang.beans.*; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub //String configurationPath = "/com/coupang/c4/step16/"; BeanDefinitionLoader beanDefinitionLoader = new XmlFileBeanDefinitionLoader("/com/coupang/bean-definitions.xml"); //BeanDefinitionLoader beanDefinitionLoader = new PropertyFileBeanDefinitionLoader("/com/coupang/bean-definitions.properties"); BeanFactory beanFactory = new DefaultBeanFactory(beanDefinitionLoader.getBeanDefinitions()); Sample1 instance = beanFactory.getInstance(Sample1.class); System.out.println(instance != null); Sample1 instance1 = (Sample1)beanFactory.getInstance("sample1"); System.out.println(instance1 != null); System.out.println(instance1 == instance); /* DefaultBeanFactory defaultBeanFactory = DefaultBeanFactory.createScopedBeanBeanFactory( configurationPath + "bean-definitions.properties", configurationPath + "bean-definitions2.xml"); Sample1 instance = defaultBeanFactory.getInstance(Sample1.class); System.out.println(instance != null); Object instance2 = defaultBeanFactory.getInstance("sample2"); System.out.println(instance2 != null); System.out.println(Sample2.class.isAssignableFrom(instance2.getClass())); System.out.println(instance2 instanceof Sample2); */ } }
1,442
0.751734
0.737171
36
38.055557
34.145882
130
false
false
0
0
0
0
0
0
2.166667
false
false
7
5b1813392a0243381676f5d9732d6c120dc80bc4
6,330,781,856,509
c4e546da8725d9cd24322786a8e181c92a390cb1
/scaffold-route/scaffold-route-app/src/main/java/com/cms/scaffold/route/app/entity/req/user/UserSendMessageCodeReq.java
fdf68b7582d962a785fa7cf93f67ae539d3f6612
[]
no_license
Sylvia-m/scaffold
https://github.com/Sylvia-m/scaffold
c5e38affc31165438c4295016184c3dd01fcec9d
da941c7bf945f4ed9d6f99a20ac098527500d2d5
refs/heads/master
2020-12-04T20:27:51.226000
2020-01-05T10:18:37
2020-01-05T10:18:37
231,894,460
1
0
null
true
2020-01-05T09:25:02
2020-01-05T09:25:01
2019-12-03T02:44:14
2019-07-29T15:36:23
9,790
0
0
0
null
false
false
package com.cms.scaffold.route.app.entity.req.user; import lombok.Getter; import lombok.Setter; /** * @author JHX * @date 2018/11/22 14:39 */ @Getter @Setter public class UserSendMessageCodeReq { private String mobilePhone; /** * 1 登录验证码 2 更改密码验证码 */ private String type; }
UTF-8
Java
325
java
UserSendMessageCodeReq.java
Java
[ { "context": "mbok.Getter;\nimport lombok.Setter;\n\n/**\n * @author JHX\n * @date 2018/11/22 14:39\n */\n@Getter\n@Setter\npub", "end": 116, "score": 0.9996865391731262, "start": 113, "tag": "USERNAME", "value": "JHX" } ]
null
[]
package com.cms.scaffold.route.app.entity.req.user; import lombok.Getter; import lombok.Setter; /** * @author JHX * @date 2018/11/22 14:39 */ @Getter @Setter public class UserSendMessageCodeReq { private String mobilePhone; /** * 1 登录验证码 2 更改密码验证码 */ private String type; }
325
0.674419
0.627907
18
15.722222
14.046769
51
false
false
0
0
0
0
0
0
0.277778
false
false
7
8ed31c63c32bf6215443fe2a4c73fe1f0f9b048d
35,820,027,258,953
4708b90f1492b6796712fa430a4eb58788c1cf42
/NetBeansProjects/CS/CSWebClient/src/java/ru/ntik/cs/webclient/Controller.java
08094cfd168d84350d569ee97efd750bf3a24972
[]
no_license
IgorDolgo/Nauka
https://github.com/IgorDolgo/Nauka
3897f055e056df29f53b58b3dd353f1b31a32e2a
34228355430ea1eb971877b4ab54a52372611ba6
refs/heads/master
2016-09-14T02:28:17.931000
2016-04-15T09:30:09
2016-04-15T09:30:09
56,043,790
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 ru.ntik.cs.webclient; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.sql.ResultSet; import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.activation.MimetypesFileTypeMap; import javax.annotation.PostConstruct; import javax.ejb.EJB; import javax.ejb.EJBException; import javax.faces.application.FacesMessage; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.convert.Converter; import javax.faces.model.SelectItem; import org.primefaces.event.NodeCollapseEvent; import org.primefaces.event.NodeExpandEvent; import org.primefaces.event.NodeSelectEvent; import org.primefaces.event.NodeUnselectEvent; import org.primefaces.model.DefaultStreamedContent; import org.primefaces.model.DefaultTreeNode; import org.primefaces.model.StreamedContent; import org.primefaces.model.TreeNode; import ru.ntik.cs.entities.Acl; import ru.ntik.cs.entities.Action; import ru.ntik.cs.entities.Attribute; import ru.ntik.cs.entities.AttributeParams; import ru.ntik.cs.entities.AuthType; import ru.ntik.cs.entities.BaseObject; import ru.ntik.cs.entities.Content; import ru.ntik.cs.entities.Folder; import ru.ntik.cs.entities.Identity; import ru.ntik.cs.entities.IndexQueue; import ru.ntik.cs.entities.Lifecycle; import ru.ntik.cs.entities.Notification; import ru.ntik.cs.entities.ObjectType; import ru.ntik.cs.entities.Permission; import ru.ntik.cs.entities.PersistentObject; import ru.ntik.cs.entities.Right; import ru.ntik.cs.entities.Storage; import ru.ntik.cs.interfaces.remote.ConfProviderRemote; import ru.ntik.cs.entities.CSUser; import ru.ntik.cs.entities.FolderedObject; import ru.ntik.cs.entities.Version; import ru.ntik.cs.entities.VersionedObject; import ru.ntik.cs.exceptions.CSException; import ru.ntik.cs.interfaces.csdml.QueryExecutorResult; import ru.ntik.cs.interfaces.remote.AclRemote; import ru.ntik.cs.interfaces.remote.ActionRemote; import ru.ntik.cs.interfaces.remote.AttributeParamsRemote; import ru.ntik.cs.interfaces.remote.BaseObjectRemote; import ru.ntik.cs.interfaces.remote.ContentRemote; import ru.ntik.cs.interfaces.remote.EventAuditRemote; import ru.ntik.cs.interfaces.remote.EventLinkRemote; import ru.ntik.cs.interfaces.remote.EventRemote; import ru.ntik.cs.interfaces.remote.ExternalTableRemote; import ru.ntik.cs.interfaces.remote.FolderRemote; import ru.ntik.cs.interfaces.remote.FolderedObjectRemote; import ru.ntik.cs.interfaces.remote.GroupRemote; import ru.ntik.cs.interfaces.remote.IdentityRemote; import ru.ntik.cs.interfaces.remote.IndexQueueRemote; import ru.ntik.cs.interfaces.remote.IndexSingletonRemote; import ru.ntik.cs.interfaces.remote.LifecycleRemote; import ru.ntik.cs.interfaces.remote.LifecycleStateRemote; import ru.ntik.cs.interfaces.remote.MailGroupRemote; import ru.ntik.cs.interfaces.remote.NotificationRemote; import ru.ntik.cs.interfaces.remote.ObjectTypeRemote; import ru.ntik.cs.interfaces.remote.PermissionRemote; import ru.ntik.cs.interfaces.remote.PersistentObjectRemote; import ru.ntik.cs.interfaces.remote.QueryExecutorRemote; import ru.ntik.cs.interfaces.remote.ScheduleRemote; import ru.ntik.cs.interfaces.remote.SecuredObjectRemote; import ru.ntik.cs.interfaces.remote.SubscriptionEventLinkRemote; import ru.ntik.cs.interfaces.remote.SubscriptionRemote; import ru.ntik.cs.interfaces.remote.TaskRemote; import ru.ntik.cs.interfaces.remote.TaskTemplateRemote; import ru.ntik.cs.interfaces.remote.TypesProviderRemote; import ru.ntik.cs.interfaces.remote.UserRemote; import ru.ntik.cs.interfaces.remote.VersionedObjectRemote; import ru.ntik.cs.interfaces.remote.WorkflowRemote; import ru.ntik.cs.interfaces.remote.WorkflowTemplateRemote; import ru.ntik.cs.search.AdvancedSearch; import ru.ntik.cs.search.Operators; import ru.ntik.cs.utils.typedescr.CSAttribute; import ru.ntik.cs.utils.typedescr.CSType; import ru.ntik.cs.webclient.utils.PojoConverter; /** * * @author artem */ @ManagedBean @SessionScoped public class Controller implements Serializable { @EJB(name = "TypesProvider") private TypesProviderRemote typesProviderBean; @EJB(name = "ConfProvider") private ConfProviderRemote confProviderBean; @EJB(name = "PersistentObject") private PersistentObjectRemote persistentObjectBean; @EJB(name = "Folder") private FolderRemote folderBean; @EJB(name = "ObjectType") private ObjectTypeRemote objectTypeBean; @EJB(name = "EventAudit") private EventAuditRemote eventAuditBean; @EJB(name = "EventLink") private EventLinkRemote eventLinkBean; @EJB(name = "Schedule") private ScheduleRemote scheduleBean; @EJB(name = "Notification") private NotificationRemote notificationBean; @EJB(name = "Identity") private IdentityRemote identityBean; @EJB(name = "MailGroup") private MailGroupRemote mailGroupBean; @EJB(name = "Subscription") private SubscriptionRemote subscriptionBean; @EJB(name = "Event") private EventRemote eventBean; @EJB(name = "SubscriptionEventLink") private SubscriptionEventLinkRemote subscriptionEventLinkBean; @EJB(name = "User") private UserRemote userBean; @EJB(name = "Permission") private PermissionRemote permissionBean; @EJB(name = "Acl") private AclRemote aclBean; @EJB(name = "Lifecycle") private LifecycleRemote lifecycleBean; @EJB(name = "VersionedObject") private VersionedObjectRemote versionedObjectBean; @EJB(name = "IndexQueue") private IndexQueueRemote indexQueueBean; @EJB(name = "IndexSingleton") private IndexSingletonRemote indexSingletonBean; @EJB(name = "Content") private ContentRemote contentBean; @EJB(name = "QueryExecutor") private QueryExecutorRemote queryExecutorBean; @EJB(name = "FolderedObject") private FolderedObjectRemote folderedObjectBean; @EJB(name = "BaseObject") private BaseObjectRemote baseObjectBean; @EJB(name = "WorkflowTemplate") private WorkflowTemplateRemote workflowTemplateBean; @EJB(name = "Action") private ActionRemote actionBean; @EJB(name = "Workflow") private WorkflowRemote workflowBean; @EJB(name = "SecuredObject") private SecuredObjectRemote securedObjectBean; @EJB(name = "Group") private GroupRemote groupBean; @EJB(name = "Task") private TaskRemote taskBean; @EJB(name = "TaskTemplate") private TaskTemplateRemote taskTemplateBean; @EJB(name = "LifecycleState") private LifecycleStateRemote lifecycleStateBean; @EJB(name = "AttributeParams") private AttributeParamsRemote attributeParamsBean; @EJB(name = "ExternalTable") private ExternalTableRemote externalTableBean; private String taskType; private String search; private String indexQuery = "select * from versionedobject where id > 0;"; private boolean indexSearchEnabled = false; private int minSearchQuerySize = 0; private int indexTimer = 5; private String password; private boolean isCreated; private boolean createNew = true; private boolean open; private boolean collapsed; private boolean required; private boolean advanced; private TreeNode userCatalog; private TreeNode selectedFolder; private CSUser user; private Acl acl; private Right right = Right.READ; private Identity identity; private Permission selPer; private Storage storage; private ObjectType type; private CSType cstype; private Attribute attribute; private AdvancedSearch advSearch; private Notification notification; private final POConverter<CSUser> userConverter = new POConverter<>(CSUser.class); private final POConverter<Acl> aclConverter = new POConverter<>(Acl.class); private final POConverter<Lifecycle> lifeCycleConverter = new POConverter<>(Lifecycle.class); private final POConverter<ObjectType> typeConverter = new POConverter<>(ObjectType.class); private final POConverter<Storage> storageConverter = new POConverter<>(Storage.class); private final CSTypeConverter cstypeConverter = new CSTypeConverter(); private final ActionConverter actionConverter = new ActionConverter(); private final ExtTableConverter extTableConverter = new ExtTableConverter(); private PojoConverter<Attribute> typeAttributes = new PojoConverter<>(new ArrayList<Attribute>(20)); private List<Permission> permissions = new ArrayList<>(); private List<Permission> selPermissions = new ArrayList<>(); private List<Attribute> attributes = new ArrayList<>(); private List<CSType> cstypes = new ArrayList<>(); private List<Notification> notifications = new ArrayList<>(); private List<? extends PersistentObject> searchRes = new ArrayList<>(); private Map<String, CSType> allTypes; private Map<String, String> confMap; private Map<String, Object> beanMap; public AclRemote getAclBean() { return aclBean; } public POConverter getAclConverter() { return aclConverter; } public ActionRemote getActionBean() { return actionBean; } public ActionConverter getActionConverter() { return actionConverter; } public AdvancedSearch getAdvSearch() { return advSearch; } public void setAdvSearch(AdvancedSearch advSearch) { this.advSearch = advSearch; } public Map<String, CSType> getAllTypes() { return allTypes; } public Attribute getAttribute() { return attribute; } public void setAttribute(Attribute attribute) { this.attribute = attribute; } public AttributeParamsRemote getAttributeParamsBean() { return attributeParamsBean; } public BaseObjectRemote getBaseObjectBean() { return baseObjectBean; } public Map<String, Object> getBeanMap() { return beanMap; } public Map<String, String> getConfMap() { return confMap; } public void setConfMap(Map<String, String> confMap) { this.confMap = confMap; } public ConfProviderRemote getConfProviderBean() { return confProviderBean; } public ContentRemote getContentBean() { return contentBean; } public CSType getCstype() { return cstype; } public void setCstype(CSType cstype) { this.cstype = cstype; } public CSTypeConverter getCstypeConverter() { return cstypeConverter; } public List<CSType> getCstypes() { return cstypes; } public void setCstypes(List<CSType> cstypes) { this.cstypes = cstypes; } public EventAuditRemote getEventAuditBean() { return eventAuditBean; } public EventRemote getEventBean() { return eventBean; } public EventLinkRemote getEventLinkBean() { return eventLinkBean; } public ExtTableConverter getExtTableConverter() { return extTableConverter; } public ExternalTableRemote getExternalTableBean() { return externalTableBean; } public FolderRemote getFolderBean() { return folderBean; } public FolderedObjectRemote getFolderedObjectBean() { return folderedObjectBean; } public GroupRemote getGroupBean() { return groupBean; } public IdentityRemote getIdentityBean() { return identityBean; } public IndexQueueRemote getIndexQueueBean() { return indexQueueBean; } public IndexSingletonRemote getIndexSingletonBean() { return indexSingletonBean; } public POConverter<Lifecycle> getLifeCycleConverter() { return lifeCycleConverter; } public LifecycleRemote getLifecycleBean() { return lifecycleBean; } public LifecycleStateRemote getLifecycleStateBean() { return lifecycleStateBean; } public MailGroupRemote getMailGroupBean() { return mailGroupBean; } public NotificationRemote getNotificationBean() { return notificationBean; } public ObjectTypeRemote getObjectTypeBean() { return objectTypeBean; } public PermissionRemote getPermissionBean() { return permissionBean; } public PersistentObjectRemote getPersistentObjectBean() { return persistentObjectBean; } public QueryExecutorRemote getQueryExecutorBean() { return queryExecutorBean; } public ScheduleRemote getScheduleBean() { return scheduleBean; } public SecuredObjectRemote getSecuredObjectBean() { return securedObjectBean; } public POConverter<Storage> getStorageConverter() { return storageConverter; } public SubscriptionRemote getSubscriptionBean() { return subscriptionBean; } public SubscriptionEventLinkRemote getSubscriptionEventLinkBean() { return subscriptionEventLinkBean; } public TaskRemote getTaskBean() { return taskBean; } public TaskTemplateRemote getTaskTemplateBean() { return taskTemplateBean; } public POConverter<ObjectType> getTypeConverter() { return typeConverter; } public TypesProviderRemote getTypesProviderBean() { return typesProviderBean; } public UserRemote getUserBean() { return userBean; } public POConverter<CSUser> getUserConverter() { return userConverter; } public List<IndexQueue> getIndexQueue() { return indexQueueBean.findAll(); } public List<Attribute> getAttributes() { return attributes; } public void setAttributes(List<Attribute> attributes) { this.attributes = attributes; } public Identity getIdentity() { return identity; } public void setIdentity(Identity identity) { this.identity = identity; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public SelectItem[] getRightValues() { SelectItem[] items = new SelectItem[Right.values().length]; int i = 0; for (Right r : Right.values()) { items[i++] = new SelectItem(r, r.name()); } return items; } public VersionedObjectRemote getVersionedObjectBean() { return versionedObjectBean; } public Version[] getVersions() { return Version.values(); } public SelectItem[] getAuthType() { SelectItem[] items = new SelectItem[AuthType.values().length]; int i = 0; for (AuthType a : AuthType.values()) { items[i++] = new SelectItem(a, a.name()); } return items; } public Operators[] getOperators() { return Operators.values(); } public String getSearch() { return search; } public void setSearch(String search) { this.search = search; } public String getIndexQuery() { return indexQuery; } public void setIndexQuery(String indexQuery) { this.indexQuery = indexQuery; } public boolean getIndexSearchEnabled() { return indexSearchEnabled; } public void setIndexSearchEnabled(boolean indexSearchEnabled) { this.indexSearchEnabled = indexSearchEnabled; } public int getMinSearchQuerySize() { return minSearchQuerySize; } public void setMinSearchQuerySize(int minSearchQuerySize) { this.minSearchQuerySize = minSearchQuerySize; } public int getIndexTimer() { return indexTimer; } public void setIndexTimer(int indexTimer) { this.indexTimer = indexTimer; indexSingletonBean.changeIndexSchedule(indexTimer); } public Permission getSelPer() { return selPer; } public void setSelPer(Permission selPer) { this.selPer = selPer; } public Storage getStorage() { return storage; } public void setStorage(Storage storage) { this.storage = storage; } public String getTaskType() { return taskType; } public void setTaskType(String taskType) { this.taskType = taskType; } public ObjectType getType() { return type; } public void setType(ObjectType type) { this.type = type; } public PojoConverter<Attribute> getTypeAttributes() { return typeAttributes; } public void setTypeAttributes(PojoConverter<Attribute> typeAttributes) { this.typeAttributes = typeAttributes; } public TreeNode getUserCatalog() { return this.userCatalog; } public void setUserCatalog(TreeNode userCatalog) { this.userCatalog = userCatalog; } public TreeNode getSelectedFolder() { return this.selectedFolder; } public void setSelectedFolder(TreeNode selectedFolder) { this.selectedFolder = selectedFolder; } public List<Permission> getPermissions() { return permissions; } public void setPermissions(List<Permission> permissions) { this.permissions = permissions; } public List<Permission> getSelPermissions() { return selPermissions; } public void setSelPermissions(List<Permission> selPermissions) { this.selPermissions = selPermissions; } public Right getRight() { return right; } public void setRight(Right right) { this.right = right; } public CSUser getUser() { return this.user; } public void setUser(CSUser user) { this.user = user; } public Acl getAcl() { return this.acl; } public void setAcl(Acl acl) { this.acl = acl; } public WorkflowRemote getWorkflowBean() { return workflowBean; } public WorkflowTemplateRemote getWorkflowTemplateBean() { return workflowTemplateBean; } public boolean isAdvanced() { return advanced; } public void setAdvanced(boolean advanced) { this.advanced = advanced; } public boolean isCollapsed() { return collapsed; } public void setCollapsed(boolean collapsed) { this.collapsed = collapsed; } public boolean isCreateNew() { return this.createNew; } public void setCreateNew(boolean createNew) { this.createNew = createNew; } public boolean isOpen() { return open; } public void setOpen(boolean open) { this.open = open; } public boolean isRequired() { return required; } public void setRequired(boolean required) { this.required = required; } public void onLoad(String page) { if (!isCreated) { isCreated = true; initBeanMap(); initFolderTree(); } allTypes = typesProviderBean.getCSTypeMap(); createNew = false; switch (page) { case "task": Identity performer = (Identity) identityBean.find(getLogin()); notifications = notificationBean.findByPerformer(performer); break; } } public String getLogin() { return FacesContext.getCurrentInstance().getExternalContext().getRemoteUser(); } public void toggle() { collapsed = !collapsed; } public String convDate(Date date) { SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); if (date != null) { return sdf.format(date); } else { return null; } } public void onNodeExpand(NodeExpandEvent event) { try { event.getTreeNode().setExpanded(true); TreeNode node = event.getTreeNode(); for (TreeNode n : node.getChildren()) { Folder f = (Folder) n.getData(); f = folderBean.initNestedFolders(f); for (Folder ff : f.getNestedFolders()) { TreeNode node2 = new DefaultTreeNode(ff, n); } } } catch (CSException | EJBException ex) { handleException(ex); } catch (Throwable ex) { handleException(ex); throw ex; } } public void onNodeCollapse(NodeCollapseEvent event) { event.getTreeNode().setExpanded(false); } public void onNodeSelect(NodeSelectEvent event) throws IOException { event.getTreeNode().setSelected(true); selectedFolder = event.getTreeNode(); FacesContext.getCurrentInstance().getExternalContext().redirect("folder.xhtml"); } public void onNodeUnselect(NodeUnselectEvent event) { event.getTreeNode().setSelected(false); } public void handleException(Throwable e) { e = CSException.getCause(e); FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage() != null ? e.getMessage() : e.toString(), "")); e.printStackTrace(); } public void removeNotification() { persistentObjectBean.delete(notification); notifications.remove(notification); } public String getContentNotification() throws IOException { try { notification = notificationBean.initAttachedBaseObjects(notification); List<BaseObject> baseObjects = notification.getAttachedBaseObjects(); if (baseObjects != null && !baseObjects.isEmpty()) { BaseObject bo = baseObjects.get(0); VersionedObject v = versionedObjectBean.initContents(bo); Content content; if (!v.getContentList().isEmpty()) { content = v.getContentList().get(0); } else { return null; } content = contentBean.initBytes(content); ByteArrayInputStream filedata = new ByteArrayInputStream(content.getBytes()); MimetypesFileTypeMap mimeTypesMap = new MimetypesFileTypeMap(); String filename = new String(v.getName().getBytes("utf8"), "ISO-8859-1"); filename += "." + content.getContentType(); DefaultStreamedContent dsc = new DefaultStreamedContent(filedata, mimeTypesMap.getContentType(filename), filename); String msg = getStringFromInputStream(dsc.getStream()); return msg; } return null; } catch (CSException | EJBException | UnsupportedEncodingException ex) { handleException(ex); return null; } catch (Throwable ex) { handleException(ex); throw ex; } } private static String getStringFromInputStream(InputStream is) { BufferedReader br = null; StringBuilder sb = new StringBuilder(); String line; try { br = new BufferedReader(new InputStreamReader(is)); while ((line = br.readLine()) != null) { sb.append(line); } } catch (IOException e) { e.printStackTrace(); } finally { if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } return sb.toString(); } public void initFolderTree() { try { userCatalog = new DefaultTreeNode(null, null); TreeNode root = new DefaultTreeNode(new Folder("ROOT", null, null), userCatalog); Folder f; f = folderBean.initNestedFolders(null); for (Folder ff : f.getNestedFolders()) { TreeNode node = new DefaultTreeNode(ff, root); } if (selectedFolder != null) { selectedFolder.setSelected(true); } } catch (CSException | EJBException ex) { handleException(ex); } catch (Throwable ex) { handleException(ex); throw ex; } } public void prepCreateType() { createNew = true; } public List<Notification> getNotifications() { return notifications; } public void setNotifications(List<Notification> notifications) { this.notifications = notifications; } public Notification getNotification() { return notification; } public void setNotification(Notification notification) { this.notification = notification; } public String locAttr(String objType, String attr, String loc) { CSType csType = allTypes.get(objType); if (csType != null) { CSAttribute csa = csType.getAllAttributes().get(attr); if (csa != null) { return csa.getAttribute().getLocaleLabel(loc); } } return null; } public void preSearch() { cstype = typesProviderBean.getCSType("folderedobject"); cstypes = new ArrayList<>(typesProviderBean.getDescendants(cstype, true)); selectType(); } public void selectType() { try { type = objectTypeBean.initAttributeParams(cstype.getObjectType()); Iterator<CSAttribute> attributeIt = cstype.getAllAttributes().values().iterator(); typeAttributes.getList().clear(); List<Attribute> attrs = new ArrayList<>(); while (attributeIt.hasNext()) { CSAttribute ca = attributeIt.next(); AttributeParams ap = type.getAttributeParams().get(new Attribute(ca)); typeAttributes.getList().add(ap.getAttribute()); if (ap.getShowInSearch()) { attrs.add(ap.getAttribute()); } } advSearch = new AdvancedSearch(attrs, cstype.getName()); } catch (CSException | EJBException ex) { handleException(ex); } catch (Throwable ex) { handleException(ex); throw ex; } } public List<CSUser> completeUser(String query) { return userBean.completeUser(query); } public List<Acl> completeAcl(String query) { return aclBean.completeAcl(query); } public List<Lifecycle> completeLifecycle(String query) { return lifecycleBean.completeLifecycle(query); } public void addAttribute() { advSearch.addAttribute(attribute); } public String doSearch(boolean isAdv) { advanced = isAdv; if (null != searchRes) { searchRes.clear(); } if (isAdv) { try { searchRes = persistentObjectBean.searchByAttributes(advSearch); } catch (CSException | SQLException ex) { handleException(ex); } } return "searchResult?faces-redirect=true"; } public void indexEverything() { try { indexSingletonBean.indexAll(); } catch (CSException | EJBException ex) { handleException(ex); } catch (Throwable ex) { handleException(ex); throw ex; } } public void doIndexQuery() { indexSingletonBean.indexQuery(indexQuery); } public String saveIndexSettings() { return "index?faces-redirect=true"; } public class POConverter<T extends PersistentObject> implements Converter, Serializable { private Class<T> type; public POConverter(Class<T> type) { this.type = type; } @Override public Object getAsObject(FacesContext fc, UIComponent uic, String string) { try { Long id = Long.valueOf(string); if (type != null) { return persistentObjectBean.find(id, type); } return null; } catch (NumberFormatException e) { return null; } } @Override public String getAsString(FacesContext fc, UIComponent uic, Object object) { if (object != null) { return ((PersistentObject) object).getId().toString(); } else { return null; } } } public class CSTypeConverter implements Converter { @Override public Object getAsObject(FacesContext fc, UIComponent uic, String string) { return typesProviderBean.getCSType(string); } @Override public String getAsString(FacesContext fc, UIComponent uic, Object object) { if (object != null) { return ((CSType) object).getName(); } else { return null; } } } public class ActionConverter implements Converter { @Override public Object getAsObject(FacesContext fc, UIComponent uic, String string) { try { Long id = Long.valueOf(string); return getActionBean().find(id); } catch (NumberFormatException e) { return null; } } @Override public String getAsString(FacesContext fc, UIComponent uic, Object object) { if (object != null) { return ((Action) object).getId().toString(); } else { return null; } } } public class ExtTableConverter implements Converter { @Override public Object getAsObject(FacesContext fc, UIComponent uic, String string) { if (string != null) { AttributeParams ap = (AttributeParams) uic.getAttributes().get("attParam"); if (ap != null && ap.getExtTableName() != null) { handleException(new Exception("Use ExtTableConverter only for readOnly=\"true\" input.")); return null; } else { switch (ap.getAttribute().getAttributeType()) { case INTEGER: return Long.parseLong(string); case FLOAT: return Double.parseDouble(string); case STRING: return string; } } } return null; } @Override public String getAsString(FacesContext fc, UIComponent uic, Object object) { if (object != null) { AttributeParams ap = (AttributeParams) uic.getAttributes().get("attParam"); try { String string = object.toString(); if (ap != null && ap.getExtTableName() != null && !ap.getExtTableLabel().equals(ap.getExtTableValue())) { QueryExecutorResult result = queryExecutorBean.execute("SELECT " + ap.getExtTableLabel() + " FROM " + ap.getExtTableName() + " WHERE " + ap.getExtTableValue() + "='" + object.toString() + "'"); ResultSet res = result.getResultSet(); if (res != null) { int columnsCount = res.getMetaData().getColumnCount(); if (columnsCount > 0) { res.next(); string = res.getString(1); } } } return string; } catch (CSException | SQLException e) { return null; } } return null; } } public StreamedContent downloadFile(BaseObject baseObject) { try { Content content; VersionedObject v = getVersionedObjectBean().initContents((VersionedObject) baseObject); if (!v.getContentList().isEmpty()) { content = v.getContentList().get(0); } else { return null; } if (content.getBytes() == null) { content = getContentBean().initBytes(content); } ByteArrayInputStream filedata = new ByteArrayInputStream(content.getBytes()); MimetypesFileTypeMap mimeTypesMap = new MimetypesFileTypeMap(); String filename = new String(v.getName().getBytes("utf8"), "ISO-8859-1"); filename += "." + content.getContentType(); return new DefaultStreamedContent(filedata, mimeTypesMap.getContentType(filename), filename); } catch (CSException | EJBException | UnsupportedEncodingException ex) { handleException(ex); } catch (Throwable ex) { handleException(ex); throw ex; } return null; } public String getVersion(FolderedObject f) { if (f instanceof VersionedObject) { VersionedObject fo = (VersionedObject) f; return fo.getMajor() + "." + fo.getMinor(); } return null; } @PostConstruct private void postConstruct() { allTypes = typesProviderBean.getCSTypeMap(); confMap = confProviderBean.getConf(); //indexSearchEnabled = Boolean.valueOf(confMap.get("indexsearchenabled")); //minSearchQuerySize = Integer.valueOf(confMap.get("minsearchquerysize")); //indexTimer = Integer.valueOf(confMap.get("indextimer")); } private void initBeanMap() { beanMap = new HashMap<>(); beanMap.put(TypesProviderRemote.class.getSimpleName(), typesProviderBean); beanMap.put(ConfProviderRemote.class.getSimpleName(), confProviderBean); beanMap.put(PersistentObjectRemote.class.getSimpleName(), persistentObjectBean); beanMap.put(FolderRemote.class.getSimpleName(), folderBean); beanMap.put(ObjectTypeRemote.class.getSimpleName(), objectTypeBean); beanMap.put(EventAuditRemote.class.getSimpleName(), eventAuditBean); beanMap.put(EventLinkRemote.class.getSimpleName(), eventLinkBean); beanMap.put(ScheduleRemote.class.getSimpleName(), scheduleBean); beanMap.put(NotificationRemote.class.getSimpleName(), notificationBean); beanMap.put(IdentityRemote.class.getSimpleName(), identityBean); beanMap.put(MailGroupRemote.class.getSimpleName(), mailGroupBean); beanMap.put(SubscriptionRemote.class.getSimpleName(), subscriptionBean); beanMap.put(EventRemote.class.getSimpleName(), eventBean); beanMap.put(SubscriptionEventLinkRemote.class.getSimpleName(), subscriptionEventLinkBean); beanMap.put(UserRemote.class.getSimpleName(), userBean); beanMap.put(PermissionRemote.class.getSimpleName(), permissionBean); beanMap.put(AclRemote.class.getSimpleName(), aclBean); beanMap.put(LifecycleRemote.class.getSimpleName(), lifecycleBean); beanMap.put(VersionedObjectRemote.class.getSimpleName(), versionedObjectBean); beanMap.put(IndexQueueRemote.class.getSimpleName(), indexQueueBean); beanMap.put(IndexSingletonRemote.class.getSimpleName(), indexSingletonBean); beanMap.put(ContentRemote.class.getSimpleName(), contentBean); beanMap.put(QueryExecutorRemote.class.getSimpleName(), queryExecutorBean); beanMap.put(FolderedObjectRemote.class.getSimpleName(), folderedObjectBean); beanMap.put(BaseObjectRemote.class.getSimpleName(), baseObjectBean); beanMap.put(WorkflowTemplateRemote.class.getSimpleName(), workflowTemplateBean); beanMap.put(ActionRemote.class.getSimpleName(), actionBean); beanMap.put(WorkflowRemote.class.getSimpleName(), workflowBean); beanMap.put(SecuredObjectRemote.class.getSimpleName(), securedObjectBean); beanMap.put(GroupRemote.class.getSimpleName(), groupBean); beanMap.put(TaskRemote.class.getSimpleName(), taskBean); beanMap.put(TaskTemplateRemote.class.getSimpleName(), taskTemplateBean); beanMap.put(LifecycleStateRemote.class.getSimpleName(), lifecycleStateBean); beanMap.put(AttributeParamsRemote.class.getSimpleName(), attributeParamsBean); beanMap.put(ExternalTableRemote.class.getSimpleName(), externalTableBean); } }
UTF-8
Java
31,777
java
Controller.java
Java
[ { "context": ".webclient.utils.PojoConverter;\n\n/**\n *\n * @author artem\n */\n@ManagedBean\n@SessionScoped\npublic class Cont", "end": 4430, "score": 0.9339122772216797, "start": 4425, "tag": "USERNAME", "value": "artem" }, { "context": "d setPassword(String password) {\n\t\tthis.password = password;\n\t}\n\n\tpublic SelectItem[] getRightValues() {\n\t\tSe", "end": 13441, "score": 0.9951291084289551, "start": 13433, "tag": "PASSWORD", "value": "password" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package ru.ntik.cs.webclient; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.sql.ResultSet; import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.activation.MimetypesFileTypeMap; import javax.annotation.PostConstruct; import javax.ejb.EJB; import javax.ejb.EJBException; import javax.faces.application.FacesMessage; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.convert.Converter; import javax.faces.model.SelectItem; import org.primefaces.event.NodeCollapseEvent; import org.primefaces.event.NodeExpandEvent; import org.primefaces.event.NodeSelectEvent; import org.primefaces.event.NodeUnselectEvent; import org.primefaces.model.DefaultStreamedContent; import org.primefaces.model.DefaultTreeNode; import org.primefaces.model.StreamedContent; import org.primefaces.model.TreeNode; import ru.ntik.cs.entities.Acl; import ru.ntik.cs.entities.Action; import ru.ntik.cs.entities.Attribute; import ru.ntik.cs.entities.AttributeParams; import ru.ntik.cs.entities.AuthType; import ru.ntik.cs.entities.BaseObject; import ru.ntik.cs.entities.Content; import ru.ntik.cs.entities.Folder; import ru.ntik.cs.entities.Identity; import ru.ntik.cs.entities.IndexQueue; import ru.ntik.cs.entities.Lifecycle; import ru.ntik.cs.entities.Notification; import ru.ntik.cs.entities.ObjectType; import ru.ntik.cs.entities.Permission; import ru.ntik.cs.entities.PersistentObject; import ru.ntik.cs.entities.Right; import ru.ntik.cs.entities.Storage; import ru.ntik.cs.interfaces.remote.ConfProviderRemote; import ru.ntik.cs.entities.CSUser; import ru.ntik.cs.entities.FolderedObject; import ru.ntik.cs.entities.Version; import ru.ntik.cs.entities.VersionedObject; import ru.ntik.cs.exceptions.CSException; import ru.ntik.cs.interfaces.csdml.QueryExecutorResult; import ru.ntik.cs.interfaces.remote.AclRemote; import ru.ntik.cs.interfaces.remote.ActionRemote; import ru.ntik.cs.interfaces.remote.AttributeParamsRemote; import ru.ntik.cs.interfaces.remote.BaseObjectRemote; import ru.ntik.cs.interfaces.remote.ContentRemote; import ru.ntik.cs.interfaces.remote.EventAuditRemote; import ru.ntik.cs.interfaces.remote.EventLinkRemote; import ru.ntik.cs.interfaces.remote.EventRemote; import ru.ntik.cs.interfaces.remote.ExternalTableRemote; import ru.ntik.cs.interfaces.remote.FolderRemote; import ru.ntik.cs.interfaces.remote.FolderedObjectRemote; import ru.ntik.cs.interfaces.remote.GroupRemote; import ru.ntik.cs.interfaces.remote.IdentityRemote; import ru.ntik.cs.interfaces.remote.IndexQueueRemote; import ru.ntik.cs.interfaces.remote.IndexSingletonRemote; import ru.ntik.cs.interfaces.remote.LifecycleRemote; import ru.ntik.cs.interfaces.remote.LifecycleStateRemote; import ru.ntik.cs.interfaces.remote.MailGroupRemote; import ru.ntik.cs.interfaces.remote.NotificationRemote; import ru.ntik.cs.interfaces.remote.ObjectTypeRemote; import ru.ntik.cs.interfaces.remote.PermissionRemote; import ru.ntik.cs.interfaces.remote.PersistentObjectRemote; import ru.ntik.cs.interfaces.remote.QueryExecutorRemote; import ru.ntik.cs.interfaces.remote.ScheduleRemote; import ru.ntik.cs.interfaces.remote.SecuredObjectRemote; import ru.ntik.cs.interfaces.remote.SubscriptionEventLinkRemote; import ru.ntik.cs.interfaces.remote.SubscriptionRemote; import ru.ntik.cs.interfaces.remote.TaskRemote; import ru.ntik.cs.interfaces.remote.TaskTemplateRemote; import ru.ntik.cs.interfaces.remote.TypesProviderRemote; import ru.ntik.cs.interfaces.remote.UserRemote; import ru.ntik.cs.interfaces.remote.VersionedObjectRemote; import ru.ntik.cs.interfaces.remote.WorkflowRemote; import ru.ntik.cs.interfaces.remote.WorkflowTemplateRemote; import ru.ntik.cs.search.AdvancedSearch; import ru.ntik.cs.search.Operators; import ru.ntik.cs.utils.typedescr.CSAttribute; import ru.ntik.cs.utils.typedescr.CSType; import ru.ntik.cs.webclient.utils.PojoConverter; /** * * @author artem */ @ManagedBean @SessionScoped public class Controller implements Serializable { @EJB(name = "TypesProvider") private TypesProviderRemote typesProviderBean; @EJB(name = "ConfProvider") private ConfProviderRemote confProviderBean; @EJB(name = "PersistentObject") private PersistentObjectRemote persistentObjectBean; @EJB(name = "Folder") private FolderRemote folderBean; @EJB(name = "ObjectType") private ObjectTypeRemote objectTypeBean; @EJB(name = "EventAudit") private EventAuditRemote eventAuditBean; @EJB(name = "EventLink") private EventLinkRemote eventLinkBean; @EJB(name = "Schedule") private ScheduleRemote scheduleBean; @EJB(name = "Notification") private NotificationRemote notificationBean; @EJB(name = "Identity") private IdentityRemote identityBean; @EJB(name = "MailGroup") private MailGroupRemote mailGroupBean; @EJB(name = "Subscription") private SubscriptionRemote subscriptionBean; @EJB(name = "Event") private EventRemote eventBean; @EJB(name = "SubscriptionEventLink") private SubscriptionEventLinkRemote subscriptionEventLinkBean; @EJB(name = "User") private UserRemote userBean; @EJB(name = "Permission") private PermissionRemote permissionBean; @EJB(name = "Acl") private AclRemote aclBean; @EJB(name = "Lifecycle") private LifecycleRemote lifecycleBean; @EJB(name = "VersionedObject") private VersionedObjectRemote versionedObjectBean; @EJB(name = "IndexQueue") private IndexQueueRemote indexQueueBean; @EJB(name = "IndexSingleton") private IndexSingletonRemote indexSingletonBean; @EJB(name = "Content") private ContentRemote contentBean; @EJB(name = "QueryExecutor") private QueryExecutorRemote queryExecutorBean; @EJB(name = "FolderedObject") private FolderedObjectRemote folderedObjectBean; @EJB(name = "BaseObject") private BaseObjectRemote baseObjectBean; @EJB(name = "WorkflowTemplate") private WorkflowTemplateRemote workflowTemplateBean; @EJB(name = "Action") private ActionRemote actionBean; @EJB(name = "Workflow") private WorkflowRemote workflowBean; @EJB(name = "SecuredObject") private SecuredObjectRemote securedObjectBean; @EJB(name = "Group") private GroupRemote groupBean; @EJB(name = "Task") private TaskRemote taskBean; @EJB(name = "TaskTemplate") private TaskTemplateRemote taskTemplateBean; @EJB(name = "LifecycleState") private LifecycleStateRemote lifecycleStateBean; @EJB(name = "AttributeParams") private AttributeParamsRemote attributeParamsBean; @EJB(name = "ExternalTable") private ExternalTableRemote externalTableBean; private String taskType; private String search; private String indexQuery = "select * from versionedobject where id > 0;"; private boolean indexSearchEnabled = false; private int minSearchQuerySize = 0; private int indexTimer = 5; private String password; private boolean isCreated; private boolean createNew = true; private boolean open; private boolean collapsed; private boolean required; private boolean advanced; private TreeNode userCatalog; private TreeNode selectedFolder; private CSUser user; private Acl acl; private Right right = Right.READ; private Identity identity; private Permission selPer; private Storage storage; private ObjectType type; private CSType cstype; private Attribute attribute; private AdvancedSearch advSearch; private Notification notification; private final POConverter<CSUser> userConverter = new POConverter<>(CSUser.class); private final POConverter<Acl> aclConverter = new POConverter<>(Acl.class); private final POConverter<Lifecycle> lifeCycleConverter = new POConverter<>(Lifecycle.class); private final POConverter<ObjectType> typeConverter = new POConverter<>(ObjectType.class); private final POConverter<Storage> storageConverter = new POConverter<>(Storage.class); private final CSTypeConverter cstypeConverter = new CSTypeConverter(); private final ActionConverter actionConverter = new ActionConverter(); private final ExtTableConverter extTableConverter = new ExtTableConverter(); private PojoConverter<Attribute> typeAttributes = new PojoConverter<>(new ArrayList<Attribute>(20)); private List<Permission> permissions = new ArrayList<>(); private List<Permission> selPermissions = new ArrayList<>(); private List<Attribute> attributes = new ArrayList<>(); private List<CSType> cstypes = new ArrayList<>(); private List<Notification> notifications = new ArrayList<>(); private List<? extends PersistentObject> searchRes = new ArrayList<>(); private Map<String, CSType> allTypes; private Map<String, String> confMap; private Map<String, Object> beanMap; public AclRemote getAclBean() { return aclBean; } public POConverter getAclConverter() { return aclConverter; } public ActionRemote getActionBean() { return actionBean; } public ActionConverter getActionConverter() { return actionConverter; } public AdvancedSearch getAdvSearch() { return advSearch; } public void setAdvSearch(AdvancedSearch advSearch) { this.advSearch = advSearch; } public Map<String, CSType> getAllTypes() { return allTypes; } public Attribute getAttribute() { return attribute; } public void setAttribute(Attribute attribute) { this.attribute = attribute; } public AttributeParamsRemote getAttributeParamsBean() { return attributeParamsBean; } public BaseObjectRemote getBaseObjectBean() { return baseObjectBean; } public Map<String, Object> getBeanMap() { return beanMap; } public Map<String, String> getConfMap() { return confMap; } public void setConfMap(Map<String, String> confMap) { this.confMap = confMap; } public ConfProviderRemote getConfProviderBean() { return confProviderBean; } public ContentRemote getContentBean() { return contentBean; } public CSType getCstype() { return cstype; } public void setCstype(CSType cstype) { this.cstype = cstype; } public CSTypeConverter getCstypeConverter() { return cstypeConverter; } public List<CSType> getCstypes() { return cstypes; } public void setCstypes(List<CSType> cstypes) { this.cstypes = cstypes; } public EventAuditRemote getEventAuditBean() { return eventAuditBean; } public EventRemote getEventBean() { return eventBean; } public EventLinkRemote getEventLinkBean() { return eventLinkBean; } public ExtTableConverter getExtTableConverter() { return extTableConverter; } public ExternalTableRemote getExternalTableBean() { return externalTableBean; } public FolderRemote getFolderBean() { return folderBean; } public FolderedObjectRemote getFolderedObjectBean() { return folderedObjectBean; } public GroupRemote getGroupBean() { return groupBean; } public IdentityRemote getIdentityBean() { return identityBean; } public IndexQueueRemote getIndexQueueBean() { return indexQueueBean; } public IndexSingletonRemote getIndexSingletonBean() { return indexSingletonBean; } public POConverter<Lifecycle> getLifeCycleConverter() { return lifeCycleConverter; } public LifecycleRemote getLifecycleBean() { return lifecycleBean; } public LifecycleStateRemote getLifecycleStateBean() { return lifecycleStateBean; } public MailGroupRemote getMailGroupBean() { return mailGroupBean; } public NotificationRemote getNotificationBean() { return notificationBean; } public ObjectTypeRemote getObjectTypeBean() { return objectTypeBean; } public PermissionRemote getPermissionBean() { return permissionBean; } public PersistentObjectRemote getPersistentObjectBean() { return persistentObjectBean; } public QueryExecutorRemote getQueryExecutorBean() { return queryExecutorBean; } public ScheduleRemote getScheduleBean() { return scheduleBean; } public SecuredObjectRemote getSecuredObjectBean() { return securedObjectBean; } public POConverter<Storage> getStorageConverter() { return storageConverter; } public SubscriptionRemote getSubscriptionBean() { return subscriptionBean; } public SubscriptionEventLinkRemote getSubscriptionEventLinkBean() { return subscriptionEventLinkBean; } public TaskRemote getTaskBean() { return taskBean; } public TaskTemplateRemote getTaskTemplateBean() { return taskTemplateBean; } public POConverter<ObjectType> getTypeConverter() { return typeConverter; } public TypesProviderRemote getTypesProviderBean() { return typesProviderBean; } public UserRemote getUserBean() { return userBean; } public POConverter<CSUser> getUserConverter() { return userConverter; } public List<IndexQueue> getIndexQueue() { return indexQueueBean.findAll(); } public List<Attribute> getAttributes() { return attributes; } public void setAttributes(List<Attribute> attributes) { this.attributes = attributes; } public Identity getIdentity() { return identity; } public void setIdentity(Identity identity) { this.identity = identity; } public String getPassword() { return password; } public void setPassword(String password) { this.password = <PASSWORD>; } public SelectItem[] getRightValues() { SelectItem[] items = new SelectItem[Right.values().length]; int i = 0; for (Right r : Right.values()) { items[i++] = new SelectItem(r, r.name()); } return items; } public VersionedObjectRemote getVersionedObjectBean() { return versionedObjectBean; } public Version[] getVersions() { return Version.values(); } public SelectItem[] getAuthType() { SelectItem[] items = new SelectItem[AuthType.values().length]; int i = 0; for (AuthType a : AuthType.values()) { items[i++] = new SelectItem(a, a.name()); } return items; } public Operators[] getOperators() { return Operators.values(); } public String getSearch() { return search; } public void setSearch(String search) { this.search = search; } public String getIndexQuery() { return indexQuery; } public void setIndexQuery(String indexQuery) { this.indexQuery = indexQuery; } public boolean getIndexSearchEnabled() { return indexSearchEnabled; } public void setIndexSearchEnabled(boolean indexSearchEnabled) { this.indexSearchEnabled = indexSearchEnabled; } public int getMinSearchQuerySize() { return minSearchQuerySize; } public void setMinSearchQuerySize(int minSearchQuerySize) { this.minSearchQuerySize = minSearchQuerySize; } public int getIndexTimer() { return indexTimer; } public void setIndexTimer(int indexTimer) { this.indexTimer = indexTimer; indexSingletonBean.changeIndexSchedule(indexTimer); } public Permission getSelPer() { return selPer; } public void setSelPer(Permission selPer) { this.selPer = selPer; } public Storage getStorage() { return storage; } public void setStorage(Storage storage) { this.storage = storage; } public String getTaskType() { return taskType; } public void setTaskType(String taskType) { this.taskType = taskType; } public ObjectType getType() { return type; } public void setType(ObjectType type) { this.type = type; } public PojoConverter<Attribute> getTypeAttributes() { return typeAttributes; } public void setTypeAttributes(PojoConverter<Attribute> typeAttributes) { this.typeAttributes = typeAttributes; } public TreeNode getUserCatalog() { return this.userCatalog; } public void setUserCatalog(TreeNode userCatalog) { this.userCatalog = userCatalog; } public TreeNode getSelectedFolder() { return this.selectedFolder; } public void setSelectedFolder(TreeNode selectedFolder) { this.selectedFolder = selectedFolder; } public List<Permission> getPermissions() { return permissions; } public void setPermissions(List<Permission> permissions) { this.permissions = permissions; } public List<Permission> getSelPermissions() { return selPermissions; } public void setSelPermissions(List<Permission> selPermissions) { this.selPermissions = selPermissions; } public Right getRight() { return right; } public void setRight(Right right) { this.right = right; } public CSUser getUser() { return this.user; } public void setUser(CSUser user) { this.user = user; } public Acl getAcl() { return this.acl; } public void setAcl(Acl acl) { this.acl = acl; } public WorkflowRemote getWorkflowBean() { return workflowBean; } public WorkflowTemplateRemote getWorkflowTemplateBean() { return workflowTemplateBean; } public boolean isAdvanced() { return advanced; } public void setAdvanced(boolean advanced) { this.advanced = advanced; } public boolean isCollapsed() { return collapsed; } public void setCollapsed(boolean collapsed) { this.collapsed = collapsed; } public boolean isCreateNew() { return this.createNew; } public void setCreateNew(boolean createNew) { this.createNew = createNew; } public boolean isOpen() { return open; } public void setOpen(boolean open) { this.open = open; } public boolean isRequired() { return required; } public void setRequired(boolean required) { this.required = required; } public void onLoad(String page) { if (!isCreated) { isCreated = true; initBeanMap(); initFolderTree(); } allTypes = typesProviderBean.getCSTypeMap(); createNew = false; switch (page) { case "task": Identity performer = (Identity) identityBean.find(getLogin()); notifications = notificationBean.findByPerformer(performer); break; } } public String getLogin() { return FacesContext.getCurrentInstance().getExternalContext().getRemoteUser(); } public void toggle() { collapsed = !collapsed; } public String convDate(Date date) { SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); if (date != null) { return sdf.format(date); } else { return null; } } public void onNodeExpand(NodeExpandEvent event) { try { event.getTreeNode().setExpanded(true); TreeNode node = event.getTreeNode(); for (TreeNode n : node.getChildren()) { Folder f = (Folder) n.getData(); f = folderBean.initNestedFolders(f); for (Folder ff : f.getNestedFolders()) { TreeNode node2 = new DefaultTreeNode(ff, n); } } } catch (CSException | EJBException ex) { handleException(ex); } catch (Throwable ex) { handleException(ex); throw ex; } } public void onNodeCollapse(NodeCollapseEvent event) { event.getTreeNode().setExpanded(false); } public void onNodeSelect(NodeSelectEvent event) throws IOException { event.getTreeNode().setSelected(true); selectedFolder = event.getTreeNode(); FacesContext.getCurrentInstance().getExternalContext().redirect("folder.xhtml"); } public void onNodeUnselect(NodeUnselectEvent event) { event.getTreeNode().setSelected(false); } public void handleException(Throwable e) { e = CSException.getCause(e); FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage() != null ? e.getMessage() : e.toString(), "")); e.printStackTrace(); } public void removeNotification() { persistentObjectBean.delete(notification); notifications.remove(notification); } public String getContentNotification() throws IOException { try { notification = notificationBean.initAttachedBaseObjects(notification); List<BaseObject> baseObjects = notification.getAttachedBaseObjects(); if (baseObjects != null && !baseObjects.isEmpty()) { BaseObject bo = baseObjects.get(0); VersionedObject v = versionedObjectBean.initContents(bo); Content content; if (!v.getContentList().isEmpty()) { content = v.getContentList().get(0); } else { return null; } content = contentBean.initBytes(content); ByteArrayInputStream filedata = new ByteArrayInputStream(content.getBytes()); MimetypesFileTypeMap mimeTypesMap = new MimetypesFileTypeMap(); String filename = new String(v.getName().getBytes("utf8"), "ISO-8859-1"); filename += "." + content.getContentType(); DefaultStreamedContent dsc = new DefaultStreamedContent(filedata, mimeTypesMap.getContentType(filename), filename); String msg = getStringFromInputStream(dsc.getStream()); return msg; } return null; } catch (CSException | EJBException | UnsupportedEncodingException ex) { handleException(ex); return null; } catch (Throwable ex) { handleException(ex); throw ex; } } private static String getStringFromInputStream(InputStream is) { BufferedReader br = null; StringBuilder sb = new StringBuilder(); String line; try { br = new BufferedReader(new InputStreamReader(is)); while ((line = br.readLine()) != null) { sb.append(line); } } catch (IOException e) { e.printStackTrace(); } finally { if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } return sb.toString(); } public void initFolderTree() { try { userCatalog = new DefaultTreeNode(null, null); TreeNode root = new DefaultTreeNode(new Folder("ROOT", null, null), userCatalog); Folder f; f = folderBean.initNestedFolders(null); for (Folder ff : f.getNestedFolders()) { TreeNode node = new DefaultTreeNode(ff, root); } if (selectedFolder != null) { selectedFolder.setSelected(true); } } catch (CSException | EJBException ex) { handleException(ex); } catch (Throwable ex) { handleException(ex); throw ex; } } public void prepCreateType() { createNew = true; } public List<Notification> getNotifications() { return notifications; } public void setNotifications(List<Notification> notifications) { this.notifications = notifications; } public Notification getNotification() { return notification; } public void setNotification(Notification notification) { this.notification = notification; } public String locAttr(String objType, String attr, String loc) { CSType csType = allTypes.get(objType); if (csType != null) { CSAttribute csa = csType.getAllAttributes().get(attr); if (csa != null) { return csa.getAttribute().getLocaleLabel(loc); } } return null; } public void preSearch() { cstype = typesProviderBean.getCSType("folderedobject"); cstypes = new ArrayList<>(typesProviderBean.getDescendants(cstype, true)); selectType(); } public void selectType() { try { type = objectTypeBean.initAttributeParams(cstype.getObjectType()); Iterator<CSAttribute> attributeIt = cstype.getAllAttributes().values().iterator(); typeAttributes.getList().clear(); List<Attribute> attrs = new ArrayList<>(); while (attributeIt.hasNext()) { CSAttribute ca = attributeIt.next(); AttributeParams ap = type.getAttributeParams().get(new Attribute(ca)); typeAttributes.getList().add(ap.getAttribute()); if (ap.getShowInSearch()) { attrs.add(ap.getAttribute()); } } advSearch = new AdvancedSearch(attrs, cstype.getName()); } catch (CSException | EJBException ex) { handleException(ex); } catch (Throwable ex) { handleException(ex); throw ex; } } public List<CSUser> completeUser(String query) { return userBean.completeUser(query); } public List<Acl> completeAcl(String query) { return aclBean.completeAcl(query); } public List<Lifecycle> completeLifecycle(String query) { return lifecycleBean.completeLifecycle(query); } public void addAttribute() { advSearch.addAttribute(attribute); } public String doSearch(boolean isAdv) { advanced = isAdv; if (null != searchRes) { searchRes.clear(); } if (isAdv) { try { searchRes = persistentObjectBean.searchByAttributes(advSearch); } catch (CSException | SQLException ex) { handleException(ex); } } return "searchResult?faces-redirect=true"; } public void indexEverything() { try { indexSingletonBean.indexAll(); } catch (CSException | EJBException ex) { handleException(ex); } catch (Throwable ex) { handleException(ex); throw ex; } } public void doIndexQuery() { indexSingletonBean.indexQuery(indexQuery); } public String saveIndexSettings() { return "index?faces-redirect=true"; } public class POConverter<T extends PersistentObject> implements Converter, Serializable { private Class<T> type; public POConverter(Class<T> type) { this.type = type; } @Override public Object getAsObject(FacesContext fc, UIComponent uic, String string) { try { Long id = Long.valueOf(string); if (type != null) { return persistentObjectBean.find(id, type); } return null; } catch (NumberFormatException e) { return null; } } @Override public String getAsString(FacesContext fc, UIComponent uic, Object object) { if (object != null) { return ((PersistentObject) object).getId().toString(); } else { return null; } } } public class CSTypeConverter implements Converter { @Override public Object getAsObject(FacesContext fc, UIComponent uic, String string) { return typesProviderBean.getCSType(string); } @Override public String getAsString(FacesContext fc, UIComponent uic, Object object) { if (object != null) { return ((CSType) object).getName(); } else { return null; } } } public class ActionConverter implements Converter { @Override public Object getAsObject(FacesContext fc, UIComponent uic, String string) { try { Long id = Long.valueOf(string); return getActionBean().find(id); } catch (NumberFormatException e) { return null; } } @Override public String getAsString(FacesContext fc, UIComponent uic, Object object) { if (object != null) { return ((Action) object).getId().toString(); } else { return null; } } } public class ExtTableConverter implements Converter { @Override public Object getAsObject(FacesContext fc, UIComponent uic, String string) { if (string != null) { AttributeParams ap = (AttributeParams) uic.getAttributes().get("attParam"); if (ap != null && ap.getExtTableName() != null) { handleException(new Exception("Use ExtTableConverter only for readOnly=\"true\" input.")); return null; } else { switch (ap.getAttribute().getAttributeType()) { case INTEGER: return Long.parseLong(string); case FLOAT: return Double.parseDouble(string); case STRING: return string; } } } return null; } @Override public String getAsString(FacesContext fc, UIComponent uic, Object object) { if (object != null) { AttributeParams ap = (AttributeParams) uic.getAttributes().get("attParam"); try { String string = object.toString(); if (ap != null && ap.getExtTableName() != null && !ap.getExtTableLabel().equals(ap.getExtTableValue())) { QueryExecutorResult result = queryExecutorBean.execute("SELECT " + ap.getExtTableLabel() + " FROM " + ap.getExtTableName() + " WHERE " + ap.getExtTableValue() + "='" + object.toString() + "'"); ResultSet res = result.getResultSet(); if (res != null) { int columnsCount = res.getMetaData().getColumnCount(); if (columnsCount > 0) { res.next(); string = res.getString(1); } } } return string; } catch (CSException | SQLException e) { return null; } } return null; } } public StreamedContent downloadFile(BaseObject baseObject) { try { Content content; VersionedObject v = getVersionedObjectBean().initContents((VersionedObject) baseObject); if (!v.getContentList().isEmpty()) { content = v.getContentList().get(0); } else { return null; } if (content.getBytes() == null) { content = getContentBean().initBytes(content); } ByteArrayInputStream filedata = new ByteArrayInputStream(content.getBytes()); MimetypesFileTypeMap mimeTypesMap = new MimetypesFileTypeMap(); String filename = new String(v.getName().getBytes("utf8"), "ISO-8859-1"); filename += "." + content.getContentType(); return new DefaultStreamedContent(filedata, mimeTypesMap.getContentType(filename), filename); } catch (CSException | EJBException | UnsupportedEncodingException ex) { handleException(ex); } catch (Throwable ex) { handleException(ex); throw ex; } return null; } public String getVersion(FolderedObject f) { if (f instanceof VersionedObject) { VersionedObject fo = (VersionedObject) f; return fo.getMajor() + "." + fo.getMinor(); } return null; } @PostConstruct private void postConstruct() { allTypes = typesProviderBean.getCSTypeMap(); confMap = confProviderBean.getConf(); //indexSearchEnabled = Boolean.valueOf(confMap.get("indexsearchenabled")); //minSearchQuerySize = Integer.valueOf(confMap.get("minsearchquerysize")); //indexTimer = Integer.valueOf(confMap.get("indextimer")); } private void initBeanMap() { beanMap = new HashMap<>(); beanMap.put(TypesProviderRemote.class.getSimpleName(), typesProviderBean); beanMap.put(ConfProviderRemote.class.getSimpleName(), confProviderBean); beanMap.put(PersistentObjectRemote.class.getSimpleName(), persistentObjectBean); beanMap.put(FolderRemote.class.getSimpleName(), folderBean); beanMap.put(ObjectTypeRemote.class.getSimpleName(), objectTypeBean); beanMap.put(EventAuditRemote.class.getSimpleName(), eventAuditBean); beanMap.put(EventLinkRemote.class.getSimpleName(), eventLinkBean); beanMap.put(ScheduleRemote.class.getSimpleName(), scheduleBean); beanMap.put(NotificationRemote.class.getSimpleName(), notificationBean); beanMap.put(IdentityRemote.class.getSimpleName(), identityBean); beanMap.put(MailGroupRemote.class.getSimpleName(), mailGroupBean); beanMap.put(SubscriptionRemote.class.getSimpleName(), subscriptionBean); beanMap.put(EventRemote.class.getSimpleName(), eventBean); beanMap.put(SubscriptionEventLinkRemote.class.getSimpleName(), subscriptionEventLinkBean); beanMap.put(UserRemote.class.getSimpleName(), userBean); beanMap.put(PermissionRemote.class.getSimpleName(), permissionBean); beanMap.put(AclRemote.class.getSimpleName(), aclBean); beanMap.put(LifecycleRemote.class.getSimpleName(), lifecycleBean); beanMap.put(VersionedObjectRemote.class.getSimpleName(), versionedObjectBean); beanMap.put(IndexQueueRemote.class.getSimpleName(), indexQueueBean); beanMap.put(IndexSingletonRemote.class.getSimpleName(), indexSingletonBean); beanMap.put(ContentRemote.class.getSimpleName(), contentBean); beanMap.put(QueryExecutorRemote.class.getSimpleName(), queryExecutorBean); beanMap.put(FolderedObjectRemote.class.getSimpleName(), folderedObjectBean); beanMap.put(BaseObjectRemote.class.getSimpleName(), baseObjectBean); beanMap.put(WorkflowTemplateRemote.class.getSimpleName(), workflowTemplateBean); beanMap.put(ActionRemote.class.getSimpleName(), actionBean); beanMap.put(WorkflowRemote.class.getSimpleName(), workflowBean); beanMap.put(SecuredObjectRemote.class.getSimpleName(), securedObjectBean); beanMap.put(GroupRemote.class.getSimpleName(), groupBean); beanMap.put(TaskRemote.class.getSimpleName(), taskBean); beanMap.put(TaskTemplateRemote.class.getSimpleName(), taskTemplateBean); beanMap.put(LifecycleStateRemote.class.getSimpleName(), lifecycleStateBean); beanMap.put(AttributeParamsRemote.class.getSimpleName(), attributeParamsBean); beanMap.put(ExternalTableRemote.class.getSimpleName(), externalTableBean); } }
31,779
0.747364
0.746578
1,133
27.046778
24.10774
199
false
false
0
0
0
0
0
0
1.995587
false
false
7
0906588d9724746ff928de512f6d004cdc008b4f
34,995,393,561,163
7e689be329d1aae9065b59c9549ee06fddecee3b
/platform/src/java/com/xcase/open/impl/simple/methods/DeleteUserEntitySecurityMethod.java
9fad857bf886c2b6be8c15984ad8484a976d58ca
[]
no_license
martinpg2001/xcase
https://github.com/martinpg2001/xcase
14564efa8160105ed2301a2c7ad79293a039414a
e530d16f951adbdde1694b0d837bfd6c6c9b7f6b
refs/heads/master
2023-08-22T14:28:40.712000
2023-08-01T03:52:35
2023-08-01T03:52:35
34,886,456
0
2
null
false
2022-12-12T02:45:28
2015-05-01T02:20:51
2021-12-19T15:48:06
2022-12-12T02:45:27
148,235
0
1
5
Java
false
false
/** * Copyright 2016 Xcase All rights reserved. */ package com.xcase.open.impl.simple.methods; import com.xcase.open.factories.OpenResponseFactory; import com.xcase.open.impl.simple.core.CommonApiWebProxy; import com.xcase.open.impl.simple.core.DeleteUserEntitySecurityentityType; import com.xcase.open.transputs.DeleteUserEntitySecurityRequest; import com.xcase.open.transputs.DeleteUserEntitySecurityResponse; import java.lang.invoke.*; import java.net.URL; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; /** * * @author martin */ public class DeleteUserEntitySecurityMethod extends BaseOpenMethod { /** * log4j object. */ protected static final Logger LOGGER = LogManager.getLogger(MethodHandles.lookup().lookupClass()); public DeleteUserEntitySecurityMethod() { super(); // LOGGER.debug("finishing DeleteUserEntitySecurityMethod()"); } public DeleteUserEntitySecurityResponse deleteUserEntitySecurity(DeleteUserEntitySecurityRequest deleteUserEntitySecurityRequest) { LOGGER.debug("starting deleteUserEntitySecurity()"); try { DeleteUserEntitySecurityResponse deleteUserEntitySecurityResponse = OpenResponseFactory.createDeleteUserEntitySecurityResponse(); DeleteUserEntitySecurityentityType deleteUserEntitySecurityentityType = deleteUserEntitySecurityRequest.getDeleteUserEntitySecurityentityType(); String entityId = deleteUserEntitySecurityRequest.getEntityId(); String[] userIds = deleteUserEntitySecurityRequest.getUserIds(); String parentEntityId = deleteUserEntitySecurityRequest.getParentEntityId(); CommonApiWebProxy commonApiWebProxy = new CommonApiWebProxy(new URL(swaggerApiUrl)); /* Invoke the DeleteUserEntitySecurityMethod() method */ // commonApiWebProxy.DeleteUserEntitySecurity(entityId, deleteUserEntitySecurityentityType, userIds, parentEntityId); // LOGGER.debug("deleted user entity security"); return deleteUserEntitySecurityResponse; } catch (Exception e) { LOGGER.warn("exception deleting user entity security: " + e.getMessage()); } return null; } }
UTF-8
Java
2,299
java
DeleteUserEntitySecurityMethod.java
Java
[ { "context": "pache.logging.log4j.Logger;\r\n\r\n/**\r\n *\r\n * @author martin\r\n */\r\npublic class DeleteUserEntitySecurityMethod e", "end": 589, "score": 0.8742641806602478, "start": 583, "tag": "USERNAME", "value": "martin" } ]
null
[]
/** * Copyright 2016 Xcase All rights reserved. */ package com.xcase.open.impl.simple.methods; import com.xcase.open.factories.OpenResponseFactory; import com.xcase.open.impl.simple.core.CommonApiWebProxy; import com.xcase.open.impl.simple.core.DeleteUserEntitySecurityentityType; import com.xcase.open.transputs.DeleteUserEntitySecurityRequest; import com.xcase.open.transputs.DeleteUserEntitySecurityResponse; import java.lang.invoke.*; import java.net.URL; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; /** * * @author martin */ public class DeleteUserEntitySecurityMethod extends BaseOpenMethod { /** * log4j object. */ protected static final Logger LOGGER = LogManager.getLogger(MethodHandles.lookup().lookupClass()); public DeleteUserEntitySecurityMethod() { super(); // LOGGER.debug("finishing DeleteUserEntitySecurityMethod()"); } public DeleteUserEntitySecurityResponse deleteUserEntitySecurity(DeleteUserEntitySecurityRequest deleteUserEntitySecurityRequest) { LOGGER.debug("starting deleteUserEntitySecurity()"); try { DeleteUserEntitySecurityResponse deleteUserEntitySecurityResponse = OpenResponseFactory.createDeleteUserEntitySecurityResponse(); DeleteUserEntitySecurityentityType deleteUserEntitySecurityentityType = deleteUserEntitySecurityRequest.getDeleteUserEntitySecurityentityType(); String entityId = deleteUserEntitySecurityRequest.getEntityId(); String[] userIds = deleteUserEntitySecurityRequest.getUserIds(); String parentEntityId = deleteUserEntitySecurityRequest.getParentEntityId(); CommonApiWebProxy commonApiWebProxy = new CommonApiWebProxy(new URL(swaggerApiUrl)); /* Invoke the DeleteUserEntitySecurityMethod() method */ // commonApiWebProxy.DeleteUserEntitySecurity(entityId, deleteUserEntitySecurityentityType, userIds, parentEntityId); // LOGGER.debug("deleted user entity security"); return deleteUserEntitySecurityResponse; } catch (Exception e) { LOGGER.warn("exception deleting user entity security: " + e.getMessage()); } return null; } }
2,299
0.736842
0.733797
51
43.07843
41.311749
156
false
false
0
0
0
0
0
0
0.54902
false
false
7
ee60a7f6c2416759d852c68e7d5a2df397953210
35,210,141,909,055
b0632ffa18f90714220667daecef21d1d4c85cd7
/src/main/java/com/example/test/model/Registration.java
c4383874800e3c9c8d4de6db41b63a8bd75aebad
[]
no_license
sh-siddharth/testProject
https://github.com/sh-siddharth/testProject
5b49b3d1afe515c32a33993bf4ba17fa72a2324e
bec20f9d32768e06a08b354fb84607a29ed91715
refs/heads/master
2020-03-20T04:49:44.028000
2018-06-13T11:39:24
2018-06-13T11:39:24
137,195,964
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.test.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.metamodel.StaticMetamodel; import org.springframework.stereotype.Component; @Entity public class Registration { @Id @GeneratedValue(strategy=GenerationType.SEQUENCE) private Long id; @Column(name="Name") private String name; @Column(name="Age") private String age; @Column(name="Address") private String address; public Registration() { } public Registration(Long id, String name, String age, String address) { super(); this.id = id; this.name = name; this.age = age; this.address = address; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAge() { return age; } public void setAge(String age) { this.age = age; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } @Override public String toString() { // TODO Auto-generated method stub String output = "Id is: "+ id + "|| Name is: "+name+"|| Age is:"+age+"|| Place is: "+address; return output; } }
UTF-8
Java
1,453
java
Registration.java
Java
[]
null
[]
package com.example.test.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.metamodel.StaticMetamodel; import org.springframework.stereotype.Component; @Entity public class Registration { @Id @GeneratedValue(strategy=GenerationType.SEQUENCE) private Long id; @Column(name="Name") private String name; @Column(name="Age") private String age; @Column(name="Address") private String address; public Registration() { } public Registration(Long id, String name, String age, String address) { super(); this.id = id; this.name = name; this.age = age; this.address = address; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAge() { return age; } public void setAge(String age) { this.age = age; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } @Override public String toString() { // TODO Auto-generated method stub String output = "Id is: "+ id + "|| Name is: "+name+"|| Age is:"+age+"|| Place is: "+address; return output; } }
1,453
0.663455
0.663455
79
17.392405
18.057865
97
false
false
0
0
0
0
0
0
0.455696
false
false
7
0b37d0888d6386f3431924fb1af0ce3b5cfd5424
36,902,359,018,672
947b01aa45e9f1072f80dbbb893c45d7cb3eb696
/EVETycoon/src/modules/gui/FuelPlannerPanel.java
2a6d619fc32ff7c8a7566601d327252c75abe388
[]
no_license
gcleric/Apps
https://github.com/gcleric/Apps
0a2f4ba99dbbb803dde5b7a3abe079bde9b38bb3
f223644d7f198302337cfb00d9534bb0f2f307e7
refs/heads/master
2016-08-05T00:36:20.686000
2011-09-29T19:24:20
2011-09-29T19:24:20
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * StarbaseStatusPanel.java * * Created on Sep 7, 2011, 12:23:18 PM */ package modules.gui; import com.beimin.eveapi.core.ApiException; import java.sql.SQLException; import java.util.ArrayList; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import modules.fuelplanner.FuelPlanner; import services.ApiData; import tables.BasicTableModel; /** * * @author hrivanov */ public class FuelPlannerPanel extends javax.swing.JPanel { private BasicTableModel fuelPlanListModel; private FuelPlanner fuelPlanner; private IconHeaderRenderer iconHeaderRenderer; private ListSelectionModel fuelPlanListSelModel; private Integer currIndex; private ArrayList<Integer> checkedIndexes; private DefaultCellRenderer defaultCellRenderer; private IconLabelRenderer iconLabelRenderer; /** Creates new form StarbaseStatusPanel */ public FuelPlannerPanel() { initComponents(); fuelPlanner = ApiData.getCurrFuelPlanner(); monthsTextField.setValue(fuelPlanner.getMonths()); weeksTextField.setValue(fuelPlanner.getWeeks()); daysTextField.setValue(fuelPlanner.getDays()); hoursTextField.setValue(fuelPlanner.getHours()); checkedIndexes = new ArrayList<Integer>(); iconHeaderRenderer = new IconHeaderRenderer(); fuelPlanListModel = fuelPlanner.getFuelPlanListModel(); fuelPlanListTable.setModel(fuelPlanListModel); iconLabelRenderer = new IconLabelRenderer(); defaultCellRenderer = new DefaultCellRenderer(); fuelPlanListTable.setDefaultRenderer(ImageIcon.class, iconLabelRenderer); fuelPlanListSelModel = fuelPlanListTable.getSelectionModel(); fuelPlanListSelModel.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) { return; } currIndex = fuelPlanListTable.getSelectedRow(); if(currIndex >= 0) { if((checkedIndexes.contains(currIndex))&&(fuelPlanDataTable.getRowCount() > 0)) { fuelPlanDataTable.clearSelection(); fuelPlanDataTable.addRowSelectionInterval(checkedIndexes.indexOf(currIndex) * 3 + 1,checkedIndexes.indexOf(currIndex) * 3 + 2); } } } }); fuelPlanDataTable.setModel(fuelPlanner.getFuelPlanDataModel()); for(int cnt = 0; cnt < fuelPlanDataTable.getColumnCount(); cnt++) { fuelPlanDataTable.getColumnModel().getColumn(cnt).setHeaderRenderer(iconHeaderRenderer); fuelPlanDataTable.getColumnModel().getColumn(cnt).setCellRenderer(defaultCellRenderer); } fuelPlanListTable.clearSelection(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { timeSettingPanel = new javax.swing.JPanel(); monthsLabel = new javax.swing.JLabel(); weeksLabel = new javax.swing.JLabel(); daysLabel = new javax.swing.JLabel(); hoursLabel = new javax.swing.JLabel(); monthsTextField = new javax.swing.JFormattedTextField(); weeksTextField = new javax.swing.JFormattedTextField(); daysTextField = new javax.swing.JFormattedTextField(); hoursTextField = new javax.swing.JFormattedTextField(); calculatePlanBtn = new javax.swing.JButton(); starbaseListPanel = new javax.swing.JPanel(); fuelPlannerListScrollPane = new javax.swing.JScrollPane(); fuelPlanListTable = new javax.swing.JTable(); starbaseFuelPanel = new javax.swing.JPanel(); fuelsTabbedPane = new javax.swing.JTabbedPane(); fuelPlannerDataScrollPane = new javax.swing.JScrollPane(); fuelPlanDataTable = new javax.swing.JTable(); storedFuelsPanel1 = new modules.gui.StoredFuelsPanel(); starbaseCtrlPanel = new javax.swing.JPanel(); addTowerBtn = new javax.swing.JButton(); removeTowerBtn = new javax.swing.JButton(); importBtn = new javax.swing.JButton(); clearBtn = new javax.swing.JButton(); setName("Form"); // NOI18N setPreferredSize(new java.awt.Dimension(656, 553)); addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { formFocusGained(evt); } }); org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(evetycoon.EveTycoonApp.class).getContext().getResourceMap(FuelPlannerPanel.class); timeSettingPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED), resourceMap.getString("timeSettingPanel.border.title"))); // NOI18N timeSettingPanel.setName("timeSettingPanel"); // NOI18N monthsLabel.setText(resourceMap.getString("monthsLabel.text")); // NOI18N monthsLabel.setName("monthsLabel"); // NOI18N weeksLabel.setText(resourceMap.getString("weeksLabel.text")); // NOI18N weeksLabel.setName("weeksLabel"); // NOI18N daysLabel.setText(resourceMap.getString("daysLabel.text")); // NOI18N daysLabel.setName("daysLabel"); // NOI18N hoursLabel.setText(resourceMap.getString("hoursLabel.text")); // NOI18N hoursLabel.setName("hoursLabel"); // NOI18N monthsTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0")))); monthsTextField.setHorizontalAlignment(javax.swing.JTextField.RIGHT); monthsTextField.setText(resourceMap.getString("monthsTextField.text")); // NOI18N monthsTextField.setName("monthsTextField"); // NOI18N weeksTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0")))); weeksTextField.setHorizontalAlignment(javax.swing.JTextField.RIGHT); weeksTextField.setText(resourceMap.getString("weeksTextField.text")); // NOI18N weeksTextField.setName("weeksTextField"); // NOI18N daysTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0")))); daysTextField.setHorizontalAlignment(javax.swing.JTextField.RIGHT); daysTextField.setText(resourceMap.getString("daysTextField.text")); // NOI18N daysTextField.setName("daysTextField"); // NOI18N hoursTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0")))); hoursTextField.setHorizontalAlignment(javax.swing.JTextField.RIGHT); hoursTextField.setText(resourceMap.getString("hoursTextField.text")); // NOI18N hoursTextField.setName("hoursTextField"); // NOI18N calculatePlanBtn.setText(resourceMap.getString("calculatePlanBtn.text")); // NOI18N calculatePlanBtn.setName("calculatePlanBtn"); // NOI18N calculatePlanBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { calculatePlanBtnActionPerformed(evt); } }); javax.swing.GroupLayout timeSettingPanelLayout = new javax.swing.GroupLayout(timeSettingPanel); timeSettingPanel.setLayout(timeSettingPanelLayout); timeSettingPanelLayout.setHorizontalGroup( timeSettingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, timeSettingPanelLayout.createSequentialGroup() .addContainerGap() .addGroup(timeSettingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(calculatePlanBtn) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, timeSettingPanelLayout.createSequentialGroup() .addComponent(monthsTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(weeksTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(daysTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(hoursTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, timeSettingPanelLayout.createSequentialGroup() .addComponent(monthsLabel) .addGap(10, 10, 10) .addComponent(weeksLabel) .addGap(6, 6, 6) .addComponent(daysLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(hoursLabel))) .addContainerGap()) ); timeSettingPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {daysLabel, hoursLabel, monthsLabel, weeksLabel}); timeSettingPanelLayout.setVerticalGroup( timeSettingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(timeSettingPanelLayout.createSequentialGroup() .addGroup(timeSettingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(weeksLabel) .addComponent(daysLabel) .addComponent(hoursLabel) .addComponent(monthsLabel)) .addGap(1, 1, 1) .addGroup(timeSettingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(monthsTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(weeksTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(daysTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(hoursTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(calculatePlanBtn) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); starbaseListPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED), resourceMap.getString("starbaseListPanel.border.title"))); // NOI18N starbaseListPanel.setName("starbaseListPanel"); // NOI18N fuelPlannerListScrollPane.setName("fuelPlannerListScrollPane"); // NOI18N fuelPlanListTable.setBackground(resourceMap.getColor("fuelPlanListTable.background")); // NOI18N fuelPlanListTable.setForeground(resourceMap.getColor("fuelPlanListTable.foreground")); // NOI18N fuelPlanListTable.setFillsViewportHeight(true); fuelPlanListTable.setGridColor(resourceMap.getColor("fuelPlanListTable.gridColor")); // NOI18N fuelPlanListTable.setName("fuelPlanListTable"); // NOI18N fuelPlanListTable.setRowHeight(32); fuelPlanListTable.setSelectionBackground(resourceMap.getColor("defaultTable.selectionBackground")); // NOI18N fuelPlanListTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); fuelPlannerListScrollPane.setViewportView(fuelPlanListTable); javax.swing.GroupLayout starbaseListPanelLayout = new javax.swing.GroupLayout(starbaseListPanel); starbaseListPanel.setLayout(starbaseListPanelLayout); starbaseListPanelLayout.setHorizontalGroup( starbaseListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(starbaseListPanelLayout.createSequentialGroup() .addContainerGap() .addComponent(fuelPlannerListScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) .addContainerGap()) ); starbaseListPanelLayout.setVerticalGroup( starbaseListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(starbaseListPanelLayout.createSequentialGroup() .addComponent(fuelPlannerListScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 164, Short.MAX_VALUE) .addContainerGap()) ); starbaseFuelPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED), resourceMap.getString("starbaseFuelPanel.border.title"))); // NOI18N starbaseFuelPanel.setName("starbaseFuelPanel"); // NOI18N starbaseFuelPanel.setRequestFocusEnabled(false); fuelsTabbedPane.setName("fuelsTabbedPane"); // NOI18N fuelPlannerDataScrollPane.setName("fuelPlannerDataScrollPane"); // NOI18N fuelPlanDataTable.setBackground(resourceMap.getColor("fuelPlanDataTable.background")); // NOI18N fuelPlanDataTable.setForeground(resourceMap.getColor("fuelPlanDataTable.foreground")); // NOI18N fuelPlanDataTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {}, {}, {}, {}, {}, {}, {} }, new String [] { } )); fuelPlanDataTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS); fuelPlanDataTable.setFillsViewportHeight(true); fuelPlanDataTable.setGridColor(resourceMap.getColor("fuelPlanDataTable.gridColor")); // NOI18N fuelPlanDataTable.setName("fuelPlanDataTable"); // NOI18N fuelPlanDataTable.setSelectionBackground(resourceMap.getColor("defaultTable.selectionBackground")); // NOI18N fuelPlanDataTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_INTERVAL_SELECTION); fuelPlannerDataScrollPane.setViewportView(fuelPlanDataTable); fuelsTabbedPane.addTab(resourceMap.getString("fuelPlannerDataScrollPane.TabConstraints.tabTitle"), fuelPlannerDataScrollPane); // NOI18N storedFuelsPanel1.setName("storedFuelsPanel1"); // NOI18N fuelsTabbedPane.addTab(resourceMap.getString("storedFuelsPanel1.TabConstraints.tabTitle"), storedFuelsPanel1); // NOI18N javax.swing.GroupLayout starbaseFuelPanelLayout = new javax.swing.GroupLayout(starbaseFuelPanel); starbaseFuelPanel.setLayout(starbaseFuelPanelLayout); starbaseFuelPanelLayout.setHorizontalGroup( starbaseFuelPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(fuelsTabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 624, Short.MAX_VALUE) ); starbaseFuelPanelLayout.setVerticalGroup( starbaseFuelPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(fuelsTabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 309, Short.MAX_VALUE) ); starbaseCtrlPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED), resourceMap.getString("starbaseCtrlPanel.border.title"))); // NOI18N starbaseCtrlPanel.setName("starbaseCtrlPanel"); // NOI18N addTowerBtn.setText(resourceMap.getString("addTowerBtn.text")); // NOI18N addTowerBtn.setName("addTowerBtn"); // NOI18N addTowerBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { addTowerBtnActionPerformed(evt); } }); removeTowerBtn.setText(resourceMap.getString("removeTowerBtn.text")); // NOI18N removeTowerBtn.setName("removeTowerBtn"); // NOI18N removeTowerBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { removeTowerBtnActionPerformed(evt); } }); importBtn.setText(resourceMap.getString("importBtn.text")); // NOI18N importBtn.setName("importBtn"); // NOI18N importBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { importBtnActionPerformed(evt); } }); clearBtn.setText(resourceMap.getString("clearBtn.text")); // NOI18N clearBtn.setName("clearBtn"); // NOI18N clearBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { clearBtnActionPerformed(evt); } }); javax.swing.GroupLayout starbaseCtrlPanelLayout = new javax.swing.GroupLayout(starbaseCtrlPanel); starbaseCtrlPanel.setLayout(starbaseCtrlPanelLayout); starbaseCtrlPanelLayout.setHorizontalGroup( starbaseCtrlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(starbaseCtrlPanelLayout.createSequentialGroup() .addContainerGap() .addGroup(starbaseCtrlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(clearBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(importBtn)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(starbaseCtrlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(addTowerBtn, javax.swing.GroupLayout.DEFAULT_SIZE, 73, Short.MAX_VALUE) .addComponent(removeTowerBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(24, 24, 24)) ); starbaseCtrlPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {addTowerBtn, importBtn, removeTowerBtn}); starbaseCtrlPanelLayout.setVerticalGroup( starbaseCtrlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(starbaseCtrlPanelLayout.createSequentialGroup() .addGroup(starbaseCtrlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(importBtn) .addComponent(addTowerBtn)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(starbaseCtrlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(clearBtn) .addComponent(removeTowerBtn)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(starbaseFuelPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(starbaseListPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(starbaseCtrlPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(timeSettingPanel, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(starbaseCtrlPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(timeSettingPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(starbaseListPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(starbaseFuelPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); }// </editor-fold>//GEN-END:initComponents private void calculatePlanBtnActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_calculatePlanBtnActionPerformed {//GEN-HEADEREND:event_calculatePlanBtnActionPerformed checkedIndexes.clear(); for(int cnt = 0; cnt < fuelPlanListModel.getRowCount(); cnt++) { if(((Boolean)fuelPlanListModel.getValueAt(cnt, 0))) { fuelPlanner.setPlanActivation(cnt, true); checkedIndexes.add(cnt); } else fuelPlanner.setPlanActivation(cnt, false); } if(fuelPlanner.isEmpty()) return; int months = 0; int weeks = 0; int days = 0; int hours = 0; if(monthsTextField.getValue() != null) months = ((Long)monthsTextField.getValue()).intValue(); if(weeksTextField.getValue() != null) weeks = ((Long)weeksTextField.getValue()).intValue(); if(daysTextField.getValue() != null) days = ((Long)daysTextField.getValue()).intValue(); if(hoursTextField.getValue() != null) hours = ((Long)hoursTextField.getValue()).intValue(); try { fuelPlanner.calculatePlans(months, weeks, days, hours); fuelPlanDataTable.setModel(fuelPlanner.getFuelPlanDataModel()); for(int cnt = 0; cnt < fuelPlanDataTable.getColumnCount(); cnt++) { fuelPlanDataTable.getColumnModel().getColumn(cnt).setHeaderRenderer(iconHeaderRenderer); fuelPlanDataTable.getColumnModel().getColumn(cnt).setCellRenderer(defaultCellRenderer); } fuelPlanListTable.clearSelection(); } catch (SQLException sqlEx) { JOptionPane.showMessageDialog(this, sqlEx.getMessage(), "Exception", JOptionPane.ERROR_MESSAGE); } catch (ApiException apiEx) { JOptionPane.showMessageDialog(this, apiEx.getMessage(), "Exception", JOptionPane.ERROR_MESSAGE); } }//GEN-LAST:event_calculatePlanBtnActionPerformed private void formFocusGained(java.awt.event.FocusEvent evt)//GEN-FIRST:event_formFocusGained {//GEN-HEADEREND:event_formFocusGained }//GEN-LAST:event_formFocusGained private void removeTowerBtnActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_removeTowerBtnActionPerformed {//GEN-HEADEREND:event_removeTowerBtnActionPerformed if(fuelPlanListTable.getSelectedRow() >= 0) { fuelPlanner.removeStarbase(fuelPlanListTable.getSelectedRow()); if(checkedIndexes.contains(((Integer)fuelPlanListTable.getSelectedRow()))) checkedIndexes.remove(((Integer)fuelPlanListTable.getSelectedRow())); } }//GEN-LAST:event_removeTowerBtnActionPerformed private void addTowerBtnActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_addTowerBtnActionPerformed {//GEN-HEADEREND:event_addTowerBtnActionPerformed GenericStarbaseDlg newGenDlg = new GenericStarbaseDlg(JFrame.getFrames()[0], true); newGenDlg.setFuelPlanner(fuelPlanner); newGenDlg.setVisible(true); }//GEN-LAST:event_addTowerBtnActionPerformed private void importBtnActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_importBtnActionPerformed {//GEN-HEADEREND:event_importBtnActionPerformed fuelPlanner.importStarbaseList(ApiData.getCurrStarbaseInfo().getStarbaseList()); }//GEN-LAST:event_importBtnActionPerformed private void clearBtnActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_clearBtnActionPerformed {//GEN-HEADEREND:event_clearBtnActionPerformed fuelPlanner.clearAllFuelPlans(); }//GEN-LAST:event_clearBtnActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton addTowerBtn; private javax.swing.JButton calculatePlanBtn; private javax.swing.JButton clearBtn; private javax.swing.JLabel daysLabel; private javax.swing.JFormattedTextField daysTextField; private javax.swing.JTable fuelPlanDataTable; private javax.swing.JTable fuelPlanListTable; private javax.swing.JScrollPane fuelPlannerDataScrollPane; private javax.swing.JScrollPane fuelPlannerListScrollPane; private javax.swing.JTabbedPane fuelsTabbedPane; private javax.swing.JLabel hoursLabel; private javax.swing.JFormattedTextField hoursTextField; private javax.swing.JButton importBtn; private javax.swing.JLabel monthsLabel; private javax.swing.JFormattedTextField monthsTextField; private javax.swing.JButton removeTowerBtn; private javax.swing.JPanel starbaseCtrlPanel; private javax.swing.JPanel starbaseFuelPanel; private javax.swing.JPanel starbaseListPanel; private modules.gui.StoredFuelsPanel storedFuelsPanel1; private javax.swing.JPanel timeSettingPanel; private javax.swing.JLabel weeksLabel; private javax.swing.JFormattedTextField weeksTextField; // End of variables declaration//GEN-END:variables public void valueChanged(ListSelectionEvent e) { throw new UnsupportedOperationException("Not supported yet."); } }
UTF-8
Java
26,670
java
FuelPlannerPanel.java
Java
[ { "context": "\nimport tables.BasicTableModel;\n\n/**\n *\n * @author hrivanov\n */\npublic class FuelPlannerPanel extends javax.s", "end": 646, "score": 0.9979631304740906, "start": 638, "tag": "USERNAME", "value": "hrivanov" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * StarbaseStatusPanel.java * * Created on Sep 7, 2011, 12:23:18 PM */ package modules.gui; import com.beimin.eveapi.core.ApiException; import java.sql.SQLException; import java.util.ArrayList; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import modules.fuelplanner.FuelPlanner; import services.ApiData; import tables.BasicTableModel; /** * * @author hrivanov */ public class FuelPlannerPanel extends javax.swing.JPanel { private BasicTableModel fuelPlanListModel; private FuelPlanner fuelPlanner; private IconHeaderRenderer iconHeaderRenderer; private ListSelectionModel fuelPlanListSelModel; private Integer currIndex; private ArrayList<Integer> checkedIndexes; private DefaultCellRenderer defaultCellRenderer; private IconLabelRenderer iconLabelRenderer; /** Creates new form StarbaseStatusPanel */ public FuelPlannerPanel() { initComponents(); fuelPlanner = ApiData.getCurrFuelPlanner(); monthsTextField.setValue(fuelPlanner.getMonths()); weeksTextField.setValue(fuelPlanner.getWeeks()); daysTextField.setValue(fuelPlanner.getDays()); hoursTextField.setValue(fuelPlanner.getHours()); checkedIndexes = new ArrayList<Integer>(); iconHeaderRenderer = new IconHeaderRenderer(); fuelPlanListModel = fuelPlanner.getFuelPlanListModel(); fuelPlanListTable.setModel(fuelPlanListModel); iconLabelRenderer = new IconLabelRenderer(); defaultCellRenderer = new DefaultCellRenderer(); fuelPlanListTable.setDefaultRenderer(ImageIcon.class, iconLabelRenderer); fuelPlanListSelModel = fuelPlanListTable.getSelectionModel(); fuelPlanListSelModel.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) { return; } currIndex = fuelPlanListTable.getSelectedRow(); if(currIndex >= 0) { if((checkedIndexes.contains(currIndex))&&(fuelPlanDataTable.getRowCount() > 0)) { fuelPlanDataTable.clearSelection(); fuelPlanDataTable.addRowSelectionInterval(checkedIndexes.indexOf(currIndex) * 3 + 1,checkedIndexes.indexOf(currIndex) * 3 + 2); } } } }); fuelPlanDataTable.setModel(fuelPlanner.getFuelPlanDataModel()); for(int cnt = 0; cnt < fuelPlanDataTable.getColumnCount(); cnt++) { fuelPlanDataTable.getColumnModel().getColumn(cnt).setHeaderRenderer(iconHeaderRenderer); fuelPlanDataTable.getColumnModel().getColumn(cnt).setCellRenderer(defaultCellRenderer); } fuelPlanListTable.clearSelection(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { timeSettingPanel = new javax.swing.JPanel(); monthsLabel = new javax.swing.JLabel(); weeksLabel = new javax.swing.JLabel(); daysLabel = new javax.swing.JLabel(); hoursLabel = new javax.swing.JLabel(); monthsTextField = new javax.swing.JFormattedTextField(); weeksTextField = new javax.swing.JFormattedTextField(); daysTextField = new javax.swing.JFormattedTextField(); hoursTextField = new javax.swing.JFormattedTextField(); calculatePlanBtn = new javax.swing.JButton(); starbaseListPanel = new javax.swing.JPanel(); fuelPlannerListScrollPane = new javax.swing.JScrollPane(); fuelPlanListTable = new javax.swing.JTable(); starbaseFuelPanel = new javax.swing.JPanel(); fuelsTabbedPane = new javax.swing.JTabbedPane(); fuelPlannerDataScrollPane = new javax.swing.JScrollPane(); fuelPlanDataTable = new javax.swing.JTable(); storedFuelsPanel1 = new modules.gui.StoredFuelsPanel(); starbaseCtrlPanel = new javax.swing.JPanel(); addTowerBtn = new javax.swing.JButton(); removeTowerBtn = new javax.swing.JButton(); importBtn = new javax.swing.JButton(); clearBtn = new javax.swing.JButton(); setName("Form"); // NOI18N setPreferredSize(new java.awt.Dimension(656, 553)); addFocusListener(new java.awt.event.FocusAdapter() { public void focusGained(java.awt.event.FocusEvent evt) { formFocusGained(evt); } }); org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(evetycoon.EveTycoonApp.class).getContext().getResourceMap(FuelPlannerPanel.class); timeSettingPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED), resourceMap.getString("timeSettingPanel.border.title"))); // NOI18N timeSettingPanel.setName("timeSettingPanel"); // NOI18N monthsLabel.setText(resourceMap.getString("monthsLabel.text")); // NOI18N monthsLabel.setName("monthsLabel"); // NOI18N weeksLabel.setText(resourceMap.getString("weeksLabel.text")); // NOI18N weeksLabel.setName("weeksLabel"); // NOI18N daysLabel.setText(resourceMap.getString("daysLabel.text")); // NOI18N daysLabel.setName("daysLabel"); // NOI18N hoursLabel.setText(resourceMap.getString("hoursLabel.text")); // NOI18N hoursLabel.setName("hoursLabel"); // NOI18N monthsTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0")))); monthsTextField.setHorizontalAlignment(javax.swing.JTextField.RIGHT); monthsTextField.setText(resourceMap.getString("monthsTextField.text")); // NOI18N monthsTextField.setName("monthsTextField"); // NOI18N weeksTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0")))); weeksTextField.setHorizontalAlignment(javax.swing.JTextField.RIGHT); weeksTextField.setText(resourceMap.getString("weeksTextField.text")); // NOI18N weeksTextField.setName("weeksTextField"); // NOI18N daysTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0")))); daysTextField.setHorizontalAlignment(javax.swing.JTextField.RIGHT); daysTextField.setText(resourceMap.getString("daysTextField.text")); // NOI18N daysTextField.setName("daysTextField"); // NOI18N hoursTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0")))); hoursTextField.setHorizontalAlignment(javax.swing.JTextField.RIGHT); hoursTextField.setText(resourceMap.getString("hoursTextField.text")); // NOI18N hoursTextField.setName("hoursTextField"); // NOI18N calculatePlanBtn.setText(resourceMap.getString("calculatePlanBtn.text")); // NOI18N calculatePlanBtn.setName("calculatePlanBtn"); // NOI18N calculatePlanBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { calculatePlanBtnActionPerformed(evt); } }); javax.swing.GroupLayout timeSettingPanelLayout = new javax.swing.GroupLayout(timeSettingPanel); timeSettingPanel.setLayout(timeSettingPanelLayout); timeSettingPanelLayout.setHorizontalGroup( timeSettingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, timeSettingPanelLayout.createSequentialGroup() .addContainerGap() .addGroup(timeSettingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(calculatePlanBtn) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, timeSettingPanelLayout.createSequentialGroup() .addComponent(monthsTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(weeksTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(daysTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(hoursTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, timeSettingPanelLayout.createSequentialGroup() .addComponent(monthsLabel) .addGap(10, 10, 10) .addComponent(weeksLabel) .addGap(6, 6, 6) .addComponent(daysLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(hoursLabel))) .addContainerGap()) ); timeSettingPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {daysLabel, hoursLabel, monthsLabel, weeksLabel}); timeSettingPanelLayout.setVerticalGroup( timeSettingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(timeSettingPanelLayout.createSequentialGroup() .addGroup(timeSettingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(weeksLabel) .addComponent(daysLabel) .addComponent(hoursLabel) .addComponent(monthsLabel)) .addGap(1, 1, 1) .addGroup(timeSettingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(monthsTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(weeksTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(daysTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(hoursTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(calculatePlanBtn) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); starbaseListPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED), resourceMap.getString("starbaseListPanel.border.title"))); // NOI18N starbaseListPanel.setName("starbaseListPanel"); // NOI18N fuelPlannerListScrollPane.setName("fuelPlannerListScrollPane"); // NOI18N fuelPlanListTable.setBackground(resourceMap.getColor("fuelPlanListTable.background")); // NOI18N fuelPlanListTable.setForeground(resourceMap.getColor("fuelPlanListTable.foreground")); // NOI18N fuelPlanListTable.setFillsViewportHeight(true); fuelPlanListTable.setGridColor(resourceMap.getColor("fuelPlanListTable.gridColor")); // NOI18N fuelPlanListTable.setName("fuelPlanListTable"); // NOI18N fuelPlanListTable.setRowHeight(32); fuelPlanListTable.setSelectionBackground(resourceMap.getColor("defaultTable.selectionBackground")); // NOI18N fuelPlanListTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); fuelPlannerListScrollPane.setViewportView(fuelPlanListTable); javax.swing.GroupLayout starbaseListPanelLayout = new javax.swing.GroupLayout(starbaseListPanel); starbaseListPanel.setLayout(starbaseListPanelLayout); starbaseListPanelLayout.setHorizontalGroup( starbaseListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(starbaseListPanelLayout.createSequentialGroup() .addContainerGap() .addComponent(fuelPlannerListScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) .addContainerGap()) ); starbaseListPanelLayout.setVerticalGroup( starbaseListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(starbaseListPanelLayout.createSequentialGroup() .addComponent(fuelPlannerListScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 164, Short.MAX_VALUE) .addContainerGap()) ); starbaseFuelPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED), resourceMap.getString("starbaseFuelPanel.border.title"))); // NOI18N starbaseFuelPanel.setName("starbaseFuelPanel"); // NOI18N starbaseFuelPanel.setRequestFocusEnabled(false); fuelsTabbedPane.setName("fuelsTabbedPane"); // NOI18N fuelPlannerDataScrollPane.setName("fuelPlannerDataScrollPane"); // NOI18N fuelPlanDataTable.setBackground(resourceMap.getColor("fuelPlanDataTable.background")); // NOI18N fuelPlanDataTable.setForeground(resourceMap.getColor("fuelPlanDataTable.foreground")); // NOI18N fuelPlanDataTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {}, {}, {}, {}, {}, {}, {} }, new String [] { } )); fuelPlanDataTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS); fuelPlanDataTable.setFillsViewportHeight(true); fuelPlanDataTable.setGridColor(resourceMap.getColor("fuelPlanDataTable.gridColor")); // NOI18N fuelPlanDataTable.setName("fuelPlanDataTable"); // NOI18N fuelPlanDataTable.setSelectionBackground(resourceMap.getColor("defaultTable.selectionBackground")); // NOI18N fuelPlanDataTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_INTERVAL_SELECTION); fuelPlannerDataScrollPane.setViewportView(fuelPlanDataTable); fuelsTabbedPane.addTab(resourceMap.getString("fuelPlannerDataScrollPane.TabConstraints.tabTitle"), fuelPlannerDataScrollPane); // NOI18N storedFuelsPanel1.setName("storedFuelsPanel1"); // NOI18N fuelsTabbedPane.addTab(resourceMap.getString("storedFuelsPanel1.TabConstraints.tabTitle"), storedFuelsPanel1); // NOI18N javax.swing.GroupLayout starbaseFuelPanelLayout = new javax.swing.GroupLayout(starbaseFuelPanel); starbaseFuelPanel.setLayout(starbaseFuelPanelLayout); starbaseFuelPanelLayout.setHorizontalGroup( starbaseFuelPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(fuelsTabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 624, Short.MAX_VALUE) ); starbaseFuelPanelLayout.setVerticalGroup( starbaseFuelPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(fuelsTabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 309, Short.MAX_VALUE) ); starbaseCtrlPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED), resourceMap.getString("starbaseCtrlPanel.border.title"))); // NOI18N starbaseCtrlPanel.setName("starbaseCtrlPanel"); // NOI18N addTowerBtn.setText(resourceMap.getString("addTowerBtn.text")); // NOI18N addTowerBtn.setName("addTowerBtn"); // NOI18N addTowerBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { addTowerBtnActionPerformed(evt); } }); removeTowerBtn.setText(resourceMap.getString("removeTowerBtn.text")); // NOI18N removeTowerBtn.setName("removeTowerBtn"); // NOI18N removeTowerBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { removeTowerBtnActionPerformed(evt); } }); importBtn.setText(resourceMap.getString("importBtn.text")); // NOI18N importBtn.setName("importBtn"); // NOI18N importBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { importBtnActionPerformed(evt); } }); clearBtn.setText(resourceMap.getString("clearBtn.text")); // NOI18N clearBtn.setName("clearBtn"); // NOI18N clearBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { clearBtnActionPerformed(evt); } }); javax.swing.GroupLayout starbaseCtrlPanelLayout = new javax.swing.GroupLayout(starbaseCtrlPanel); starbaseCtrlPanel.setLayout(starbaseCtrlPanelLayout); starbaseCtrlPanelLayout.setHorizontalGroup( starbaseCtrlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(starbaseCtrlPanelLayout.createSequentialGroup() .addContainerGap() .addGroup(starbaseCtrlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(clearBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(importBtn)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(starbaseCtrlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(addTowerBtn, javax.swing.GroupLayout.DEFAULT_SIZE, 73, Short.MAX_VALUE) .addComponent(removeTowerBtn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(24, 24, 24)) ); starbaseCtrlPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {addTowerBtn, importBtn, removeTowerBtn}); starbaseCtrlPanelLayout.setVerticalGroup( starbaseCtrlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(starbaseCtrlPanelLayout.createSequentialGroup() .addGroup(starbaseCtrlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(importBtn) .addComponent(addTowerBtn)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(starbaseCtrlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(clearBtn) .addComponent(removeTowerBtn)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(starbaseFuelPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(starbaseListPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(starbaseCtrlPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(timeSettingPanel, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(starbaseCtrlPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(timeSettingPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(starbaseListPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(starbaseFuelPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); }// </editor-fold>//GEN-END:initComponents private void calculatePlanBtnActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_calculatePlanBtnActionPerformed {//GEN-HEADEREND:event_calculatePlanBtnActionPerformed checkedIndexes.clear(); for(int cnt = 0; cnt < fuelPlanListModel.getRowCount(); cnt++) { if(((Boolean)fuelPlanListModel.getValueAt(cnt, 0))) { fuelPlanner.setPlanActivation(cnt, true); checkedIndexes.add(cnt); } else fuelPlanner.setPlanActivation(cnt, false); } if(fuelPlanner.isEmpty()) return; int months = 0; int weeks = 0; int days = 0; int hours = 0; if(monthsTextField.getValue() != null) months = ((Long)monthsTextField.getValue()).intValue(); if(weeksTextField.getValue() != null) weeks = ((Long)weeksTextField.getValue()).intValue(); if(daysTextField.getValue() != null) days = ((Long)daysTextField.getValue()).intValue(); if(hoursTextField.getValue() != null) hours = ((Long)hoursTextField.getValue()).intValue(); try { fuelPlanner.calculatePlans(months, weeks, days, hours); fuelPlanDataTable.setModel(fuelPlanner.getFuelPlanDataModel()); for(int cnt = 0; cnt < fuelPlanDataTable.getColumnCount(); cnt++) { fuelPlanDataTable.getColumnModel().getColumn(cnt).setHeaderRenderer(iconHeaderRenderer); fuelPlanDataTable.getColumnModel().getColumn(cnt).setCellRenderer(defaultCellRenderer); } fuelPlanListTable.clearSelection(); } catch (SQLException sqlEx) { JOptionPane.showMessageDialog(this, sqlEx.getMessage(), "Exception", JOptionPane.ERROR_MESSAGE); } catch (ApiException apiEx) { JOptionPane.showMessageDialog(this, apiEx.getMessage(), "Exception", JOptionPane.ERROR_MESSAGE); } }//GEN-LAST:event_calculatePlanBtnActionPerformed private void formFocusGained(java.awt.event.FocusEvent evt)//GEN-FIRST:event_formFocusGained {//GEN-HEADEREND:event_formFocusGained }//GEN-LAST:event_formFocusGained private void removeTowerBtnActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_removeTowerBtnActionPerformed {//GEN-HEADEREND:event_removeTowerBtnActionPerformed if(fuelPlanListTable.getSelectedRow() >= 0) { fuelPlanner.removeStarbase(fuelPlanListTable.getSelectedRow()); if(checkedIndexes.contains(((Integer)fuelPlanListTable.getSelectedRow()))) checkedIndexes.remove(((Integer)fuelPlanListTable.getSelectedRow())); } }//GEN-LAST:event_removeTowerBtnActionPerformed private void addTowerBtnActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_addTowerBtnActionPerformed {//GEN-HEADEREND:event_addTowerBtnActionPerformed GenericStarbaseDlg newGenDlg = new GenericStarbaseDlg(JFrame.getFrames()[0], true); newGenDlg.setFuelPlanner(fuelPlanner); newGenDlg.setVisible(true); }//GEN-LAST:event_addTowerBtnActionPerformed private void importBtnActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_importBtnActionPerformed {//GEN-HEADEREND:event_importBtnActionPerformed fuelPlanner.importStarbaseList(ApiData.getCurrStarbaseInfo().getStarbaseList()); }//GEN-LAST:event_importBtnActionPerformed private void clearBtnActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_clearBtnActionPerformed {//GEN-HEADEREND:event_clearBtnActionPerformed fuelPlanner.clearAllFuelPlans(); }//GEN-LAST:event_clearBtnActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton addTowerBtn; private javax.swing.JButton calculatePlanBtn; private javax.swing.JButton clearBtn; private javax.swing.JLabel daysLabel; private javax.swing.JFormattedTextField daysTextField; private javax.swing.JTable fuelPlanDataTable; private javax.swing.JTable fuelPlanListTable; private javax.swing.JScrollPane fuelPlannerDataScrollPane; private javax.swing.JScrollPane fuelPlannerListScrollPane; private javax.swing.JTabbedPane fuelsTabbedPane; private javax.swing.JLabel hoursLabel; private javax.swing.JFormattedTextField hoursTextField; private javax.swing.JButton importBtn; private javax.swing.JLabel monthsLabel; private javax.swing.JFormattedTextField monthsTextField; private javax.swing.JButton removeTowerBtn; private javax.swing.JPanel starbaseCtrlPanel; private javax.swing.JPanel starbaseFuelPanel; private javax.swing.JPanel starbaseListPanel; private modules.gui.StoredFuelsPanel storedFuelsPanel1; private javax.swing.JPanel timeSettingPanel; private javax.swing.JLabel weeksLabel; private javax.swing.JFormattedTextField weeksTextField; // End of variables declaration//GEN-END:variables public void valueChanged(ListSelectionEvent e) { throw new UnsupportedOperationException("Not supported yet."); } }
26,670
0.754181
0.747057
536
48.757462
41.906891
231
false
false
0
0
0
0
0
0
0.669776
false
false
7
60978ab90cbc7c70f0cd5258fec944d8c8d23523
22,316,650,138,478
fc97069a0b4701fd7ee5d489e94abbfdba273066
/src/main/java/com/google/android/gms/internal/measurement/zzbo.java
a6c08532eb39a3c5be55891f598e90a9547981a5
[]
no_license
bellmit/zycami-ded
https://github.com/bellmit/zycami-ded
8604f1eb24fb767e4cf499e019d6e4568451bb4b
27686ca846de6d164692c81bac2ae7f85710361f
refs/heads/main
2023-06-17T20:36:29.589000
2021-07-19T18:58:18
2021-07-19T18:58:18
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Decompiled with CFR 0.151. * * Could not load the following classes: * android.app.Activity */ package com.google.android.gms.internal.measurement; import android.app.Activity; import com.google.android.gms.dynamic.IObjectWrapper; import com.google.android.gms.dynamic.ObjectWrapper; import com.google.android.gms.internal.measurement.zzbg; import com.google.android.gms.internal.measurement.zzbq; import com.google.android.gms.internal.measurement.zzbr; import com.google.android.gms.internal.measurement.zzm; import com.google.android.gms.internal.measurement.zzp; public final class zzbo extends zzbg { public final /* synthetic */ Activity zza; public final /* synthetic */ zzm zzb; public final /* synthetic */ zzbq zzc; public zzbo(zzbq object, Activity activity, zzm zzm2) { this.zzc = object; this.zza = activity; this.zzb = zzm2; object = ((zzbq)object).zza; super((zzbr)object, true); } public final void zza() { zzp zzp2 = zzbr.zzR(this.zzc.zza); IObjectWrapper iObjectWrapper = ObjectWrapper.wrap(this.zza); zzm zzm2 = this.zzb; long l10 = this.zzi; zzp2.onActivitySaveInstanceState(iObjectWrapper, zzm2, l10); } }
UTF-8
Java
1,252
java
zzbo.java
Java
[]
null
[]
/* * Decompiled with CFR 0.151. * * Could not load the following classes: * android.app.Activity */ package com.google.android.gms.internal.measurement; import android.app.Activity; import com.google.android.gms.dynamic.IObjectWrapper; import com.google.android.gms.dynamic.ObjectWrapper; import com.google.android.gms.internal.measurement.zzbg; import com.google.android.gms.internal.measurement.zzbq; import com.google.android.gms.internal.measurement.zzbr; import com.google.android.gms.internal.measurement.zzm; import com.google.android.gms.internal.measurement.zzp; public final class zzbo extends zzbg { public final /* synthetic */ Activity zza; public final /* synthetic */ zzm zzb; public final /* synthetic */ zzbq zzc; public zzbo(zzbq object, Activity activity, zzm zzm2) { this.zzc = object; this.zza = activity; this.zzb = zzm2; object = ((zzbq)object).zza; super((zzbr)object, true); } public final void zza() { zzp zzp2 = zzbr.zzR(this.zzc.zza); IObjectWrapper iObjectWrapper = ObjectWrapper.wrap(this.zza); zzm zzm2 = this.zzb; long l10 = this.zzi; zzp2.onActivitySaveInstanceState(iObjectWrapper, zzm2, l10); } }
1,252
0.700479
0.689297
39
31.076923
21.301722
69
false
false
0
0
0
0
0
0
0.692308
false
false
7
d30cc23a88a02ee83b7536fe7eca50429caad0f2
36,679,020,735,351
0c1309c4f70a49d4de33dc9e169e55181a19746e
/asset/src/main/java/com/xyb2c/dao/RepairListMapper.java
f23bb6ee6423f244499a28c2cbd718c0e191b374
[]
no_license
WCTGD/code
https://github.com/WCTGD/code
434ee1cc43a1ed4422e7e2439a78742f428dfe03
e9bd6bbaa837f30f1f117a9c56812e65656425d8
refs/heads/master
2020-03-18T05:56:31.059000
2018-05-22T06:35:44
2018-05-22T06:35:44
134,368,524
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.xyb2c.dao; import com.xyb2c.pojo.RepairList; import com.xyb2c.pojo.RepairListExample; import java.util.List; import org.apache.ibatis.annotations.Param; public interface RepairListMapper { int countByExample(RepairListExample example); int deleteByExample(RepairListExample example); int deleteByPrimaryKey(Integer id); int insert(RepairList record); int insertSelective(RepairList record); List<RepairList> selectByExample(RepairListExample example); RepairList selectByPrimaryKey(Integer id); int updateByExampleSelective(@Param("record") RepairList record, @Param("example") RepairListExample example); int updateByExample(@Param("record") RepairList record, @Param("example") RepairListExample example); int updateByPrimaryKeySelective(RepairList record); int updateByPrimaryKey(RepairList record); /** * 分页查询 * @param example * @return */ List<RepairList> selectByExamplePage(RepairListExample example); /** * 回收站 * @return */ List<RepairList> selectRepairListByFlag(); }
UTF-8
Java
1,115
java
RepairListMapper.java
Java
[]
null
[]
package com.xyb2c.dao; import com.xyb2c.pojo.RepairList; import com.xyb2c.pojo.RepairListExample; import java.util.List; import org.apache.ibatis.annotations.Param; public interface RepairListMapper { int countByExample(RepairListExample example); int deleteByExample(RepairListExample example); int deleteByPrimaryKey(Integer id); int insert(RepairList record); int insertSelective(RepairList record); List<RepairList> selectByExample(RepairListExample example); RepairList selectByPrimaryKey(Integer id); int updateByExampleSelective(@Param("record") RepairList record, @Param("example") RepairListExample example); int updateByExample(@Param("record") RepairList record, @Param("example") RepairListExample example); int updateByPrimaryKeySelective(RepairList record); int updateByPrimaryKey(RepairList record); /** * 分页查询 * @param example * @return */ List<RepairList> selectByExamplePage(RepairListExample example); /** * 回收站 * @return */ List<RepairList> selectRepairListByFlag(); }
1,115
0.73297
0.730245
42
25.238094
28.033831
114
false
false
0
0
0
0
0
0
0.47619
false
false
7
8f0a14875efb1594383f30fc55237181eeb6ca9f
36,867,999,285,391
722f0d4be08f476e1fee0dbfc202dcd45c490670
/src/com/pfe/v4/EnquetesActivity.java
28717de6706a6b6760c55ea20aef7f51c442735a
[]
no_license
anisdjer/mob_enqueteur
https://github.com/anisdjer/mob_enqueteur
ab675fcc19c63e1b009dc8c1b28e92e0ee08d8cd
db395cd15085750468a9d5cf75062c59592ae228
refs/heads/master
2016-09-05T23:13:24.821000
2013-06-13T18:06:02
2013-06-13T18:06:02
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.pfe.v4; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.Toast; import com.pfe.v4.adapters.EnquetesListAdapter; import com.pfe.v4.entities.Enquete; import com.pfe.v4.entities.Enqueteur; import com.pfe.v4.entities.Questionnaire; import com.pfe.v4.utils.Utils; public class EnquetesActivity extends Activity { private ArrayList<Enquete> enquetesList = new ArrayList<Enquete>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_enquetes); EnqueteLoading enquetesLoading = new EnqueteLoading(); enquetesLoading.execute(); EnquetesListAdapter adapter = new EnquetesListAdapter( this.getApplicationContext()); ListView enquetesList = (ListView) findViewById(R.id.enquetes_list); enquetesList.setAdapter(adapter); } @Override protected void onStart() { super.onStart(); Utils.questionStack.clear(); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.enquetes, menu); return true; } @Override public boolean onMenuItemSelected(int featureId, MenuItem item) { switch (item.getItemId()) { case R.id.action_update: // Toast.makeText(Utils.applicationContext, // "Mettre à jour les enquetes", Toast.LENGTH_SHORT).show(); // TODO : tester la connexion new updateAsyncTask().execute(); break; case R.id.new_respondent: // Toast.makeText(Utils.applicationContext, "Nouveau repondant", // Toast.LENGTH_SHORT).show(); Intent i = new Intent(Utils.applicationContext, RespondentActivity.class); startActivity(i); break; default: break; } return super.onMenuItemSelected(featureId, item); } @Override public void onBackPressed() { super.onBackPressed(); finish(); } private class EnqueteLoading extends AsyncTask<Void, Enquete, Void> { @Override protected Void doInBackground(Void... params) { enquetesList = (ArrayList<Enquete>) Utils.db.getEnquetesList(); Log.e("Enquete Loading size enquetes list", "" + enquetesList.size()); if (enquetesList.size() != 0) { return null; } String hostname = "http://" + getResources().getString(R.string.server_address) + getResources().getString(R.string.project_root_name) + getResources().getString(R.string.server_host) + "/rest/enqueteurs/" + Enqueteur.id + "/enquetes"; InputStream is = null; HttpClient httpclient = new DefaultHttpClient(); HttpGet httppost = new HttpGet(hostname); HttpResponse response; try { response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); is = entity.getContent(); } catch (ClientProtocolException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } String result = "[]"; try { BufferedReader reader1 = new BufferedReader( new InputStreamReader(is, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader1.readLine()) != null) { sb.append(line); } is.close(); result = sb.toString(); } catch (Exception e) { Log.e("log_tag_convert", "Error converting result " + e.toString()); } Log.d("Enquetes Loading AsyncTask", result); enquetesList = new ArrayList<Enquete>(); try { JSONArray enquetes = new JSONArray(result); for (int i = 0; i < enquetes.length(); i++) { final Enquete enq = new Enquete(); enq.setId(enquetes.getJSONObject(i).getInt("id")); enq.setTitre(enquetes.getJSONObject(i).getString("titre")); JSONArray jQuestionnaires = (JSONArray) ((JSONObject) enquetes .get(i)).get("questionnaire"); ArrayList<Questionnaire> questionnaires = new ArrayList<Questionnaire>(); for (int j = 0; j < jQuestionnaires.length(); j++) { Questionnaire questionnaire = new Questionnaire(); questionnaire.setId((jQuestionnaires.getJSONObject(j)) .getInt("id")); questionnaire.setTitre((jQuestionnaires .getJSONObject(j)).getString("titre")); questionnaire .setDate_creation(jQuestionnaires .getJSONObject(j).getLong( "date_creation") * 1000); questionnaire.setPremierQuestion_id((jQuestionnaires .getJSONObject(j)).getInt("premiereQuestion")); // Question question = new Question(); // JSONObject jPremierQuestion = // jQuestionnaires.getJSONObject(j). questionnaires.add(questionnaire); } enq.setQuestionnaires(questionnaires); publishProgress(enq); } } catch (JSONException e1) { e1.printStackTrace(); } return null; } @Override protected void onProgressUpdate(Enquete... values) { super.onProgressUpdate(values); Log.d("progress", values[0].getTitre()); enquetesList.add(values[0]); Utils.db.addEnquete(values[0]); } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); EnquetesListAdapter.enquetes = enquetesList; // TODO : change // Utils.helper.deleteAll(); // for (Enquete e : enquetesList) // Utils.helper.addEnquete(e); EnquetesListAdapter adapter = new EnquetesListAdapter( Utils.applicationContext); ListView enquetesListView = (ListView) findViewById(R.id.enquetes_list); if (enquetesList.size() == 0) Toast.makeText(Utils.applicationContext, "Enquetes Liste est vide.", Toast.LENGTH_LONG).show(); enquetesListView.setAdapter(adapter); ((ListView) findViewById(R.id.enquetes_list)) .setVisibility(View.VISIBLE); ((LinearLayout) findViewById(R.id.enquetes_status)) .setVisibility(View.INVISIBLE); } } private class updateAsyncTask extends AsyncTask<Void, Void, Void> { @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); ((LinearLayout) findViewById(R.id.enquetes_status)) .setVisibility(View.VISIBLE); ((ListView) findViewById(R.id.enquetes_list)) .setVisibility(View.INVISIBLE); } @Override protected Void doInBackground(Void... arg0) { Utils.db.truncate(); new EnqueteLoading().execute(); return null; } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); // // // ((ListView) findViewById(R.id.enquetes_list)) // .setVisibility(View.VISIBLE); // ((LinearLayout) findViewById(R.id.enquetes_status)) // .setVisibility(View.INVISIBLE); } } }
WINDOWS-1252
Java
7,275
java
EnquetesActivity.java
Java
[]
null
[]
package com.pfe.v4; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.Toast; import com.pfe.v4.adapters.EnquetesListAdapter; import com.pfe.v4.entities.Enquete; import com.pfe.v4.entities.Enqueteur; import com.pfe.v4.entities.Questionnaire; import com.pfe.v4.utils.Utils; public class EnquetesActivity extends Activity { private ArrayList<Enquete> enquetesList = new ArrayList<Enquete>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_enquetes); EnqueteLoading enquetesLoading = new EnqueteLoading(); enquetesLoading.execute(); EnquetesListAdapter adapter = new EnquetesListAdapter( this.getApplicationContext()); ListView enquetesList = (ListView) findViewById(R.id.enquetes_list); enquetesList.setAdapter(adapter); } @Override protected void onStart() { super.onStart(); Utils.questionStack.clear(); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.enquetes, menu); return true; } @Override public boolean onMenuItemSelected(int featureId, MenuItem item) { switch (item.getItemId()) { case R.id.action_update: // Toast.makeText(Utils.applicationContext, // "Mettre à jour les enquetes", Toast.LENGTH_SHORT).show(); // TODO : tester la connexion new updateAsyncTask().execute(); break; case R.id.new_respondent: // Toast.makeText(Utils.applicationContext, "Nouveau repondant", // Toast.LENGTH_SHORT).show(); Intent i = new Intent(Utils.applicationContext, RespondentActivity.class); startActivity(i); break; default: break; } return super.onMenuItemSelected(featureId, item); } @Override public void onBackPressed() { super.onBackPressed(); finish(); } private class EnqueteLoading extends AsyncTask<Void, Enquete, Void> { @Override protected Void doInBackground(Void... params) { enquetesList = (ArrayList<Enquete>) Utils.db.getEnquetesList(); Log.e("Enquete Loading size enquetes list", "" + enquetesList.size()); if (enquetesList.size() != 0) { return null; } String hostname = "http://" + getResources().getString(R.string.server_address) + getResources().getString(R.string.project_root_name) + getResources().getString(R.string.server_host) + "/rest/enqueteurs/" + Enqueteur.id + "/enquetes"; InputStream is = null; HttpClient httpclient = new DefaultHttpClient(); HttpGet httppost = new HttpGet(hostname); HttpResponse response; try { response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); is = entity.getContent(); } catch (ClientProtocolException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } String result = "[]"; try { BufferedReader reader1 = new BufferedReader( new InputStreamReader(is, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader1.readLine()) != null) { sb.append(line); } is.close(); result = sb.toString(); } catch (Exception e) { Log.e("log_tag_convert", "Error converting result " + e.toString()); } Log.d("Enquetes Loading AsyncTask", result); enquetesList = new ArrayList<Enquete>(); try { JSONArray enquetes = new JSONArray(result); for (int i = 0; i < enquetes.length(); i++) { final Enquete enq = new Enquete(); enq.setId(enquetes.getJSONObject(i).getInt("id")); enq.setTitre(enquetes.getJSONObject(i).getString("titre")); JSONArray jQuestionnaires = (JSONArray) ((JSONObject) enquetes .get(i)).get("questionnaire"); ArrayList<Questionnaire> questionnaires = new ArrayList<Questionnaire>(); for (int j = 0; j < jQuestionnaires.length(); j++) { Questionnaire questionnaire = new Questionnaire(); questionnaire.setId((jQuestionnaires.getJSONObject(j)) .getInt("id")); questionnaire.setTitre((jQuestionnaires .getJSONObject(j)).getString("titre")); questionnaire .setDate_creation(jQuestionnaires .getJSONObject(j).getLong( "date_creation") * 1000); questionnaire.setPremierQuestion_id((jQuestionnaires .getJSONObject(j)).getInt("premiereQuestion")); // Question question = new Question(); // JSONObject jPremierQuestion = // jQuestionnaires.getJSONObject(j). questionnaires.add(questionnaire); } enq.setQuestionnaires(questionnaires); publishProgress(enq); } } catch (JSONException e1) { e1.printStackTrace(); } return null; } @Override protected void onProgressUpdate(Enquete... values) { super.onProgressUpdate(values); Log.d("progress", values[0].getTitre()); enquetesList.add(values[0]); Utils.db.addEnquete(values[0]); } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); EnquetesListAdapter.enquetes = enquetesList; // TODO : change // Utils.helper.deleteAll(); // for (Enquete e : enquetesList) // Utils.helper.addEnquete(e); EnquetesListAdapter adapter = new EnquetesListAdapter( Utils.applicationContext); ListView enquetesListView = (ListView) findViewById(R.id.enquetes_list); if (enquetesList.size() == 0) Toast.makeText(Utils.applicationContext, "Enquetes Liste est vide.", Toast.LENGTH_LONG).show(); enquetesListView.setAdapter(adapter); ((ListView) findViewById(R.id.enquetes_list)) .setVisibility(View.VISIBLE); ((LinearLayout) findViewById(R.id.enquetes_status)) .setVisibility(View.INVISIBLE); } } private class updateAsyncTask extends AsyncTask<Void, Void, Void> { @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); ((LinearLayout) findViewById(R.id.enquetes_status)) .setVisibility(View.VISIBLE); ((ListView) findViewById(R.id.enquetes_list)) .setVisibility(View.INVISIBLE); } @Override protected Void doInBackground(Void... arg0) { Utils.db.truncate(); new EnqueteLoading().execute(); return null; } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); // // // ((ListView) findViewById(R.id.enquetes_list)) // .setVisibility(View.VISIBLE); // ((LinearLayout) findViewById(R.id.enquetes_status)) // .setVisibility(View.INVISIBLE); } } }
7,275
0.702227
0.697828
271
25.841328
20.877094
78
false
false
0
0
0
0
0
0
2.785978
false
false
7
55291825eea98397f27fcb84202ae947c603ab29
33,097,018,020,630
a98021b825f3c004421330cdfdc0f1a27d5c2317
/ejb/txReservation/txAgent/txAgentEJB/src/main/java/ejava/examples/txagent/ejb/AgentReservationSessionRemote.java
ea92529d7c48998badba18ac1b7d9e78bce3d486
[]
no_license
ejavaguy/ejava-student
https://github.com/ejavaguy/ejava-student
78e9c9a11250ed7bc0f32a5cc8cd1bc80dbc919a
0dc378dcf4a7f56a1f40ec2c9cee0ec269d6e87f
refs/heads/master
2022-11-30T18:37:18.070000
2019-08-22T11:03:56
2019-08-22T11:03:56
19,055,611
5
7
null
false
2022-11-24T09:36:48
2014-04-23T03:27:01
2022-01-11T19:52:18
2022-11-24T09:36:47
7,685
2
7
17
Java
false
false
package ejava.examples.txagent.ejb; import javax.ejb.Remote; import ejava.examples.txagent.bl.AgentReservationSession; @Remote public interface AgentReservationSessionRemote extends AgentReservationSession { }
UTF-8
Java
213
java
AgentReservationSessionRemote.java
Java
[]
null
[]
package ejava.examples.txagent.ejb; import javax.ejb.Remote; import ejava.examples.txagent.bl.AgentReservationSession; @Remote public interface AgentReservationSessionRemote extends AgentReservationSession { }
213
0.849765
0.849765
9
22.666666
27.640551
80
false
false
0
0
0
0
0
0
0.333333
false
false
7
1cbaa98ffbf7a9fc7a0cedaeaff886b02313385c
26,199,300,556,665
065bed83a225afe59245ebcb8f48271a3cdf37ff
/Front_end/app/src/main/java/com/system/odering/front_end/domain/user/IPerson.java
5d269ff321946fc6d5c687c1c96757d7adbeaec5
[]
no_license
ChaseAgulhas/client_app
https://github.com/ChaseAgulhas/client_app
fbeb8dccc0b66c596008ec87334c86e9da6804f9
f0705665b88a18958a6a9ef0992ce11bc64f6cf9
refs/heads/master
2021-01-12T09:13:50.704000
2016-12-18T19:26:38
2016-12-18T19:26:38
76,802,842
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.system.odering.front_end.domain.user; /** * Created by cfebruary on 2016/09/29. */ public interface IPerson { Long getCustomerId(); String getName(); String getSurname(); String getEmail(); String getPhoneNumber(); }
UTF-8
Java
252
java
IPerson.java
Java
[ { "context": ".odering.front_end.domain.user;\n\n/**\n * Created by cfebruary on 2016/09/29.\n */\npublic interface IPerson {\n ", "end": 78, "score": 0.9996324181556702, "start": 69, "tag": "USERNAME", "value": "cfebruary" } ]
null
[]
package com.system.odering.front_end.domain.user; /** * Created by cfebruary on 2016/09/29. */ public interface IPerson { Long getCustomerId(); String getName(); String getSurname(); String getEmail(); String getPhoneNumber(); }
252
0.678571
0.646825
12
20
14.860462
49
false
false
0
0
0
0
0
0
0.5
false
false
7
6b3bba1da3393a545e2fe3cac4bc3d198ee38a6d
1,932,735,336,547
4cb47e74e07345c1d3f697356050ba921eaeab50
/CorsoJava/src/org/saluti/corso/ciao.java
4eaa89dbb8dd68cb9b2f0d31b051bc3556917782
[]
no_license
steepana/CorsoJava
https://github.com/steepana/CorsoJava
96b8118235e788c6f9b6ab2aef57e7545fa407e2
3c9c8188ccb56ad34af1d9746d24df968d877c71
refs/heads/master
2023-08-17T22:49:08.596000
2021-09-16T16:02:03
2021-09-16T16:02:03
407,226,980
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.saluti.corso; public class ciao { public static void main(String[] args) { Saluto francese = new Francesce(); francese.setModoSaluto("bonjour"); francese.setNazione("Francia"); System.out.println(francese.getNazione() + " " + (francese.getModoSaluto()) ); Saluto inglese = new Inglese(); inglese.setModoSaluto("goodmorning"); inglese.setNazione("Inghilterra"); System.out.println(inglese.getNazione() + " " + (inglese.getModoSaluto()) ); Saluto italiano = new Italiano(); italiano.setModoSaluto("Ciao"); italiano.setNazione("Italia"); System.out.println(italiano.getNazione() + " " + (italiano.getModoSaluto()) ); } }
UTF-8
Java
701
java
ciao.java
Java
[]
null
[]
package org.saluti.corso; public class ciao { public static void main(String[] args) { Saluto francese = new Francesce(); francese.setModoSaluto("bonjour"); francese.setNazione("Francia"); System.out.println(francese.getNazione() + " " + (francese.getModoSaluto()) ); Saluto inglese = new Inglese(); inglese.setModoSaluto("goodmorning"); inglese.setNazione("Inghilterra"); System.out.println(inglese.getNazione() + " " + (inglese.getModoSaluto()) ); Saluto italiano = new Italiano(); italiano.setModoSaluto("Ciao"); italiano.setNazione("Italia"); System.out.println(italiano.getNazione() + " " + (italiano.getModoSaluto()) ); } }
701
0.661912
0.661912
31
21.612904
24.822826
81
false
false
0
0
0
0
0
0
1.193548
false
false
7
f6e6b18c035fbd0c7669304fa8a4d55328a6f935
1,932,735,339,160
911b4b22d3c5b1e00172a77bb6d91c2a3025f12b
/SoldeskProject/src/main/java/com/soldesk/spring/sns/SNSReply.java
97fda2536ed3564a763d26b6f20f5833aa7be4fb
[]
no_license
Onneoul/SoldeskProject
https://github.com/Onneoul/SoldeskProject
856043f62841d007eeccc6920575194ce4835f44
14b27917bf88eda8896ead6ed60ce447693d8d59
refs/heads/master
2022-12-21T23:05:10.754000
2020-07-13T15:40:39
2020-07-13T15:40:39
225,306,394
0
0
null
false
2022-12-16T01:00:43
2019-12-02T06:56:38
2020-07-13T15:41:05
2022-12-16T01:00:42
3,150
0
0
4
Java
false
false
package com.soldesk.spring.sns; import java.math.BigDecimal; import java.util.Date; public class SNSReply { private String reply_user; // 기존 number_id private BigDecimal reply_number; // 기존 sns_number private Date reply_date; private String reply_text; private BigDecimal reply_number_num; // 기존 reply_number public SNSReply() { // TODO Auto-generated constructor stub } public SNSReply(String reply_user, BigDecimal reply_number, Date reply_date, String reply_text, BigDecimal reply_number_num) { super(); this.reply_user = reply_user; this.reply_number = reply_number; this.reply_date = reply_date; this.reply_text = reply_text; this.reply_number_num = reply_number_num; } public String getReply_user() { return reply_user; } public void setReply_user(String reply_user) { this.reply_user = reply_user; } public BigDecimal getReply_number() { return reply_number; } public void setReply_number(BigDecimal reply_number) { this.reply_number = reply_number; } public Date getReply_date() { return reply_date; } public void setReply_date(Date reply_date) { this.reply_date = reply_date; } public String getReply_text() { return reply_text; } public void setReply_text(String reply_text) { this.reply_text = reply_text; } public BigDecimal getReply_number_num() { return reply_number_num; } public void setReply_number_num(BigDecimal reply_number_num) { this.reply_number_num = reply_number_num; } }
UTF-8
Java
1,559
java
SNSReply.java
Java
[]
null
[]
package com.soldesk.spring.sns; import java.math.BigDecimal; import java.util.Date; public class SNSReply { private String reply_user; // 기존 number_id private BigDecimal reply_number; // 기존 sns_number private Date reply_date; private String reply_text; private BigDecimal reply_number_num; // 기존 reply_number public SNSReply() { // TODO Auto-generated constructor stub } public SNSReply(String reply_user, BigDecimal reply_number, Date reply_date, String reply_text, BigDecimal reply_number_num) { super(); this.reply_user = reply_user; this.reply_number = reply_number; this.reply_date = reply_date; this.reply_text = reply_text; this.reply_number_num = reply_number_num; } public String getReply_user() { return reply_user; } public void setReply_user(String reply_user) { this.reply_user = reply_user; } public BigDecimal getReply_number() { return reply_number; } public void setReply_number(BigDecimal reply_number) { this.reply_number = reply_number; } public Date getReply_date() { return reply_date; } public void setReply_date(Date reply_date) { this.reply_date = reply_date; } public String getReply_text() { return reply_text; } public void setReply_text(String reply_text) { this.reply_text = reply_text; } public BigDecimal getReply_number_num() { return reply_number_num; } public void setReply_number_num(BigDecimal reply_number_num) { this.reply_number_num = reply_number_num; } }
1,559
0.688429
0.688429
67
21.089552
20.51627
96
false
false
0
0
0
0
0
0
1.432836
false
false
7
77d6dcd927859e97cf516c86281bd1b5c7fa2ddf
3,685,082,000,459
eaa1ff1a55263b2a656e557245be431c085843a1
/app/src/main/java/com/newtrekwang/yiweather/Base/BasePresenter.java
ff449eee339c3c4f35bcb9f0c8a13ee8c8f8c62c
[ "Apache-2.0" ]
permissive
Wangjiaxing123/YiWeather
https://github.com/Wangjiaxing123/YiWeather
69369f99f7037e6fcdc8bb5c1bc39923473da857
62fc23395166a7f4fd6d72dd740f4896fb52545e
refs/heads/master
2019-01-23T06:41:13.181000
2017-05-01T14:18:46
2017-05-01T14:18:46
85,833,292
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.newtrekwang.yiweather.Base; import android.content.Context; /** * Created by WJX . * Desc:Presenter 基类 * Created on 2017/1/13 20:05. * Mail:408030208@qq.com */ public abstract class BasePresenter <V>{ public Context context; public V mView; /** * 绑定View */ public void onAttached(V view){ this.mView=view; } /** * 解绑View */ public void onDetached(){ this.mView=null; } }
UTF-8
Java
473
java
BasePresenter.java
Java
[ { "context": "mport android.content.Context;\n\n\n/**\n * Created by WJX .\n * Desc:Presenter 基类\n * Created on 2017/1/13 20", "end": 96, "score": 0.9990559220314026, "start": 93, "tag": "USERNAME", "value": "WJX" }, { "context": "esenter 基类\n * Created on 2017/1/13 20:05.\n * Mail:408030208@qq.com\n */\n\npublic abstract class BasePresenter <V>{\n ", "end": 175, "score": 0.9999094605445862, "start": 159, "tag": "EMAIL", "value": "408030208@qq.com" } ]
null
[]
package com.newtrekwang.yiweather.Base; import android.content.Context; /** * Created by WJX . * Desc:Presenter 基类 * Created on 2017/1/13 20:05. * Mail:<EMAIL> */ public abstract class BasePresenter <V>{ public Context context; public V mView; /** * 绑定View */ public void onAttached(V view){ this.mView=view; } /** * 解绑View */ public void onDetached(){ this.mView=null; } }
464
0.59436
0.550976
28
15.464286
12.807593
40
false
false
0
0
0
0
0
0
0.214286
false
false
7
6437ed753a003a8dd09088e0a411c14e8d5b400c
38,216,619,004,234
dd59639b4b47aa75d4fd450be68b05e9c2a3810c
/RDwebFrameApp/src/main/java/webFrame/ws/integration/PersonWrapper.java
4e4d48bd8498b03e6884632676dc45a240266680
[]
no_license
sikza/ICTDTech
https://github.com/sikza/ICTDTech
bcae8c1147e86afe334a7bfae752c33389819d8a
7cf57a10baf908dd9698f31c0e6575b8cbc02b0d
refs/heads/master
2021-09-20T13:49:37.181000
2018-08-10T06:36:27
2018-08-10T06:36:27
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package webFrame.ws.integration; import java.io.Serializable; import javax.xml.bind.annotation.XmlRootElement; import usergate.classes.Person; @XmlRootElement public class PersonWrapper implements Serializable { /** * */ private static final long serialVersionUID = 1L; private Person profile; private String[] document; public PersonWrapper() { } public PersonWrapper(Person psn, String[] files) { this.profile = psn; this.document = files; } public Person getP() { return profile; } public void setP(Person p) { this.profile = p; } public String[] getFiles() { return document; } public void setFiles(String[] files) { this.document = files; } }
UTF-8
Java
696
java
PersonWrapper.java
Java
[]
null
[]
package webFrame.ws.integration; import java.io.Serializable; import javax.xml.bind.annotation.XmlRootElement; import usergate.classes.Person; @XmlRootElement public class PersonWrapper implements Serializable { /** * */ private static final long serialVersionUID = 1L; private Person profile; private String[] document; public PersonWrapper() { } public PersonWrapper(Person psn, String[] files) { this.profile = psn; this.document = files; } public Person getP() { return profile; } public void setP(Person p) { this.profile = p; } public String[] getFiles() { return document; } public void setFiles(String[] files) { this.document = files; } }
696
0.708333
0.706897
45
14.466666
16.254368
52
false
false
0
0
0
0
0
0
1
false
false
7
d638ea9dd08443b5ded233b4c5fe5a2cd4e569b2
36,764,920,080,096
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/nathanmarz--storm/17863eb328332af14568862a61b88c17e7c42ee0/before/CommitterBoltExecutor.java
adcaebdda24ff82fe06707660d6150749b714f66
[]
no_license
fracz/refactor-extractor
https://github.com/fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211000
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package backtype.storm.transactional; import backtype.storm.task.TopologyContext; import backtype.storm.topology.OutputFieldsDeclarer; import backtype.storm.tuple.Tuple; import java.util.Map; public class CommitterBoltExecutor implements IBatchBolt { ICommitterBolt _delegate; BatchOutputCollector _collector; public CommitterBoltExecutor(ICommitterBolt delegate) { _delegate = delegate; } @Override public void prepare(Map conf, TopologyContext context, BatchOutputCollector collector, Object id) { _delegate.prepare(conf, context, (TransactionAttempt) id); _collector = collector; } @Override public void execute(Tuple tuple) { _delegate.execute(tuple); } @Override public void finishBatch() { _delegate.commit(_collector); } @Override public void declareOutputFields(OutputFieldsDeclarer declarer) { _delegate.declareOutputFields(declarer); } @Override public Map<String, Object> getComponentConfiguration() { return _delegate.getComponentConfiguration(); } }
UTF-8
Java
1,105
java
CommitterBoltExecutor.java
Java
[]
null
[]
package backtype.storm.transactional; import backtype.storm.task.TopologyContext; import backtype.storm.topology.OutputFieldsDeclarer; import backtype.storm.tuple.Tuple; import java.util.Map; public class CommitterBoltExecutor implements IBatchBolt { ICommitterBolt _delegate; BatchOutputCollector _collector; public CommitterBoltExecutor(ICommitterBolt delegate) { _delegate = delegate; } @Override public void prepare(Map conf, TopologyContext context, BatchOutputCollector collector, Object id) { _delegate.prepare(conf, context, (TransactionAttempt) id); _collector = collector; } @Override public void execute(Tuple tuple) { _delegate.execute(tuple); } @Override public void finishBatch() { _delegate.commit(_collector); } @Override public void declareOutputFields(OutputFieldsDeclarer declarer) { _delegate.declareOutputFields(declarer); } @Override public Map<String, Object> getComponentConfiguration() { return _delegate.getComponentConfiguration(); } }
1,105
0.712217
0.712217
43
24.72093
24.732359
103
false
false
0
0
0
0
0
0
0.465116
false
false
7
7d8072132cbc7f1db23a205a4be07968e11b8df2
36,764,920,078,417
bc38aa25bd03dc856fc89dc8cc3b2324404076b9
/src/main/java/com/jifenke/lepluslive/groupon/service/GrouponProductDetailService.java
f6a9ebde31ba1c2f58d4c8219464486459915f1d
[]
no_license
zhaiyu/lepluslife_back
https://github.com/zhaiyu/lepluslife_back
4728991243b32e8e5d3470e03be667b4e0bc44d5
21568917ba64b8a2082a38cedcaa3a6bfdeb7591
refs/heads/master
2021-01-20T14:22:34.075000
2017-08-24T09:02:28
2017-08-24T09:02:28
72,407,756
1
30
null
true
2017-05-08T02:12:52
2016-10-31T06:12:12
2016-11-12T11:17:17
2017-05-08T02:12:51
1,630
1
3
0
Java
null
null
package com.jifenke.lepluslive.groupon.service; import com.jifenke.lepluslive.groupon.domain.entities.GrouponProduct; import com.jifenke.lepluslive.groupon.domain.entities.GrouponProductDetail; import com.jifenke.lepluslive.groupon.repository.GrouponProductDetailRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import java.util.List; import javax.inject.Inject; /** * GrouponProductDetailService * 商品详情图 * @author XF * @date 2017/6/27 */ @Service @Transactional(readOnly = true) public class GrouponProductDetailService { @Inject private GrouponProductDetailRepository productDetailRepository; @Transactional(readOnly = true,propagation = Propagation.REQUIRED) public List<GrouponProductDetail> findByGrouponProduct(GrouponProduct grouponProduct) { return productDetailRepository.findByGrouponProduct(grouponProduct); } }
UTF-8
Java
1,010
java
GrouponProductDetailService.java
Java
[ { "context": "* GrouponProductDetailService\n * 商品详情图\n * @author XF\n * @date 2017/6/27\n */\n@Service\n@Transactional(re", "end": 564, "score": 0.9980125427246094, "start": 562, "tag": "USERNAME", "value": "XF" } ]
null
[]
package com.jifenke.lepluslive.groupon.service; import com.jifenke.lepluslive.groupon.domain.entities.GrouponProduct; import com.jifenke.lepluslive.groupon.domain.entities.GrouponProductDetail; import com.jifenke.lepluslive.groupon.repository.GrouponProductDetailRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import java.util.List; import javax.inject.Inject; /** * GrouponProductDetailService * 商品详情图 * @author XF * @date 2017/6/27 */ @Service @Transactional(readOnly = true) public class GrouponProductDetailService { @Inject private GrouponProductDetailRepository productDetailRepository; @Transactional(readOnly = true,propagation = Propagation.REQUIRED) public List<GrouponProductDetail> findByGrouponProduct(GrouponProduct grouponProduct) { return productDetailRepository.findByGrouponProduct(grouponProduct); } }
1,010
0.821
0.814
30
32.333332
29.874552
91
false
false
0
0
0
0
0
0
0.4
false
false
7
cee7758872c4b9cb704eb9aa83547d95a19a1e2f
4,269,197,552,035
e499e882b12b02413000315a6bddf0ab7021cde2
/src/com/jagdeep/ds/graph/Graph.java
f3d4c8c971d2dffafd5dc960b422143236a7fad7
[]
no_license
JagdeepSingh28/DS
https://github.com/JagdeepSingh28/DS
9796f2f84f74b9cf5567e788e1eb1e400836cc4a
ef5043e3e19faab7be70ec766565ca1f8fde2d43
refs/heads/master
2021-07-13T12:56:49.769000
2020-11-15T09:31:03
2020-11-15T09:31:03
67,930,224
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jagdeep.ds.graph; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; public class Graph<T> { private class QueueNode { GraphNode graphNode; int level; public QueueNode(GraphNode node, int level) { this.graphNode = node; this.level = level; } } private class GraphNode { T nodeId; GraphNode next; int parentDist; GraphNode(T id) { nodeId = id; next = null; } GraphNode(T id, int dist) { nodeId = id; next = null; parentDist = dist; } } ArrayList<GraphNode> nodeList; public Graph() { nodeList = new ArrayList<GraphNode>(); } private void addNode(T id) { GraphNode node = new GraphNode(id); nodeList.add(node); } private void addEdge(T id1, T id2, int dist) { int i = 0; for (i = 0; i < nodeList.size(); i++) { if (nodeList.get(i).nodeId == id1) { break; } } if (i == nodeList.size()) { return; } GraphNode node1 = nodeList.get(i); GraphNode node2 = new GraphNode(id2, dist); node2.next = node1.next; node1.next = node2; } private GraphNode findGraphNode(T nodeId) { for (int i = 0; i < nodeList.size(); i++) { if (nodeList.get(i).nodeId == nodeId) { return nodeList.get(i); } } return null; } public void printGraph() { for (int i = 0; i < nodeList.size(); i++) { GraphNode curr = nodeList.get(i); while (curr != null) { System.out.print(curr.nodeId + "(" + curr.parentDist + ")" + "->"); curr = curr.next; } System.out.print("Null"); System.out.println(); } } public boolean breadthFirstSearch(T srcId, T destId) { if (nodeList.isEmpty()) { System.out.println("Empty graph"); return false; } LinkedList<QueueNode> queue = new LinkedList(); HashMap<T, Integer> visited = new HashMap(); GraphNode srcNode = null; for (int i = 0; i < nodeList.size(); i++) { if (nodeList.get(i).nodeId == srcId) { srcNode = nodeList.get(i); break; } } if (srcNode == null) { System.out.println("Source vertex not found"); return false; } boolean destNodeFound = false; int maxLevelVisited = -1; queue.add(new QueueNode(srcNode, 0)); visited.put(srcNode.nodeId, 1); while (!queue.isEmpty()) { QueueNode currentNode = queue.remove(); if (currentNode.level > maxLevelVisited) { System.out.print("\nlevel " + currentNode.level + "-"); maxLevelVisited = currentNode.level; } System.out.print(currentNode.graphNode.nodeId + " "); if (currentNode.graphNode.nodeId == destId) { destNodeFound = true; } GraphNode neighbor = currentNode.graphNode.next; while (neighbor != null) { if (visited.get(neighbor.nodeId) == null) { visited.put(neighbor.nodeId, 1); queue.add(new QueueNode(findGraphNode(neighbor.nodeId), currentNode.level + 1)); } neighbor = neighbor.next; } } return destNodeFound; } @SuppressWarnings("unchecked") public static void createGraph(Graph graph) { graph.addNode(0); graph.addNode(1); graph.addNode(2); graph.addNode(3); graph.addNode(4); graph.addNode(5); graph.addEdge(0, 1, 2); graph.addEdge(0, 2, 4); graph.addEdge(1, 2, 4); graph.addEdge(1, 3, 5); graph.addEdge(1, 4, 3); graph.addEdge(3, 5, 1); graph.addEdge(4, 5, 1); } public static void main(String[] args) { Graph<Integer> graph = new Graph(); createGraph(graph); int srcNodeId = 0, destNodeId = 5; graph.printGraph(); System.out .print("\n\nIf path exists between source and destination node:\n" + graph.breadthFirstSearch(srcNodeId, destNodeId)); } }
UTF-8
Java
3,616
java
Graph.java
Java
[]
null
[]
package com.jagdeep.ds.graph; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; public class Graph<T> { private class QueueNode { GraphNode graphNode; int level; public QueueNode(GraphNode node, int level) { this.graphNode = node; this.level = level; } } private class GraphNode { T nodeId; GraphNode next; int parentDist; GraphNode(T id) { nodeId = id; next = null; } GraphNode(T id, int dist) { nodeId = id; next = null; parentDist = dist; } } ArrayList<GraphNode> nodeList; public Graph() { nodeList = new ArrayList<GraphNode>(); } private void addNode(T id) { GraphNode node = new GraphNode(id); nodeList.add(node); } private void addEdge(T id1, T id2, int dist) { int i = 0; for (i = 0; i < nodeList.size(); i++) { if (nodeList.get(i).nodeId == id1) { break; } } if (i == nodeList.size()) { return; } GraphNode node1 = nodeList.get(i); GraphNode node2 = new GraphNode(id2, dist); node2.next = node1.next; node1.next = node2; } private GraphNode findGraphNode(T nodeId) { for (int i = 0; i < nodeList.size(); i++) { if (nodeList.get(i).nodeId == nodeId) { return nodeList.get(i); } } return null; } public void printGraph() { for (int i = 0; i < nodeList.size(); i++) { GraphNode curr = nodeList.get(i); while (curr != null) { System.out.print(curr.nodeId + "(" + curr.parentDist + ")" + "->"); curr = curr.next; } System.out.print("Null"); System.out.println(); } } public boolean breadthFirstSearch(T srcId, T destId) { if (nodeList.isEmpty()) { System.out.println("Empty graph"); return false; } LinkedList<QueueNode> queue = new LinkedList(); HashMap<T, Integer> visited = new HashMap(); GraphNode srcNode = null; for (int i = 0; i < nodeList.size(); i++) { if (nodeList.get(i).nodeId == srcId) { srcNode = nodeList.get(i); break; } } if (srcNode == null) { System.out.println("Source vertex not found"); return false; } boolean destNodeFound = false; int maxLevelVisited = -1; queue.add(new QueueNode(srcNode, 0)); visited.put(srcNode.nodeId, 1); while (!queue.isEmpty()) { QueueNode currentNode = queue.remove(); if (currentNode.level > maxLevelVisited) { System.out.print("\nlevel " + currentNode.level + "-"); maxLevelVisited = currentNode.level; } System.out.print(currentNode.graphNode.nodeId + " "); if (currentNode.graphNode.nodeId == destId) { destNodeFound = true; } GraphNode neighbor = currentNode.graphNode.next; while (neighbor != null) { if (visited.get(neighbor.nodeId) == null) { visited.put(neighbor.nodeId, 1); queue.add(new QueueNode(findGraphNode(neighbor.nodeId), currentNode.level + 1)); } neighbor = neighbor.next; } } return destNodeFound; } @SuppressWarnings("unchecked") public static void createGraph(Graph graph) { graph.addNode(0); graph.addNode(1); graph.addNode(2); graph.addNode(3); graph.addNode(4); graph.addNode(5); graph.addEdge(0, 1, 2); graph.addEdge(0, 2, 4); graph.addEdge(1, 2, 4); graph.addEdge(1, 3, 5); graph.addEdge(1, 4, 3); graph.addEdge(3, 5, 1); graph.addEdge(4, 5, 1); } public static void main(String[] args) { Graph<Integer> graph = new Graph(); createGraph(graph); int srcNodeId = 0, destNodeId = 5; graph.printGraph(); System.out .print("\n\nIf path exists between source and destination node:\n" + graph.breadthFirstSearch(srcNodeId, destNodeId)); } }
3,616
0.631084
0.617533
181
18.977901
17.540783
70
false
false
0
0
0
0
0
0
2.403315
false
false
7
c85e4b001a8cc33780d15f0630f56109ac3eee53
2,061,584,310,436
eebe8ce64a31ee18d39c383ecf91df6b40094c24
/core/src/main/java/com/taobao/arthas/core/command/monitor200/GcinfoCommand.java
aa4245f30240a9abcbf338b1e25e9b9d6a4e23d6
[ "Apache-2.0" ]
permissive
wangdonghello/arthas
https://github.com/wangdonghello/arthas
ca8192fcbc8b74ba8d50d616b0e87e281d5f2948
1c28b016d7e60cd10c08ba6ba9358cbd97387f73
refs/heads/master
2023-03-31T10:22:07.121000
2021-03-17T12:16:49
2021-03-17T12:16:49
268,944,966
0
0
Apache-2.0
true
2020-06-03T01:16:56
2020-06-03T01:16:56
2020-06-03T01:04:42
2020-06-01T11:42:57
17,306
0
0
0
null
false
false
package com.taobao.arthas.core.command.monitor200; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Timer; import java.util.TimerTask; import com.alibaba.arthas.deps.org.slf4j.Logger; import com.alibaba.arthas.deps.org.slf4j.LoggerFactory; import com.taobao.arthas.core.command.Constants; import com.taobao.arthas.core.shell.command.AnnotatedCommand; import com.taobao.arthas.core.shell.command.CommandProcess; import com.taobao.arthas.core.shell.handlers.shell.QExitHandler; import com.taobao.middleware.cli.annotations.Description; import com.taobao.middleware.cli.annotations.Name; import com.taobao.middleware.cli.annotations.Option; import com.taobao.middleware.cli.annotations.Summary; /** * <pre> * 此gc命令提供的后端一次性获取,然后展示; * 后期再改造一下 * </pre> * * @author wangdong 2020年06月01日 下午2:06:21 */ @Name("gcinfo") @Summary("Display gc info") @Description(Constants.EXAMPLE + " gcinfo \n" + " gcinfo -i 1000 \n" + " gcinfo -i 1000 -n 5\n") public class GcinfoCommand extends AnnotatedCommand { private static final Logger logger = LoggerFactory.getLogger(GcinfoCommand.class); private volatile int intervalTime = -1;// 默认间隔时间 private volatile int loopCount = -1;// 循环次数 private volatile int initCount = 0;// 初始化次数 private long pid = 0; private volatile Timer timer; @Option(shortName = "n", longName = "loopCount") @Description("The number of gcinfo to show, the default count is 5.") public void setLoopCount(Integer count) { this.loopCount = count; } @Option(shortName = "i", longName = "intervalTime") @Description("The intervalTime (in ms) between two executions, default is 1000 ms.") public void setIntervalTime(int interval) { this.intervalTime = interval; } @Override public void process(CommandProcess process) { pid = process.session().getPid(); logger.info("pid:" + pid + ",interval:" + intervalTime + ",n:" + loopCount); if (pid > 0) { loopCount = loopCount == -1 ? 5 : loopCount; intervalTime = intervalTime == -1 ? 1000 : intervalTime; timer = new Timer("Timer-for-arthas-gcinfo-" + process.session().getSessionId(), true); // ctrl-C exit support process.interruptHandler(new GcInfoInterruptHandler(process, timer)); // q exit support process.stdinHandler(new QExitHandler(process)); // start the timer timer.scheduleAtFixedRate(new GCTimerTask(process), 0, intervalTime); } else { process.write("get pid failure!"); } } private class GCTimerTask extends TimerTask { private CommandProcess process; /** * @param process */ public GCTimerTask(CommandProcess process) { this.process = process; } @Override public void run() { if (initCount > loopCount) { // stop the timer timer.cancel(); timer.purge(); process.write("Process ends after " + loopCount + " time(s).\n"); process.end(); return; } processGC(process); } } private void processGC(CommandProcess process) { StringBuilder content = new StringBuilder(""); Runtime run = Runtime.getRuntime(); Process p = null; try { logger.info("command:" + assembleCommand()); p = run.exec(assembleCommand()); getResponse(content, p); process.write(content.toString()); } catch (IOException e) { logger.error("jstat -gcutil command has error!", e); process.write("jstat -gcutil has error!\n"); } finally { if (p != null) { p.destroy(); } initCount++; } } private void getResponse(StringBuilder content, Process p) { Thread redirectStdout = new Thread(new Runnable() { @Override public void run() { BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); try { String line = null; while ((line = br.readLine()) != null) { if (initCount == 0) { content.append(line); content.append("\n"); } else { if (!line.contains("S0")) { // 命令每次返回结果,都会有列名,只取第一次执行的列名,后续的直接取值 content.append(line); content.append("\n"); } } } } catch (Exception e) { logger.error("GcinfoCommand-redirectStdout has error:"+e.getMessage(),e); try { if (br!=null) { br.close(); } } catch (IOException e1) { e1.printStackTrace(); } } } }); StringBuilder errorMessage = new StringBuilder(); Thread redirectStderr = new Thread(new Runnable() { @Override public void run() { BufferedReader error = new BufferedReader(new InputStreamReader(p.getErrorStream())); try { String line = null; while ((line = error.readLine()) != null) { errorMessage.append(line).append("\n"); } } catch (Exception e) { logger.error("GcinfoCommand-redirectStderr has error:"+e.getMessage(),e); try { if (error!=null) { error.close(); } } catch (IOException e1) { e1.printStackTrace(); } } } }); redirectStdout.start(); redirectStderr.start(); try { redirectStdout.join(); redirectStderr.join(); } catch (InterruptedException e) { logger.error("redirectStdout or redirectStderr is interrupted,the error is:"+e.getMessage(),e); } if (errorMessage.toString().length() != 0) { logger.error("jstat -gcutil command has error:" + errorMessage.toString()); content.append(errorMessage); } } private String assembleCommand() { StringBuilder command = new StringBuilder("jstat -gcutil "); command.append(pid); command.append(" "); command.append(intervalTime); command.append(" "); command.append(1); return command.toString(); } }
UTF-8
Java
5,783
java
GcinfoCommand.java
Java
[ { "context": "的后端一次性获取,然后展示;\n * 后期再改造一下\n * </pre>\n * \n * @author wangdong 2020年06月01日 下午2:06:21\n */\n@Name(\"gcinfo\")\n@Summar", "end": 838, "score": 0.9984517097473145, "start": 830, "tag": "USERNAME", "value": "wangdong" } ]
null
[]
package com.taobao.arthas.core.command.monitor200; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Timer; import java.util.TimerTask; import com.alibaba.arthas.deps.org.slf4j.Logger; import com.alibaba.arthas.deps.org.slf4j.LoggerFactory; import com.taobao.arthas.core.command.Constants; import com.taobao.arthas.core.shell.command.AnnotatedCommand; import com.taobao.arthas.core.shell.command.CommandProcess; import com.taobao.arthas.core.shell.handlers.shell.QExitHandler; import com.taobao.middleware.cli.annotations.Description; import com.taobao.middleware.cli.annotations.Name; import com.taobao.middleware.cli.annotations.Option; import com.taobao.middleware.cli.annotations.Summary; /** * <pre> * 此gc命令提供的后端一次性获取,然后展示; * 后期再改造一下 * </pre> * * @author wangdong 2020年06月01日 下午2:06:21 */ @Name("gcinfo") @Summary("Display gc info") @Description(Constants.EXAMPLE + " gcinfo \n" + " gcinfo -i 1000 \n" + " gcinfo -i 1000 -n 5\n") public class GcinfoCommand extends AnnotatedCommand { private static final Logger logger = LoggerFactory.getLogger(GcinfoCommand.class); private volatile int intervalTime = -1;// 默认间隔时间 private volatile int loopCount = -1;// 循环次数 private volatile int initCount = 0;// 初始化次数 private long pid = 0; private volatile Timer timer; @Option(shortName = "n", longName = "loopCount") @Description("The number of gcinfo to show, the default count is 5.") public void setLoopCount(Integer count) { this.loopCount = count; } @Option(shortName = "i", longName = "intervalTime") @Description("The intervalTime (in ms) between two executions, default is 1000 ms.") public void setIntervalTime(int interval) { this.intervalTime = interval; } @Override public void process(CommandProcess process) { pid = process.session().getPid(); logger.info("pid:" + pid + ",interval:" + intervalTime + ",n:" + loopCount); if (pid > 0) { loopCount = loopCount == -1 ? 5 : loopCount; intervalTime = intervalTime == -1 ? 1000 : intervalTime; timer = new Timer("Timer-for-arthas-gcinfo-" + process.session().getSessionId(), true); // ctrl-C exit support process.interruptHandler(new GcInfoInterruptHandler(process, timer)); // q exit support process.stdinHandler(new QExitHandler(process)); // start the timer timer.scheduleAtFixedRate(new GCTimerTask(process), 0, intervalTime); } else { process.write("get pid failure!"); } } private class GCTimerTask extends TimerTask { private CommandProcess process; /** * @param process */ public GCTimerTask(CommandProcess process) { this.process = process; } @Override public void run() { if (initCount > loopCount) { // stop the timer timer.cancel(); timer.purge(); process.write("Process ends after " + loopCount + " time(s).\n"); process.end(); return; } processGC(process); } } private void processGC(CommandProcess process) { StringBuilder content = new StringBuilder(""); Runtime run = Runtime.getRuntime(); Process p = null; try { logger.info("command:" + assembleCommand()); p = run.exec(assembleCommand()); getResponse(content, p); process.write(content.toString()); } catch (IOException e) { logger.error("jstat -gcutil command has error!", e); process.write("jstat -gcutil has error!\n"); } finally { if (p != null) { p.destroy(); } initCount++; } } private void getResponse(StringBuilder content, Process p) { Thread redirectStdout = new Thread(new Runnable() { @Override public void run() { BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); try { String line = null; while ((line = br.readLine()) != null) { if (initCount == 0) { content.append(line); content.append("\n"); } else { if (!line.contains("S0")) { // 命令每次返回结果,都会有列名,只取第一次执行的列名,后续的直接取值 content.append(line); content.append("\n"); } } } } catch (Exception e) { logger.error("GcinfoCommand-redirectStdout has error:"+e.getMessage(),e); try { if (br!=null) { br.close(); } } catch (IOException e1) { e1.printStackTrace(); } } } }); StringBuilder errorMessage = new StringBuilder(); Thread redirectStderr = new Thread(new Runnable() { @Override public void run() { BufferedReader error = new BufferedReader(new InputStreamReader(p.getErrorStream())); try { String line = null; while ((line = error.readLine()) != null) { errorMessage.append(line).append("\n"); } } catch (Exception e) { logger.error("GcinfoCommand-redirectStderr has error:"+e.getMessage(),e); try { if (error!=null) { error.close(); } } catch (IOException e1) { e1.printStackTrace(); } } } }); redirectStdout.start(); redirectStderr.start(); try { redirectStdout.join(); redirectStderr.join(); } catch (InterruptedException e) { logger.error("redirectStdout or redirectStderr is interrupted,the error is:"+e.getMessage(),e); } if (errorMessage.toString().length() != 0) { logger.error("jstat -gcutil command has error:" + errorMessage.toString()); content.append(errorMessage); } } private String assembleCommand() { StringBuilder command = new StringBuilder("jstat -gcutil "); command.append(pid); command.append(" "); command.append(intervalTime); command.append(" "); command.append(1); return command.toString(); } }
5,783
0.668978
0.659556
206
26.305826
23.900251
100
false
false
0
0
0
0
0
0
2.679612
false
false
7
41056151954ee9a1d226c6b4d479ea53858690eb
8,873,402,439,461
a6fb064b0d286886ad59c7f3d5b4f0036a8c3ccc
/bwdrsystem/src/main/java/bwdrsystem/dto/ReportFileImportLog.java
c223eb0fdc893e1fa827b7dbe09b47221f5a39aa
[]
no_license
xiongshaogang/supersion
https://github.com/xiongshaogang/supersion
8496407ccf5b298bc50a27af19d858cc57f6999b
c88f803924b21e4993076f22ab16a210ac4a32a2
refs/heads/master
2021-01-19T17:36:37.251000
2016-12-14T06:44:52
2016-12-14T06:44:52
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package bwdrsystem.dto; import java.util.Date; import java.util.Map; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; import org.hibernate.annotations.GenericGenerator; import coresystem.dto.UserInfo; import framework.helper.TypeParse; import framework.interfaces.IColumn; import framework.show.ShowContext; /** * * @description <p>报文导入日志DTO</P> * @createDate 2016/08/08 16:24 PM * @createDate 2016/08/08 16:24 PM * @author Liutao */ @Entity @Table(name="ReportFileImportLog") public class ReportFileImportLog implements java.io.Serializable{ private static final long serialVersionUID = 7697927021246834759L; @Id @Column(name = "id", length = 32) @GeneratedValue(generator = "system-uuid") @GenericGenerator(name = "system-uuid", strategy = "uuid.hex") private String id; @Column(name = "dtDate", nullable = true) @IColumn(description="报文数据日期", isNullable=true) @Temporal(TemporalType.DATE) private Date dtDate; @Column(name = "importDate", nullable = false) @IColumn(description="报文导入日期", isNullable=false) @Temporal(TemporalType.DATE) private Date importDate; @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name="strUserCode", nullable=true) @IColumn(description="导入人员", isNullable=true) private UserInfo operator; @Column(name = "reportFileName", length = 200, nullable = false) @IColumn(description="报文文件名称", isNullable=false) private String reportFileName; @Column(name = "reportName", length = 50, nullable = false) @IColumn(description="报文名称", isNullable=false) private String reportName; @Column(name = "reportType", length = 200, nullable = true) @IColumn(description="报文类型", isNullable=true) private String reportType; @Column(name="strReportInstCode", length=50, nullable=false) @IColumn(description="报送机构代码", isNullable=false) private String strReportInstCode; @Transient @IColumn(description="报送机构名称",isListShow=true, isNullable=true) private String strReportInstName; @Column(name = "importDataCount", nullable = false) @IColumn(description="导入数据条数", isNullable=false) private int importDataCount; @Column(name="remark", length=200, nullable = true) @IColumn(description="备注", isNullable=true) private String remark; @Column(name="result", length=10, nullable = false) @IColumn(description="导入结果", tagMethodName="getImportResult", isNullable=false) private String result; public static Map<String,String> getImportResult(){ return ShowContext.getInstance().getShowEntityMap().get("reportImportResult"); } public String getId() { return id; } public void setId(String id) { this.id = id; } public Date getDtDate() { return dtDate; } public void setDtDate(String in) { this.dtDate = TypeParse.parseDate(in); } public Date getImportDate() { return importDate; } public void setImportDate(String in) { this.importDate = TypeParse.parseDate(in);; } public UserInfo getOperator() { return operator; } public void setOperator(UserInfo operator) { this.operator = operator; } public String getReportFileName() { return reportFileName; } public void setReportFileName(String reportFileName) { this.reportFileName = reportFileName; } public String getReportName() { return reportName; } public void setReportName(String reportName) { this.reportName = reportName; } public String getReportType() { return reportType; } public void setReportType(String reportType) { this.reportType = reportType; } public String getStrReportInstCode() { return strReportInstCode; } public void setStrReportInstCode(String strReportInstCode) { this.strReportInstCode = strReportInstCode; } public String getStrReportInstName() { return strReportInstName; } public void setStrReportInstName(String strReportInstName) { this.strReportInstName = strReportInstName; } public int getImportDataCount() { return importDataCount; } public void setImportDataCount(int importDataCount) { this.importDataCount = importDataCount; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public String getResult() { return result; } public void setResult(String result) { this.result = result; } }
UTF-8
Java
4,893
java
ReportFileImportLog.java
Java
[ { "context": "PM\r\n * @createDate 2016/08/08 16:24 PM\r\n * @author Liutao\r\n */\r\n@Entity\r\n@Table(name=\"ReportFileImportLog\")", "end": 808, "score": 0.8740992546081543, "start": 802, "tag": "NAME", "value": "Liutao" } ]
null
[]
package bwdrsystem.dto; import java.util.Date; import java.util.Map; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; import org.hibernate.annotations.GenericGenerator; import coresystem.dto.UserInfo; import framework.helper.TypeParse; import framework.interfaces.IColumn; import framework.show.ShowContext; /** * * @description <p>报文导入日志DTO</P> * @createDate 2016/08/08 16:24 PM * @createDate 2016/08/08 16:24 PM * @author Liutao */ @Entity @Table(name="ReportFileImportLog") public class ReportFileImportLog implements java.io.Serializable{ private static final long serialVersionUID = 7697927021246834759L; @Id @Column(name = "id", length = 32) @GeneratedValue(generator = "system-uuid") @GenericGenerator(name = "system-uuid", strategy = "uuid.hex") private String id; @Column(name = "dtDate", nullable = true) @IColumn(description="报文数据日期", isNullable=true) @Temporal(TemporalType.DATE) private Date dtDate; @Column(name = "importDate", nullable = false) @IColumn(description="报文导入日期", isNullable=false) @Temporal(TemporalType.DATE) private Date importDate; @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name="strUserCode", nullable=true) @IColumn(description="导入人员", isNullable=true) private UserInfo operator; @Column(name = "reportFileName", length = 200, nullable = false) @IColumn(description="报文文件名称", isNullable=false) private String reportFileName; @Column(name = "reportName", length = 50, nullable = false) @IColumn(description="报文名称", isNullable=false) private String reportName; @Column(name = "reportType", length = 200, nullable = true) @IColumn(description="报文类型", isNullable=true) private String reportType; @Column(name="strReportInstCode", length=50, nullable=false) @IColumn(description="报送机构代码", isNullable=false) private String strReportInstCode; @Transient @IColumn(description="报送机构名称",isListShow=true, isNullable=true) private String strReportInstName; @Column(name = "importDataCount", nullable = false) @IColumn(description="导入数据条数", isNullable=false) private int importDataCount; @Column(name="remark", length=200, nullable = true) @IColumn(description="备注", isNullable=true) private String remark; @Column(name="result", length=10, nullable = false) @IColumn(description="导入结果", tagMethodName="getImportResult", isNullable=false) private String result; public static Map<String,String> getImportResult(){ return ShowContext.getInstance().getShowEntityMap().get("reportImportResult"); } public String getId() { return id; } public void setId(String id) { this.id = id; } public Date getDtDate() { return dtDate; } public void setDtDate(String in) { this.dtDate = TypeParse.parseDate(in); } public Date getImportDate() { return importDate; } public void setImportDate(String in) { this.importDate = TypeParse.parseDate(in);; } public UserInfo getOperator() { return operator; } public void setOperator(UserInfo operator) { this.operator = operator; } public String getReportFileName() { return reportFileName; } public void setReportFileName(String reportFileName) { this.reportFileName = reportFileName; } public String getReportName() { return reportName; } public void setReportName(String reportName) { this.reportName = reportName; } public String getReportType() { return reportType; } public void setReportType(String reportType) { this.reportType = reportType; } public String getStrReportInstCode() { return strReportInstCode; } public void setStrReportInstCode(String strReportInstCode) { this.strReportInstCode = strReportInstCode; } public String getStrReportInstName() { return strReportInstName; } public void setStrReportInstName(String strReportInstName) { this.strReportInstName = strReportInstName; } public int getImportDataCount() { return importDataCount; } public void setImportDataCount(int importDataCount) { this.importDataCount = importDataCount; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public String getResult() { return result; } public void setResult(String result) { this.result = result; } }
4,893
0.722187
0.709617
192
22.859375
20.758181
80
false
false
0
0
0
0
0
0
1.28125
false
false
7
f0d5695d6d9d17a8da5923a3a2e4c702f786d7e1
8,873,402,442,672
a778c7ddb9f63d2f3d8bbd5fc6c1bc4ee996b765
/app/src/main/java/db/PersistedData.java
843d2170e59b9e69299b49761d450b48f9961e0d
[]
no_license
ayush1/SearchImagePOC
https://github.com/ayush1/SearchImagePOC
776234611a4d31a7ce1e7463b8267cc1a6b48711
bc99861da366b39e485e1d8d540a9dec710b7657
refs/heads/master
2020-03-16T11:58:37.154000
2018-05-08T19:55:03
2018-05-08T19:55:03
132,657,510
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package db; import android.arch.persistence.room.ColumnInfo; import android.arch.persistence.room.Entity; import android.arch.persistence.room.PrimaryKey; @Entity(tableName = "persisted") public class PersistedData { @PrimaryKey(autoGenerate = true) private int uid; @ColumnInfo(name = "search_key") private String key; @ColumnInfo(name = "key_url") private String keyUrl; public int getUid() { return uid; } public void setUid(int uid) { this.uid = uid; } public String getKey() { return key; } public void setKey(String key) { this.key = key; } public String getKeyUrl() { return keyUrl; } public void setKeyUrl(String keyUrl) { this.keyUrl = keyUrl; } }
UTF-8
Java
788
java
PersistedData.java
Java
[]
null
[]
package db; import android.arch.persistence.room.ColumnInfo; import android.arch.persistence.room.Entity; import android.arch.persistence.room.PrimaryKey; @Entity(tableName = "persisted") public class PersistedData { @PrimaryKey(autoGenerate = true) private int uid; @ColumnInfo(name = "search_key") private String key; @ColumnInfo(name = "key_url") private String keyUrl; public int getUid() { return uid; } public void setUid(int uid) { this.uid = uid; } public String getKey() { return key; } public void setKey(String key) { this.key = key; } public String getKeyUrl() { return keyUrl; } public void setKeyUrl(String keyUrl) { this.keyUrl = keyUrl; } }
788
0.626904
0.626904
42
17.761906
15.647622
48
false
false
0
0
0
0
0
0
0.309524
false
false
7
fb0e4fd6742d938bd1f63ddb26add4ddeb660bf7
20,804,821,591,071
31b796c8f4619008370fefdfafbfdbef4a4bf13d
/app/src/main/java/com/example/hw2timer/ListFragment.java
c53c627e35050c968b21e9ed0dcf7d2ea71d16a3
[]
no_license
joshuamsje/HW2AsyncTask
https://github.com/joshuamsje/HW2AsyncTask
d1870c9ea873481e99364335150b80d681f0afa6
89e57f08c0167b1a8b935a28f14edd938485cb56
refs/heads/master
2023-03-25T11:17:12.819000
2021-03-06T21:47:11
2021-03-06T21:47:11
345,202,088
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.hw2timer; import android.content.Context; import android.content.res.Configuration; import android.os.Bundle; import android.service.controls.Control; import android.text.method.ScrollingMovementMethod; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import org.w3c.dom.Text; import java.util.ArrayList; public class ListFragment extends Fragment { boolean landscapeCheck; TextView lapHolder; int listCheck = 0; public ListFragment() { } public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view= inflater.inflate(R.layout.list_fragment, container, false); lapHolder = view.findViewById(R.id.listScreen); lapHolder.setMovementMethod(new ScrollingMovementMethod()); return view; } public void setResult(ArrayList<String> list, int counter) { String result = ""; for (int i = 0; i < list.size(); i++) { result += i + ": " + list.get(i) + "\n"; } lapHolder.setText(result); listCheck++; } public void clear() { lapHolder.setText(""); } }
UTF-8
Java
1,430
java
ListFragment.java
Java
[]
null
[]
package com.example.hw2timer; import android.content.Context; import android.content.res.Configuration; import android.os.Bundle; import android.service.controls.Control; import android.text.method.ScrollingMovementMethod; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import org.w3c.dom.Text; import java.util.ArrayList; public class ListFragment extends Fragment { boolean landscapeCheck; TextView lapHolder; int listCheck = 0; public ListFragment() { } public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view= inflater.inflate(R.layout.list_fragment, container, false); lapHolder = view.findViewById(R.id.listScreen); lapHolder.setMovementMethod(new ScrollingMovementMethod()); return view; } public void setResult(ArrayList<String> list, int counter) { String result = ""; for (int i = 0; i < list.size(); i++) { result += i + ": " + list.get(i) + "\n"; } lapHolder.setText(result); listCheck++; } public void clear() { lapHolder.setText(""); } }
1,430
0.671329
0.668531
69
19.724638
21.279291
78
false
false
0
0
0
0
0
0
0.507246
false
false
7
b6525761973ce117b4c26e88ac2354cd8514e85d
13,829,794,706,094
22042e687d87696412d9ca518909486f8f133a13
/eclipse/src/com/csz/cci/Q14.java
95ec6df65369b66b33ceb54e839c68dd2e822069
[]
no_license
xiaos/mycode
https://github.com/xiaos/mycode
2e2553e063c9cace9c2410fcda0f38dcb3214947
3aed98c61ec74fc486784a26e5483b526d162ad7
refs/heads/master
2018-03-31T03:12:45.252000
2018-03-30T14:54:10
2018-03-30T14:54:10
88,062,389
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.csz.cci; // Write a method to decide if two strings are anagrams or not. public class Q14 { public static void main(String... args) { char[] a = "abcdefe".toCharArray(); char[] b = "cdefbea".toCharArray(); System.out.println(isAnagrams2(a, b)); } private static boolean isAnagrams2(char[] a, char[] b) { if (a.length != b.length) { return false; } char[] count = new char[256]; for (int i = 0; i < a.length; i++) { count[a[i]]++; } for (int i = 0; i < b.length; i++) { count[b[i]]--; } for (int i = 0; i < count.length; i++) { if (count[i] != 0) { return false; } } return true; } private static boolean isAnagrams(char[] a, char[] b) { boolean isSame = true; if (a.length == b.length) { quickSort(a, 0, a.length - 1); quickSort(b, 0, b.length - 1); System.out.println(a); System.out.println(b); for (int i = 0; i < a.length; i++) { if (a[i] != b[i]) { isSame = false; break; } } } else { isSame = false; } return isSame; } private static void quickSort(char[] a, int left, int right) { if (right > left) { int pivot = findPivot(a, left, right); quickSort(a, left, pivot - 1); quickSort(a, pivot + 1, right); } } private static int findPivot(char[] a, int left, int right) { int pivotValue = a[left]; while (right > left) { while (a[right] >= pivotValue && right > left) { right--; } if (right > left) { char tmp = a[left]; a[left] = a[right]; a[right] = tmp; left++; } while (left < right && a[left] < a[right]) { left++; } if (left < right) { char tmp = a[left]; a[left] = a[right]; a[right] = tmp; left++; } } return left; } }
UTF-8
Java
1,752
java
Q14.java
Java
[]
null
[]
package com.csz.cci; // Write a method to decide if two strings are anagrams or not. public class Q14 { public static void main(String... args) { char[] a = "abcdefe".toCharArray(); char[] b = "cdefbea".toCharArray(); System.out.println(isAnagrams2(a, b)); } private static boolean isAnagrams2(char[] a, char[] b) { if (a.length != b.length) { return false; } char[] count = new char[256]; for (int i = 0; i < a.length; i++) { count[a[i]]++; } for (int i = 0; i < b.length; i++) { count[b[i]]--; } for (int i = 0; i < count.length; i++) { if (count[i] != 0) { return false; } } return true; } private static boolean isAnagrams(char[] a, char[] b) { boolean isSame = true; if (a.length == b.length) { quickSort(a, 0, a.length - 1); quickSort(b, 0, b.length - 1); System.out.println(a); System.out.println(b); for (int i = 0; i < a.length; i++) { if (a[i] != b[i]) { isSame = false; break; } } } else { isSame = false; } return isSame; } private static void quickSort(char[] a, int left, int right) { if (right > left) { int pivot = findPivot(a, left, right); quickSort(a, left, pivot - 1); quickSort(a, pivot + 1, right); } } private static int findPivot(char[] a, int left, int right) { int pivotValue = a[left]; while (right > left) { while (a[right] >= pivotValue && right > left) { right--; } if (right > left) { char tmp = a[left]; a[left] = a[right]; a[right] = tmp; left++; } while (left < right && a[left] < a[right]) { left++; } if (left < right) { char tmp = a[left]; a[left] = a[right]; a[right] = tmp; left++; } } return left; } }
1,752
0.542237
0.531963
97
17.061855
17.095737
63
false
false
0
0
0
0
0
0
2.556701
false
false
7
9479edb30ede8dd4f1a9348bddab24b85a8942d3
14,843,406,987,230
ccf83a91aa0f156b83dd5c0aa56a8f51c493c4d9
/crm-all/crm-cm/crm-cm-web/src/main/java/com/aii/crm/cm/web/persistence/bo/CmGroupOrgStruct.java
bb872d01dd11fb6013c135b30be9d8c09fb80161
[]
no_license
bellmit/pirvate
https://github.com/bellmit/pirvate
9cb39b22e88f0f94e6fa25822acc827e1b0c0172
168e11634a3ce5ba0fc0dd44a270d136442c5709
refs/heads/master
2022-11-14T06:40:34.180000
2019-08-01T08:53:10
2019-08-01T08:53:10
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.aii.crm.cm.web.persistence.bo; import java.util.Date; public class CmGroupOrgStruct { /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.DEPT_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long deptId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.PARENT_DEPT_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long parentDeptId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.CUST_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long custId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.DEPT_NAME * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private String deptName; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.DEPT_TYPE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long deptType; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.DEPT_FUNC * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private String deptFunc; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.DEPT_LEVEL * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long deptLevel; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.PRINCIPAL * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private String principal; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.PRINCIPAL_TEL * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private String principalTel; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.HAS_LEAF * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long hasLeaf; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.REL_CUST_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long relCustId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.IS_CONTACT_POINT * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long isContactPoint; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.IS_HAVE_CONTACT_POINT * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long isHaveContactPoint; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.IS_REVISABLE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long isRevisable; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.MODIFIED_BY * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long modifiedBy; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.MODIFIED_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Date modifiedDate; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.STATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private String state; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.CREATE_OP_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long createOpId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.CREATE_ORG_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long createOrgId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.OP_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long opId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.ORG_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long orgId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.DONE_CODE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long doneCode; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.CREATE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Date createDate; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.DONE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Date doneDate; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.EFFECTIVE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Date effectiveDate; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.EXPIRE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Date expireDate; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.REGION_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private String regionId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.REMARKS * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private String remarks; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.IS_CPE_PROVISIONING_NEEDED * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private String isCpeProvisioningNeeded; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.WIFI_NAME * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private String wifiName; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.WIFI_PASSWORD * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private String wifiPassword; /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.DEPT_ID * * @return the value of cm_group_org_struct.DEPT_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getDeptId() { return deptId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.DEPT_ID * * @param deptId the value for cm_group_org_struct.DEPT_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setDeptId(Long deptId) { this.deptId = deptId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.PARENT_DEPT_ID * * @return the value of cm_group_org_struct.PARENT_DEPT_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getParentDeptId() { return parentDeptId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.PARENT_DEPT_ID * * @param parentDeptId the value for cm_group_org_struct.PARENT_DEPT_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setParentDeptId(Long parentDeptId) { this.parentDeptId = parentDeptId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.CUST_ID * * @return the value of cm_group_org_struct.CUST_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getCustId() { return custId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.CUST_ID * * @param custId the value for cm_group_org_struct.CUST_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setCustId(Long custId) { this.custId = custId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.DEPT_NAME * * @return the value of cm_group_org_struct.DEPT_NAME * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public String getDeptName() { return deptName; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.DEPT_NAME * * @param deptName the value for cm_group_org_struct.DEPT_NAME * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setDeptName(String deptName) { this.deptName = deptName == null ? null : deptName.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.DEPT_TYPE * * @return the value of cm_group_org_struct.DEPT_TYPE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getDeptType() { return deptType; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.DEPT_TYPE * * @param deptType the value for cm_group_org_struct.DEPT_TYPE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setDeptType(Long deptType) { this.deptType = deptType; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.DEPT_FUNC * * @return the value of cm_group_org_struct.DEPT_FUNC * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public String getDeptFunc() { return deptFunc; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.DEPT_FUNC * * @param deptFunc the value for cm_group_org_struct.DEPT_FUNC * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setDeptFunc(String deptFunc) { this.deptFunc = deptFunc == null ? null : deptFunc.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.DEPT_LEVEL * * @return the value of cm_group_org_struct.DEPT_LEVEL * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getDeptLevel() { return deptLevel; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.DEPT_LEVEL * * @param deptLevel the value for cm_group_org_struct.DEPT_LEVEL * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setDeptLevel(Long deptLevel) { this.deptLevel = deptLevel; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.PRINCIPAL * * @return the value of cm_group_org_struct.PRINCIPAL * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public String getPrincipal() { return principal; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.PRINCIPAL * * @param principal the value for cm_group_org_struct.PRINCIPAL * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setPrincipal(String principal) { this.principal = principal == null ? null : principal.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.PRINCIPAL_TEL * * @return the value of cm_group_org_struct.PRINCIPAL_TEL * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public String getPrincipalTel() { return principalTel; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.PRINCIPAL_TEL * * @param principalTel the value for cm_group_org_struct.PRINCIPAL_TEL * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setPrincipalTel(String principalTel) { this.principalTel = principalTel == null ? null : principalTel.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.HAS_LEAF * * @return the value of cm_group_org_struct.HAS_LEAF * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getHasLeaf() { return hasLeaf; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.HAS_LEAF * * @param hasLeaf the value for cm_group_org_struct.HAS_LEAF * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setHasLeaf(Long hasLeaf) { this.hasLeaf = hasLeaf; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.REL_CUST_ID * * @return the value of cm_group_org_struct.REL_CUST_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getRelCustId() { return relCustId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.REL_CUST_ID * * @param relCustId the value for cm_group_org_struct.REL_CUST_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setRelCustId(Long relCustId) { this.relCustId = relCustId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.IS_CONTACT_POINT * * @return the value of cm_group_org_struct.IS_CONTACT_POINT * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getIsContactPoint() { return isContactPoint; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.IS_CONTACT_POINT * * @param isContactPoint the value for cm_group_org_struct.IS_CONTACT_POINT * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setIsContactPoint(Long isContactPoint) { this.isContactPoint = isContactPoint; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.IS_HAVE_CONTACT_POINT * * @return the value of cm_group_org_struct.IS_HAVE_CONTACT_POINT * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getIsHaveContactPoint() { return isHaveContactPoint; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.IS_HAVE_CONTACT_POINT * * @param isHaveContactPoint the value for cm_group_org_struct.IS_HAVE_CONTACT_POINT * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setIsHaveContactPoint(Long isHaveContactPoint) { this.isHaveContactPoint = isHaveContactPoint; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.IS_REVISABLE * * @return the value of cm_group_org_struct.IS_REVISABLE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getIsRevisable() { return isRevisable; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.IS_REVISABLE * * @param isRevisable the value for cm_group_org_struct.IS_REVISABLE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setIsRevisable(Long isRevisable) { this.isRevisable = isRevisable; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.MODIFIED_BY * * @return the value of cm_group_org_struct.MODIFIED_BY * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getModifiedBy() { return modifiedBy; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.MODIFIED_BY * * @param modifiedBy the value for cm_group_org_struct.MODIFIED_BY * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setModifiedBy(Long modifiedBy) { this.modifiedBy = modifiedBy; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.MODIFIED_DATE * * @return the value of cm_group_org_struct.MODIFIED_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Date getModifiedDate() { return modifiedDate; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.MODIFIED_DATE * * @param modifiedDate the value for cm_group_org_struct.MODIFIED_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setModifiedDate(Date modifiedDate) { this.modifiedDate = modifiedDate; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.STATE * * @return the value of cm_group_org_struct.STATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public String getState() { return state; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.STATE * * @param state the value for cm_group_org_struct.STATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setState(String state) { this.state = state == null ? null : state.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.CREATE_OP_ID * * @return the value of cm_group_org_struct.CREATE_OP_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getCreateOpId() { return createOpId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.CREATE_OP_ID * * @param createOpId the value for cm_group_org_struct.CREATE_OP_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setCreateOpId(Long createOpId) { this.createOpId = createOpId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.CREATE_ORG_ID * * @return the value of cm_group_org_struct.CREATE_ORG_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getCreateOrgId() { return createOrgId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.CREATE_ORG_ID * * @param createOrgId the value for cm_group_org_struct.CREATE_ORG_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setCreateOrgId(Long createOrgId) { this.createOrgId = createOrgId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.OP_ID * * @return the value of cm_group_org_struct.OP_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getOpId() { return opId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.OP_ID * * @param opId the value for cm_group_org_struct.OP_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setOpId(Long opId) { this.opId = opId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.ORG_ID * * @return the value of cm_group_org_struct.ORG_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getOrgId() { return orgId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.ORG_ID * * @param orgId the value for cm_group_org_struct.ORG_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setOrgId(Long orgId) { this.orgId = orgId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.DONE_CODE * * @return the value of cm_group_org_struct.DONE_CODE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getDoneCode() { return doneCode; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.DONE_CODE * * @param doneCode the value for cm_group_org_struct.DONE_CODE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setDoneCode(Long doneCode) { this.doneCode = doneCode; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.CREATE_DATE * * @return the value of cm_group_org_struct.CREATE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Date getCreateDate() { return createDate; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.CREATE_DATE * * @param createDate the value for cm_group_org_struct.CREATE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setCreateDate(Date createDate) { this.createDate = createDate; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.DONE_DATE * * @return the value of cm_group_org_struct.DONE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Date getDoneDate() { return doneDate; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.DONE_DATE * * @param doneDate the value for cm_group_org_struct.DONE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setDoneDate(Date doneDate) { this.doneDate = doneDate; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.EFFECTIVE_DATE * * @return the value of cm_group_org_struct.EFFECTIVE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Date getEffectiveDate() { return effectiveDate; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.EFFECTIVE_DATE * * @param effectiveDate the value for cm_group_org_struct.EFFECTIVE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setEffectiveDate(Date effectiveDate) { this.effectiveDate = effectiveDate; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.EXPIRE_DATE * * @return the value of cm_group_org_struct.EXPIRE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Date getExpireDate() { return expireDate; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.EXPIRE_DATE * * @param expireDate the value for cm_group_org_struct.EXPIRE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setExpireDate(Date expireDate) { this.expireDate = expireDate; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.REGION_ID * * @return the value of cm_group_org_struct.REGION_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public String getRegionId() { return regionId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.REGION_ID * * @param regionId the value for cm_group_org_struct.REGION_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setRegionId(String regionId) { this.regionId = regionId == null ? null : regionId.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.REMARKS * * @return the value of cm_group_org_struct.REMARKS * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public String getRemarks() { return remarks; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.REMARKS * * @param remarks the value for cm_group_org_struct.REMARKS * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setRemarks(String remarks) { this.remarks = remarks == null ? null : remarks.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.IS_CPE_PROVISIONING_NEEDED * * @return the value of cm_group_org_struct.IS_CPE_PROVISIONING_NEEDED * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public String getIsCpeProvisioningNeeded() { return isCpeProvisioningNeeded; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.IS_CPE_PROVISIONING_NEEDED * * @param isCpeProvisioningNeeded the value for cm_group_org_struct.IS_CPE_PROVISIONING_NEEDED * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setIsCpeProvisioningNeeded(String isCpeProvisioningNeeded) { this.isCpeProvisioningNeeded = isCpeProvisioningNeeded == null ? null : isCpeProvisioningNeeded.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.WIFI_NAME * * @return the value of cm_group_org_struct.WIFI_NAME * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public String getWifiName() { return wifiName; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.WIFI_NAME * * @param wifiName the value for cm_group_org_struct.WIFI_NAME * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setWifiName(String wifiName) { this.wifiName = wifiName == null ? null : wifiName.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.WIFI_PASSWORD * * @return the value of cm_group_org_struct.WIFI_PASSWORD * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public String getWifiPassword() { return wifiPassword; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.WIFI_PASSWORD * * @param wifiPassword the value for cm_group_org_struct.WIFI_PASSWORD * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setWifiPassword(String wifiPassword) { this.wifiPassword = wifiPassword == null ? null : wifiPassword.trim(); } }
UTF-8
Java
31,299
java
CmGroupOrgStruct.java
Java
[]
null
[]
package com.aii.crm.cm.web.persistence.bo; import java.util.Date; public class CmGroupOrgStruct { /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.DEPT_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long deptId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.PARENT_DEPT_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long parentDeptId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.CUST_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long custId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.DEPT_NAME * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private String deptName; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.DEPT_TYPE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long deptType; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.DEPT_FUNC * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private String deptFunc; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.DEPT_LEVEL * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long deptLevel; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.PRINCIPAL * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private String principal; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.PRINCIPAL_TEL * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private String principalTel; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.HAS_LEAF * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long hasLeaf; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.REL_CUST_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long relCustId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.IS_CONTACT_POINT * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long isContactPoint; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.IS_HAVE_CONTACT_POINT * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long isHaveContactPoint; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.IS_REVISABLE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long isRevisable; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.MODIFIED_BY * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long modifiedBy; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.MODIFIED_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Date modifiedDate; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.STATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private String state; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.CREATE_OP_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long createOpId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.CREATE_ORG_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long createOrgId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.OP_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long opId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.ORG_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long orgId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.DONE_CODE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Long doneCode; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.CREATE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Date createDate; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.DONE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Date doneDate; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.EFFECTIVE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Date effectiveDate; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.EXPIRE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private Date expireDate; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.REGION_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private String regionId; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.REMARKS * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private String remarks; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.IS_CPE_PROVISIONING_NEEDED * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private String isCpeProvisioningNeeded; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.WIFI_NAME * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private String wifiName; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column cm_group_org_struct.WIFI_PASSWORD * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ private String wifiPassword; /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.DEPT_ID * * @return the value of cm_group_org_struct.DEPT_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getDeptId() { return deptId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.DEPT_ID * * @param deptId the value for cm_group_org_struct.DEPT_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setDeptId(Long deptId) { this.deptId = deptId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.PARENT_DEPT_ID * * @return the value of cm_group_org_struct.PARENT_DEPT_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getParentDeptId() { return parentDeptId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.PARENT_DEPT_ID * * @param parentDeptId the value for cm_group_org_struct.PARENT_DEPT_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setParentDeptId(Long parentDeptId) { this.parentDeptId = parentDeptId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.CUST_ID * * @return the value of cm_group_org_struct.CUST_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getCustId() { return custId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.CUST_ID * * @param custId the value for cm_group_org_struct.CUST_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setCustId(Long custId) { this.custId = custId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.DEPT_NAME * * @return the value of cm_group_org_struct.DEPT_NAME * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public String getDeptName() { return deptName; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.DEPT_NAME * * @param deptName the value for cm_group_org_struct.DEPT_NAME * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setDeptName(String deptName) { this.deptName = deptName == null ? null : deptName.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.DEPT_TYPE * * @return the value of cm_group_org_struct.DEPT_TYPE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getDeptType() { return deptType; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.DEPT_TYPE * * @param deptType the value for cm_group_org_struct.DEPT_TYPE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setDeptType(Long deptType) { this.deptType = deptType; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.DEPT_FUNC * * @return the value of cm_group_org_struct.DEPT_FUNC * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public String getDeptFunc() { return deptFunc; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.DEPT_FUNC * * @param deptFunc the value for cm_group_org_struct.DEPT_FUNC * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setDeptFunc(String deptFunc) { this.deptFunc = deptFunc == null ? null : deptFunc.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.DEPT_LEVEL * * @return the value of cm_group_org_struct.DEPT_LEVEL * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getDeptLevel() { return deptLevel; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.DEPT_LEVEL * * @param deptLevel the value for cm_group_org_struct.DEPT_LEVEL * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setDeptLevel(Long deptLevel) { this.deptLevel = deptLevel; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.PRINCIPAL * * @return the value of cm_group_org_struct.PRINCIPAL * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public String getPrincipal() { return principal; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.PRINCIPAL * * @param principal the value for cm_group_org_struct.PRINCIPAL * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setPrincipal(String principal) { this.principal = principal == null ? null : principal.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.PRINCIPAL_TEL * * @return the value of cm_group_org_struct.PRINCIPAL_TEL * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public String getPrincipalTel() { return principalTel; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.PRINCIPAL_TEL * * @param principalTel the value for cm_group_org_struct.PRINCIPAL_TEL * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setPrincipalTel(String principalTel) { this.principalTel = principalTel == null ? null : principalTel.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.HAS_LEAF * * @return the value of cm_group_org_struct.HAS_LEAF * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getHasLeaf() { return hasLeaf; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.HAS_LEAF * * @param hasLeaf the value for cm_group_org_struct.HAS_LEAF * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setHasLeaf(Long hasLeaf) { this.hasLeaf = hasLeaf; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.REL_CUST_ID * * @return the value of cm_group_org_struct.REL_CUST_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getRelCustId() { return relCustId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.REL_CUST_ID * * @param relCustId the value for cm_group_org_struct.REL_CUST_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setRelCustId(Long relCustId) { this.relCustId = relCustId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.IS_CONTACT_POINT * * @return the value of cm_group_org_struct.IS_CONTACT_POINT * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getIsContactPoint() { return isContactPoint; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.IS_CONTACT_POINT * * @param isContactPoint the value for cm_group_org_struct.IS_CONTACT_POINT * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setIsContactPoint(Long isContactPoint) { this.isContactPoint = isContactPoint; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.IS_HAVE_CONTACT_POINT * * @return the value of cm_group_org_struct.IS_HAVE_CONTACT_POINT * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getIsHaveContactPoint() { return isHaveContactPoint; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.IS_HAVE_CONTACT_POINT * * @param isHaveContactPoint the value for cm_group_org_struct.IS_HAVE_CONTACT_POINT * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setIsHaveContactPoint(Long isHaveContactPoint) { this.isHaveContactPoint = isHaveContactPoint; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.IS_REVISABLE * * @return the value of cm_group_org_struct.IS_REVISABLE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getIsRevisable() { return isRevisable; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.IS_REVISABLE * * @param isRevisable the value for cm_group_org_struct.IS_REVISABLE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setIsRevisable(Long isRevisable) { this.isRevisable = isRevisable; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.MODIFIED_BY * * @return the value of cm_group_org_struct.MODIFIED_BY * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getModifiedBy() { return modifiedBy; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.MODIFIED_BY * * @param modifiedBy the value for cm_group_org_struct.MODIFIED_BY * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setModifiedBy(Long modifiedBy) { this.modifiedBy = modifiedBy; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.MODIFIED_DATE * * @return the value of cm_group_org_struct.MODIFIED_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Date getModifiedDate() { return modifiedDate; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.MODIFIED_DATE * * @param modifiedDate the value for cm_group_org_struct.MODIFIED_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setModifiedDate(Date modifiedDate) { this.modifiedDate = modifiedDate; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.STATE * * @return the value of cm_group_org_struct.STATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public String getState() { return state; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.STATE * * @param state the value for cm_group_org_struct.STATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setState(String state) { this.state = state == null ? null : state.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.CREATE_OP_ID * * @return the value of cm_group_org_struct.CREATE_OP_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getCreateOpId() { return createOpId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.CREATE_OP_ID * * @param createOpId the value for cm_group_org_struct.CREATE_OP_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setCreateOpId(Long createOpId) { this.createOpId = createOpId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.CREATE_ORG_ID * * @return the value of cm_group_org_struct.CREATE_ORG_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getCreateOrgId() { return createOrgId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.CREATE_ORG_ID * * @param createOrgId the value for cm_group_org_struct.CREATE_ORG_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setCreateOrgId(Long createOrgId) { this.createOrgId = createOrgId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.OP_ID * * @return the value of cm_group_org_struct.OP_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getOpId() { return opId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.OP_ID * * @param opId the value for cm_group_org_struct.OP_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setOpId(Long opId) { this.opId = opId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.ORG_ID * * @return the value of cm_group_org_struct.ORG_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getOrgId() { return orgId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.ORG_ID * * @param orgId the value for cm_group_org_struct.ORG_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setOrgId(Long orgId) { this.orgId = orgId; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.DONE_CODE * * @return the value of cm_group_org_struct.DONE_CODE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Long getDoneCode() { return doneCode; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.DONE_CODE * * @param doneCode the value for cm_group_org_struct.DONE_CODE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setDoneCode(Long doneCode) { this.doneCode = doneCode; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.CREATE_DATE * * @return the value of cm_group_org_struct.CREATE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Date getCreateDate() { return createDate; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.CREATE_DATE * * @param createDate the value for cm_group_org_struct.CREATE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setCreateDate(Date createDate) { this.createDate = createDate; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.DONE_DATE * * @return the value of cm_group_org_struct.DONE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Date getDoneDate() { return doneDate; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.DONE_DATE * * @param doneDate the value for cm_group_org_struct.DONE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setDoneDate(Date doneDate) { this.doneDate = doneDate; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.EFFECTIVE_DATE * * @return the value of cm_group_org_struct.EFFECTIVE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Date getEffectiveDate() { return effectiveDate; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.EFFECTIVE_DATE * * @param effectiveDate the value for cm_group_org_struct.EFFECTIVE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setEffectiveDate(Date effectiveDate) { this.effectiveDate = effectiveDate; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.EXPIRE_DATE * * @return the value of cm_group_org_struct.EXPIRE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public Date getExpireDate() { return expireDate; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.EXPIRE_DATE * * @param expireDate the value for cm_group_org_struct.EXPIRE_DATE * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setExpireDate(Date expireDate) { this.expireDate = expireDate; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.REGION_ID * * @return the value of cm_group_org_struct.REGION_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public String getRegionId() { return regionId; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.REGION_ID * * @param regionId the value for cm_group_org_struct.REGION_ID * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setRegionId(String regionId) { this.regionId = regionId == null ? null : regionId.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.REMARKS * * @return the value of cm_group_org_struct.REMARKS * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public String getRemarks() { return remarks; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.REMARKS * * @param remarks the value for cm_group_org_struct.REMARKS * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setRemarks(String remarks) { this.remarks = remarks == null ? null : remarks.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.IS_CPE_PROVISIONING_NEEDED * * @return the value of cm_group_org_struct.IS_CPE_PROVISIONING_NEEDED * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public String getIsCpeProvisioningNeeded() { return isCpeProvisioningNeeded; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.IS_CPE_PROVISIONING_NEEDED * * @param isCpeProvisioningNeeded the value for cm_group_org_struct.IS_CPE_PROVISIONING_NEEDED * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setIsCpeProvisioningNeeded(String isCpeProvisioningNeeded) { this.isCpeProvisioningNeeded = isCpeProvisioningNeeded == null ? null : isCpeProvisioningNeeded.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.WIFI_NAME * * @return the value of cm_group_org_struct.WIFI_NAME * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public String getWifiName() { return wifiName; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.WIFI_NAME * * @param wifiName the value for cm_group_org_struct.WIFI_NAME * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setWifiName(String wifiName) { this.wifiName = wifiName == null ? null : wifiName.trim(); } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column cm_group_org_struct.WIFI_PASSWORD * * @return the value of cm_group_org_struct.WIFI_PASSWORD * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public String getWifiPassword() { return wifiPassword; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column cm_group_org_struct.WIFI_PASSWORD * * @param wifiPassword the value for cm_group_org_struct.WIFI_PASSWORD * * @mbg.generated Tue May 28 20:26:01 CST 2019 */ public void setWifiPassword(String wifiPassword) { this.wifiPassword = wifiPassword == null ? null : wifiPassword.trim(); } }
31,299
0.636666
0.60101
1,028
29.447472
28.626539
111
false
false
0
0
0
0
0
0
0.092412
false
false
7
ed8d8884cf7b38a14d651effa008b19014174d4b
11,295,764,002,463
4f069a8ab9d1c4bea773e63d23864a2f490d9e55
/src/cui/litang/phoneguard/engine/AppInfoProvider.java
a3e874ff755362f69c8f88790ae13fcbf6c3b640
[ "Apache-2.0" ]
permissive
cuilitang/PhoneGuard
https://github.com/cuilitang/PhoneGuard
1f31e395e719943fe18cf692956213e512effe0f
94ca3c2e0250eb7f14686844c28eeadef4bec0c9
refs/heads/master
2021-01-10T12:39:35.029000
2015-08-10T16:57:54
2015-08-10T16:57:54
36,923,815
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cui.litang.phoneguard.engine; import java.util.ArrayList; import java.util.List; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.graphics.drawable.Drawable; import cui.litang.phoneguard.entity.AppInfo; /** * 获取手机安装的所有应用信息 * @author Cuilitang * @Date 2015年7月21日 */ public class AppInfoProvider { /** * 获取已经安卓的所有程序信息的List集合 * @param context 上下文 * @return List<AppInfo> */ public static List<AppInfo> getAppInfos(Context context){ PackageManager pm = context.getPackageManager(); List<PackageInfo> pi = pm.getInstalledPackages(0); ArrayList<AppInfo> appInfos = new ArrayList<AppInfo>(); for (PackageInfo packageInfo : pi) { AppInfo appInfo = new AppInfo(); String packname = packageInfo.packageName; Drawable icon = packageInfo.applicationInfo.loadIcon(pm); String name = packageInfo.applicationInfo.loadLabel(pm).toString(); int flags = packageInfo.applicationInfo.flags; if((flags&ApplicationInfo.FLAG_SYSTEM)==0){ appInfo.setUserApp(true); }else { appInfo.setUserApp(false); } if((flags&ApplicationInfo.FLAG_EXTERNAL_STORAGE)==0){ appInfo.setInRAM(true); }else { appInfo.setInRAM(false); } appInfo.setName(name); appInfo.setIcon(icon); appInfo.setPackname(packname); appInfos.add(appInfo); } return appInfos; } }
UTF-8
Java
1,602
java
AppInfoProvider.java
Java
[ { "context": "tity.AppInfo;\r\n\r\n/**\r\n * 获取手机安装的所有应用信息\r\n * @author Cuilitang\r\n * @Date 2015年7月21日\r\n */\r\npublic class AppInfoPr", "end": 391, "score": 0.8550102114677429, "start": 382, "tag": "USERNAME", "value": "Cuilitang" } ]
null
[]
package cui.litang.phoneguard.engine; import java.util.ArrayList; import java.util.List; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.graphics.drawable.Drawable; import cui.litang.phoneguard.entity.AppInfo; /** * 获取手机安装的所有应用信息 * @author Cuilitang * @Date 2015年7月21日 */ public class AppInfoProvider { /** * 获取已经安卓的所有程序信息的List集合 * @param context 上下文 * @return List<AppInfo> */ public static List<AppInfo> getAppInfos(Context context){ PackageManager pm = context.getPackageManager(); List<PackageInfo> pi = pm.getInstalledPackages(0); ArrayList<AppInfo> appInfos = new ArrayList<AppInfo>(); for (PackageInfo packageInfo : pi) { AppInfo appInfo = new AppInfo(); String packname = packageInfo.packageName; Drawable icon = packageInfo.applicationInfo.loadIcon(pm); String name = packageInfo.applicationInfo.loadLabel(pm).toString(); int flags = packageInfo.applicationInfo.flags; if((flags&ApplicationInfo.FLAG_SYSTEM)==0){ appInfo.setUserApp(true); }else { appInfo.setUserApp(false); } if((flags&ApplicationInfo.FLAG_EXTERNAL_STORAGE)==0){ appInfo.setInRAM(true); }else { appInfo.setInRAM(false); } appInfo.setName(name); appInfo.setIcon(icon); appInfo.setPackname(packname); appInfos.add(appInfo); } return appInfos; } }
1,602
0.691906
0.685379
62
22.709677
19.461615
70
false
false
0
0
0
0
0
0
2.048387
false
false
7
8d3ffd414c0b4e13a2fc43c15ea102fc89dea943
30,837,865,197,564
4fcdcead3b75c8b1e13adc97ce6498cd47293fa2
/NisiraWebMovil/src/java/com/pe/nisira/movil/view/bean/PrecioshistoricosBean.java
9ddaaae998e68b61b4514f36fcc37b9b1482d3e6
[]
no_license
aburgosd91/NisiraWebPatos
https://github.com/aburgosd91/NisiraWebPatos
e17e90ab342d4d1f29f16b5957f781fc5ee23cf0
764fcb7099bab061ea579ba5b6a5b980b2f27c1e
refs/heads/master
2021-01-20T01:24:53.405000
2017-04-24T18:22:26
2017-04-24T18:22:26
85,764,698
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 com.pe.nisira.movil.view.bean; import java.io.Serializable; import java.util.Date; /** * * @author Antenor */ public class PrecioshistoricosBean implements Serializable{ private static final long serialVersionUID=1L; private String idempresa; private String idproducto; private String idclieprov; private String idcompra; private String item; private Date fecha; private String idmoneda; private String formapago; private double precio; private double porcentajedscto1; private double porcentajedscto2; private double porcentajedscto3; private String iddocumento; private String tabla; private String fechacreacion; private String sincroniza; public PrecioshistoricosBean() { } public String getIdempresa() { return idempresa; } public void setIdempresa(String idempresa) { this.idempresa = idempresa; } public String getIdproducto() { return idproducto; } public void setIdproducto(String idproducto) { this.idproducto = idproducto; } public String getIdclieprov() { return idclieprov; } public void setIdclieprov(String idclieprov) { this.idclieprov = idclieprov; } public String getIdcompra() { return idcompra; } public void setIdcompra(String idcompra) { this.idcompra = idcompra; } public String getItem() { return item; } public void setItem(String item) { this.item = item; } public Date getFecha() { return fecha; } public void setFecha(Date fecha) { this.fecha = fecha; } public String getIdmoneda() { return idmoneda; } public void setIdmoneda(String idmoneda) { this.idmoneda = idmoneda; } public String getFormapago() { return formapago; } public void setFormapago(String formapago) { this.formapago = formapago; } public double getPrecio() { return precio; } public void setPrecio(double precio) { this.precio = precio; } public double getPorcentajedscto1() { return porcentajedscto1; } public void setPorcentajedscto1(double porcentajedscto1) { this.porcentajedscto1 = porcentajedscto1; } public double getPorcentajedscto2() { return porcentajedscto2; } public void setPorcentajedscto2(double porcentajedscto2) { this.porcentajedscto2 = porcentajedscto2; } public double getPorcentajedscto3() { return porcentajedscto3; } public void setPorcentajedscto3(double porcentajedscto3) { this.porcentajedscto3 = porcentajedscto3; } public String getIddocumento() { return iddocumento; } public void setIddocumento(String iddocumento) { this.iddocumento = iddocumento; } public String getTabla() { return tabla; } public void setTabla(String tabla) { this.tabla = tabla; } public String getFechacreacion() { return fechacreacion; } public void setFechacreacion(String fechacreacion) { this.fechacreacion = fechacreacion; } public String getSincroniza() { return sincroniza; } public void setSincroniza(String sincroniza) { this.sincroniza = sincroniza; } }
UTF-8
Java
3,508
java
PrecioshistoricosBean.java
Java
[ { "context": "lizable;\nimport java.util.Date;\n\n/**\n *\n * @author Antenor\n */\npublic class PrecioshistoricosBean implements", "end": 218, "score": 0.9997343420982361, "start": 211, "tag": "NAME", "value": "Antenor" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.pe.nisira.movil.view.bean; import java.io.Serializable; import java.util.Date; /** * * @author Antenor */ public class PrecioshistoricosBean implements Serializable{ private static final long serialVersionUID=1L; private String idempresa; private String idproducto; private String idclieprov; private String idcompra; private String item; private Date fecha; private String idmoneda; private String formapago; private double precio; private double porcentajedscto1; private double porcentajedscto2; private double porcentajedscto3; private String iddocumento; private String tabla; private String fechacreacion; private String sincroniza; public PrecioshistoricosBean() { } public String getIdempresa() { return idempresa; } public void setIdempresa(String idempresa) { this.idempresa = idempresa; } public String getIdproducto() { return idproducto; } public void setIdproducto(String idproducto) { this.idproducto = idproducto; } public String getIdclieprov() { return idclieprov; } public void setIdclieprov(String idclieprov) { this.idclieprov = idclieprov; } public String getIdcompra() { return idcompra; } public void setIdcompra(String idcompra) { this.idcompra = idcompra; } public String getItem() { return item; } public void setItem(String item) { this.item = item; } public Date getFecha() { return fecha; } public void setFecha(Date fecha) { this.fecha = fecha; } public String getIdmoneda() { return idmoneda; } public void setIdmoneda(String idmoneda) { this.idmoneda = idmoneda; } public String getFormapago() { return formapago; } public void setFormapago(String formapago) { this.formapago = formapago; } public double getPrecio() { return precio; } public void setPrecio(double precio) { this.precio = precio; } public double getPorcentajedscto1() { return porcentajedscto1; } public void setPorcentajedscto1(double porcentajedscto1) { this.porcentajedscto1 = porcentajedscto1; } public double getPorcentajedscto2() { return porcentajedscto2; } public void setPorcentajedscto2(double porcentajedscto2) { this.porcentajedscto2 = porcentajedscto2; } public double getPorcentajedscto3() { return porcentajedscto3; } public void setPorcentajedscto3(double porcentajedscto3) { this.porcentajedscto3 = porcentajedscto3; } public String getIddocumento() { return iddocumento; } public void setIddocumento(String iddocumento) { this.iddocumento = iddocumento; } public String getTabla() { return tabla; } public void setTabla(String tabla) { this.tabla = tabla; } public String getFechacreacion() { return fechacreacion; } public void setFechacreacion(String fechacreacion) { this.fechacreacion = fechacreacion; } public String getSincroniza() { return sincroniza; } public void setSincroniza(String sincroniza) { this.sincroniza = sincroniza; } }
3,508
0.648233
0.641961
165
20.260607
18.16787
62
false
false
0
0
0
0
0
0
0.327273
false
false
7
6f6dadc8633f139b6b51e94ad201e3fb4aa10f2a
33,560,874,462,384
bb13907de0911a1c03f1a32a7ea16740234abf1c
/src/main/java/com/emc/fapi/jaxws/v4_3_1/SyslogFacility.java
8a3d32c9e97e858957a4fbeac79d9f02ec3c99bc
[]
no_license
noamda/fal431
https://github.com/noamda/fal431
9287e95fa2bacdace92e65b16ec6985ce2ded29c
dad30667424970fba049df3ba2c2023b82b9276e
refs/heads/master
2021-01-21T14:25:10.211000
2016-06-20T08:55:43
2016-06-20T08:58:33
58,481,483
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.emc.fapi.jaxws.v4_3_1; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlType; @XmlType(name = "syslogFacility") @XmlEnum public enum SyslogFacility { AUTH, AUTHPRIV, CRON, DAEMON, FTP, KERN, LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7, LPR, MAIL, NEWS, SYSLOG, USER, UUCP, UNKNOWN; private SyslogFacility() { } public static SyslogFacility fromValue(String v) { return valueOf(v); } public String value() { return name(); } }
UTF-8
Java
618
java
SyslogFacility.java
Java
[]
null
[]
package com.emc.fapi.jaxws.v4_3_1; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlType; @XmlType(name = "syslogFacility") @XmlEnum public enum SyslogFacility { AUTH, AUTHPRIV, CRON, DAEMON, FTP, KERN, LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7, LPR, MAIL, NEWS, SYSLOG, USER, UUCP, UNKNOWN; private SyslogFacility() { } public static SyslogFacility fromValue(String v) { return valueOf(v); } public String value() { return name(); } }
618
0.590615
0.572816
42
13.666667
12.544524
54
false
false
0
0
0
0
0
0
0.619048
false
false
7
8c64dd1ee48289dc1ed406d6d0ca00a88567cf25
4,389,456,611,777
812e05a0061228c688954c36e1f58d99d49107dd
/src/main/java/com/sparrow/backend/service/impl/HotelRoomDiscountServiceImpl.java
b98da3d81cfd3dc916ea73a952dd54ab04f20ce1
[]
no_license
pavle-j4nk/sparrow
https://github.com/pavle-j4nk/sparrow
c346ad9ec9723cedac3daa6471df5a482a3e7896
66f3b98acf48688615e74a8a5bd36db73a17912a
refs/heads/master
2022-05-01T03:52:42.036000
2019-09-27T19:04:29
2019-09-27T19:04:29
154,820,556
0
1
null
false
2022-03-31T18:44:28
2018-10-26T10:54:57
2019-09-27T19:04:46
2022-03-31T18:44:27
60,689
1
1
6
Java
false
false
package com.sparrow.backend.service.impl; import com.sparrow.backend.model.HotelReservation; import com.sparrow.backend.model.HotelRoomDiscount; import com.sparrow.backend.repository.HotelRoomDiscountRepository; import com.sparrow.backend.service.HotelReservationService; import com.sparrow.backend.service.HotelRoomDiscountService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.sql.Date; import java.util.List; @Service @Transactional public class HotelRoomDiscountServiceImpl implements HotelRoomDiscountService { @Autowired private HotelRoomDiscountRepository hotelRoomDiscountRepository; @Autowired private HotelReservationService hotelReservationService; @Override public List<HotelRoomDiscount> findAll() { return hotelRoomDiscountRepository.findAll(); } @Override public List<HotelRoomDiscount> findAllActive(Date tripStart, Date tripEnd) { List<HotelReservation> hotelReservations = hotelReservationService.findActive(); List<HotelRoomDiscount> hotelRoomDiscounts = hotelRoomDiscountRepository.findAll(); for (HotelReservation hr : hotelReservations) { if (tripStart.before(hr.getStart()) && tripEnd.before(hr.getStart())) { continue; } else if (hr.getEnd().before(tripStart)) { continue; } else { hotelRoomDiscounts.removeIf(h -> hr.getRooms().contains(h.getPriceListItem().getRoom())); } } return hotelRoomDiscounts; } @Override public HotelRoomDiscount getOne(Long id) { return hotelRoomDiscountRepository.getOne(id); } @Override public HotelRoomDiscount save(HotelRoomDiscount hotelRoomDiscount) { return hotelRoomDiscountRepository.save(hotelRoomDiscount); } }
UTF-8
Java
1,947
java
HotelRoomDiscountServiceImpl.java
Java
[]
null
[]
package com.sparrow.backend.service.impl; import com.sparrow.backend.model.HotelReservation; import com.sparrow.backend.model.HotelRoomDiscount; import com.sparrow.backend.repository.HotelRoomDiscountRepository; import com.sparrow.backend.service.HotelReservationService; import com.sparrow.backend.service.HotelRoomDiscountService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.sql.Date; import java.util.List; @Service @Transactional public class HotelRoomDiscountServiceImpl implements HotelRoomDiscountService { @Autowired private HotelRoomDiscountRepository hotelRoomDiscountRepository; @Autowired private HotelReservationService hotelReservationService; @Override public List<HotelRoomDiscount> findAll() { return hotelRoomDiscountRepository.findAll(); } @Override public List<HotelRoomDiscount> findAllActive(Date tripStart, Date tripEnd) { List<HotelReservation> hotelReservations = hotelReservationService.findActive(); List<HotelRoomDiscount> hotelRoomDiscounts = hotelRoomDiscountRepository.findAll(); for (HotelReservation hr : hotelReservations) { if (tripStart.before(hr.getStart()) && tripEnd.before(hr.getStart())) { continue; } else if (hr.getEnd().before(tripStart)) { continue; } else { hotelRoomDiscounts.removeIf(h -> hr.getRooms().contains(h.getPriceListItem().getRoom())); } } return hotelRoomDiscounts; } @Override public HotelRoomDiscount getOne(Long id) { return hotelRoomDiscountRepository.getOne(id); } @Override public HotelRoomDiscount save(HotelRoomDiscount hotelRoomDiscount) { return hotelRoomDiscountRepository.save(hotelRoomDiscount); } }
1,947
0.739086
0.739086
54
35.055557
29.75481
105
false
false
0
0
0
0
0
0
0.425926
false
false
7
227ac73db44bbbbd5e9439c995ad88d9a1ab276c
18,872,086,323,132
43d8520aecdad8ee7e4b1ac6b4e18bdf871de774
/src/websocket/notify/model/Notify.java
391bd8f8c134e5ba2ce9612342a4e2c307e72d9c
[]
no_license
a5372268/MoviesHit
https://github.com/a5372268/MoviesHit
16f2862a40b1debc0ba4ae4def5ed56e98bbd1a6
26f20fe75510b2ecd80b3660b91801146f496a22
refs/heads/main
2023-05-25T04:47:08.688000
2021-06-11T11:38:33
2021-06-11T11:38:33
375,986,887
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package websocket.notify.model; public class Notify { private String type; private int sender; private String receiver; private String message; private String time; private String read; public Notify() {}; public Notify(String type, int sender, String receiver, String message, String time, String read) { super(); this.type=type; this.sender=sender; this.receiver=receiver; this.message=message; this.setTime(time); this.read=read; } public String getTime() { return time; } public void setTime(String time) { this.time = time; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getType() { return type; } public void setType(String type) { this.type = type; } public int getSender() { return sender; } public void setSender(int sender) { this.sender = sender; } public String getReceiver() { return receiver; } public void setReceiver(String receiver) { this.receiver = receiver; } public String getRead() { return read; } public void setRead(String read) { this.read = read; } }
UTF-8
Java
1,154
java
Notify.java
Java
[]
null
[]
package websocket.notify.model; public class Notify { private String type; private int sender; private String receiver; private String message; private String time; private String read; public Notify() {}; public Notify(String type, int sender, String receiver, String message, String time, String read) { super(); this.type=type; this.sender=sender; this.receiver=receiver; this.message=message; this.setTime(time); this.read=read; } public String getTime() { return time; } public void setTime(String time) { this.time = time; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getType() { return type; } public void setType(String type) { this.type = type; } public int getSender() { return sender; } public void setSender(int sender) { this.sender = sender; } public String getReceiver() { return receiver; } public void setReceiver(String receiver) { this.receiver = receiver; } public String getRead() { return read; } public void setRead(String read) { this.read = read; } }
1,154
0.689775
0.689775
70
15.485714
16.049694
100
false
false
0
0
0
0
0
0
1.571429
false
false
7
36eab56dfb02cca3d404cf51786cd5578b493dbc
13,194,139,567,371
6042c0aa06883b4ac2795ea39e9b91c37d9ce9d1
/src/main/java/com/java/service/UserService.java
2b04e66d5c609d23683e54d66e240bd5b55d48e7
[]
no_license
mygithub12/javaproject
https://github.com/mygithub12/javaproject
02d06d685e6a76bcd9d41d83e3aa8820fc144c5e
0340aebf0da180d58f9a5f47efb59ca9b31c30c5
refs/heads/master
2021-01-16T19:02:57.371000
2014-10-29T08:02:09
2014-10-29T08:02:09
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.java.service; import java.util.ArrayList; import java.util.List; import javax.transaction.Transactional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.java.model.Role; import com.java.model.UserEntity; import com.java.repositories.RoleRepository; import com.java.repositories.UserRepository; @Service @Transactional public class UserService { @Autowired private UserRepository userRep; @Autowired private RoleRepository roleRep; public List<UserEntity> findAll(){ return userRep.findAll(); } public UserEntity findOne(int id) { return userRep.findOne(id); } public void save(UserEntity users) { users.setEnabled(true); List<Role> roles=new ArrayList<Role>(); roles.add(roleRep.findByName("ROLE_USER")); users.setRoles(roles); userRep.save(users); } public UserEntity findByname(String name) { return userRep.findByName(name); } public void delete(int id) { userRep.delete(userRep.findOne(id)); } }
UTF-8
Java
1,063
java
UserService.java
Java
[]
null
[]
package com.java.service; import java.util.ArrayList; import java.util.List; import javax.transaction.Transactional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.java.model.Role; import com.java.model.UserEntity; import com.java.repositories.RoleRepository; import com.java.repositories.UserRepository; @Service @Transactional public class UserService { @Autowired private UserRepository userRep; @Autowired private RoleRepository roleRep; public List<UserEntity> findAll(){ return userRep.findAll(); } public UserEntity findOne(int id) { return userRep.findOne(id); } public void save(UserEntity users) { users.setEnabled(true); List<Role> roles=new ArrayList<Role>(); roles.add(roleRep.findByName("ROLE_USER")); users.setRoles(roles); userRep.save(users); } public UserEntity findByname(String name) { return userRep.findByName(name); } public void delete(int id) { userRep.delete(userRep.findOne(id)); } }
1,063
0.74412
0.74412
62
16.145161
17.208256
62
false
false
0
0
0
0
0
0
1.193548
false
false
7
d91e3b8d22bd8728b2204ddb024c7939ed27d526
30,932,354,502,806
d28c6359f2c3f4342b1f7bec74e9c3efc32ebf1d
/app/src/main/java/com/group/msci/puzzlegenerator/utils/json/UploadPuzzleJSON.java
27d05eb364d32715bbc78e14b6e0e1825f098b71
[]
no_license
hamzah-hayat/MSci-Team-Project
https://github.com/hamzah-hayat/MSci-Team-Project
1fb8c23e0ae771fd688dba9facd132f0b6dfdd65
d48fb11aa9701f10224510bda133848e469462dd
refs/heads/master
2021-05-31T14:31:34.085000
2016-04-25T18:15:15
2016-04-25T18:15:15
44,331,284
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.group.msci.puzzlegenerator.utils.json; import android.util.Log; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; /** * Created by Magdi on 06/04/2016. */ public class UploadPuzzleJSON implements Runnable { //DON'T KNOW HOW TO IMPLEMENT THIS private char puzzleType; private String puzzleData; private String puzzleText; private volatile JSONObject jsonFile; private String urlBase; public UploadPuzzleJSON(char puzzleCodeT, String data, String text) { puzzleType = puzzleCodeT; puzzleData = data; puzzleText = text; } @Override public void run() { buildJSON(); } public JSONObject getJSON() { return jsonFile; } public void buildJSON() { if (puzzleType == 'd') { urlBase = "http://webprojects.eecs.qmul.ac.uk/ma334/puzzle/dotSave.php?puzzleData=" + puzzleData + "&puzzleText=" + puzzleText; } else if (puzzleType == 'm') { urlBase = "http://webprojects.eecs.qmul.ac.uk/ma334/puzzle/mazeSave.php?puzzleData=" + puzzleData + "&puzzleText=" + puzzleText; } else if (puzzleType == 'p') { urlBase = "http://webprojects.eecs.qmul.ac.uk/ma334/puzzle/picrossSave.php?puzzleData=" + puzzleData + "&puzzleText=" + puzzleText; } else { urlBase = "http://webprojects.eecs.qmul.ac.uk/ma334/puzzle/ballSave.php?puzzleData=" + puzzleData + "&puzzleText=" + puzzleText; } try { URL url = new URL(urlBase); InputStream urlStream = url.openConnection().getInputStream(); BufferedReader bf = new BufferedReader(new InputStreamReader(urlStream, "UTF-8")); StringBuilder responseBuilder = new StringBuilder(); String input = bf.readLine(); while (input != null) { responseBuilder.append(input); input = bf.readLine(); } jsonFile = new JSONObject(responseBuilder.toString()); Log.i("UploadPuzzle", jsonFile.toString()); System.out.println("Hello"); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } } }
UTF-8
Java
2,421
java
UploadPuzzleJSON.java
Java
[ { "context": "eamReader;\nimport java.net.URL;\n\n/**\n * Created by Magdi on 06/04/2016.\n */\npublic class UploadPuzzleJSON ", "end": 304, "score": 0.9547807574272156, "start": 299, "tag": "NAME", "value": "Magdi" } ]
null
[]
package com.group.msci.puzzlegenerator.utils.json; import android.util.Log; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; /** * Created by Magdi on 06/04/2016. */ public class UploadPuzzleJSON implements Runnable { //DON'T KNOW HOW TO IMPLEMENT THIS private char puzzleType; private String puzzleData; private String puzzleText; private volatile JSONObject jsonFile; private String urlBase; public UploadPuzzleJSON(char puzzleCodeT, String data, String text) { puzzleType = puzzleCodeT; puzzleData = data; puzzleText = text; } @Override public void run() { buildJSON(); } public JSONObject getJSON() { return jsonFile; } public void buildJSON() { if (puzzleType == 'd') { urlBase = "http://webprojects.eecs.qmul.ac.uk/ma334/puzzle/dotSave.php?puzzleData=" + puzzleData + "&puzzleText=" + puzzleText; } else if (puzzleType == 'm') { urlBase = "http://webprojects.eecs.qmul.ac.uk/ma334/puzzle/mazeSave.php?puzzleData=" + puzzleData + "&puzzleText=" + puzzleText; } else if (puzzleType == 'p') { urlBase = "http://webprojects.eecs.qmul.ac.uk/ma334/puzzle/picrossSave.php?puzzleData=" + puzzleData + "&puzzleText=" + puzzleText; } else { urlBase = "http://webprojects.eecs.qmul.ac.uk/ma334/puzzle/ballSave.php?puzzleData=" + puzzleData + "&puzzleText=" + puzzleText; } try { URL url = new URL(urlBase); InputStream urlStream = url.openConnection().getInputStream(); BufferedReader bf = new BufferedReader(new InputStreamReader(urlStream, "UTF-8")); StringBuilder responseBuilder = new StringBuilder(); String input = bf.readLine(); while (input != null) { responseBuilder.append(input); input = bf.readLine(); } jsonFile = new JSONObject(responseBuilder.toString()); Log.i("UploadPuzzle", jsonFile.toString()); System.out.println("Hello"); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } } }
2,421
0.61834
0.609665
74
31.729731
33.389309
143
false
false
0
0
0
0
0
0
0.527027
false
false
7
0346b3b7d1c95f53e6081df17a8e3556661b828d
8,546,984,952,211
38aa5cccad737bd5b27a1aad7070013c6b7e4842
/src/main/java/frc/robot/commands/Drive.java
2cbc1a2bb6876c83107cfc0e178cbe1dd892607c
[]
no_license
RaidersOfTheARC/Infinite-Recharge
https://github.com/RaidersOfTheARC/Infinite-Recharge
9a53598190fa0f3e8648063c852835a6c90fb6b9
3b204c389f7bba73031f3fd0558c4bfb7556b582
refs/heads/master
2020-12-07T12:01:47.082000
2020-02-26T17:59:23
2020-02-26T17:59:23
232,717,476
2
3
null
false
2020-02-26T17:59:27
2020-01-09T03:52:05
2020-02-25T01:50:25
2020-02-26T17:59:24
86
2
2
0
Java
false
false
package frc.robot.commands; import java.util.function.DoubleSupplier; import edu.wpi.first.wpilibj2.command.CommandBase; import frc.robot.subsystems.DriveBase; public class Drive extends CommandBase { @SuppressWarnings({"PMD.UnusedPrivateField", "PMD.SingularField"}) private final DriveBase m_drive; private final DoubleSupplier m_left, m_right; public Drive(DriveBase drivetrain, DoubleSupplier driveLeft, DoubleSupplier driveRight) { m_drive = drivetrain; m_left = driveLeft; m_right = driveRight; addRequirements(drivetrain); } // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { m_drive.drive(m_left.getAsDouble(), m_right.getAsDouble()); } }
UTF-8
Java
790
java
Drive.java
Java
[]
null
[]
package frc.robot.commands; import java.util.function.DoubleSupplier; import edu.wpi.first.wpilibj2.command.CommandBase; import frc.robot.subsystems.DriveBase; public class Drive extends CommandBase { @SuppressWarnings({"PMD.UnusedPrivateField", "PMD.SingularField"}) private final DriveBase m_drive; private final DoubleSupplier m_left, m_right; public Drive(DriveBase drivetrain, DoubleSupplier driveLeft, DoubleSupplier driveRight) { m_drive = drivetrain; m_left = driveLeft; m_right = driveRight; addRequirements(drivetrain); } // Called every time the scheduler runs while the command is scheduled. @Override public void execute() { m_drive.drive(m_left.getAsDouble(), m_right.getAsDouble()); } }
790
0.708861
0.707595
29
26.275862
26.499052
93
false
false
0
0
0
0
0
0
0.551724
false
false
7
a271368c5e2f0ce84955216da79fc86f93a3489b
16,484,084,522,819
25cd86f56e2e81c72de283ab00f98904cb6e5c37
/src/main/java/Graphics/Game.java
ae0cd891470509310515ba7e7816b83d8df19a16
[]
no_license
SPI133/Munchkin
https://github.com/SPI133/Munchkin
2baa344f2ec59f26ac6141ba7c5cd0fcd7020a32
dc2a6d285f2fe9e3de2455a0d90c35d4e8bc9678
refs/heads/main
2023-04-14T06:59:53.468000
2021-04-24T10:36:52
2021-04-24T10:36:52
361,133,832
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Graphics; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.scene.layout.AnchorPane; import javafx.stage.Stage; import java.io.IOException; public class Game extends Application {//TODO:add choice for players private Scene mainMenu; private static Stage window; public static void main(String[] args){ launch(args); } @Override public void start(Stage primaryStage) throws Exception { window = primaryStage; setScenes(); window.setScene(mainMenu); window.setResizable(false); window.show(); } private void setScenes(){ try { AnchorPane root = FXMLLoader.load(getClass().getResource("menu.fxml")); mainMenu = new Scene(root,root.getPrefWidth(),root.getPrefHeight()); mainMenu.getStylesheets().addAll( this.getClass().getResource("mainMenuStyle.css").toExternalForm(), this.getClass().getResource("button.css").toExternalForm()); } catch (IOException e) { e.printStackTrace(); window.close(); } } static void close(){ window.close(); } }
UTF-8
Java
1,288
java
Game.java
Java
[]
null
[]
package Graphics; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.scene.layout.AnchorPane; import javafx.stage.Stage; import java.io.IOException; public class Game extends Application {//TODO:add choice for players private Scene mainMenu; private static Stage window; public static void main(String[] args){ launch(args); } @Override public void start(Stage primaryStage) throws Exception { window = primaryStage; setScenes(); window.setScene(mainMenu); window.setResizable(false); window.show(); } private void setScenes(){ try { AnchorPane root = FXMLLoader.load(getClass().getResource("menu.fxml")); mainMenu = new Scene(root,root.getPrefWidth(),root.getPrefHeight()); mainMenu.getStylesheets().addAll( this.getClass().getResource("mainMenuStyle.css").toExternalForm(), this.getClass().getResource("button.css").toExternalForm()); } catch (IOException e) { e.printStackTrace(); window.close(); } } static void close(){ window.close(); } }
1,288
0.60559
0.60559
48
24.833334
23.895025
86
false
false
0
0
0
0
0
0
0.5
false
false
7
4921a106616f7069f786aa38c0be325cd747b00d
20,323,785,279,147
acb3d7022ef121d3917fd64fa3f8b19a90393bdd
/src/algorithms/accepted/A513_Find_Bottom_Left_Tree_Value.java
0259a59db263c01d56363c85f5f5731819100b28
[]
no_license
SuperLatte/LeetCode
https://github.com/SuperLatte/LeetCode
00ff7da46485dca6dc9fc714ca03b68ba6f54962
6a4155211731dbbe085d9ea9bdd05160a72ff44a
refs/heads/master
2018-01-08T12:41:26.484000
2017-10-11T00:52:59
2017-10-11T00:52:59
36,746,553
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package algorithms.accepted; import algorithms.datastructure.TreeNode; import java.util.ArrayList; import java.util.List; /** Given a binary tree, find the leftmost value in the last row of the tree. Example 1: Input: 2 / \ 1 3 Output: 1 Example 2: Input: 1 / \ 2 3 / / \ 4 5 6 / 7 Output: 7 Note: You may assume the tree (i.e., the given root node) is not NULL. */ public class A513_Find_Bottom_Left_Tree_Value { int[] array = new int[1000]; int index = -1; public int findBottomLeftValue(TreeNode root) { func(root, 0); return array[index]; } private void func(TreeNode node, int depth) { if (node == null) { return; } else if (depth > index) { index++; array[index] = node.val; } func(node.left, depth + 1); func(node.right, depth + 1); } }
UTF-8
Java
901
java
A513_Find_Bottom_Left_Tree_Value.java
Java
[]
null
[]
package algorithms.accepted; import algorithms.datastructure.TreeNode; import java.util.ArrayList; import java.util.List; /** Given a binary tree, find the leftmost value in the last row of the tree. Example 1: Input: 2 / \ 1 3 Output: 1 Example 2: Input: 1 / \ 2 3 / / \ 4 5 6 / 7 Output: 7 Note: You may assume the tree (i.e., the given root node) is not NULL. */ public class A513_Find_Bottom_Left_Tree_Value { int[] array = new int[1000]; int index = -1; public int findBottomLeftValue(TreeNode root) { func(root, 0); return array[index]; } private void func(TreeNode node, int depth) { if (node == null) { return; } else if (depth > index) { index++; array[index] = node.val; } func(node.left, depth + 1); func(node.right, depth + 1); } }
901
0.572697
0.54495
54
15.685185
18.366459
74
false
false
0
0
0
0
0
0
0.351852
false
false
7
30a8b75ae5e4faa315b5613e8088a4c6c3cc451e
412,316,894,477
a0f00f1d7ba65ccd029bd6aea31ffa0028e8e9d0
/app/src/main/java/pl/opencaching/android/ui/geocache/logs/GeocacheLogsFragment.java
68b55127e7537231758b26170b8b9cffcb9722bd
[ "Apache-2.0" ]
permissive
wkopec/Opencaching
https://github.com/wkopec/Opencaching
eb6e2a5a6b881b226e1415c69218cea905988453
32950d945504cd881324bb30c8fbc012adb653fb
refs/heads/master
2020-12-30T12:54:59.812000
2019-04-02T18:35:51
2019-04-02T18:35:51
91,365,787
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pl.opencaching.android.ui.geocache.logs; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import pl.opencaching.android.R; import pl.opencaching.android.ui.base.BaseActivity; import pl.opencaching.android.ui.base.BaseFragment; import java.util.ArrayList; import java.util.Collections; import javax.inject.Inject; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; import static pl.opencaching.android.ui.geocache.GeocacheActivity.getGeocacheWaypoint; /** * Created by Volfram on 27.07.2017. */ public class GeocacheLogsFragment extends BaseFragment implements GeocacheLogsContract.View { @BindView(R.id.recyclerView) RecyclerView recyclerView; private Unbinder unbinder; private LogListAdapter adapter; private BaseActivity activity; @Inject GeocacheLogsContract.Presenter presenter; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_geocache_logs, null); unbinder = ButterKnife.bind(this, view); activity = (BaseActivity) requireActivity(); setPresenter(presenter); return view; } @Override public void onResume() { super.onResume(); presenter.getGeocacheLogs(getGeocacheWaypoint()); } @Override public void setLogs(ArrayList<GeocacheLogInterface> geocacheLogs) { Collections.sort(geocacheLogs); configureRecyclerView(geocacheLogs); } private void configureRecyclerView(ArrayList<GeocacheLogInterface> geocacheLogs) { adapter = new LogListAdapter(geocacheLogs, activity); recyclerView.setAdapter(adapter); recyclerView.setLayoutManager(new LinearLayoutManager(activity)); } @Override public void showError(Error error) { activity.showToast(error.getMessage()); } @Override public void showProgress() { } @Override public void hideProgress() { } }
UTF-8
Java
2,285
java
GeocacheLogsFragment.java
Java
[ { "context": "heActivity.getGeocacheWaypoint;\n\n/**\n * Created by Volfram on 27.07.2017.\n */\n\npublic class GeocacheLogsFrag", "end": 745, "score": 0.9987252950668335, "start": 738, "tag": "NAME", "value": "Volfram" } ]
null
[]
package pl.opencaching.android.ui.geocache.logs; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import pl.opencaching.android.R; import pl.opencaching.android.ui.base.BaseActivity; import pl.opencaching.android.ui.base.BaseFragment; import java.util.ArrayList; import java.util.Collections; import javax.inject.Inject; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; import static pl.opencaching.android.ui.geocache.GeocacheActivity.getGeocacheWaypoint; /** * Created by Volfram on 27.07.2017. */ public class GeocacheLogsFragment extends BaseFragment implements GeocacheLogsContract.View { @BindView(R.id.recyclerView) RecyclerView recyclerView; private Unbinder unbinder; private LogListAdapter adapter; private BaseActivity activity; @Inject GeocacheLogsContract.Presenter presenter; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_geocache_logs, null); unbinder = ButterKnife.bind(this, view); activity = (BaseActivity) requireActivity(); setPresenter(presenter); return view; } @Override public void onResume() { super.onResume(); presenter.getGeocacheLogs(getGeocacheWaypoint()); } @Override public void setLogs(ArrayList<GeocacheLogInterface> geocacheLogs) { Collections.sort(geocacheLogs); configureRecyclerView(geocacheLogs); } private void configureRecyclerView(ArrayList<GeocacheLogInterface> geocacheLogs) { adapter = new LogListAdapter(geocacheLogs, activity); recyclerView.setAdapter(adapter); recyclerView.setLayoutManager(new LinearLayoutManager(activity)); } @Override public void showError(Error error) { activity.showToast(error.getMessage()); } @Override public void showProgress() { } @Override public void hideProgress() { } }
2,285
0.741794
0.737418
84
26.202381
25.907701
123
false
false
0
0
0
0
0
0
0.488095
false
false
7
bb92f89099540e1e12e1e836d7c8ca70415097b2
33,595,234,230,320
175417cfbf5c10a90948cc583aea0186632889a5
/app/src/main/java/app/psiteportal/com/model/Seminar.java
715e196a4c805e53e634167d205d061c1bd4ac55
[]
no_license
glendonpable/PSITEPortal
https://github.com/glendonpable/PSITEPortal
9b5d3fe34423c3aa892a920d945ac903a1c68b06
ac5ea350793c2242497f2c3e9a04ecb92cf34aa7
refs/heads/master
2020-06-12T15:05:40.007000
2016-12-07T07:59:03
2016-12-07T07:59:03
75,812,210
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package app.psiteportal.com.model; import android.graphics.Bitmap; import app.psiteportal.com.utils.Config; /** * Created by Lawrence on 2/12/2016. */ public class Seminar { private String id; private String seminarName; private String date; private String startTime; private String endTime; private String bannerUrl; private Bitmap banner; private String is_convention; private Seminar(){ //empty constructor } public Seminar(String id, String seminarName, String date, String endTime, String startTime, String bannerUrl) { this.id = id; this.seminarName = seminarName; this.date = date; this.endTime = endTime; this.startTime = startTime; this.bannerUrl = bannerUrl; } public Seminar(String id, String seminarName, String bannerUrl, String is_convention) { this.is_convention = is_convention; this.id = id; this.seminarName = seminarName; this.bannerUrl = Config.ROOT_URL + Config.SEMINAR_BANNER + bannerUrl; } public Seminar(String id, String seminarName, String date){ this.id = id; this.seminarName = seminarName; this.date = date ; } public String getIs_convention() { return is_convention; } public void setIs_convention(String is_convention) { this.is_convention = is_convention; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getSeminarName() { return seminarName; } public void setSeminarName(String seminarName) { this.seminarName = seminarName; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public String getStartTime() { return startTime; } public void setStartTime(String startTime) { this.startTime = startTime; } public String getEndTime() { return endTime; } public void setEndTime(String endTime) { this.endTime = endTime; } public String getBannerUrl() { return bannerUrl; } public void setBannerUrl(String bannerUrl) { this.bannerUrl = bannerUrl; } public Bitmap getBanner() { return banner; } public void setBanner(Bitmap banner) { this.banner = banner; } }
UTF-8
Java
2,441
java
Seminar.java
Java
[ { "context": "p.psiteportal.com.utils.Config;\n\n/**\n * Created by Lawrence on 2/12/2016.\n */\npublic class Seminar {\n\n pri", "end": 137, "score": 0.9962369203567505, "start": 129, "tag": "NAME", "value": "Lawrence" } ]
null
[]
package app.psiteportal.com.model; import android.graphics.Bitmap; import app.psiteportal.com.utils.Config; /** * Created by Lawrence on 2/12/2016. */ public class Seminar { private String id; private String seminarName; private String date; private String startTime; private String endTime; private String bannerUrl; private Bitmap banner; private String is_convention; private Seminar(){ //empty constructor } public Seminar(String id, String seminarName, String date, String endTime, String startTime, String bannerUrl) { this.id = id; this.seminarName = seminarName; this.date = date; this.endTime = endTime; this.startTime = startTime; this.bannerUrl = bannerUrl; } public Seminar(String id, String seminarName, String bannerUrl, String is_convention) { this.is_convention = is_convention; this.id = id; this.seminarName = seminarName; this.bannerUrl = Config.ROOT_URL + Config.SEMINAR_BANNER + bannerUrl; } public Seminar(String id, String seminarName, String date){ this.id = id; this.seminarName = seminarName; this.date = date ; } public String getIs_convention() { return is_convention; } public void setIs_convention(String is_convention) { this.is_convention = is_convention; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getSeminarName() { return seminarName; } public void setSeminarName(String seminarName) { this.seminarName = seminarName; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public String getStartTime() { return startTime; } public void setStartTime(String startTime) { this.startTime = startTime; } public String getEndTime() { return endTime; } public void setEndTime(String endTime) { this.endTime = endTime; } public String getBannerUrl() { return bannerUrl; } public void setBannerUrl(String bannerUrl) { this.bannerUrl = bannerUrl; } public Bitmap getBanner() { return banner; } public void setBanner(Bitmap banner) { this.banner = banner; } }
2,441
0.622696
0.619828
110
21.190908
20.587505
116
false
false
0
0
0
0
0
0
0.454545
false
false
7
35b522b362e421af06b5e6c85cd2edf098ae2d69
2,241,972,976,725
a138358745690ca628de6d44f9dc2332ceb99a5a
/src/irs/UserController.java
1a590728912c9010b29f31de2bd2f1a7464c69a6
[]
no_license
fadega/HeartRateMonitor
https://github.com/fadega/HeartRateMonitor
5685437d866f56bfcca819f0dba48ad6f2a887f7
b0862614bb8d48dc6683724b50febc858f065898
refs/heads/master
2021-08-07T12:38:35.157000
2021-07-28T05:11:37
2021-07-28T05:11:37
192,929,227
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package irs; import com.jfoenix.controls.JFXButton; import com.jfoenix.controls.JFXPasswordField; import com.jfoenix.controls.JFXRadioButton; import com.jfoenix.controls.JFXTextField; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.collections.transformation.FilteredList; import javafx.collections.transformation.SortedList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.*; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.input.MouseEvent; import javafx.scene.layout.AnchorPane; import java.net.URL; import java.sql.Date; import java.util.ResourceBundle; public class UserController implements Initializable { @FXML private JFXTextField txtName; @FXML private JFXTextField txtLastName; @FXML private JFXTextField txtUserName; @FXML private JFXPasswordField txtPassword; @FXML private JFXPasswordField txtConfirmPass; @FXML private JFXRadioButton radioUser; @FXML private JFXRadioButton radioAdmin; @FXML private TableView<User> userTableView; @FXML private TableColumn<User, Integer> idCol; @FXML private TableColumn<User, String> nameCol; @FXML private TableColumn<User, String> lastnamCol; @FXML private TableColumn<User, String> usernameCol; @FXML private TableColumn<User, String> passCol; @FXML private TableColumn<User, String> roleCol; @FXML private JFXTextField txtSearch; @FXML private JFXButton btnLogout; @FXML private JFXButton btnRecommendation; @FXML private JFXButton btnManageTest; @FXML private JFXButton btnLoadDashboard; private User userObj = new User(); ToggleGroup roleGroup = new ToggleGroup(); @FXML public void passUserToAdd(){ if(txtName.getText().isEmpty() || txtLastName.getText().isEmpty() || txtUserName.getText().isEmpty() || txtPassword.getText().isEmpty()|| txtConfirmPass.getText().isEmpty() || ((RadioButton) roleGroup.getSelectedToggle()).getText().isEmpty()){ validateUserInput(); }else { if(txtPassword.getText().equals(txtConfirmPass.getText()) && !txtPassword.getText().isEmpty()&&txtPassword.getText()!=null){ userObj.addUser(txtName.getText(),txtLastName.getText(),txtUserName.getText(),txtPassword.getText(), txtConfirmPass.getText(), ((RadioButton) roleGroup.getSelectedToggle()).getText()); clearFields(); userTableView.getItems().clear(); ObservableList<User> userList = FXCollections.observableArrayList(userObj.getUsers()); userTableView.setItems(userList); }else{ txtConfirmPass.setStyle("-fx-border-color:red"); Alert alert= new Alert(Alert.AlertType.WARNING); alert.setTitle("Information"); alert.setHeaderText(null); alert.setContentText("Confirm password doesn't match the password!"); alert.showAndWait(); } } //Clear the input fields and upadate tableview after a successful creation of a record } private void validateUserInput(){ if(txtName.getText()==null ||txtName.getText().isEmpty()){ txtName.setStyle("-fx-border-color:red"); txtName.setFocusTraversable(true); }else{ txtName.setStyle("-fx-border-color:none"); } if(txtLastName.getText()==null ||txtLastName.getText().isEmpty()){ txtLastName.setStyle("-fx-border-color:red"); txtLastName.setFocusTraversable(true); }else{ txtLastName.setStyle("-fx-border-color:none"); } if(txtUserName.getText()==null ||txtUserName.getText().isEmpty()){ txtUserName.setStyle("-fx-border-color:red"); txtUserName.setFocusTraversable(true); }else{ txtUserName.setStyle("-fx-border-color:none"); } if(txtPassword.getText()==null ||txtPassword.getText().isEmpty()){ txtPassword.setStyle("-fx-border-color:red"); txtPassword.setFocusTraversable(true); }else { txtPassword.setStyle("-fx-border-color:none"); } if(txtConfirmPass.getText()==null ||txtConfirmPass.getText().isEmpty()){ txtConfirmPass.setStyle("-fx-border-color:red"); txtConfirmPass.setFocusTraversable(true); }else{ txtConfirmPass.setStyle("-fx-border-color:none"); }if(!radioUser.isSelected() && !radioAdmin.isSelected()){ radioUser.setStyle("-fx-border-color:red"); radioAdmin.setStyle("-fx-border-color:red"); }else{ radioUser.setStyle("-fx-border-color:none"); radioAdmin.setStyle("-fx-border-color:none"); } } @FXML private void clearFields() { validateUserInput(); txtName.clear();txtLastName.clear();txtUserName.clear();txtPassword.clear(); txtConfirmPass.clear();roleGroup.selectToggle(null); radioUser.setStyle("-fx-border-color:none"); radioAdmin.setStyle("-fx-border-color:none"); txtName.setStyle("-fx-border-color:none"); txtConfirmPass.setStyle("-fx-border-color:none"); txtPassword.setStyle("-fx-border-color:none"); txtUserName.setStyle("-fx-border-color:none"); txtLastName.setStyle("-fx-border-color:none"); txtName.setStyle("-fx-border-color:none"); } @FXML private void getUserTableData(MouseEvent event) { userObj = userTableView.getSelectionModel().getSelectedItem(); if(userObj!=null){ System.out.println(" Clicked here "); //int id = userObj.getId(); txtName.setText(userObj.getFirstName()); txtLastName.setText(userObj.getLastName()); txtUserName.setText(userObj.getUsername()); txtPassword.setText(userObj.getPassword()); txtConfirmPass.setText(userObj.getConfirmPassword()); String txt =userObj.getRole(); if(txt.equals("User")){ radioUser.setSelected(true); }else if(txt.equals("Admin")){ radioUser.setSelected(true); } } } private void loadUserData(){ idCol.setCellValueFactory(new PropertyValueFactory<>("id")); nameCol.setCellValueFactory(new PropertyValueFactory<>("firstName")); lastnamCol.setCellValueFactory(new PropertyValueFactory<>("lastName")); usernameCol.setCellValueFactory(new PropertyValueFactory<>("username")); passCol.setCellValueFactory(new PropertyValueFactory<>("password")); // confirmCol.setCellValueFactory(new PropertyValueFactory<>("confrimPassword")); roleCol.setCellValueFactory(new PropertyValueFactory<>("role")); //Call method getPatients which returns an observable list of type Patient userTableView.setItems(userObj.getUsers()); } @FXML void logout(ActionEvent event) { btnLogout.setOnAction(e->{ DashboardController db = new DashboardController(); db.logout(e); }); } public void passUserToUpdate(){ User row; //boolean updated; row= userTableView.getSelectionModel().getSelectedItem(); if(row!=null){ int id = row.getId(); row.updateUser(id,txtName.getText(),txtLastName.getText(),txtUserName.getText(),txtPassword.getText(), txtConfirmPass.getText(),((RadioButton) roleGroup.getSelectedToggle()).getText()); //update table view // if(updated){ userTableView.getItems().clear(); System.out.println("Just updated the table and should update the view too: hah"); //ObservableList<User> dataList = FXCollections.observableArrayList(userObj.getUsers()); userTableView.setItems(userObj.getUsers()); clearFields(); // } }else{ //Alert user System.out.println("There is no selection"); } } @FXML public void passUserToDelete(){ userObj = userTableView.getSelectionModel().getSelectedItem(); if(userObj!=null) { int id = userObj.getId(); userObj.deleteUser(id); // patientObj.deletePatient(patientObj.getId()); clearFields(); } ObservableList<User>allUsers, singleUser; allUsers=userTableView.getItems(); singleUser=userTableView.getSelectionModel().getSelectedItems(); singleUser.forEach(allUsers::remove); } @FXML void passUserToSearch() {//searched User ObservableList<User> dataOnTable = FXCollections.observableArrayList(userObj.getUsers()); FilteredList<User> filteredData = new FilteredList<>(dataOnTable, e -> true); txtSearch.setOnKeyReleased(e->{ txtSearch.textProperty().addListener((observable, oldValue, newValue) -> { filteredData.setPredicate(user -> { //If filter text is empty, display all patients if (newValue == null || newValue.isEmpty()) { return true; } String lowerCaseFilter = newValue.toLowerCase(); if (user.getFirstName().toLowerCase().contains(lowerCaseFilter)) { return true; } else if (user.getLastName().toLowerCase().contains(lowerCaseFilter)) { return true; } return false; }); }); SortedList<User> sortedData = new SortedList<>(filteredData); sortedData.comparatorProperty().bind(userTableView.comparatorProperty()); userTableView.setItems(sortedData); }); } @Override public void initialize(URL location, ResourceBundle resources) { //initialize the GUI radioAdmin.setToggleGroup(roleGroup); radioUser.setToggleGroup(roleGroup); radioUser.setSelected(true); passUserToSearch(); loadUserData(); //Switch views/stages btnManageTest.setOnAction(e->{ try { String fxml ="TestController.fxml"; String windowTitle ="Manage IRS Test"; WindowLoader winLoad = new WindowLoader(); winLoad.loadWindow(e,userObj,windowTitle,fxml); }catch (Exception ex){ //Debugg System.out.println("Loading Error"); } }); btnLoadDashboard.setOnAction(e->{ try{ String fxml = "dashboard.fxml"; String windowTitle ="IRS Management Console"; WindowLoader winLoad= new WindowLoader(); winLoad.loadWindow(e, userObj,windowTitle,fxml); }catch(Exception ex){ System.out.println("Loading Error"); } }); btnRecommendation.setOnAction(e->{ try{ String fxml = "RecommendationController.fxml"; String windowTitle ="Manage Recommendation"; WindowLoader winLoad= new WindowLoader(); winLoad.loadWindow(e, userObj,windowTitle,fxml); }catch(Exception ex){ System.out.println("Loading Error"); } }); } }
UTF-8
Java
11,675
java
UserController.java
Java
[ { "context": "rname());\n txtPassword.setText(userObj.getPassword());\n txtConfirmPass.setText(userObj.ge", "end": 6085, "score": 0.5216437578201294, "start": 6074, "tag": "PASSWORD", "value": "getPassword" }, { "context": "l.setCellValueFactory(new PropertyValueFactory<>(\"username\"));\n passCol.setCellValueFactory(new Prop", "end": 6740, "score": 0.9994623064994812, "start": 6732, "tag": "USERNAME", "value": "username" } ]
null
[]
package irs; import com.jfoenix.controls.JFXButton; import com.jfoenix.controls.JFXPasswordField; import com.jfoenix.controls.JFXRadioButton; import com.jfoenix.controls.JFXTextField; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.collections.transformation.FilteredList; import javafx.collections.transformation.SortedList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.*; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.input.MouseEvent; import javafx.scene.layout.AnchorPane; import java.net.URL; import java.sql.Date; import java.util.ResourceBundle; public class UserController implements Initializable { @FXML private JFXTextField txtName; @FXML private JFXTextField txtLastName; @FXML private JFXTextField txtUserName; @FXML private JFXPasswordField txtPassword; @FXML private JFXPasswordField txtConfirmPass; @FXML private JFXRadioButton radioUser; @FXML private JFXRadioButton radioAdmin; @FXML private TableView<User> userTableView; @FXML private TableColumn<User, Integer> idCol; @FXML private TableColumn<User, String> nameCol; @FXML private TableColumn<User, String> lastnamCol; @FXML private TableColumn<User, String> usernameCol; @FXML private TableColumn<User, String> passCol; @FXML private TableColumn<User, String> roleCol; @FXML private JFXTextField txtSearch; @FXML private JFXButton btnLogout; @FXML private JFXButton btnRecommendation; @FXML private JFXButton btnManageTest; @FXML private JFXButton btnLoadDashboard; private User userObj = new User(); ToggleGroup roleGroup = new ToggleGroup(); @FXML public void passUserToAdd(){ if(txtName.getText().isEmpty() || txtLastName.getText().isEmpty() || txtUserName.getText().isEmpty() || txtPassword.getText().isEmpty()|| txtConfirmPass.getText().isEmpty() || ((RadioButton) roleGroup.getSelectedToggle()).getText().isEmpty()){ validateUserInput(); }else { if(txtPassword.getText().equals(txtConfirmPass.getText()) && !txtPassword.getText().isEmpty()&&txtPassword.getText()!=null){ userObj.addUser(txtName.getText(),txtLastName.getText(),txtUserName.getText(),txtPassword.getText(), txtConfirmPass.getText(), ((RadioButton) roleGroup.getSelectedToggle()).getText()); clearFields(); userTableView.getItems().clear(); ObservableList<User> userList = FXCollections.observableArrayList(userObj.getUsers()); userTableView.setItems(userList); }else{ txtConfirmPass.setStyle("-fx-border-color:red"); Alert alert= new Alert(Alert.AlertType.WARNING); alert.setTitle("Information"); alert.setHeaderText(null); alert.setContentText("Confirm password doesn't match the password!"); alert.showAndWait(); } } //Clear the input fields and upadate tableview after a successful creation of a record } private void validateUserInput(){ if(txtName.getText()==null ||txtName.getText().isEmpty()){ txtName.setStyle("-fx-border-color:red"); txtName.setFocusTraversable(true); }else{ txtName.setStyle("-fx-border-color:none"); } if(txtLastName.getText()==null ||txtLastName.getText().isEmpty()){ txtLastName.setStyle("-fx-border-color:red"); txtLastName.setFocusTraversable(true); }else{ txtLastName.setStyle("-fx-border-color:none"); } if(txtUserName.getText()==null ||txtUserName.getText().isEmpty()){ txtUserName.setStyle("-fx-border-color:red"); txtUserName.setFocusTraversable(true); }else{ txtUserName.setStyle("-fx-border-color:none"); } if(txtPassword.getText()==null ||txtPassword.getText().isEmpty()){ txtPassword.setStyle("-fx-border-color:red"); txtPassword.setFocusTraversable(true); }else { txtPassword.setStyle("-fx-border-color:none"); } if(txtConfirmPass.getText()==null ||txtConfirmPass.getText().isEmpty()){ txtConfirmPass.setStyle("-fx-border-color:red"); txtConfirmPass.setFocusTraversable(true); }else{ txtConfirmPass.setStyle("-fx-border-color:none"); }if(!radioUser.isSelected() && !radioAdmin.isSelected()){ radioUser.setStyle("-fx-border-color:red"); radioAdmin.setStyle("-fx-border-color:red"); }else{ radioUser.setStyle("-fx-border-color:none"); radioAdmin.setStyle("-fx-border-color:none"); } } @FXML private void clearFields() { validateUserInput(); txtName.clear();txtLastName.clear();txtUserName.clear();txtPassword.clear(); txtConfirmPass.clear();roleGroup.selectToggle(null); radioUser.setStyle("-fx-border-color:none"); radioAdmin.setStyle("-fx-border-color:none"); txtName.setStyle("-fx-border-color:none"); txtConfirmPass.setStyle("-fx-border-color:none"); txtPassword.setStyle("-fx-border-color:none"); txtUserName.setStyle("-fx-border-color:none"); txtLastName.setStyle("-fx-border-color:none"); txtName.setStyle("-fx-border-color:none"); } @FXML private void getUserTableData(MouseEvent event) { userObj = userTableView.getSelectionModel().getSelectedItem(); if(userObj!=null){ System.out.println(" Clicked here "); //int id = userObj.getId(); txtName.setText(userObj.getFirstName()); txtLastName.setText(userObj.getLastName()); txtUserName.setText(userObj.getUsername()); txtPassword.setText(userObj.<PASSWORD>()); txtConfirmPass.setText(userObj.getConfirmPassword()); String txt =userObj.getRole(); if(txt.equals("User")){ radioUser.setSelected(true); }else if(txt.equals("Admin")){ radioUser.setSelected(true); } } } private void loadUserData(){ idCol.setCellValueFactory(new PropertyValueFactory<>("id")); nameCol.setCellValueFactory(new PropertyValueFactory<>("firstName")); lastnamCol.setCellValueFactory(new PropertyValueFactory<>("lastName")); usernameCol.setCellValueFactory(new PropertyValueFactory<>("username")); passCol.setCellValueFactory(new PropertyValueFactory<>("password")); // confirmCol.setCellValueFactory(new PropertyValueFactory<>("confrimPassword")); roleCol.setCellValueFactory(new PropertyValueFactory<>("role")); //Call method getPatients which returns an observable list of type Patient userTableView.setItems(userObj.getUsers()); } @FXML void logout(ActionEvent event) { btnLogout.setOnAction(e->{ DashboardController db = new DashboardController(); db.logout(e); }); } public void passUserToUpdate(){ User row; //boolean updated; row= userTableView.getSelectionModel().getSelectedItem(); if(row!=null){ int id = row.getId(); row.updateUser(id,txtName.getText(),txtLastName.getText(),txtUserName.getText(),txtPassword.getText(), txtConfirmPass.getText(),((RadioButton) roleGroup.getSelectedToggle()).getText()); //update table view // if(updated){ userTableView.getItems().clear(); System.out.println("Just updated the table and should update the view too: hah"); //ObservableList<User> dataList = FXCollections.observableArrayList(userObj.getUsers()); userTableView.setItems(userObj.getUsers()); clearFields(); // } }else{ //Alert user System.out.println("There is no selection"); } } @FXML public void passUserToDelete(){ userObj = userTableView.getSelectionModel().getSelectedItem(); if(userObj!=null) { int id = userObj.getId(); userObj.deleteUser(id); // patientObj.deletePatient(patientObj.getId()); clearFields(); } ObservableList<User>allUsers, singleUser; allUsers=userTableView.getItems(); singleUser=userTableView.getSelectionModel().getSelectedItems(); singleUser.forEach(allUsers::remove); } @FXML void passUserToSearch() {//searched User ObservableList<User> dataOnTable = FXCollections.observableArrayList(userObj.getUsers()); FilteredList<User> filteredData = new FilteredList<>(dataOnTable, e -> true); txtSearch.setOnKeyReleased(e->{ txtSearch.textProperty().addListener((observable, oldValue, newValue) -> { filteredData.setPredicate(user -> { //If filter text is empty, display all patients if (newValue == null || newValue.isEmpty()) { return true; } String lowerCaseFilter = newValue.toLowerCase(); if (user.getFirstName().toLowerCase().contains(lowerCaseFilter)) { return true; } else if (user.getLastName().toLowerCase().contains(lowerCaseFilter)) { return true; } return false; }); }); SortedList<User> sortedData = new SortedList<>(filteredData); sortedData.comparatorProperty().bind(userTableView.comparatorProperty()); userTableView.setItems(sortedData); }); } @Override public void initialize(URL location, ResourceBundle resources) { //initialize the GUI radioAdmin.setToggleGroup(roleGroup); radioUser.setToggleGroup(roleGroup); radioUser.setSelected(true); passUserToSearch(); loadUserData(); //Switch views/stages btnManageTest.setOnAction(e->{ try { String fxml ="TestController.fxml"; String windowTitle ="Manage IRS Test"; WindowLoader winLoad = new WindowLoader(); winLoad.loadWindow(e,userObj,windowTitle,fxml); }catch (Exception ex){ //Debugg System.out.println("Loading Error"); } }); btnLoadDashboard.setOnAction(e->{ try{ String fxml = "dashboard.fxml"; String windowTitle ="IRS Management Console"; WindowLoader winLoad= new WindowLoader(); winLoad.loadWindow(e, userObj,windowTitle,fxml); }catch(Exception ex){ System.out.println("Loading Error"); } }); btnRecommendation.setOnAction(e->{ try{ String fxml = "RecommendationController.fxml"; String windowTitle ="Manage Recommendation"; WindowLoader winLoad= new WindowLoader(); winLoad.loadWindow(e, userObj,windowTitle,fxml); }catch(Exception ex){ System.out.println("Loading Error"); } }); } }
11,674
0.615332
0.615332
320
35.484375
29.260464
146
false
false
0
0
0
0
0
0
0.68125
false
false
7
5c27eaff9eda1ae885ce692e7a5668b466b1b4e4
22,136,261,478,156
562aa7d5971afa85154a55d9a1ebdcf4239bbed8
/CarFactory/src/main/java/com/solvd/carfactory/dao/IBaseDAO.java
a13292f32be13ce0ae99ca48fdb40dcd97a8f46b
[ "Apache-2.0" ]
permissive
sergiomarchio/SolvdTACourseProjects
https://github.com/sergiomarchio/SolvdTACourseProjects
dbb87d8ca01cb739b55d7c900fae8b37fe6ef7d2
a4eb85b26e3fa35c4365f1a0208d215c089250e3
refs/heads/main
2023-07-13T07:53:30.319000
2021-08-26T11:37:19
2021-08-26T11:37:19
392,446,669
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.solvd.carfactory.dao; public interface IBaseDAO<T> { void createItem(T item); T getItemById(long id); void updateItem(T item); void deleteItem(long id); }
UTF-8
Java
192
java
IBaseDAO.java
Java
[]
null
[]
package com.solvd.carfactory.dao; public interface IBaseDAO<T> { void createItem(T item); T getItemById(long id); void updateItem(T item); void deleteItem(long id); }
192
0.666667
0.666667
8
22
12.529964
33
false
false
0
0
0
0
0
0
0.625
false
false
7
ed3ce4b81878c11563351aa8a9ea0edc11390d76
944,892,847,386
77a85302d1f60e57c8f30812bff67ee068a92fb2
/spring-mytest/src/main/java/com/eric/bean/BeanB.java
a6eb6079f57ee2e001a7466ce18f06b39e0300ae
[ "Apache-2.0" ]
permissive
EricGu11/springframework5
https://github.com/EricGu11/springframework5
872b8dedb6ef8ab8ed3ef28d889db1198654ed51
a6460e0dbdd4dc4a5f4b6ce25d5850dad9c0ca86
refs/heads/master
2020-09-12T08:48:15.089000
2019-11-20T06:34:23
2019-11-20T06:34:23
222,373,217
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.eric.bean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * @author: Eric * @Date: 2019/11/15 16:36 * @Description: */ //@Component public class BeanB { @Autowired private BeanA beanA; }
UTF-8
Java
276
java
BeanB.java
Java
[ { "context": "ngframework.stereotype.Component;\n\n/**\n * @author: Eric\n * @Date: 2019/11/15 16:36\n * @Description:\n */\n/", "end": 157, "score": 0.9993643164634705, "start": 153, "tag": "NAME", "value": "Eric" } ]
null
[]
package com.eric.bean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * @author: Eric * @Date: 2019/11/15 16:36 * @Description: */ //@Component public class BeanB { @Autowired private BeanA beanA; }
276
0.73913
0.695652
15
17.4
17.133982
62
false
false
0
0
0
0
0
0
0.4
false
false
7
3bbc14277f307bd84669c243b0aeb15edba49981
944,892,844,064
4675ccb9605740f5294f1b2f791639bbd9531776
/dessin_vectoriel/src/controller/JControllerDessins.java
07c6c426a5c0fb85f6e8e2ae981b2eddd9030f52
[]
no_license
Gayout/dessin_vectoriel
https://github.com/Gayout/dessin_vectoriel
325bd32a31244ea0397a8a512bdbe6fdc37bbaaf
58486818255648c32d0bf0c1a61eba33aad3a335
refs/heads/master
2021-01-10T17:24:21.057000
2015-11-30T07:11:18
2015-11-30T07:11:18
45,028,482
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package controller; import java.util.Observable; import java.util.Observer; import java.util.Vector; import abstraction.Application; import abstraction.Chemin; import abstraction.DessinComposite; import visitor.VisiteurAWTDessiner; public class JControllerDessins implements Observer{ private Application application; private VisiteurAWTDessiner fenetre; public JControllerDessins (VisiteurAWTDessiner fenetre, Application application) { this.fenetre = fenetre; this.application = application; } @Override public void update(Observable arg0, Object arg1) { Integer iMessage = (Integer)arg1; if(iMessage == Application.MODIFY_DESSINS) { this.fenetre.getG().clearRect(0, 0, this.application.largeur, this.application.hauteur); DessinComposite dessin = new DessinComposite(); Vector<Chemin> dessins = this.application.getDessins(); for(int i=0; i<dessins.size(); i++) { dessin.addDessin(dessins.get(i)); } dessin.accept(this.fenetre); this.fenetre.setVisible(true); } } }
UTF-8
Java
1,018
java
JControllerDessins.java
Java
[]
null
[]
package controller; import java.util.Observable; import java.util.Observer; import java.util.Vector; import abstraction.Application; import abstraction.Chemin; import abstraction.DessinComposite; import visitor.VisiteurAWTDessiner; public class JControllerDessins implements Observer{ private Application application; private VisiteurAWTDessiner fenetre; public JControllerDessins (VisiteurAWTDessiner fenetre, Application application) { this.fenetre = fenetre; this.application = application; } @Override public void update(Observable arg0, Object arg1) { Integer iMessage = (Integer)arg1; if(iMessage == Application.MODIFY_DESSINS) { this.fenetre.getG().clearRect(0, 0, this.application.largeur, this.application.hauteur); DessinComposite dessin = new DessinComposite(); Vector<Chemin> dessins = this.application.getDessins(); for(int i=0; i<dessins.size(); i++) { dessin.addDessin(dessins.get(i)); } dessin.accept(this.fenetre); this.fenetre.setVisible(true); } } }
1,018
0.765226
0.759332
35
28.085714
22.603882
91
false
false
0
0
0
0
0
0
2
false
false
7
ef62b63ea372388e2d687ea633a6c3e484b1b8c4
36,996,848,323,111
eb9f70c991df25f5264138fe945880ccb0a7b309
/core/src/de/homelab/madgaksha/lotsofbs/enums/TrackingOrientationStrategy.java
792ae5ff8ea9b0de3bbb00eb59b932b265b493f9
[ "CC0-1.0" ]
permissive
blutorange/lotsOfBSGdx
https://github.com/blutorange/lotsOfBSGdx
2d53a80385fd72de37becb5b7443fd3493eacb88
d5474f7a5090e1f919ef00280c91b0077249d51c
refs/heads/master
2020-12-21T01:18:53.868000
2017-06-12T17:42:40
2017-06-12T17:42:40
58,227,744
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package de.homelab.madgaksha.lotsofbs.enums; public enum TrackingOrientationStrategy { MINIBALL, ABSOLUTE, RELATIVE; }
UTF-8
Java
123
java
TrackingOrientationStrategy.java
Java
[]
null
[]
package de.homelab.madgaksha.lotsofbs.enums; public enum TrackingOrientationStrategy { MINIBALL, ABSOLUTE, RELATIVE; }
123
0.804878
0.804878
7
16.571428
16.884964
44
false
false
0
0
0
0
0
0
1
false
false
7
37f5ad797147a08112902bc3108014e6400cbab4
10,909,216,979,934
af24008f9c92df145959f2593083d1093c0e668f
/app/src/main/java/com/elbissopsoft/schooldiary/Events.java
f63eb6016980ea24d1d16322934f7073e65e72ce
[]
no_license
GDShankar/SchoolDiary
https://github.com/GDShankar/SchoolDiary
232a0a273e376972e275ccaf405e4fd4c62a7080
4ffd826972e1b74495b47b3d4f8949647632130c
refs/heads/master
2020-06-13T02:12:01.151000
2016-12-03T09:08:54
2016-12-03T09:08:54
75,463,682
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.elbissopsoft.schooldiary; import android.app.ProgressDialog; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.ImageButton; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; public class Events extends AppCompatActivity { TextView datedisplay; ImageButton next_btn,previous_btn; final ArrayList<Eventdec> eventsList = new ArrayList<>(); ListView listView; String date,year_month; int mon,year; ProgressDialog loading; String []months={"January","Febraury","March","April","May","June","July","August","September","October","November","December"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.events); datedisplay=(TextView)findViewById(R.id.date); next_btn=(ImageButton)findViewById(R.id.nextimg); previous_btn=(ImageButton)findViewById(R.id.previousimg); listView=(ListView) findViewById(R.id.eventslist); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM"); Date dateobj = new Date(); date= df.format(dateobj); String []dateparts=date.split("-"); String mont; mont = dateparts[1]; year= Integer.parseInt(dateparts[0]); mon=Integer.parseInt(mont); year_month=String.valueOf(year)+String.valueOf(mon); // Toast.makeText(getApplicationContext(),year_month,Toast.LENGTH_LONG).show(); datedisplay.setText(months[mon-1] +year); next_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mon+=1; if(mon==13) { mon=1; year+=1; } year_month=String.valueOf(year)+String.valueOf(mon); datedisplay.setText(months[mon-1] +"-" +year); getData(year_month); // Toast.makeText(getApplicationContext(),String.valueOf(year)+String.valueOf(mon),Toast.LENGTH_LONG).show(); } }); previous_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mon-=1; if(mon==0) { mon=12; year-=1; } year_month=String.valueOf(year)+String.valueOf(mon); datedisplay.setText(months[mon-1] +"-" +year); getData(year_month); } }); getData(year_month); } private void getData( String date) { // Toast.makeText(getApplicationContext(),date,Toast.LENGTH_LONG).show(); loading = ProgressDialog.show(Events.this,"Please wait...","Fetching...",false,false); final String url = Config.get_events_URL+"date="+date.trim(); StringRequest stringRequest = new StringRequest(url, new Response.Listener<String>() { @Override public void onResponse(String response) { loading.dismiss(); showJSON(response); //Toast.makeText(getApplicationContext(),response,Toast.LENGTH_LONG).show(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Toast.makeText(Events.this,error.getMessage(),Toast.LENGTH_LONG).show(); } }); RequestQueue requestQueue = Volley.newRequestQueue(this); requestQueue.add(stringRequest); } private void showJSON(String response) { try { JSONObject jsonObject = new JSONObject(response); JSONArray result = jsonObject.getJSONArray(Config.JSON_ARRAY); eventsList.clear(); for(int i=0;i<result.length();i++) { JSONObject eve = result.getJSONObject(i); String dateinfo = eve.getString(Config.e_date); String events = eve.getString(Config.e_events); String event_desc = eve.getString(Config.e_edesc); String longdesc = eve.getString(Config.e_eldesc); // Toast.makeText(getApplicationContext(),dateinfo+event_desc+events,Toast.LENGTH_LONG).show(); Eventdec ed=new Eventdec(); ed.setDateinfo(dateinfo); ed.setEvents(events); ed.setEvent_desc(event_desc); ed.setLongdesc(longdesc); eventsList.add(ed); // Toast.makeText(getApplicationContext(), (CharSequence) eventsList,Toast.LENGTH_LONG).show(); } Events_Custom adapter=new Events_Custom(this,eventsList); adapter.notifyDataSetChanged(); listView.setAdapter(adapter); } catch (JSONException e) { e.printStackTrace(); } } }
UTF-8
Java
5,522
java
Events.java
Java
[]
null
[]
package com.elbissopsoft.schooldiary; import android.app.ProgressDialog; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.ImageButton; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; public class Events extends AppCompatActivity { TextView datedisplay; ImageButton next_btn,previous_btn; final ArrayList<Eventdec> eventsList = new ArrayList<>(); ListView listView; String date,year_month; int mon,year; ProgressDialog loading; String []months={"January","Febraury","March","April","May","June","July","August","September","October","November","December"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.events); datedisplay=(TextView)findViewById(R.id.date); next_btn=(ImageButton)findViewById(R.id.nextimg); previous_btn=(ImageButton)findViewById(R.id.previousimg); listView=(ListView) findViewById(R.id.eventslist); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM"); Date dateobj = new Date(); date= df.format(dateobj); String []dateparts=date.split("-"); String mont; mont = dateparts[1]; year= Integer.parseInt(dateparts[0]); mon=Integer.parseInt(mont); year_month=String.valueOf(year)+String.valueOf(mon); // Toast.makeText(getApplicationContext(),year_month,Toast.LENGTH_LONG).show(); datedisplay.setText(months[mon-1] +year); next_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mon+=1; if(mon==13) { mon=1; year+=1; } year_month=String.valueOf(year)+String.valueOf(mon); datedisplay.setText(months[mon-1] +"-" +year); getData(year_month); // Toast.makeText(getApplicationContext(),String.valueOf(year)+String.valueOf(mon),Toast.LENGTH_LONG).show(); } }); previous_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mon-=1; if(mon==0) { mon=12; year-=1; } year_month=String.valueOf(year)+String.valueOf(mon); datedisplay.setText(months[mon-1] +"-" +year); getData(year_month); } }); getData(year_month); } private void getData( String date) { // Toast.makeText(getApplicationContext(),date,Toast.LENGTH_LONG).show(); loading = ProgressDialog.show(Events.this,"Please wait...","Fetching...",false,false); final String url = Config.get_events_URL+"date="+date.trim(); StringRequest stringRequest = new StringRequest(url, new Response.Listener<String>() { @Override public void onResponse(String response) { loading.dismiss(); showJSON(response); //Toast.makeText(getApplicationContext(),response,Toast.LENGTH_LONG).show(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Toast.makeText(Events.this,error.getMessage(),Toast.LENGTH_LONG).show(); } }); RequestQueue requestQueue = Volley.newRequestQueue(this); requestQueue.add(stringRequest); } private void showJSON(String response) { try { JSONObject jsonObject = new JSONObject(response); JSONArray result = jsonObject.getJSONArray(Config.JSON_ARRAY); eventsList.clear(); for(int i=0;i<result.length();i++) { JSONObject eve = result.getJSONObject(i); String dateinfo = eve.getString(Config.e_date); String events = eve.getString(Config.e_events); String event_desc = eve.getString(Config.e_edesc); String longdesc = eve.getString(Config.e_eldesc); // Toast.makeText(getApplicationContext(),dateinfo+event_desc+events,Toast.LENGTH_LONG).show(); Eventdec ed=new Eventdec(); ed.setDateinfo(dateinfo); ed.setEvents(events); ed.setEvent_desc(event_desc); ed.setLongdesc(longdesc); eventsList.add(ed); // Toast.makeText(getApplicationContext(), (CharSequence) eventsList,Toast.LENGTH_LONG).show(); } Events_Custom adapter=new Events_Custom(this,eventsList); adapter.notifyDataSetChanged(); listView.setAdapter(adapter); } catch (JSONException e) { e.printStackTrace(); } } }
5,522
0.595074
0.591996
142
37.887325
26.287708
132
false
false
0
0
0
0
0
0
0.901408
false
false
7