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
34fc57459547dc92576afcddfbcfee481010a838
16,965,120,843,527
d78ef3b5bb52598c92207f39d338115b17360659
/Tile.java
084e94ad3965947f4c29750b2afee2583bcb0262
[]
no_license
mfprint/Domino
https://github.com/mfprint/Domino
c46492acb0eb0e99fe6c05e935601eaaf047bd30
422af11e90730e5e0f09b11df2c66cac704f454d
refs/heads/master
2021-06-04T06:43:45.839000
2016-09-25T05:39:51
2016-09-25T05:39:51
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Tile { private int top, bottom; public enum Side { top, bottom }; public Tile(int top, int bottom) { this.top = top; this.bottom = bottom; } public void upsidedown() { int temp = top; top = bottom; bottom = temp; } public boolean isGreater(Tile t) { int topA = (top <= bottom) ? top : bottom, bottomA = (top <= bottom) ? bottom : top; int topB = (t.getTop() < t.getBottom()) ? t.getTop() : t.getBottom(), bottomB = (t.getTop() < t.getBottom()) ? t.getBottom() : t.getTop(); if(bottomA > bottomB || (bottomA == bottomB && topA > topB)) return true; else return false; } public boolean isSmaller(Tile t) { int topA = (top <= bottom) ? top : bottom, bottomA = (top <= bottom) ? bottom : top; int topB = (t.getTop() < t.getBottom()) ? t.getTop() : t.getBottom(), bottomB = (t.getTop() < t.getBottom()) ? t.getBottom() : t.getTop(); if(bottomA < bottomB || (bottomA == bottomB && topA < topB)) return true; else return false; } public boolean isEqual(Tile t) { int topA = (top <= bottom) ? top : bottom, bottomA = (top <= bottom) ? bottom : top; int topB = (t.getTop() < t.getBottom()) ? t.getTop() : t.getBottom(), bottomB = (t.getTop() < t.getBottom()) ? t.getBottom() : t.getTop(); if(bottomA == bottomB && topA == topB) return true; else return false; } public int getTop() { return top; } public int getBottom() { return bottom; } public String toString() { return "[" + top + " | " + bottom + "]"; } public String toGraphic() { String[] graphics = {" ", " . ", " : ", " .:", " ::", ":.:", ":::"}; return "[" + graphics[top] + "|" + graphics[bottom] + "]"; } }
UTF-8
Java
1,774
java
Tile.java
Java
[]
null
[]
public class Tile { private int top, bottom; public enum Side { top, bottom }; public Tile(int top, int bottom) { this.top = top; this.bottom = bottom; } public void upsidedown() { int temp = top; top = bottom; bottom = temp; } public boolean isGreater(Tile t) { int topA = (top <= bottom) ? top : bottom, bottomA = (top <= bottom) ? bottom : top; int topB = (t.getTop() < t.getBottom()) ? t.getTop() : t.getBottom(), bottomB = (t.getTop() < t.getBottom()) ? t.getBottom() : t.getTop(); if(bottomA > bottomB || (bottomA == bottomB && topA > topB)) return true; else return false; } public boolean isSmaller(Tile t) { int topA = (top <= bottom) ? top : bottom, bottomA = (top <= bottom) ? bottom : top; int topB = (t.getTop() < t.getBottom()) ? t.getTop() : t.getBottom(), bottomB = (t.getTop() < t.getBottom()) ? t.getBottom() : t.getTop(); if(bottomA < bottomB || (bottomA == bottomB && topA < topB)) return true; else return false; } public boolean isEqual(Tile t) { int topA = (top <= bottom) ? top : bottom, bottomA = (top <= bottom) ? bottom : top; int topB = (t.getTop() < t.getBottom()) ? t.getTop() : t.getBottom(), bottomB = (t.getTop() < t.getBottom()) ? t.getBottom() : t.getTop(); if(bottomA == bottomB && topA == topB) return true; else return false; } public int getTop() { return top; } public int getBottom() { return bottom; } public String toString() { return "[" + top + " | " + bottom + "]"; } public String toGraphic() { String[] graphics = {" ", " . ", " : ", " .:", " ::", ":.:", ":::"}; return "[" + graphics[top] + "|" + graphics[bottom] + "]"; } }
1,774
0.542277
0.542277
80
20.200001
22.776304
72
false
false
0
0
0
0
0
0
1.8875
false
false
10
c829ae5ac427962a510e0ffbe6fe32d5a67af91a
23,398,981,894,289
3475a766a354f2853aaa1accf04e9f82ca0080be
/src/edu/bms/entity/BookCatalog.java
621756622a6f309c9cb19c8ad1dfed068a05e6af
[]
no_license
luyan0807/bms-ls
https://github.com/luyan0807/bms-ls
b11f657d5888499ea29f36195c51b4a82422c11a
92ac39762307e44e5acfb88d6fbdedad33b0acdc
refs/heads/master
2021-09-04T11:35:45.123000
2018-01-18T09:50:15
2018-01-18T09:50:15
111,508,068
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.bms.entity; public class BookCatalog { private int id;//自动编号 private int borrowTime;//借阅次数 private int borrowNum;//可借阅数量 private int renewTime;//续借次数 private String isbn;//国际编号 public int getId() { return id; } public void setId(int id) { this.id = id; } public int getBorrowTime() { return borrowTime; } public void setBorrowTime(int borrowTime) { this.borrowTime = borrowTime; } public int getBorrowNum() { return borrowNum; } public void setBorrowNum(int borrowNum) { this.borrowNum = borrowNum; } public int getRenewTime() { return renewTime; } public void setRenewTime(int renewTime) { this.renewTime = renewTime; } public String getIsbn() { return isbn; } public void setIsbn(String isbn) { this.isbn = isbn; } }
UTF-8
Java
834
java
BookCatalog.java
Java
[]
null
[]
package edu.bms.entity; public class BookCatalog { private int id;//自动编号 private int borrowTime;//借阅次数 private int borrowNum;//可借阅数量 private int renewTime;//续借次数 private String isbn;//国际编号 public int getId() { return id; } public void setId(int id) { this.id = id; } public int getBorrowTime() { return borrowTime; } public void setBorrowTime(int borrowTime) { this.borrowTime = borrowTime; } public int getBorrowNum() { return borrowNum; } public void setBorrowNum(int borrowNum) { this.borrowNum = borrowNum; } public int getRenewTime() { return renewTime; } public void setRenewTime(int renewTime) { this.renewTime = renewTime; } public String getIsbn() { return isbn; } public void setIsbn(String isbn) { this.isbn = isbn; } }
834
0.693182
0.693182
52
14.230769
14.047468
44
false
false
0
0
0
0
0
0
1.211538
false
false
10
07a09af066de3837c0a18e38b1c60b3c0b23cdb9
25,451,976,198,678
0d6b8ec07de08838d9a529d99a70aad265ae733a
/Front-end/ProjetoSistemasDistribuidos/src/br/faj/sd/controle/PessoaDetalheControle.java
ea83ef4781544d4d30258badb0df0f200ef6165c
[]
no_license
RicardoGPP/projeto-sistemas-distribuidos
https://github.com/RicardoGPP/projeto-sistemas-distribuidos
d345dca05ca99848b045355f7026196b85fbd6b4
8cef68a0420f4e60ebc3c2e49ff7a66b8630874c
refs/heads/master
2020-03-29T13:04:55.594000
2018-09-23T01:42:29
2018-09-23T01:42:29
149,938,498
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.faj.sd.controle; import br.faj.sd.modelo.Pessoa; import br.faj.sd.visao.PessoaDetalheVisao; public class PessoaDetalheControle extends Controle<PessoaDetalheVisao> { private Pessoa pessoa; public void setPessoa(Pessoa pessoa) { this.pessoa = pessoa; } public Pessoa getPessoa() { return this.pessoa; } public PessoaDetalheControle(PessoaDetalheVisao visao) { super(visao); } }
UTF-8
Java
412
java
PessoaDetalheControle.java
Java
[]
null
[]
package br.faj.sd.controle; import br.faj.sd.modelo.Pessoa; import br.faj.sd.visao.PessoaDetalheVisao; public class PessoaDetalheControle extends Controle<PessoaDetalheVisao> { private Pessoa pessoa; public void setPessoa(Pessoa pessoa) { this.pessoa = pessoa; } public Pessoa getPessoa() { return this.pessoa; } public PessoaDetalheControle(PessoaDetalheVisao visao) { super(visao); } }
412
0.754854
0.754854
24
16.166666
19.413626
71
false
false
0
0
0
0
0
0
1.083333
false
false
10
90d1024d45865a4b1752583af68341dd8da39bdb
687,194,778,287
c92965da21f5b8fc972a0831e83538613c63dc4f
/app/src/main/java/com/learn/expansionfile/helper/XAPKFile.java
2b8ee68e36806c5d04ac63f898e0279c7474c7fb
[]
no_license
randiw/LearnExpansionFile
https://github.com/randiw/LearnExpansionFile
a306ba3c8ef3672ef904beee7913f1b48fbbe529
f8ff8bafe9ed1b2ce2d0d756f64ac9135407e65d
refs/heads/master
2021-01-10T05:38:59.174000
2015-06-01T08:01:34
2015-06-01T08:01:34
36,422,125
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.learn.expansionfile.helper; /** * Created by randiwaranugraha on 6/1/15. */ public class XAPKFile { public final boolean isMain; public final int fileVersion; public final long fileSize; public XAPKFile(boolean isMain, int fileVersion, long fileSize) { this.isMain = isMain; this.fileVersion = fileVersion; this.fileSize = fileSize; } }
UTF-8
Java
397
java
XAPKFile.java
Java
[ { "context": "com.learn.expansionfile.helper;\n\n/**\n * Created by randiwaranugraha on 6/1/15.\n */\npublic class XAPKFile {\n\n publi", "end": 75, "score": 0.9993790984153748, "start": 59, "tag": "USERNAME", "value": "randiwaranugraha" } ]
null
[]
package com.learn.expansionfile.helper; /** * Created by randiwaranugraha on 6/1/15. */ public class XAPKFile { public final boolean isMain; public final int fileVersion; public final long fileSize; public XAPKFile(boolean isMain, int fileVersion, long fileSize) { this.isMain = isMain; this.fileVersion = fileVersion; this.fileSize = fileSize; } }
397
0.68262
0.672544
17
22.411764
19.587088
69
false
false
0
0
0
0
0
0
0.529412
false
false
10
54050006b3cf66d5f1011111f7bcb7c30d83298a
231,928,256,365
29a1ee225919c2aaaa8762021990521285310630
/src/jmh/java/com/github/tonivade/claudb/ClauDBBenchmark.java
b89f2edc6fbde031e930b230ace3bbe7e898d667
[ "MIT" ]
permissive
tonivade/tinydb
https://github.com/tonivade/tinydb
2b65e7e616a0b8ab622cb4dc82162bae5409afff
ba88b2a8fbbb0b229cf83a77e1e87d3a12b3a147
refs/heads/master
2020-05-20T19:26:15.579000
2020-05-12T20:21:22
2020-05-12T20:21:22
35,656,597
10
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (c) 2015-2020, Antonio Gabriel Muñoz Conejo <antoniogmc at gmail dot com> * Distributed under the terms of the MIT License */ package com.github.tonivade.claudb; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import redis.clients.jedis.Jedis; import redis.clients.jedis.Pipeline; @State(Scope.Thread) @BenchmarkMode(Mode.AverageTime) public class ClauDBBenchmark { private Jedis jedis = new Jedis("localhost", 7081); @Benchmark public void testCommands() { jedis.set("a", "b"); jedis.set("a", "b"); jedis.set("a", "b"); jedis.set("a", "b"); } @Benchmark public void testPipeline() { Pipeline pipeline = jedis.pipelined(); pipeline.set("a", "b"); pipeline.set("a", "b"); pipeline.set("a", "b"); pipeline.set("a", "b"); pipeline.sync(); } }
UTF-8
Java
996
java
ClauDBBenchmark.java
Java
[ { "context": "/*\n * Copyright (c) 2015-2020, Antonio Gabriel Muñoz Conejo <antoniogmc at gmail dot com>\n * Distributed unde", "end": 59, "score": 0.999863862991333, "start": 31, "tag": "NAME", "value": "Antonio Gabriel Muñoz Conejo" } ]
null
[]
/* * Copyright (c) 2015-2020, <NAME> <antoniogmc at gmail dot com> * Distributed under the terms of the MIT License */ package com.github.tonivade.claudb; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import redis.clients.jedis.Jedis; import redis.clients.jedis.Pipeline; @State(Scope.Thread) @BenchmarkMode(Mode.AverageTime) public class ClauDBBenchmark { private Jedis jedis = new Jedis("localhost", 7081); @Benchmark public void testCommands() { jedis.set("a", "b"); jedis.set("a", "b"); jedis.set("a", "b"); jedis.set("a", "b"); } @Benchmark public void testPipeline() { Pipeline pipeline = jedis.pipelined(); pipeline.set("a", "b"); pipeline.set("a", "b"); pipeline.set("a", "b"); pipeline.set("a", "b"); pipeline.sync(); } }
973
0.687437
0.675377
39
24.512821
18.950504
86
false
false
0
0
0
0
0
0
0.74359
false
false
10
05b6575bd938d04af82d8674590079ed0f427dcf
3,092,376,505,744
e3cc3f68e8ae3d0dc00feae014362ad8d83301fc
/src/main/java/com/ncode/service/MessageService.java
8f34f1060ee1cf86d89ef77e293ff07940bf914f
[]
no_license
kaiwanxiaom/ncode
https://github.com/kaiwanxiaom/ncode
684bc53ab2c1b44baa3c4438556c5a25333547b0
39c7cd5c47ee5871e776acafb6f24a083a267d90
refs/heads/master
2021-09-11T01:18:53.169000
2018-04-05T14:33:34
2018-04-05T14:33:34
115,618,554
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ncode.service; import com.ncode.dao.MessageDAO; import com.ncode.model.Message; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.util.HtmlUtils; import java.util.List; @Service public class MessageService { @Autowired MessageDAO messageDAO; @Autowired SensitiveService sensitiveService; public int countUnReadMessages(String conversationId, int userId) { return messageDAO.selectCountUnreadByConversationIdUserId(conversationId, userId); } public List<Message> getMessagesByConversationId(String conversationId, int offset, int limit) { return messageDAO.selectMessageByConversationId(conversationId, offset, limit); } public List<Message> getLatestMessagesByUserId(int userId, int offset, int limit) { return messageDAO.selectMessageByUserId(userId, offset, limit); } public int addMessage(Message message) { message.setContent(HtmlUtils.htmlEscape(message.getContent())); message.setContent(sensitiveService.filter(message.getContent())); return messageDAO.addMessage(message) > 0 ? message.getId() : 0; } public int updateReadByMessageToId(int status, String conversationId, int id) { return messageDAO.updateHasReadByToId(status, conversationId, id); } }
UTF-8
Java
1,385
java
MessageService.java
Java
[]
null
[]
package com.ncode.service; import com.ncode.dao.MessageDAO; import com.ncode.model.Message; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.util.HtmlUtils; import java.util.List; @Service public class MessageService { @Autowired MessageDAO messageDAO; @Autowired SensitiveService sensitiveService; public int countUnReadMessages(String conversationId, int userId) { return messageDAO.selectCountUnreadByConversationIdUserId(conversationId, userId); } public List<Message> getMessagesByConversationId(String conversationId, int offset, int limit) { return messageDAO.selectMessageByConversationId(conversationId, offset, limit); } public List<Message> getLatestMessagesByUserId(int userId, int offset, int limit) { return messageDAO.selectMessageByUserId(userId, offset, limit); } public int addMessage(Message message) { message.setContent(HtmlUtils.htmlEscape(message.getContent())); message.setContent(sensitiveService.filter(message.getContent())); return messageDAO.addMessage(message) > 0 ? message.getId() : 0; } public int updateReadByMessageToId(int status, String conversationId, int id) { return messageDAO.updateHasReadByToId(status, conversationId, id); } }
1,385
0.756679
0.755235
41
32.780487
32.770088
100
false
false
0
0
0
0
0
0
0.731707
false
false
10
d2ed19c0262e2c65bece5aeed899d8939414971c
13,469,017,496,022
0ae9707afc4b6fd34c0386f3979dd2aa2a9fa669
/Backend/src/main/java/com/amazonaws/shortify/Shortify.java
86d3c47acd57cbe2b3894b3ef36b1e97947c77ea
[]
no_license
IrresistibleImran/Shortify
https://github.com/IrresistibleImran/Shortify
0816695db07464a7c4aa8a5ce178a4f26e2e5872
3c62d43a0eefa5a4ef395e206f5ae5ddbbec483f
refs/heads/master
2021-04-02T05:02:22.416000
2020-07-15T17:21:09
2020-07-15T17:21:09
248,244,700
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.amazonaws.shortify; import org.joda.time.DateTime; import org.joda.time.Instant; import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder; import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper; import com.amazonaws.services.dynamodbv2.document.DynamoDB; import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.LambdaLogger; import com.amazonaws.services.lambda.runtime.RequestHandler; /** * @author imran.pasha * */ public class Shortify implements RequestHandler<Input, Output> { AmazonDynamoDB dbinstance = AmazonDynamoDBClientBuilder.defaultClient(); DynamoDB dynamoDB = new DynamoDB(dbinstance); private static final String shortifyUrl = "https:/Shorti.fy/"; @Override public Output handleRequest(Input input, Context context) { LambdaLogger logger = context.getLogger(); logger.log("\n----------------------Adding new Url to database------------------------"); logger.log("\nURL details: " + input.getOriginalUrl() + "\n" ); DynamoDBMapper mapper = new DynamoDBMapper(dbinstance); UrlItem checkItem = mapper.load(UrlItem.class, input.getOriginalUrl()); Output result = new Output(); if(checkItem == null) { UrlItem item = new UrlItem(); item.setOriginalUrl(input.getOriginalUrl()); mapper.save(item); String base62Id = encodeHex(item.getId()); String shortUrl = shortifyUrl + base62Id; /** * To-do: Need to find a way to make this consistent and atomic? */ item.setBase62Id(base62Id); item.setCreationDate(new Instant().getMillis()); item.setExpirationDate(new DateTime().plusYears(5).getMillis()); mapper.save(item); System.out.println("Shortified url: " + shortUrl); result.setShortenedUrl(shortifyUrl + item.getBase62Id()); return result; } else { logger.log("Item already exists in database: "+ checkItem.toString()); result.setShortenedUrl(shortifyUrl + checkItem.getBase62Id()); return result; } } /** * base62 encoding for uuid; limited to 8 characters. * @param hexId * @return */ private String encodeHex(String Id) { String trimmedId = Id.substring(0, 14); String hexId = trimmedId.replaceAll("-", ""); String shortUrl = ChangeBase.encodeB62(hexId); System.out.println("Short Url is: " + shortUrl); return shortUrl; } }
UTF-8
Java
2,428
java
Shortify.java
Java
[ { "context": "ces.lambda.runtime.RequestHandler;\n\n/**\n * @author imran.pasha\n *\n */\npublic class Shortify implements Requ", "end": 547, "score": 0.8253850936889648, "start": 542, "tag": "USERNAME", "value": "imran" }, { "context": "bda.runtime.RequestHandler;\n\n/**\n * @author imran.pasha\n *\n */\npublic class Shortify implements RequestHa", "end": 553, "score": 0.7448641657829285, "start": 548, "tag": "NAME", "value": "pasha" } ]
null
[]
package com.amazonaws.shortify; import org.joda.time.DateTime; import org.joda.time.Instant; import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder; import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper; import com.amazonaws.services.dynamodbv2.document.DynamoDB; import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.LambdaLogger; import com.amazonaws.services.lambda.runtime.RequestHandler; /** * @author imran.pasha * */ public class Shortify implements RequestHandler<Input, Output> { AmazonDynamoDB dbinstance = AmazonDynamoDBClientBuilder.defaultClient(); DynamoDB dynamoDB = new DynamoDB(dbinstance); private static final String shortifyUrl = "https:/Shorti.fy/"; @Override public Output handleRequest(Input input, Context context) { LambdaLogger logger = context.getLogger(); logger.log("\n----------------------Adding new Url to database------------------------"); logger.log("\nURL details: " + input.getOriginalUrl() + "\n" ); DynamoDBMapper mapper = new DynamoDBMapper(dbinstance); UrlItem checkItem = mapper.load(UrlItem.class, input.getOriginalUrl()); Output result = new Output(); if(checkItem == null) { UrlItem item = new UrlItem(); item.setOriginalUrl(input.getOriginalUrl()); mapper.save(item); String base62Id = encodeHex(item.getId()); String shortUrl = shortifyUrl + base62Id; /** * To-do: Need to find a way to make this consistent and atomic? */ item.setBase62Id(base62Id); item.setCreationDate(new Instant().getMillis()); item.setExpirationDate(new DateTime().plusYears(5).getMillis()); mapper.save(item); System.out.println("Shortified url: " + shortUrl); result.setShortenedUrl(shortifyUrl + item.getBase62Id()); return result; } else { logger.log("Item already exists in database: "+ checkItem.toString()); result.setShortenedUrl(shortifyUrl + checkItem.getBase62Id()); return result; } } /** * base62 encoding for uuid; limited to 8 characters. * @param hexId * @return */ private String encodeHex(String Id) { String trimmedId = Id.substring(0, 14); String hexId = trimmedId.replaceAll("-", ""); String shortUrl = ChangeBase.encodeB62(hexId); System.out.println("Short Url is: " + shortUrl); return shortUrl; } }
2,428
0.714168
0.703871
77
30.532467
26.156664
91
false
false
0
0
0
0
0
0
2.207792
false
false
10
9d7b7837180638c41f3e92a1279ee31b4d7db726
30,734,786,025,195
d68b3d90f210af7be905632beb736af0c9cfed77
/Old/TheDarkKnight/src/org/usfirst/frc/team195/robot/Utilities/CubeHandler/ArmPosition.java
56fc280744a5e8eff98a6d51d5c609ea22e7eff7
[]
no_license
frcteam195/FRC2018
https://github.com/frcteam195/FRC2018
73560af26f09bd46aecad542ee2dfe3a9542fbb9
7588d334b6864c52b1833007abe337af5f5b5382
refs/heads/master
2020-03-14T18:00:51.956000
2019-01-06T03:37:16
2019-01-06T03:37:16
131,733,213
8
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.usfirst.frc.team195.robot.Utilities.CubeHandler; public class ArmPosition { public static final double DOWN = 0; public static final double LOW = 10; public static final double MID = 40; public static final double HOLD_THRESHOLD = 86.3; public static final double SWITCH = 70; public static final double VERTICAL = 86.3; public static final double BACK_SHOOT = 135; public static final double BACK_SHOOT_HIGH = 130; public static final double BACK_SHOOT_LESS_HIGH = 150; public static final double BACK = 175; public static final double ELEVATOR_COLLISION_POINT = 95; public static final double GET_CLIMBER_HOOK = 107; }
UTF-8
Java
646
java
ArmPosition.java
Java
[]
null
[]
package org.usfirst.frc.team195.robot.Utilities.CubeHandler; public class ArmPosition { public static final double DOWN = 0; public static final double LOW = 10; public static final double MID = 40; public static final double HOLD_THRESHOLD = 86.3; public static final double SWITCH = 70; public static final double VERTICAL = 86.3; public static final double BACK_SHOOT = 135; public static final double BACK_SHOOT_HIGH = 130; public static final double BACK_SHOOT_LESS_HIGH = 150; public static final double BACK = 175; public static final double ELEVATOR_COLLISION_POINT = 95; public static final double GET_CLIMBER_HOOK = 107; }
646
0.767802
0.716718
16
39.375
17.047268
60
false
false
0
0
0
0
0
0
1.5625
false
false
10
1a6bf838c3f45890134c1e2a1c0632767052b6d4
22,385,369,599,267
ef3f97f6b10fdf842a9678ac8fac74d16a163081
/src/main/java/ru/dna/dna/service/DnaService.java
40b109609cc7a4b0d9b1ec88a3d000c8e3d75200
[]
no_license
HK777/3DNA
https://github.com/HK777/3DNA
2d7048273320a873aa99abfdaf857d868bb643d2
42012a85968fb6a63794631afdd7091cb87213bf
refs/heads/master
2020-12-19T15:50:51.176000
2020-01-31T15:04:30
2020-01-31T15:04:30
235,780,151
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ru.dna.dna.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import ru.dna.dna.clients.CsvClient; import ru.dna.dna.parseAndConvert.ParserAndConverter; import ru.dna.dna.utils.FileUtil; import java.util.List; @Component public class DnaService { private final CsvClient csvClient; @Autowired public DnaService(CsvClient csvClient) { this.csvClient = csvClient; } public String getFile(String filename, List<String> dna) { ParserAndConverter parserAndConverter = new ParserAndConverter(); for (String str : dna) { parserAndConverter.parseAndConvert( str, csvClient.getFile(str, FileUtil.getCsvFile(filename))); } return parserAndConverter.getConvertedXml(); } public String getSummaryTxt(String dna) { return csvClient.getFile(dna, FileUtil.getSummary(dna)); } public String getTorinsonTxt(String dna) { return csvClient.getFile(dna, FileUtil.getTorsion(dna)); } }
UTF-8
Java
1,017
java
DnaService.java
Java
[]
null
[]
package ru.dna.dna.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import ru.dna.dna.clients.CsvClient; import ru.dna.dna.parseAndConvert.ParserAndConverter; import ru.dna.dna.utils.FileUtil; import java.util.List; @Component public class DnaService { private final CsvClient csvClient; @Autowired public DnaService(CsvClient csvClient) { this.csvClient = csvClient; } public String getFile(String filename, List<String> dna) { ParserAndConverter parserAndConverter = new ParserAndConverter(); for (String str : dna) { parserAndConverter.parseAndConvert( str, csvClient.getFile(str, FileUtil.getCsvFile(filename))); } return parserAndConverter.getConvertedXml(); } public String getSummaryTxt(String dna) { return csvClient.getFile(dna, FileUtil.getSummary(dna)); } public String getTorinsonTxt(String dna) { return csvClient.getFile(dna, FileUtil.getTorsion(dna)); } }
1,017
0.753196
0.753196
39
25.076923
23.7491
70
false
false
0
0
0
0
0
0
0.487179
false
false
10
e2c14f7e754908651d88f286fa2edf1713ea9128
4,243,427,749,472
fc48ed0c6926b00c75f6f0aa952cc718a42c1783
/app/src/main/java/com/mooo/ewolvy/killkodi/MainActivity.java
695a886782f1cbfd16adf03428180b7f0ac4d3df
[]
no_license
ewolvy/KillKodi
https://github.com/ewolvy/KillKodi
4d7127d5f99f872de3cef0f80a76b83a7ae12099
60e26a49770e5daab8669c3521d2835f11d683e3
refs/heads/master
2020-06-28T21:44:38.676000
2016-12-27T19:42:38
2016-12-27T19:42:38
74,466,116
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mooo.ewolvy.killkodi; import android.content.DialogInterface; import android.content.Intent; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main_menu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_settings: startActivity(new Intent(MainActivity.this, SettingsActivity.class)); return true; default: return super.onOptionsItemSelected(item); } } public void KillKodi(View v){ new AlertDialog.Builder(this) .setTitle(getString(R.string.confirm_title)) .setMessage(getString(R.string.confirm_message)) .setIcon(android.R.drawable.ic_dialog_alert) .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { //TODO: Code to connect to the Linux machine running Kodi new KillKodiAsyncTask(MainActivity.this).execute(new KKState("192.168.1.210", 1207)); }}) .setNegativeButton(android.R.string.no, null).show(); } }
UTF-8
Java
1,879
java
MainActivity.java
Java
[ { "context": "AsyncTask(MainActivity.this).execute(new KKState(\"192.168.1.210\", 1207));\n }})\n ", "end": 1766, "score": 0.9997103810310364, "start": 1753, "tag": "IP_ADDRESS", "value": "192.168.1.210" } ]
null
[]
package com.mooo.ewolvy.killkodi; import android.content.DialogInterface; import android.content.Intent; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main_menu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_settings: startActivity(new Intent(MainActivity.this, SettingsActivity.class)); return true; default: return super.onOptionsItemSelected(item); } } public void KillKodi(View v){ new AlertDialog.Builder(this) .setTitle(getString(R.string.confirm_title)) .setMessage(getString(R.string.confirm_message)) .setIcon(android.R.drawable.ic_dialog_alert) .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { //TODO: Code to connect to the Linux machine running Kodi new KillKodiAsyncTask(MainActivity.this).execute(new KKState("192.168.1.210", 1207)); }}) .setNegativeButton(android.R.string.no, null).show(); } }
1,879
0.641831
0.633316
51
35.843136
27.203209
109
false
false
0
0
0
0
0
0
0.490196
false
false
10
571f9c89791c9452f7797d8732e035f11352e6f2
20,048,907,354,628
6952304298d66aedb06b0db8687a3c2a8a250630
/JaydeStudy/src/main/java/net/jayde/commons/utils/ui/xmltree/xmltreeobjects/XmlTreeObjectCommonInfo.java
6f578b806eddd78cd6a53c93ac89bba182f352bd
[]
no_license
jaydezhou/JavaCS
https://github.com/jaydezhou/JavaCS
fe16aa2a5d5505456d67f1b1be9f9af24b5997de
033d77c41c3f03bd1cd6d2f9ca7c9f5ece97a960
refs/heads/master
2022-12-20T20:23:52.412000
2019-12-20T09:07:03
2019-12-20T09:07:03
119,678,202
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.jayde.commons.utils.ui.xmltree.xmltreeobjects; /** * Created by jayde on 2016-9-5. */ public class XmlTreeObjectCommonInfo { String name; String id; String icon; String classtype; String nodeType; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getIcon() { return icon; } public void setIcon(String icon) { this.icon = icon; } public String getClasstype() { return classtype; } public void setClasstype(String classtype) { this.classtype = classtype; } public String getNodeType() { return nodeType; } public void setNodeType(String nodeType) { this.nodeType = nodeType; } @Override public String toString() { return name; } }
UTF-8
Java
1,073
java
XmlTreeObjectCommonInfo.java
Java
[ { "context": "s.ui.xmltree.xmltreeobjects;\r\n\r\n/**\r\n * Created by jayde on 2016-9-5.\r\n */\r\npublic class XmlTreeObjectComm", "end": 86, "score": 0.9997275471687317, "start": 81, "tag": "USERNAME", "value": "jayde" } ]
null
[]
package net.jayde.commons.utils.ui.xmltree.xmltreeobjects; /** * Created by jayde on 2016-9-5. */ public class XmlTreeObjectCommonInfo { String name; String id; String icon; String classtype; String nodeType; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getIcon() { return icon; } public void setIcon(String icon) { this.icon = icon; } public String getClasstype() { return classtype; } public void setClasstype(String classtype) { this.classtype = classtype; } public String getNodeType() { return nodeType; } public void setNodeType(String nodeType) { this.nodeType = nodeType; } @Override public String toString() { return name; } }
1,073
0.543336
0.537745
58
16.5
14.994539
58
false
false
0
0
0
0
0
0
0.293103
false
false
10
089cc35dc2e6839375d9df4da6ca529dca131d11
18,279,380,841,726
909ffe11e66dd997dec495e6f18cce919c356918
/test/src/main/java/com/moviesfan/test/rest/MovieResource.java
8e5c63f177d1d4655d2bef5d3376da4744863207
[]
no_license
lyoumi/ttask
https://github.com/lyoumi/ttask
d170287fe5021ec6aa4fab7db0d486c115bfd265
c68318588640bd289bbe14ab4fc5290a426e27d8
refs/heads/master
2022-07-27T21:33:50.061000
2020-05-25T15:16:08
2020-05-25T15:16:08
266,812,131
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.moviesfan.test.rest; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.moviesfan.test.dto.FavoriteMovies; import com.moviesfan.test.dto.Movie; import com.moviesfan.test.service.MovieService; import lombok.AllArgsConstructor; @RestController @RequestMapping("favorites/movies") @AllArgsConstructor public class MovieResource { private final MovieService movieService; @GetMapping public FavoriteMovies favoriteActors() { return movieService.getFavoriteMovies(); } /** * I'd like to believe that the same method can be used to delete movie from favorites * @param movie * @return */ @PutMapping public Movie updateFavoriteMovies(@RequestBody Movie movie) { return movieService.updateFavoritesMovies(movie); } }
UTF-8
Java
1,069
java
MovieResource.java
Java
[]
null
[]
package com.moviesfan.test.rest; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.moviesfan.test.dto.FavoriteMovies; import com.moviesfan.test.dto.Movie; import com.moviesfan.test.service.MovieService; import lombok.AllArgsConstructor; @RestController @RequestMapping("favorites/movies") @AllArgsConstructor public class MovieResource { private final MovieService movieService; @GetMapping public FavoriteMovies favoriteActors() { return movieService.getFavoriteMovies(); } /** * I'd like to believe that the same method can be used to delete movie from favorites * @param movie * @return */ @PutMapping public Movie updateFavoriteMovies(@RequestBody Movie movie) { return movieService.updateFavoritesMovies(movie); } }
1,069
0.767072
0.767072
36
28.694445
24.399248
90
false
false
0
0
0
0
0
0
0.361111
false
false
10
a9eb2548c2b287669221305aaea1f297da27c513
4,776,003,660,039
fc13a570652062ebb7abaee7f0aa54a15d37ee5f
/src/main/java/demo/pqjiang/mapper/SecurityMapper.java
793323036cbc56b6f8dc21313b695374f345cc6c
[]
no_license
QPJIANG/XMEM
https://github.com/QPJIANG/XMEM
f38b40387e444c0477fdaebd1ce1233f5aad219b
79b120e664be284bc115e199eef71d806c208e0f
refs/heads/master
2021-10-19T00:59:12.043000
2019-02-16T07:04:22
2019-02-16T07:04:22
104,190,948
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package demo.pqjiang.mapper; import java.util.List; import java.util.Map; public interface SecurityMapper { /** * list all user * */ public List<Map> getUser(); /** * list user by name * * parameters: user_name * */ public List<Map> getUserByName(String name); /** * list user by name * * parameters: user_name * */ public List<Map> getRolesByName(String name); /** * get all security uri for security conf * * */ public List<Map> getSecurityUri(); }
UTF-8
Java
551
java
SecurityMapper.java
Java
[]
null
[]
package demo.pqjiang.mapper; import java.util.List; import java.util.Map; public interface SecurityMapper { /** * list all user * */ public List<Map> getUser(); /** * list user by name * * parameters: user_name * */ public List<Map> getUserByName(String name); /** * list user by name * * parameters: user_name * */ public List<Map> getRolesByName(String name); /** * get all security uri for security conf * * */ public List<Map> getSecurityUri(); }
551
0.571688
0.571688
29
18
14.722725
49
false
false
0
0
0
0
0
0
0.241379
false
false
10
208a8e6c7d71666e7573a18247c515a1030cae8f
14,697,378,110,605
e312823920b395fccbfcf13abe99bf9edc870b71
/MeetingRoom/src/main/java/be/kawi/meetingroom/service/MeetingRoomService.java
1f29f80733d29e5591b78f07fc8798ed6f46e80f
[]
no_license
wim82/Backend-MeetingRoom
https://github.com/wim82/Backend-MeetingRoom
ba060faa1017ccd694b835ecd2b9e9d281193fcb
2aa879285cbf515fd6bd353da0a4b32bb462bb99
refs/heads/master
2021-01-22T07:32:49.586000
2014-04-27T17:23:48
2014-04-27T17:23:48
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package be.kawi.meetingroom.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import be.kawi.meetingroom.dao.MeetingRoomDAO; import be.kawi.meetingroom.exceptions.CorruptDatabaseException; import be.kawi.meetingroom.exceptions.NoSuchMeetingRoomException; import be.kawi.meetingroom.model.MeetingRoom; @Service public class MeetingRoomService { @Autowired private MeetingRoomDAO meetingRoomDAO; @Transactional public List<MeetingRoom> getMeetingRooms() { return meetingRoomDAO.getMeetingRooms(); } @Transactional public MeetingRoom getMeetingRoom(Integer roomId) { MeetingRoom meetingRoom = new MeetingRoom(); meetingRoom.setRoomId(roomId); List<MeetingRoom> possibleMeetingRooms = meetingRoomDAO.getMeetingRoom(meetingRoom); if (possibleMeetingRooms.isEmpty()) { throw new NoSuchMeetingRoomException(); } if (possibleMeetingRooms.size() > 1) { throw new CorruptDatabaseException("There are 2 meeting rooms with the same id in the database"); } MeetingRoom result = possibleMeetingRooms.get(0); return result; } @Transactional public MeetingRoom getMeetingRoom(String roomName) { List<MeetingRoom> possibleMeetingRooms = meetingRoomDAO.getMeetingRoom(roomName); if (possibleMeetingRooms.isEmpty()) { throw new NoSuchMeetingRoomException(); } if (possibleMeetingRooms.size() > 1) { throw new CorruptDatabaseException("There are 2 meeting rooms with the same name in the database"); } MeetingRoom result = possibleMeetingRooms.get(0); return result; } }
UTF-8
Java
1,688
java
MeetingRoomService.java
Java
[]
null
[]
package be.kawi.meetingroom.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import be.kawi.meetingroom.dao.MeetingRoomDAO; import be.kawi.meetingroom.exceptions.CorruptDatabaseException; import be.kawi.meetingroom.exceptions.NoSuchMeetingRoomException; import be.kawi.meetingroom.model.MeetingRoom; @Service public class MeetingRoomService { @Autowired private MeetingRoomDAO meetingRoomDAO; @Transactional public List<MeetingRoom> getMeetingRooms() { return meetingRoomDAO.getMeetingRooms(); } @Transactional public MeetingRoom getMeetingRoom(Integer roomId) { MeetingRoom meetingRoom = new MeetingRoom(); meetingRoom.setRoomId(roomId); List<MeetingRoom> possibleMeetingRooms = meetingRoomDAO.getMeetingRoom(meetingRoom); if (possibleMeetingRooms.isEmpty()) { throw new NoSuchMeetingRoomException(); } if (possibleMeetingRooms.size() > 1) { throw new CorruptDatabaseException("There are 2 meeting rooms with the same id in the database"); } MeetingRoom result = possibleMeetingRooms.get(0); return result; } @Transactional public MeetingRoom getMeetingRoom(String roomName) { List<MeetingRoom> possibleMeetingRooms = meetingRoomDAO.getMeetingRoom(roomName); if (possibleMeetingRooms.isEmpty()) { throw new NoSuchMeetingRoomException(); } if (possibleMeetingRooms.size() > 1) { throw new CorruptDatabaseException("There are 2 meeting rooms with the same name in the database"); } MeetingRoom result = possibleMeetingRooms.get(0); return result; } }
1,688
0.787915
0.78436
65
24.969231
27.674465
102
false
false
0
0
0
0
0
0
1.261539
false
false
10
a6067f0372532ca7dafa78e8bf66c29f8076194a
15,934,328,702,851
cb272d4c3574bf0f1be4cb5db63e749144173295
/src/contract/environment/ContentContract.java
853b1c0022e0f8b2c85f83dd65950fc4a5f7fd63
[]
no_license
alexisraimbault/lode_runner
https://github.com/alexisraimbault/lode_runner
36dd50a4f77203439c2e817dfdfa742d6bdd9766
b12bf2d1ac7624b11fa7d6c15cc5e2727187df47
refs/heads/master
2020-05-03T13:08:05.318000
2019-05-09T04:55:16
2019-05-09T04:55:16
178,645,635
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package contract.environment; import contract.contracterr.InitError; import contract.contracterr.InvariantError; import contract.contracterr.PostconditionError; import contract.contracterr.PreconditionError; import decorator.environment.ContentDecorator; import model.services.EntityType; import model.services.IContent; public class ContentContract extends ContentDecorator{ public ContentContract(IContent d) { super(d); checkInvariant(); checkInit(); } /* * add(type) := add(type, 1) */ public void add(EntityType type) { int prenb = counts(type); checkInvariant(); super.add(type); checkInvariant(); if(!(counts(type) == prenb + 1)) throw new PostconditionError("in Content -> add : the nb of type didnt increment as expected"); } /* * post: * counts(type) == counts(type)@before + occ */ public void add(EntityType type, int occ){ int prenb = counts(type); checkInvariant(); super.add(type, occ); checkInvariant(); if(!(counts(type) == prenb + occ)) throw new PostconditionError("in Content -> add : the nb of type didnt increment as expected"); } /* * remove(type) := remove(type, 1) */ public void remove(EntityType type){ int prenb = counts(type); checkInvariant(); super.remove(type); checkInvariant(); if(!(counts(type) == prenb - 1)) throw new PostconditionError("in Content -> remove : the nb of type didnt decrease as expected"); } /* * pre: * counts(type) >= occ * * post: * count(type) == count(type)@before - occ */ public void remove(EntityType type, int occ){ if(!(counts(type) >= occ)) throw new PreconditionError("in Content -> remove : cant remove more than there already is"); int prenb = counts(type); checkInvariant(); super.remove(type, occ); checkInvariant(); if(!(counts(type) == prenb - occ)) throw new PostconditionError("in Content -> remove : the nb of type didnt decrease as expected"); } /* * post: * size() == 0 */ public void clear(){ checkInvariant(); super.clear(); checkInvariant(); if(!(super.size() == 0)) throw new PostconditionError("in Content -> clear : the size should be equal to zero"); } /* * invariants: * forall type : EntityType.values() * counts(type) >= 0 * forall type : EntityType.values() * contains(type) <=> counts(type) > 0 * size() == nbCharacters() + nbItems() * size() == 0 <=> isEmpty() * nbCharacters() >= 0 * nbItems() >= 0 * size() == sum(forall type : EntityType.values(), counts(type)) * */ public void checkInit(){ if(!(super.size() == 0)) throw new InitError("in Content : the size should be equal to zero at init"); } public void checkInvariant(){ int sum = 0; for(EntityType type : EntityType.values()){ if(!(counts(type) >= 0)) throw new InvariantError("the counts() of a EntityType should not be negative"); if(!(contains(type) && counts(type) <= 0)) throw new InvariantError("the counts() of a EntityType that is positive to the contains test should not be null."); sum += counts(type); } if(!(size() == nbCharacters() + nbItems())) throw new InvariantError("size() should be equat to nbCharacters() + nbItems()."); if(size() == 0 && !isEmpty()) throw new InvariantError("if size() == 0, the isEmptyTest should be positive."); if(!(nbCharacters() >= 0)) throw new InvariantError("nbCharacters() cant be negative"); if(!(nbItems() >= 0)) throw new InvariantError("nbItems() cant be negative"); if( !(size() == sum)) throw new InvariantError("size() should be equal to the sum of the counts() of all possible types"); } }
UTF-8
Java
3,769
java
ContentContract.java
Java
[]
null
[]
package contract.environment; import contract.contracterr.InitError; import contract.contracterr.InvariantError; import contract.contracterr.PostconditionError; import contract.contracterr.PreconditionError; import decorator.environment.ContentDecorator; import model.services.EntityType; import model.services.IContent; public class ContentContract extends ContentDecorator{ public ContentContract(IContent d) { super(d); checkInvariant(); checkInit(); } /* * add(type) := add(type, 1) */ public void add(EntityType type) { int prenb = counts(type); checkInvariant(); super.add(type); checkInvariant(); if(!(counts(type) == prenb + 1)) throw new PostconditionError("in Content -> add : the nb of type didnt increment as expected"); } /* * post: * counts(type) == counts(type)@before + occ */ public void add(EntityType type, int occ){ int prenb = counts(type); checkInvariant(); super.add(type, occ); checkInvariant(); if(!(counts(type) == prenb + occ)) throw new PostconditionError("in Content -> add : the nb of type didnt increment as expected"); } /* * remove(type) := remove(type, 1) */ public void remove(EntityType type){ int prenb = counts(type); checkInvariant(); super.remove(type); checkInvariant(); if(!(counts(type) == prenb - 1)) throw new PostconditionError("in Content -> remove : the nb of type didnt decrease as expected"); } /* * pre: * counts(type) >= occ * * post: * count(type) == count(type)@before - occ */ public void remove(EntityType type, int occ){ if(!(counts(type) >= occ)) throw new PreconditionError("in Content -> remove : cant remove more than there already is"); int prenb = counts(type); checkInvariant(); super.remove(type, occ); checkInvariant(); if(!(counts(type) == prenb - occ)) throw new PostconditionError("in Content -> remove : the nb of type didnt decrease as expected"); } /* * post: * size() == 0 */ public void clear(){ checkInvariant(); super.clear(); checkInvariant(); if(!(super.size() == 0)) throw new PostconditionError("in Content -> clear : the size should be equal to zero"); } /* * invariants: * forall type : EntityType.values() * counts(type) >= 0 * forall type : EntityType.values() * contains(type) <=> counts(type) > 0 * size() == nbCharacters() + nbItems() * size() == 0 <=> isEmpty() * nbCharacters() >= 0 * nbItems() >= 0 * size() == sum(forall type : EntityType.values(), counts(type)) * */ public void checkInit(){ if(!(super.size() == 0)) throw new InitError("in Content : the size should be equal to zero at init"); } public void checkInvariant(){ int sum = 0; for(EntityType type : EntityType.values()){ if(!(counts(type) >= 0)) throw new InvariantError("the counts() of a EntityType should not be negative"); if(!(contains(type) && counts(type) <= 0)) throw new InvariantError("the counts() of a EntityType that is positive to the contains test should not be null."); sum += counts(type); } if(!(size() == nbCharacters() + nbItems())) throw new InvariantError("size() should be equat to nbCharacters() + nbItems()."); if(size() == 0 && !isEmpty()) throw new InvariantError("if size() == 0, the isEmptyTest should be positive."); if(!(nbCharacters() >= 0)) throw new InvariantError("nbCharacters() cant be negative"); if(!(nbItems() >= 0)) throw new InvariantError("nbItems() cant be negative"); if( !(size() == sum)) throw new InvariantError("size() should be equal to the sum of the counts() of all possible types"); } }
3,769
0.633059
0.628018
127
27.677166
26.912773
119
false
false
0
0
0
0
0
0
2.031496
false
false
10
58b486676107b532d7de141022de9621d812a869
11,055,245,855,276
65c1a0357b59e8c94a27fc3e18d01d29ebec870f
/BrojPonavljanjaBroja.java
3da07ab443c49f839a7880f0496a5ba2553bf389
[]
no_license
Arthuzad/exercises-java
https://github.com/Arthuzad/exercises-java
a211c4cf78a16609ff1b6b9b59f00a17bb354d6d
bdf34856d9cec5b7d5a4a4881f71c924d511511e
refs/heads/master
2022-05-11T18:38:42.491000
2019-09-20T12:00:32
2019-09-20T12:00:32
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package zadaci; import java.util.Scanner; public class BrojPonavljanjaBroja { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Unesite niz od 10 brojeva: "); int[] array = new int[10]; int[] counter = new int[100]; for (int i = 0; i < array.length; i++) { int num = input.nextInt(); array[i] = num; counter[num]++; } input.close(); for (int i = 0; i < counter.length; i++) { if (counter[i] != 0) { System.out.println("Broj " + i + " se pojavljuje " + counter[i] + (counter[i] == 1 ? " put." : " puta.")); } } } }
UTF-8
Java
656
java
BrojPonavljanjaBroja.java
Java
[]
null
[]
package zadaci; import java.util.Scanner; public class BrojPonavljanjaBroja { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Unesite niz od 10 brojeva: "); int[] array = new int[10]; int[] counter = new int[100]; for (int i = 0; i < array.length; i++) { int num = input.nextInt(); array[i] = num; counter[num]++; } input.close(); for (int i = 0; i < counter.length; i++) { if (counter[i] != 0) { System.out.println("Broj " + i + " se pojavljuje " + counter[i] + (counter[i] == 1 ? " put." : " puta.")); } } } }
656
0.542683
0.525915
31
19.161291
19.191895
67
false
false
0
0
0
0
0
0
2.129032
false
false
10
b7589f7647ddad650636b744c82e6bea462645a2
20,633,022,945,551
55a9d446ce26cb9072480ce7f44fdbae2bc104cd
/A_FatAAR/modellocal_code/src/main/java/com/huan/modellocal_code/ModelLocal.java
c349ec2d1bcb23168699f05b4f8098116bcbc7f6
[]
no_license
sengeiou/Fat-AAR
https://github.com/sengeiou/Fat-AAR
30b1a4ede04b689df678d00af9865bcc9189b8db
4433e3d0278a5207d6d69398adc00202210e1e21
refs/heads/master
2022-09-14T23:20:29.685000
2020-05-27T09:06:42
2020-05-27T09:06:42
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.huan.modellocal_code; public class ModelLocal { public static String staticString = "static ModelLocal"; public static String getString (){ return "ModelLocal"; }; }
UTF-8
Java
203
java
ModelLocal.java
Java
[]
null
[]
package com.huan.modellocal_code; public class ModelLocal { public static String staticString = "static ModelLocal"; public static String getString (){ return "ModelLocal"; }; }
203
0.679803
0.679803
12
15.916667
19.448471
60
false
false
0
0
0
0
0
0
0.333333
false
false
10
cf464f0f7bfb613f6034f9551a396627cf0161ad
4,621,384,848,981
3f8e7b2c05b1b6ea92a267062c09ce68b43ece07
/src/main/java/com/fjnu/assetsManagement/module/personManagement/constant/PersonManagementFunctionNoConstants.java
a959064d697b2105c391791790b3a6bf90a7a91b
[]
no_license
xllenga/assetsManagement
https://github.com/xllenga/assetsManagement
87f30054d2d1861590c75cc07876285400d7c323
6419839ca64a48642fd5e1c1bb7318bb4eb9d7b9
refs/heads/master
2020-07-14T00:33:36.516000
2019-05-21T15:36:05
2019-05-21T15:36:05
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.fjnu.assetsManagement.module.personManagement.constant; public interface PersonManagementFunctionNoConstants { String GET_PERSON_LIST = "GetPersonList";//获取人员列表 String ADD_PERSON = "AddPerson";//添加人员 String UPDATE_PERSON = "UpdatePerson";//修改人员 String DELETE_PERSON = "DeletePerson";//删除人员 String UPDATE_PASSWORD = "UpdatePassword";//修改密码 String UPDATE_STATUS = "UpdataStatus";//修改状态 String GET_DEPARTMENT_LIST = "GetDepartmentList";//获取当前登录用户以及子部门 String Get_CURRENT_PERSON = "GetCurrentPerson";//获取当前登录用户信息 }
UTF-8
Java
656
java
PersonManagementFunctionNoConstants.java
Java
[ { "context": "eletePerson\";//删除人员\n String UPDATE_PASSWORD = \"UpdatePassword\";//修改密码\n String UPDATE_STATUS = \"UpdataStatus\"", "end": 364, "score": 0.992806613445282, "start": 350, "tag": "PASSWORD", "value": "UpdatePassword" } ]
null
[]
package com.fjnu.assetsManagement.module.personManagement.constant; public interface PersonManagementFunctionNoConstants { String GET_PERSON_LIST = "GetPersonList";//获取人员列表 String ADD_PERSON = "AddPerson";//添加人员 String UPDATE_PERSON = "UpdatePerson";//修改人员 String DELETE_PERSON = "DeletePerson";//删除人员 String UPDATE_PASSWORD = "<PASSWORD>";//修改密码 String UPDATE_STATUS = "UpdataStatus";//修改状态 String GET_DEPARTMENT_LIST = "GetDepartmentList";//获取当前登录用户以及子部门 String Get_CURRENT_PERSON = "GetCurrentPerson";//获取当前登录用户信息 }
652
0.747312
0.747312
14
38.857143
25.424559
68
false
false
0
0
0
0
0
0
0.642857
false
false
10
2de162e8475e12334f7ad782a638fb104a628863
32,401,233,348,470
3765ed20db1d1eb6efdb4e50416669550dfcc683
/FreeResponse/2015DiverseArray/DiverseArrayTest.java
30b9353f955b6178582aa163491233ee8d0089b5
[]
no_license
ynot1609/apcompsci3
https://github.com/ynot1609/apcompsci3
5b540a0ff9f453ef240cb89d8df32fceefe45d67
faf7db3fb0d4db55f19af09707dd0b94ebcb0a10
refs/heads/master
2021-01-19T11:58:59.461000
2017-04-06T06:23:27
2017-04-06T06:23:27
88,011,874
1
0
null
true
2017-04-12T05:07:11
2017-04-12T05:07:11
2016-10-27T06:14:40
2017-04-06T06:24:11
112,934
0
0
0
null
null
null
public class DiverseArrayTest { public static void main(String[] args) { // Part a) int[] arr1 = {1,3,2,7,3}; int linear = DiverseArray.arraySum(arr1); System.out.println("1-D sum = " + linear); // Part b) int[][] mat1 = { {1,3,2,7,3}, {10,10,4,6,2}, {5,3,5,9,6}, {7,6,4,2,1} }; int[] vector = DiverseArray.rowSums(mat1); System.out.print("2-D sum = "); for (int item : vector) { System.out.print(item + " "); } // Part c) int[][] mat2 = { {1,1,5,3,4}, {12,7,6,1,9}, {8,11,10,2,5}, {3,2,3,0,6} }; boolean unique = DiverseArray.isDiverse(mat1); System.out.println(); System.out.println("Is mat1 unique? " + unique); unique = DiverseArray.isDiverse(mat2); System.out.println("Is mat2 unique? " + unique); } }
UTF-8
Java
1,068
java
DiverseArrayTest.java
Java
[]
null
[]
public class DiverseArrayTest { public static void main(String[] args) { // Part a) int[] arr1 = {1,3,2,7,3}; int linear = DiverseArray.arraySum(arr1); System.out.println("1-D sum = " + linear); // Part b) int[][] mat1 = { {1,3,2,7,3}, {10,10,4,6,2}, {5,3,5,9,6}, {7,6,4,2,1} }; int[] vector = DiverseArray.rowSums(mat1); System.out.print("2-D sum = "); for (int item : vector) { System.out.print(item + " "); } // Part c) int[][] mat2 = { {1,1,5,3,4}, {12,7,6,1,9}, {8,11,10,2,5}, {3,2,3,0,6} }; boolean unique = DiverseArray.isDiverse(mat1); System.out.println(); System.out.println("Is mat1 unique? " + unique); unique = DiverseArray.isDiverse(mat2); System.out.println("Is mat2 unique? " + unique); } }
1,068
0.412921
0.355805
33
30.424242
16.832563
56
false
false
0
0
0
0
0
0
1.666667
false
false
10
fa71a95ddfcc8ec2c42ce7b0874018dea735b160
20,607,253,101,140
60efbd957bfc8f98121f0dc6d2ea8cfafc1865ea
/app/src/main/java/com/example/intership2019/Fragment/DPAbstractFactory/ComputerFactory.java
383ee7395eb5935be515981b73366689336b3cd5
[]
no_license
annv1990/PTIT-Internship-2019-CW
https://github.com/annv1990/PTIT-Internship-2019-CW
6f4040dd878cb7a5327b9eba7aa539e6de60129d
ad6481fd419247f72363a1c53616e4bc896cc324
refs/heads/master
2020-06-22T14:21:19.220000
2020-06-19T02:36:48
2020-06-19T02:36:48
197,728,954
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.intership2019.Fragment.DPAbstractFactory; public class ComputerFactory { public static Computer createComputer(ComputerAbstractFactory computerAbstractFactory) { return computerAbstractFactory.createComputer(); } }
UTF-8
Java
252
java
ComputerFactory.java
Java
[]
null
[]
package com.example.intership2019.Fragment.DPAbstractFactory; public class ComputerFactory { public static Computer createComputer(ComputerAbstractFactory computerAbstractFactory) { return computerAbstractFactory.createComputer(); } }
252
0.809524
0.793651
7
35
33.105892
92
false
false
0
0
0
0
0
0
0.285714
false
false
10
ac5027a4eda93a98829673263d3bb500b188b0a3
21,079,699,501,865
592dda26abb0a81cee727c18935c2511365659f0
/src/main/java/com/zerodhatech/ticker/OnDisconnect.java
8e9b3d0f292e4fb386f0b51341515b14d71f0128
[ "MIT" ]
permissive
kssujithcj/javakiteconnect_maven
https://github.com/kssujithcj/javakiteconnect_maven
f7d004192f0d5dc4093165b99d9ad29b8cb812cf
3146d06a223e78de152affe62e16b6e935e17885
refs/heads/master
2023-08-19T04:45:33.392000
2023-07-28T11:35:03
2023-07-28T11:35:03
210,796,061
1
1
MIT
false
2023-07-13T17:04:06
2019-09-25T08:38:02
2022-06-01T07:19:03
2023-07-13T17:04:06
1,346
1
1
4
Java
false
false
package com.zerodhatech.ticker; /** * Callback to listen to com.zerodhatech.ticker websocket disconnected event. */ public interface OnDisconnect { void onDisconnected(); }
UTF-8
Java
180
java
OnDisconnect.java
Java
[]
null
[]
package com.zerodhatech.ticker; /** * Callback to listen to com.zerodhatech.ticker websocket disconnected event. */ public interface OnDisconnect { void onDisconnected(); }
180
0.755556
0.755556
8
21.5
24.617067
77
false
false
0
0
0
0
0
0
0.25
false
false
10
5b1026f9d614fbad11235ccc7b3f2fba56c4bca1
24,163,486,047,400
323f388817fbcd23eec9bf6de0022a798b9c626c
/kostyleFINAL/src/main/java/kostyle/ranking/domain/RankingVO.java
a05fb042cebe171a61dfefd10120c77b92fc5084
[]
no_license
superk01/kostyle_project
https://github.com/superk01/kostyle_project
cb50cf894e2c4648602f951c43dd1604b4a3621d
1bb0426898987f24018d3f568f09c0280a65f682
refs/heads/master
2021-01-23T00:20:25.974000
2017-06-28T06:12:36
2017-06-28T06:12:36
92,806,801
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package kostyle.ranking.domain; public class RankingVO { private String s_num; private String s_shopurl; private String s_sname; private String s_age; private String s_image; private String s_rank; public String getS_shopurl() { return s_shopurl; } public void setS_shopurl(String s_shopurl) { this.s_shopurl = s_shopurl; } public String getS_sname() { return s_sname; } public void setS_sname(String s_sname) { this.s_sname = s_sname; } public String getS_age() { return s_age; } public void setS_age(String s_age) { this.s_age = s_age; } public String getS_image() { return s_image; } public void setS_image(String s_image) { this.s_image = s_image; } public String getS_num() { return s_num; } public void setS_num(String s_num) { this.s_num = s_num; } public String getS_rank() { return s_rank; } public void setS_rank(String s_rank) { this.s_rank = s_rank; } @Override public String toString() { return "RankingVO [s_num=" + s_num + ", s_shopurl=" + s_shopurl + ", s_sname=" + s_sname + ", s_age=" + s_age + ", s_image=" + s_image + ", s_rank=" + s_rank + "]"; } }
UTF-8
Java
1,211
java
RankingVO.java
Java
[]
null
[]
package kostyle.ranking.domain; public class RankingVO { private String s_num; private String s_shopurl; private String s_sname; private String s_age; private String s_image; private String s_rank; public String getS_shopurl() { return s_shopurl; } public void setS_shopurl(String s_shopurl) { this.s_shopurl = s_shopurl; } public String getS_sname() { return s_sname; } public void setS_sname(String s_sname) { this.s_sname = s_sname; } public String getS_age() { return s_age; } public void setS_age(String s_age) { this.s_age = s_age; } public String getS_image() { return s_image; } public void setS_image(String s_image) { this.s_image = s_image; } public String getS_num() { return s_num; } public void setS_num(String s_num) { this.s_num = s_num; } public String getS_rank() { return s_rank; } public void setS_rank(String s_rank) { this.s_rank = s_rank; } @Override public String toString() { return "RankingVO [s_num=" + s_num + ", s_shopurl=" + s_shopurl + ", s_sname=" + s_sname + ", s_age=" + s_age + ", s_image=" + s_image + ", s_rank=" + s_rank + "]"; } }
1,211
0.601982
0.601982
60
18.183332
18.831261
111
false
false
0
0
0
0
0
0
1.6
false
false
10
aadb0e1aebf575fdf7c8eb63416eb3f943f5dfb2
11,536,282,175,075
53040c4144c0917c5294b7c359655a2d61afef08
/java/com/acq/web/dto/ServiceDtoInf.java
769ab50d49860e20ab902b8198cd1ac418560b71
[]
no_license
acquirotech/CommunicatorOld
https://github.com/acquirotech/CommunicatorOld
8cd01b4a22ab3ce8d015c46122b667a8da4cb151
43f82f1b9b4d0d3f589bda81b79d3ca329ef33fb
refs/heads/master
2020-04-05T20:05:32.056000
2018-11-12T06:22:27
2018-11-12T06:22:27
157,163,646
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.acq.web.dto; public interface ServiceDtoInf<T> extends BaseDtoInf<T> { }
UTF-8
Java
89
java
ServiceDtoInf.java
Java
[]
null
[]
package com.acq.web.dto; public interface ServiceDtoInf<T> extends BaseDtoInf<T> { }
89
0.741573
0.741573
6
13.833333
21.574806
58
false
false
0
0
0
0
0
0
0.166667
false
false
10
6ddcc572a61fbbda6b223b3968389acf312b3d24
30,202,210,042,049
2dca2550edab8238a3565b804b0da78f547dd130
/app/src/main/java/com/beijing/zzu/multilanguagedemo/BaseApplication.java
08f887f56b514cec9115f8601a8251a1b8e9c24a
[]
no_license
walkingCoder/multiLanguageDemo
https://github.com/walkingCoder/multiLanguageDemo
5e86acfd321b1e1c794463b806d1a3ff7b2ae3b3
3167877685fa00d593da4bf7cbb2991fe1abbda2
refs/heads/master
2020-09-09T17:35:17.531000
2019-11-13T17:20:34
2019-11-13T17:20:34
221,513,210
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.beijing.zzu.multilanguagedemo; import android.app.Application; import android.content.res.Configuration; import com.beijing.zzu.multilanguagedemo.utils.MultiLanguageUtil; /** * @author jiayk * @date 2019/11/13 */ public class BaseApplication extends Application { @Override public void onCreate() { super.onCreate(); MultiLanguageUtil.init(this); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); } }
UTF-8
Java
536
java
BaseApplication.java
Java
[ { "context": "uagedemo.utils.MultiLanguageUtil;\n\n\n/**\n * @author jiayk\n * @date 2019/11/13\n */\npublic class BaseApplicat", "end": 207, "score": 0.9996988773345947, "start": 202, "tag": "USERNAME", "value": "jiayk" } ]
null
[]
package com.beijing.zzu.multilanguagedemo; import android.app.Application; import android.content.res.Configuration; import com.beijing.zzu.multilanguagedemo.utils.MultiLanguageUtil; /** * @author jiayk * @date 2019/11/13 */ public class BaseApplication extends Application { @Override public void onCreate() { super.onCreate(); MultiLanguageUtil.init(this); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); } }
536
0.722015
0.70709
26
19.615385
20.992813
65
false
false
0
0
0
0
0
0
0.269231
false
false
10
f8c856e6dd09d625ec26865ce01fa12400f8bc20
12,919,261,663,244
210c05a189d46754f615c0f2bf1031bab83bd04e
/Web/src/com/tao/calender/model/CalendarDataJoin_interface.java
8e15fa336e85f7f54396bf6b5148fa5f156a865a
[]
no_license
hand79/iii_TAO_Puzzle
https://github.com/hand79/iii_TAO_Puzzle
7750287c7f08be8fa56665800527f8bb32e9cf60
ce9e91538b413bd347104ab4a70313ba2947d415
refs/heads/master
2021-01-21T07:54:20.159000
2016-09-18T16:36:37
2016-09-18T16:36:37
68,525,975
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tao.calender.model; import java.util.List; public interface CalendarDataJoin_interface { public List<CalendarCaseJoinVO> getAllByCaseJoinWishList(Integer memno ); public List<CalendarCaseJoinVO> getAllByCaseJoinOrders(Integer memno ); }
UTF-8
Java
261
java
CalendarDataJoin_interface.java
Java
[]
null
[]
package com.tao.calender.model; import java.util.List; public interface CalendarDataJoin_interface { public List<CalendarCaseJoinVO> getAllByCaseJoinWishList(Integer memno ); public List<CalendarCaseJoinVO> getAllByCaseJoinOrders(Integer memno ); }
261
0.804598
0.804598
8
30.625
28.783405
74
false
false
0
0
0
0
0
0
0.75
false
false
10
277a80b90088e4637c437ab9ed6678b1ed35b45c
21,483,426,466,856
2c7c1649e10a3207de2e3ddc824fa7d9e8959d7e
/MovieChatBot/src/com/canberksinangil/ListFavouriteMovieList.java
b2094535d344997cd7c7703d74d47f07a39219e7
[ "MIT" ]
permissive
canberksinangil/Java
https://github.com/canberksinangil/Java
1563bda49338cae22156c5c8a445caa8c262b634
2844a8d05ac1d3714397e3439e94df480e289c95
refs/heads/master
2020-04-10T16:39:11.857000
2018-12-10T09:44:45
2018-12-10T09:44:45
161,151,525
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.canberksinangil; public class ListFavouriteMovieList extends CommandBase implements Command { public ListFavouriteMovieList(String commandKeyword) { super(commandKeyword); } @Override public void execute(String commandArgument) { int counter = 1; for (String movieName : favouriteMovie) { System.out.println(counter + ". " + movieName); counter++; } } @Override public String commandDescription() { return "Type 'showfav' to list favourite movies."; } }
UTF-8
Java
567
java
ListFavouriteMovieList.java
Java
[]
null
[]
package com.canberksinangil; public class ListFavouriteMovieList extends CommandBase implements Command { public ListFavouriteMovieList(String commandKeyword) { super(commandKeyword); } @Override public void execute(String commandArgument) { int counter = 1; for (String movieName : favouriteMovie) { System.out.println(counter + ". " + movieName); counter++; } } @Override public String commandDescription() { return "Type 'showfav' to list favourite movies."; } }
567
0.641975
0.640212
22
24.727272
23.524035
76
false
false
0
0
0
0
0
0
0.272727
false
false
10
195f796af2c793683b97bf497aa5416f1fd65687
23,424,751,636,793
e360db6b10f83645049a4698ebd43d5f2f8432f0
/src/com/util/FTPFunc.java
3580f85a1c13cfbb86d5fdfefce0478b32fff30e
[]
no_license
erhaosan/new_seastar
https://github.com/erhaosan/new_seastar
d3f4a2205636ddaf5b5f4289033323dea685b2e0
41a8c6d8489fe7737bc293ef884945c0377bbd22
refs/heads/master
2018-01-13T07:25:15.192000
2016-08-19T07:06:54
2016-08-19T07:06:54
46,706,218
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.util; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPFile; import org.apache.commons.net.ftp.FTPReply; public class FTPFunc { private static FTPClient ftp; /** * 使用默认服务器和端口进行连接 * @param path 上传到ftp服务器哪个路径下 * @return * @throws Exception */ public boolean connect(String path) throws Exception { boolean result = false; ftp = new FTPClient(); int reply; ftp.connect("61.152.176.30",21); ftp.login("EMVSXZGJ","EMVS123"); ftp.setFileType(FTPClient.BINARY_FILE_TYPE); ftp.enterLocalPassiveMode(); reply = ftp.getReplyCode(); if (!FTPReply.isPositiveCompletion(reply)) { ftp.disconnect(); return result; } ftp.changeWorkingDirectory(path); result = true; return result; } /** * * @param path 上传到ftp服务器哪个路径下 * @param addr 服务器的IP地址 * @param port 端口号 * @param username 用户名 * @param password 密码 * @return * @throws Exception */ public boolean connect(String path,String addr,int port,String username,String password) throws Exception { boolean result = false; ftp = new FTPClient(); int reply; ftp.connect(addr,port); ftp.login(username,password); ftp.setFileType(FTPClient.BINARY_FILE_TYPE); ftp.enterLocalPassiveMode(); reply = ftp.getReplyCode(); if (!FTPReply.isPositiveCompletion(reply)) { ftp.disconnect(); return result; } ftp.changeWorkingDirectory(path); result = true; return result; } /** * * @param file 上传的文件或文件夹 * @throws Exception */ public void upload(File file) throws Exception{ if(file.isDirectory()){ ftp.makeDirectory(file.getName()); ftp.changeWorkingDirectory(file.getName()); String[] files = file.list(); for (int i = 0; i < files.length; i++) { File file1 = new File(file.getPath()+"\\"+files[i] ); if(file1.isDirectory()){ upload(file1); ftp.changeToParentDirectory(); }else{ File file2 = new File(file.getPath()+"\\"+files[i]); FileInputStream input = new FileInputStream(file2); ftp.storeFile(file2.getName(), input); input.close(); } } }else{ File file2 = new File(file.getPath()); FileInputStream input = new FileInputStream(file2); String aString = file2.getName(); ftp.storeFile(aString, input); input.close(); } } /** * 上传单个文件 * @param file 需要上传的文件 * @param changeFileName 是否需要变更文件的名称 * @return 返回FTP上文件的名称 * @throws Exception */ public String upload(File file, boolean changeFileName) throws Exception{ if(file.isFile()){ File file2 = new File(file.getPath()); FileInputStream input = new FileInputStream(file2); String saveFileName = file2.getName(); if(changeFileName) { //找到文件的扩展名 int ipos = saveFileName.indexOf("."); String strExtName = saveFileName.substring(ipos,saveFileName.length()); //用新的文件名保存上传的文件 saveFileName = PBMeth.getTimeString()+strExtName; ftp.storeFile(saveFileName, input); } else //否则用原有的文件名长传文件 { if(file.exists()) //如果文件存在就返回2 { return "1"; } ftp.storeFile(saveFileName, input); } input.close(); return saveFileName; } else { return "0"; } } /** * * <p>删除ftp上的文件</p> * @param srcFname * @return true || false */ public boolean removeFile(String srcFname){ boolean flag = false; if(ftp != null) { try { flag = ftp.deleteFile(srcFname); } catch (IOException e) { e.printStackTrace(); } } return flag; } /** * 连接到FTP的方法 * @param addr 服务器的IP地址 * @param port 端口号 * @param username 用户名 * @param password 密码 * @param path FTP的目录 * @return * @throws Exception */ public boolean getConnectionFTP(String addr,int port,String username,String password,String path,FTPClient ftp) throws Exception { boolean result = false; int reply; try { ftp.connect(addr,port); ftp.login(username,password); ftp.setFileType(FTPClient.BINARY_FILE_TYPE); ftp.enterLocalPassiveMode(); reply = ftp.getReplyCode(); if (!FTPReply.isPositiveCompletion(reply)) { ftp.disconnect(); return result; } ftp.changeWorkingDirectory(path); result = true; } catch (Exception e) { e.printStackTrace(); return false; } return result; } //获得文件列表 public ArrayList<String> getFTPFileList(FTPClient ftp) { ArrayList<String> fileNameList = new ArrayList<String>(); try { FTPFile[] fs = ftp.listFiles();//获得文件列表 for (FTPFile file : fs) { fileNameList.add(file.getName());//获得文件名称组成的list } } catch (Exception e) { e.printStackTrace(); return null; } return fileNameList; } //是否成下载FTP文件到本地 public Boolean downloadFromFTP(String localPath,String fileName,FTPClient ftp) { try { File localFile = new File(localPath+fileName); OutputStream is = new FileOutputStream(localFile); ftp.retrieveFile(fileName, is);//循环取得文件并写到指定本地路径 is.close(); } catch (Exception e) { e.printStackTrace(); return false; } return true; } //删除指定名称的FTP上的文件 public Boolean deleteFromFTP(String path,String fileName,FTPClient ftp) { boolean result = true; try { result = ftp.deleteFile(path+fileName);//删除FTP上的文件 } catch (Exception e) { e.printStackTrace(); return false; } return result; } }
GB18030
Java
7,610
java
FTPFunc.java
Java
[ { "context": "(); \n int reply;\n ftp.connect(\"61.152.176.30\",21); \n ftp.login(\"EMVSXZGJ\",\"EMVS123", "end": 700, "score": 0.9997098445892334, "start": 687, "tag": "IP_ADDRESS", "value": "61.152.176.30" }, { "context": "ect(\"61.152.176.30\",21); \n ftp.login(\"EMVSXZGJ\",\"EMVS123\");\n ftp.setFileType(FTPClient.BI", "end": 740, "score": 0.9790205955505371, "start": 732, "tag": "USERNAME", "value": "EMVSXZGJ" }, { "context": "76.30\",21); \n ftp.login(\"EMVSXZGJ\",\"EMVS123\");\n ftp.setFileType(FTPClient.BINARY_FIL", "end": 748, "score": 0.4963420629501343, "start": 745, "tag": "USERNAME", "value": "VS1" }, { "context": "IP地址\n * @param port 端口号\n * @param username 用户名 \n * @param password 密码 \n * @return \n ", "end": 1241, "score": 0.990670919418335, "start": 1238, "tag": "USERNAME", "value": "用户名" }, { "context": " * @param username 用户名 \n * @param password 密码 \n * @return \n * @throws Exception \n ", "end": 1269, "score": 0.9990543723106384, "start": 1267, "tag": "PASSWORD", "value": "密码" }, { "context": " }\n else\n {\n \treturn \"0\";\n } \n \n } \n \n /*", "end": 4498, "score": 0.99272221326828, "start": 4497, "tag": "PASSWORD", "value": "0" }, { "context": "dr 服务器的IP地址\n * @param port 端口号\n * @param username 用户名 \n * @param password 密码 \n * @param", "end": 5113, "score": 0.9450177550315857, "start": 5105, "tag": "USERNAME", "value": "username" }, { "context": "地址\n * @param port 端口号\n * @param username 用户名 \n * @param password 密码 \n * @param pat", "end": 5117, "score": 0.9963734149932861, "start": 5114, "tag": "USERNAME", "value": "用户名" }, { "context": " * @param username 用户名 \n * @param password 密码 \n * @param path FTP的目录 \n * @return \n", "end": 5146, "score": 0.998153567314148, "start": 5144, "tag": "PASSWORD", "value": "密码" }, { "context": "p.connect(addr,port); \n ftp.login(username,password); \n ftp.setFileType(FTPC", "end": 5528, "score": 0.9264788031578064, "start": 5520, "tag": "USERNAME", "value": "username" } ]
null
[]
package com.util; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPFile; import org.apache.commons.net.ftp.FTPReply; public class FTPFunc { private static FTPClient ftp; /** * 使用默认服务器和端口进行连接 * @param path 上传到ftp服务器哪个路径下 * @return * @throws Exception */ public boolean connect(String path) throws Exception { boolean result = false; ftp = new FTPClient(); int reply; ftp.connect("192.168.127.12",21); ftp.login("EMVSXZGJ","EMVS123"); ftp.setFileType(FTPClient.BINARY_FILE_TYPE); ftp.enterLocalPassiveMode(); reply = ftp.getReplyCode(); if (!FTPReply.isPositiveCompletion(reply)) { ftp.disconnect(); return result; } ftp.changeWorkingDirectory(path); result = true; return result; } /** * * @param path 上传到ftp服务器哪个路径下 * @param addr 服务器的IP地址 * @param port 端口号 * @param username 用户名 * @param password 密码 * @return * @throws Exception */ public boolean connect(String path,String addr,int port,String username,String password) throws Exception { boolean result = false; ftp = new FTPClient(); int reply; ftp.connect(addr,port); ftp.login(username,password); ftp.setFileType(FTPClient.BINARY_FILE_TYPE); ftp.enterLocalPassiveMode(); reply = ftp.getReplyCode(); if (!FTPReply.isPositiveCompletion(reply)) { ftp.disconnect(); return result; } ftp.changeWorkingDirectory(path); result = true; return result; } /** * * @param file 上传的文件或文件夹 * @throws Exception */ public void upload(File file) throws Exception{ if(file.isDirectory()){ ftp.makeDirectory(file.getName()); ftp.changeWorkingDirectory(file.getName()); String[] files = file.list(); for (int i = 0; i < files.length; i++) { File file1 = new File(file.getPath()+"\\"+files[i] ); if(file1.isDirectory()){ upload(file1); ftp.changeToParentDirectory(); }else{ File file2 = new File(file.getPath()+"\\"+files[i]); FileInputStream input = new FileInputStream(file2); ftp.storeFile(file2.getName(), input); input.close(); } } }else{ File file2 = new File(file.getPath()); FileInputStream input = new FileInputStream(file2); String aString = file2.getName(); ftp.storeFile(aString, input); input.close(); } } /** * 上传单个文件 * @param file 需要上传的文件 * @param changeFileName 是否需要变更文件的名称 * @return 返回FTP上文件的名称 * @throws Exception */ public String upload(File file, boolean changeFileName) throws Exception{ if(file.isFile()){ File file2 = new File(file.getPath()); FileInputStream input = new FileInputStream(file2); String saveFileName = file2.getName(); if(changeFileName) { //找到文件的扩展名 int ipos = saveFileName.indexOf("."); String strExtName = saveFileName.substring(ipos,saveFileName.length()); //用新的文件名保存上传的文件 saveFileName = PBMeth.getTimeString()+strExtName; ftp.storeFile(saveFileName, input); } else //否则用原有的文件名长传文件 { if(file.exists()) //如果文件存在就返回2 { return "1"; } ftp.storeFile(saveFileName, input); } input.close(); return saveFileName; } else { return "0"; } } /** * * <p>删除ftp上的文件</p> * @param srcFname * @return true || false */ public boolean removeFile(String srcFname){ boolean flag = false; if(ftp != null) { try { flag = ftp.deleteFile(srcFname); } catch (IOException e) { e.printStackTrace(); } } return flag; } /** * 连接到FTP的方法 * @param addr 服务器的IP地址 * @param port 端口号 * @param username 用户名 * @param password 密码 * @param path FTP的目录 * @return * @throws Exception */ public boolean getConnectionFTP(String addr,int port,String username,String password,String path,FTPClient ftp) throws Exception { boolean result = false; int reply; try { ftp.connect(addr,port); ftp.login(username,password); ftp.setFileType(FTPClient.BINARY_FILE_TYPE); ftp.enterLocalPassiveMode(); reply = ftp.getReplyCode(); if (!FTPReply.isPositiveCompletion(reply)) { ftp.disconnect(); return result; } ftp.changeWorkingDirectory(path); result = true; } catch (Exception e) { e.printStackTrace(); return false; } return result; } //获得文件列表 public ArrayList<String> getFTPFileList(FTPClient ftp) { ArrayList<String> fileNameList = new ArrayList<String>(); try { FTPFile[] fs = ftp.listFiles();//获得文件列表 for (FTPFile file : fs) { fileNameList.add(file.getName());//获得文件名称组成的list } } catch (Exception e) { e.printStackTrace(); return null; } return fileNameList; } //是否成下载FTP文件到本地 public Boolean downloadFromFTP(String localPath,String fileName,FTPClient ftp) { try { File localFile = new File(localPath+fileName); OutputStream is = new FileOutputStream(localFile); ftp.retrieveFile(fileName, is);//循环取得文件并写到指定本地路径 is.close(); } catch (Exception e) { e.printStackTrace(); return false; } return true; } //删除指定名称的FTP上的文件 public Boolean deleteFromFTP(String path,String fileName,FTPClient ftp) { boolean result = true; try { result = ftp.deleteFile(path+fileName);//删除FTP上的文件 } catch (Exception e) { e.printStackTrace(); return false; } return result; } }
7,611
0.508522
0.504191
239
28.949791
21.297789
141
false
false
0
0
0
0
0
0
0.916318
false
false
10
a5ccd55fd986365ac1ca265f9fbf87a06d023fb9
27,161,373,192,985
408662a109c237c78651e3e332ddabe2eb555d01
/OnlineTestManagement-backend/src/main/java/com/cg/onlineTest/services/GetResultService.java
e8bc6ee160569ee18cf3bf56f1b3ec1e26dc1c0d
[]
no_license
Amarjeetsoni/OnlineTest-Backend
https://github.com/Amarjeetsoni/OnlineTest-Backend
d1eab63864fbdc1b028a23683bf54246486e1713
f33e499dbfe6b8f83ee72d323f3a4a4e66a52aa0
refs/heads/master
2022-12-05T02:08:27.508000
2020-08-21T07:51:29
2020-08-21T07:51:29
285,796,466
0
0
null
false
2020-08-09T05:18:30
2020-08-07T09:57:46
2020-08-08T18:31:23
2020-08-09T05:18:29
76
0
0
0
Java
false
false
package com.cg.onlineTest.services; public interface GetResultService { /* * This method is used to check whether the user exist or not. * @param userId This is parameter of long type of isUserExist method. * @return boolean this return true if user is there and false if no such user is there. */ public boolean isUserExist(long userId); /* * This method is used to get all upcoming test list assigned to particular user. * @param userId This is parameter of long type of getUpcomingTest method. * @return List<Test> this return List of test if data available otherwise throw exception. */ public Integer getUpcomingTest(long userId) throws Exception; /* * This method is used to get a Test object which is currently active. * @param userId This is parameter of long type of getActiveTest method. * @return Test this return test if data available otherwise throw exception. */ public Integer getActiveTest(long userId) throws Exception; /* * This method is used to get all test list assigned to particular user. * @param userId This is parameter of long type of getAssignedTest method. * @return List<Test> this return List of test if data available otherwise throw exception. */ public Integer getAssignedTest(long userId) throws Exception; /* * This method is used to assign test to particular user. * @param userId This is parameter of long type of assignTest method. * @param testId This is parameter of long type of assignTest method. * @return boolean this return List of test if data available otherwise throw exception. */ public boolean assignTest(long testId, long userId) throws Exception; }
UTF-8
Java
1,669
java
GetResultService.java
Java
[]
null
[]
package com.cg.onlineTest.services; public interface GetResultService { /* * This method is used to check whether the user exist or not. * @param userId This is parameter of long type of isUserExist method. * @return boolean this return true if user is there and false if no such user is there. */ public boolean isUserExist(long userId); /* * This method is used to get all upcoming test list assigned to particular user. * @param userId This is parameter of long type of getUpcomingTest method. * @return List<Test> this return List of test if data available otherwise throw exception. */ public Integer getUpcomingTest(long userId) throws Exception; /* * This method is used to get a Test object which is currently active. * @param userId This is parameter of long type of getActiveTest method. * @return Test this return test if data available otherwise throw exception. */ public Integer getActiveTest(long userId) throws Exception; /* * This method is used to get all test list assigned to particular user. * @param userId This is parameter of long type of getAssignedTest method. * @return List<Test> this return List of test if data available otherwise throw exception. */ public Integer getAssignedTest(long userId) throws Exception; /* * This method is used to assign test to particular user. * @param userId This is parameter of long type of assignTest method. * @param testId This is parameter of long type of assignTest method. * @return boolean this return List of test if data available otherwise throw exception. */ public boolean assignTest(long testId, long userId) throws Exception; }
1,669
0.753146
0.753146
43
37.837208
35.343452
92
false
false
0
0
0
0
0
0
1
false
false
10
ab0a7c879ad680cacc79699a633e6b5f38d126fe
21,311,627,756,850
93e1a6dddd55fc00b7a612a794bb6c09401f1d36
/app/MeetASweedt/networkserver/src/main/java/com/example/NetworkShared/ResponseCreateUser.java
11e044db7787ca860baa9cff08139c6682646f15
[]
no_license
NiklasJonsson6/Untitled
https://github.com/NiklasJonsson6/Untitled
01e0e3a7c48e77ed490788913e401ca59afe0dc6
cb7b36e1e21662183f9d7f0a94b914c1edbebfd3
refs/heads/master
2020-12-25T16:25:09.152000
2016-10-27T17:52:45
2016-10-27T17:52:45
68,273,670
1
3
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.NetworkShared; public class ResponseCreateUser extends Response { public ResponseCreateUser (boolean success, int user_id) { super(MessageType.CreateUser,success); this.user_id = user_id; } public int user_id; }
UTF-8
Java
265
java
ResponseCreateUser.java
Java
[]
null
[]
package com.example.NetworkShared; public class ResponseCreateUser extends Response { public ResponseCreateUser (boolean success, int user_id) { super(MessageType.CreateUser,success); this.user_id = user_id; } public int user_id; }
265
0.698113
0.698113
11
23.09091
21.004131
60
false
false
0
0
0
0
0
0
0.545455
false
false
10
bbe1bf9f4f242477eff5bb6871cab56d17a70d87
21,311,627,757,170
7fc958cdd61662f297d2e934131e9ef00640c198
/HashTable/SplitIntoConsecutiveSubsequences.java
49852496fa579d474b79bc21ab30b39964e55ed1
[]
no_license
robotoMax/LeetcodeEverday
https://github.com/robotoMax/LeetcodeEverday
03737a3d832469bb646d190904cd5c778ea0207f
9072b33df86ec8f4dabe5ef25868152abfc23328
refs/heads/master
2018-09-30T00:04:45.219000
2018-09-20T23:10:52
2018-09-20T23:10:52
119,123,195
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * * Date: 03/10/2018 * Created By: Shuai Liu * * You are given an integer array sorted in ascending order (may contain duplicates), * you need to split them into several subsequences, where each subsequences consist of at least 3 consecutive integers. * Return whether you can make such a split. * Example 1: * Input: [1,2,3,3,4,5] * Output: True * Explanation: * You can split them into two consecutive subsequences : * 1, 2, 3 * 3, 4, 5 * Example 2: * Input: [1,2,3,3,4,4,5,5] * Output: True * Explanation: * You can split them into two consecutive subsequences : * 1, 2, 3, 4, 5 * 3, 4, 5 * Example 3: * Input: [1,2,3,4,4,5] * Output: False */ import java.util.*; public class SplitIntoConsecutiveSubsequences { public boolean isPossible(int[] nums) { if (nums == null || nums.length == 0) return false; Map<Integer, Integer> freq = new HashMap<>(); Map<Integer, Integer> appendFreq = new HashMap<>(); for (int i : nums) freq.put(i, freq.getOrDefault(i, 0) + 1); for (int i : nums) { if (freq.get(i) == 0) continue; else if (appendFreq.getOrDefault(i, 0) > 0) { appendFreq.put(i, appendFreq.get(i) - 1); appendFreq.put(i + 1, appendFreq.getOrDefault(i + 1, 0) + 1); } else if (freq.getOrDefault(i + 1, 0) > 0 && freq.getOrDefault(i + 2, 0) > 0) { freq.put(i + 1, freq.get(i + 1) - 1); freq.put(i + 2, freq.get(i + 2) - 1); appendFreq.put(i + 3, appendFreq.getOrDefault(i + 3, 0) + 1); } else return false; freq.put(i, freq.get(i) - 1); } return true; } }
UTF-8
Java
1,720
java
SplitIntoConsecutiveSubsequences.java
Java
[ { "context": "/**\n * \n * Date: 03/10/2018\n * Created By: Shuai Liu\n * \n * You are given an integer array sorted in a", "end": 52, "score": 0.9997908473014832, "start": 43, "tag": "NAME", "value": "Shuai Liu" } ]
null
[]
/** * * Date: 03/10/2018 * Created By: <NAME> * * You are given an integer array sorted in ascending order (may contain duplicates), * you need to split them into several subsequences, where each subsequences consist of at least 3 consecutive integers. * Return whether you can make such a split. * Example 1: * Input: [1,2,3,3,4,5] * Output: True * Explanation: * You can split them into two consecutive subsequences : * 1, 2, 3 * 3, 4, 5 * Example 2: * Input: [1,2,3,3,4,4,5,5] * Output: True * Explanation: * You can split them into two consecutive subsequences : * 1, 2, 3, 4, 5 * 3, 4, 5 * Example 3: * Input: [1,2,3,4,4,5] * Output: False */ import java.util.*; public class SplitIntoConsecutiveSubsequences { public boolean isPossible(int[] nums) { if (nums == null || nums.length == 0) return false; Map<Integer, Integer> freq = new HashMap<>(); Map<Integer, Integer> appendFreq = new HashMap<>(); for (int i : nums) freq.put(i, freq.getOrDefault(i, 0) + 1); for (int i : nums) { if (freq.get(i) == 0) continue; else if (appendFreq.getOrDefault(i, 0) > 0) { appendFreq.put(i, appendFreq.get(i) - 1); appendFreq.put(i + 1, appendFreq.getOrDefault(i + 1, 0) + 1); } else if (freq.getOrDefault(i + 1, 0) > 0 && freq.getOrDefault(i + 2, 0) > 0) { freq.put(i + 1, freq.get(i + 1) - 1); freq.put(i + 2, freq.get(i + 2) - 1); appendFreq.put(i + 3, appendFreq.getOrDefault(i + 3, 0) + 1); } else return false; freq.put(i, freq.get(i) - 1); } return true; } }
1,717
0.561628
0.518605
50
33.419998
27.122751
121
false
false
0
0
0
0
0
0
1.2
false
false
10
151281ce9f91a8bc033bc7d14df11dfec950fa94
30,528,627,601,793
5f6a9f259fe30605cf03deca0404910ffa9c6349
/beetle-core/src/main/java/com/xing/beetle/util/RetryExecutor.java
3677b22f3a8b028be3dfe8da3c1510d48b66273f
[ "MIT" ]
permissive
xing/java-beetle
https://github.com/xing/java-beetle
606e85fa4b352eaa7ddab2553bcfaa859ca13241
bc7e3a53b88c8bebbd9856697104560d1fc2838c
refs/heads/master
2021-01-25T07:44:18.073000
2020-11-03T17:49:46
2020-11-03T17:49:46
8,777,778
0
3
MIT
false
2020-10-28T14:17:35
2013-03-14T14:59:12
2020-10-28T13:03:37
2020-10-28T14:17:34
696
6
2
0
Java
false
false
package com.xing.beetle.util; import com.xing.beetle.util.ExceptionSupport.Supplier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.*; import static java.util.Objects.requireNonNull; public class RetryExecutor { static final ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(2); @FunctionalInterface public interface Backoff { Backoff DEFAULT = linear(1, TimeUnit.SECONDS).withMaxAttempts(8); static Backoff linear(long delay, TimeUnit unit) { return (att, err) -> att * unit.toMillis(delay); } static Backoff fixed(long delay, TimeUnit unit) { return (att, err) -> att == 0 ? 0 : unit.toMillis(delay); } long delayInMillis(int attempt, Throwable error); default Backoff withMaxAttempts(int max) { return (att, err) -> att < max ? delayInMillis(att, err) : -1; } } private class Retrying<T> implements Runnable { private final Supplier<? extends T> supplier; private final Logger logger; private final CompletableFuture<T> future; private int attempt; Retrying(Supplier<? extends T> supplier) { this.supplier = requireNonNull(supplier); this.logger = LoggerFactory.getLogger(supplier.getClass()); this.future = new CompletableFuture<>(); this.attempt = 0; future.whenComplete(this::logCompletion); } private void logCompletion(T success, Throwable error) { if (error != null) { logger.error("Failed to supply. Stop retrying.", error); } else if (logger.isDebugEnabled()) { logger.debug("Finished to supply " + success); } } @Override public void run() { try { T result = supplier.getChecked(); future.complete(result); } catch (Throwable error) { if (logger.isDebugEnabled()) { logger.debug(String.format("%d. attempt failed", attempt), error); } schedule(error); } } CompletionStage<T> schedule(Throwable error) { long delayInMillis = backoff.delayInMillis(attempt++, error); if (delayInMillis > 0) { scheduledExecutorService.schedule(this, delayInMillis, TimeUnit.MILLISECONDS); } else if (delayInMillis == 0) { executor.execute(this); } else if (error != null) { future.completeExceptionally(error); } else { future.cancel(false); } return future; } } private Executor executor; private Backoff backoff; private RetryExecutor(Executor executor, Backoff backoff) { this.executor = requireNonNull(executor); this.backoff = requireNonNull(backoff); } public <T> CompletionStage<T> supply(Supplier<? extends T> supplier) { return new Retrying<T>(supplier).schedule(null); } public static class Builder { protected Executor executor = ForkJoinPool.commonPool(); protected Backoff backoff = Backoff.DEFAULT; public Builder executor(Executor executor) { this.executor = executor; return this; } public Builder backOff(Backoff backoff) { this.backoff = backoff; return this; } public RetryExecutor build() { return new RetryExecutor(executor, backoff); } } }
UTF-8
Java
3,267
java
RetryExecutor.java
Java
[]
null
[]
package com.xing.beetle.util; import com.xing.beetle.util.ExceptionSupport.Supplier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.*; import static java.util.Objects.requireNonNull; public class RetryExecutor { static final ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(2); @FunctionalInterface public interface Backoff { Backoff DEFAULT = linear(1, TimeUnit.SECONDS).withMaxAttempts(8); static Backoff linear(long delay, TimeUnit unit) { return (att, err) -> att * unit.toMillis(delay); } static Backoff fixed(long delay, TimeUnit unit) { return (att, err) -> att == 0 ? 0 : unit.toMillis(delay); } long delayInMillis(int attempt, Throwable error); default Backoff withMaxAttempts(int max) { return (att, err) -> att < max ? delayInMillis(att, err) : -1; } } private class Retrying<T> implements Runnable { private final Supplier<? extends T> supplier; private final Logger logger; private final CompletableFuture<T> future; private int attempt; Retrying(Supplier<? extends T> supplier) { this.supplier = requireNonNull(supplier); this.logger = LoggerFactory.getLogger(supplier.getClass()); this.future = new CompletableFuture<>(); this.attempt = 0; future.whenComplete(this::logCompletion); } private void logCompletion(T success, Throwable error) { if (error != null) { logger.error("Failed to supply. Stop retrying.", error); } else if (logger.isDebugEnabled()) { logger.debug("Finished to supply " + success); } } @Override public void run() { try { T result = supplier.getChecked(); future.complete(result); } catch (Throwable error) { if (logger.isDebugEnabled()) { logger.debug(String.format("%d. attempt failed", attempt), error); } schedule(error); } } CompletionStage<T> schedule(Throwable error) { long delayInMillis = backoff.delayInMillis(attempt++, error); if (delayInMillis > 0) { scheduledExecutorService.schedule(this, delayInMillis, TimeUnit.MILLISECONDS); } else if (delayInMillis == 0) { executor.execute(this); } else if (error != null) { future.completeExceptionally(error); } else { future.cancel(false); } return future; } } private Executor executor; private Backoff backoff; private RetryExecutor(Executor executor, Backoff backoff) { this.executor = requireNonNull(executor); this.backoff = requireNonNull(backoff); } public <T> CompletionStage<T> supply(Supplier<? extends T> supplier) { return new Retrying<T>(supplier).schedule(null); } public static class Builder { protected Executor executor = ForkJoinPool.commonPool(); protected Backoff backoff = Backoff.DEFAULT; public Builder executor(Executor executor) { this.executor = executor; return this; } public Builder backOff(Backoff backoff) { this.backoff = backoff; return this; } public RetryExecutor build() { return new RetryExecutor(executor, backoff); } } }
3,267
0.662381
0.659014
117
26.923077
23.218454
86
false
false
0
0
0
0
0
0
0.529915
false
false
10
1d401f9e0197beb08b6da7798c90cbe24416ae5e
22,144,851,398,853
7f1ba7691015026705366eabf1646dde2af055b9
/src/com/puzzlers/character/CharArray.java
4523382e2e3c127a99ff2aeec330808f9ec6f1a6
[]
no_license
XUZHOUWANG/Java_Cookbook
https://github.com/XUZHOUWANG/Java_Cookbook
ed5e62b878a82d286c02ebf2be1333ff47e06a18
41282d3047791cb7f778fea27663eed775aa4e6d
refs/heads/master
2019-01-31T19:30:37.871000
2014-02-27T09:01:37
2014-02-27T09:01:37
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.puzzlers.character; /* * 字符数组与字符串的区别 */ public class CharArray { public static void main(String[] args){ char[] numbers = {'1', '2', '3'}; String str = "ABC"; System.out.println(str + " easy as " + numbers); System.out.println(str + " easy as " + String.valueOf(numbers)); StringBuffer sb = new StringBuffer(); System.out.println(str + " easy as " + sb.append(numbers)); System.out.println(numbers); } }
GB18030
Java
493
java
CharArray.java
Java
[]
null
[]
package com.puzzlers.character; /* * 字符数组与字符串的区别 */ public class CharArray { public static void main(String[] args){ char[] numbers = {'1', '2', '3'}; String str = "ABC"; System.out.println(str + " easy as " + numbers); System.out.println(str + " easy as " + String.valueOf(numbers)); StringBuffer sb = new StringBuffer(); System.out.println(str + " easy as " + sb.append(numbers)); System.out.println(numbers); } }
493
0.600849
0.59448
22
19.40909
21.044668
66
false
false
0
0
0
0
0
0
1.545455
false
false
10
1833e619d3e0d45d20d0f5bd28ae4543253e278c
30,880,814,882,880
d6aeb39e30fd3df4961d630c237647b6247cab20
/core/src/com/mantkowicz/light/board/object/TileObjectType.java
69404ee4e8c678842410585987cd44ee86784298
[]
no_license
michalantkowicz/lightgame
https://github.com/michalantkowicz/lightgame
767bd703266142cde90a3901e1dd1251f41d1d28
9ea8b61b13a949e41df3f3364ea6a271d593bc9b
refs/heads/master
2020-03-24T13:11:33.031000
2020-03-21T12:28:03
2020-03-21T12:28:03
142,737,919
0
0
null
false
2020-03-21T12:28:04
2018-07-29T06:51:39
2019-05-08T23:37:28
2020-03-21T12:28:04
3,117
0
0
0
Java
false
false
package com.mantkowicz.light.board.object; public enum TileObjectType { SPRITE, CHEST, LIGHT, PLAYER, DOG }
UTF-8
Java
113
java
TileObjectType.java
Java
[]
null
[]
package com.mantkowicz.light.board.object; public enum TileObjectType { SPRITE, CHEST, LIGHT, PLAYER, DOG }
113
0.752212
0.752212
5
21.6
17.805616
42
false
false
0
0
0
0
0
0
1
false
false
10
7f80f4521bba37f3c48ad6ee8bbfe32c71133f18
16,063,177,727,177
5d36613fddea1dc6f128806c1e9cfe0f8fbdf515
/FinalProject3.java
3e5ce8fe30d1588038c48fd582756aa167f9d9c2
[ "MIT" ]
permissive
gpretekin101/Cs11a-FinalProject
https://github.com/gpretekin101/Cs11a-FinalProject
a13507d0d3cde1b3b48b710266b3d46203f2c9c4
ba8454f4e08896f95f3f6e583e5dffffa3ec48f5
refs/heads/master
2021-08-23T23:30:17.023000
2017-12-07T02:37:29
2017-12-07T02:37:29
112,654,382
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package recipeFinder; //import java.recipeFinder.Variables; public class FinalProject3 { /** The main method @param args an array of strings which we ignore */ public static void main(String[] args){ boolean moreInput = true; //initialize boolean variables boolean moreRecipes = true; while (moreInput == true) { Spreadsheet.readSpreadsheet(); //read data from excel file welcome(); //print welcome message int servings = narrowRecipes(); //get user's criteria for recipe and print the title of recipes that fit in a list while (moreRecipes == true){ //as long as the user wants to get recipes from the list int index = chooseRecipe(); //get the index of the recipe the user chose printChosenRecipe(index, servings); //print the ingredients, directions, and other information about the recipe the user chose moreRecipes = chooseMore(); //as the user if they want to choose another recipe title to get the ingredients and directions for } moreInput = more(); //ask the user if they want to put in more information to get a new set of recipes moreRecipes =true; } TextIO.putf("%nBon appetit!%n"); } /** welcome message no parameters no return */ public static void welcome() { TextIO.putf("%nWelcome to the Recipe Generator! %n"); TextIO.putf("The app will help you make the perfect recipes for your meal%n%n%n"); } /** gets the criteria of a recipe from the user and prints out the titles of recipes that fulfill the criteria no parameters @return integer servings, the number of servings the user wants to make */ public static int narrowRecipes(){ String type = getType(); //appetizer, entree, salad, soup String label = getLabel(); //vegerarian, vegan, gluten-free, dairy-free int time = getTime(); //maximum amount of time user can cook for int cal = getCal(); //maximum number of calories per serving int servings = getServings(); //number servings user wants to make printRecipes(type, label, time, cal); //print the titles of relavent recipes return servings; } /** ask user if they want to make an appetizer, entree, salad, or soup no parameters @return the type of dish the user wants to make, string */ public static String getType(){ TextIO.readStandardInput(); TextIO.putf("What type of dish would you like to make? %n"); String t; do{ // make sure user's input is valid TextIO.putf("Please type salad, soup, appetizer, or entree %n"); t = TextIO.getln(); }while (!t.equalsIgnoreCase("salad") && !t.equalsIgnoreCase("soup") && !t.equalsIgnoreCase("appetizer") && !t.equalsIgnoreCase("entree")); return t; } /** ask if user wants their dish to be vegetarian, vegan, gluten-free, or dairy-free no parameters @return the restriction on the dish, string */ public static String getLabel(){ TextIO.putf("%nDo your guests have any dietary restrictions? %n"); String l; do{ //make sure user's input is valid TextIO.putf("Please type gluten-free, dairy-free, vegetarian, or vegan %n"); l = TextIO.getln(); }while (!l.equalsIgnoreCase("gluten-free") && !l.equalsIgnoreCase("gluten free") && !l.equalsIgnoreCase("dairy-free") &&!l.equalsIgnoreCase("dairy free") && !l.equalsIgnoreCase("vegetarian") && !l.equalsIgnoreCase("vegan")); return l; } /** get the maximum amount of time user has to make the dish no parameters @return the time the user has to make the dish, int */ public static int getTime(){ TextIO.putf("%nHow much time (in minutes) do you have to make the recipe? %n"); int time = TextIO.getlnInt(); if (time<0){ //make sure user's input is valid TextIO.putf("That is not a valid entry. Please enter the amount of time in minutes you have to make this recipe%n"); time = TextIO.getlnInt(); } return time; } /** get the maximum amount of calories per serving in the dish no parameters @return the maximum number of calories per serving, int */ public static int getCal(){ TextIO.putf("%nWhat is the most amount of calories per serving your recipe can have? %n"); int cal = TextIO.getlnInt(); if (cal <0){ //make sure the user's input is valid TextIO.putf("That is not a valid entry. Please enter the maximum amount of calories per serving your recipe can have%n"); cal = TextIO.getlnInt(); } return cal; } /** get the number of servings the user wants to make no parameters @return the number of servings, int */ public static int getServings(){ TextIO.putf("%nHow many people are you cooking for?%n"); int servings = TextIO.getlnInt(); if (servings<0){ // make sure the user's input is valid TextIO.putf("That is not a valid entry. Please enter the number of servings you would like to make %n"); servings = TextIO.getlnInt(); } return servings; } /** print out the titles of recipes that fit the user's criteria @param type a string that describes the type (appetizer, entree, soup, salad) of the dish @param label a string that describes the restrictions (vegetarian, vegan, gluten-free, dairy-free) of the dish @param time an int that describes the maximum amount of time in minutes that the user can cook @param cal an int that describes the maximum amount of calories per serving no return */ public static void printRecipes(String type, String label, int time, int cal){ System.out.println(); int count = 0; //keep track of the number of recipes found for (int i=0; i<dbSize; i++){ // go through the arrays and print the titles of recipes that match all the criteria if(typeList[i].equalsIgnoreCase(type) && description[i].equalsIgnoreCase(label) && timeList[i]<=time && calories[i]<=cal){ count++; //increment the number of recipes found TextIO.putf("%d. %s%n", count, name[i]); } } if (count>0){ //tell the user how many recipes were found TextIO.putf("%nThere are %d %s recipes that are %s, take less than %d minutes to make, and have under %d calories per serving.%n",count, type, label, time, cal); } else{ TextIO.putf("%nSorry, there are no %s recipes that are %s, take less than %d minutes to make, and have under %d calories per serving.%n%n%n",type, label, time, cal); narrowRecipes(); //ask for different criteria if no recipes were found } } /** ask the user to pick which recipe they want to know more about no parameters @return the index (int) of the chosen recipe */ public static int chooseRecipe(){ TextIO.putf("%nWhich dish would you like to get the recipe for?%n"); boolean validInput = false; String chosenRecipe; int index=0; do{ //ask the user to type in the name of the recipe and check their response is valid chosenRecipe = TextIO.getln(); validInput=checkInput(chosenRecipe); }while (!validInput); for (int i=0; i<name.length; i++){ //find the index of the recipe the user chose if (name[i].equalsIgnoreCase(chosenRecipe)){ index =i; } } return index; } /** check to make sure the user had a valid entry for which recipe they want to know more about @param chosenRecipe a string that is the recipe the user chose @return true if valid, false if not */ public static boolean checkInput(String chosenRecipe){ for (int i=0; i<name.length; i++){ //go through array of recipe names and check to see if the user's entry matches one if (name[i].equalsIgnoreCase(chosenRecipe)){ return true; } } TextIO.putf("Please type the name of the dish you would like to get the recipe for:%n"); return false; } /** Prints the title, directions, and other information about the chosen recipe @param index the index(int) of the chosen recipe @param servings the number of servings (int) the user needs to make no return */ public static void printChosenRecipe(int index, int servings){ TextIO.putf("%n%n%s%n", name[index]); //print out the title of the recipe double multiply = changeServings(index, servings); //change proportions of recipe to fit with the number of servings the user wants to make double actualServings= multiply*servingsList[index]; //calculate the actual servings the recipe will now make (should be equal to the number of servings the user needs to make) printIngandMeas(index); //print ingredients and measurements printDirections(index); //print directions printOtherInfo(index, actualServings); //print other infor } /** multiplies the quantities of ingredients by a factor so that user will know how much to add for the number of servings they need to make @param index the index (int) of the recipe @param servings the number of servings the user needs to make @return the factor by which all quantities must be multiplied */ public static double changeServings(int index, int servings){ double multiply = 1; if (servings>servingsList[index]){ //only multiply if the recipe does not make enough, some recipes cannot be scaled back and so user may need to make more than they need multiply = (double)servings/(double)servingsList[index]; meas1[index]=multiply*meas1[index]; //multiply quantities of ingredients by a factor meas2[index]=multiply*meas2[index]; meas3[index]=multiply*meas3[index]; meas4[index]=multiply*meas4[index]; meas5[index]=multiply*meas5[index]; meas6[index]=multiply*meas6[index]; meas7[index]=multiply*meas7[index]; meas8[index]=multiply*meas8[index]; } return multiply; } /** print ingredients and new measurements @param index the index (int) of the recipe no return */ public static void printIngandMeas(int index) { TextIO.putf("Ingredients: %n"); TextIO.putf("%1.2f %s %n", meas1[index], ing1[index]); TextIO.putf("%1.2f %s %n", meas2[index], ing2[index]); TextIO.putf("%1.2f %s %n", meas3[index], ing3[index]); //all recipes have at least 3 ingredients if (meas4[index]!=0) { //check to make sure there is an ingredient to print before printing it TextIO.putf("%1.2f %s %n", meas4[index], ing4[index]); }if (meas5[index]!=0) { TextIO.putf("%1.2f %s %n", meas5[index], ing5[index]); }if (meas6[index]!=0) { TextIO.putf("%1.2f %s %n", meas6[index], ing6[index]); }if (meas7[index]!=0) { TextIO.putf("%1.2f %s %n", meas7[index], ing7[index]); }if (meas8[index]!=0) { TextIO.putf("%1.2f %s %n", meas8[index], ing8[index]); } } /** print the directions for the recipe @param index the index (int) of the recipe no return */ public static void printDirections(int index){ String dir = directions[index]; //turn the directions for the recipe into a string dir String [] split = dir.split(">"); //split the string at the character ">" and store into an array split for (int i=0; i<split.length; i++){ //print out each index of the array with a carriage return after TextIO.putf("%s%n", split[i]); } } /** prints out the calories, the amount of time to make, and the actual servings of the recipe @param index the index (int) of the recipe @param actualServings the actual number of servings the recipe makes, double no return */ public static void printOtherInfo(int index, double actualServings){ TextIO.putf("%nCalories per serving: %1.0f%n", calories[index]); TextIO.putf("Time to make: %1.0f minutes%n", timeList[index]); TextIO.putf("This recipe will make %1.0f servings%n", actualServings); } /** ask the user if they want the instructions to make a different recipe no parameters @return true if they want to get the instructions for a different recipe, false if they don't */ public static boolean chooseMore(){ TextIO.putf("%nWould you like to pick another dish to get the recipe for?%n"); return TextIO.getlnBoolean(); } /** ask the user if they want to enter a different set of criteria to find new recipes no parameters @return true if they want to enter more criteria, false if they do not, program ends if false */ public static boolean more(){ TextIO.putf("%nWould you like to enter new criteria for a recipe?%n"); return TextIO.getlnBoolean(); } }
UTF-8
Java
13,837
java
FinalProject3.java
Java
[]
null
[]
package recipeFinder; //import java.recipeFinder.Variables; public class FinalProject3 { /** The main method @param args an array of strings which we ignore */ public static void main(String[] args){ boolean moreInput = true; //initialize boolean variables boolean moreRecipes = true; while (moreInput == true) { Spreadsheet.readSpreadsheet(); //read data from excel file welcome(); //print welcome message int servings = narrowRecipes(); //get user's criteria for recipe and print the title of recipes that fit in a list while (moreRecipes == true){ //as long as the user wants to get recipes from the list int index = chooseRecipe(); //get the index of the recipe the user chose printChosenRecipe(index, servings); //print the ingredients, directions, and other information about the recipe the user chose moreRecipes = chooseMore(); //as the user if they want to choose another recipe title to get the ingredients and directions for } moreInput = more(); //ask the user if they want to put in more information to get a new set of recipes moreRecipes =true; } TextIO.putf("%nBon appetit!%n"); } /** welcome message no parameters no return */ public static void welcome() { TextIO.putf("%nWelcome to the Recipe Generator! %n"); TextIO.putf("The app will help you make the perfect recipes for your meal%n%n%n"); } /** gets the criteria of a recipe from the user and prints out the titles of recipes that fulfill the criteria no parameters @return integer servings, the number of servings the user wants to make */ public static int narrowRecipes(){ String type = getType(); //appetizer, entree, salad, soup String label = getLabel(); //vegerarian, vegan, gluten-free, dairy-free int time = getTime(); //maximum amount of time user can cook for int cal = getCal(); //maximum number of calories per serving int servings = getServings(); //number servings user wants to make printRecipes(type, label, time, cal); //print the titles of relavent recipes return servings; } /** ask user if they want to make an appetizer, entree, salad, or soup no parameters @return the type of dish the user wants to make, string */ public static String getType(){ TextIO.readStandardInput(); TextIO.putf("What type of dish would you like to make? %n"); String t; do{ // make sure user's input is valid TextIO.putf("Please type salad, soup, appetizer, or entree %n"); t = TextIO.getln(); }while (!t.equalsIgnoreCase("salad") && !t.equalsIgnoreCase("soup") && !t.equalsIgnoreCase("appetizer") && !t.equalsIgnoreCase("entree")); return t; } /** ask if user wants their dish to be vegetarian, vegan, gluten-free, or dairy-free no parameters @return the restriction on the dish, string */ public static String getLabel(){ TextIO.putf("%nDo your guests have any dietary restrictions? %n"); String l; do{ //make sure user's input is valid TextIO.putf("Please type gluten-free, dairy-free, vegetarian, or vegan %n"); l = TextIO.getln(); }while (!l.equalsIgnoreCase("gluten-free") && !l.equalsIgnoreCase("gluten free") && !l.equalsIgnoreCase("dairy-free") &&!l.equalsIgnoreCase("dairy free") && !l.equalsIgnoreCase("vegetarian") && !l.equalsIgnoreCase("vegan")); return l; } /** get the maximum amount of time user has to make the dish no parameters @return the time the user has to make the dish, int */ public static int getTime(){ TextIO.putf("%nHow much time (in minutes) do you have to make the recipe? %n"); int time = TextIO.getlnInt(); if (time<0){ //make sure user's input is valid TextIO.putf("That is not a valid entry. Please enter the amount of time in minutes you have to make this recipe%n"); time = TextIO.getlnInt(); } return time; } /** get the maximum amount of calories per serving in the dish no parameters @return the maximum number of calories per serving, int */ public static int getCal(){ TextIO.putf("%nWhat is the most amount of calories per serving your recipe can have? %n"); int cal = TextIO.getlnInt(); if (cal <0){ //make sure the user's input is valid TextIO.putf("That is not a valid entry. Please enter the maximum amount of calories per serving your recipe can have%n"); cal = TextIO.getlnInt(); } return cal; } /** get the number of servings the user wants to make no parameters @return the number of servings, int */ public static int getServings(){ TextIO.putf("%nHow many people are you cooking for?%n"); int servings = TextIO.getlnInt(); if (servings<0){ // make sure the user's input is valid TextIO.putf("That is not a valid entry. Please enter the number of servings you would like to make %n"); servings = TextIO.getlnInt(); } return servings; } /** print out the titles of recipes that fit the user's criteria @param type a string that describes the type (appetizer, entree, soup, salad) of the dish @param label a string that describes the restrictions (vegetarian, vegan, gluten-free, dairy-free) of the dish @param time an int that describes the maximum amount of time in minutes that the user can cook @param cal an int that describes the maximum amount of calories per serving no return */ public static void printRecipes(String type, String label, int time, int cal){ System.out.println(); int count = 0; //keep track of the number of recipes found for (int i=0; i<dbSize; i++){ // go through the arrays and print the titles of recipes that match all the criteria if(typeList[i].equalsIgnoreCase(type) && description[i].equalsIgnoreCase(label) && timeList[i]<=time && calories[i]<=cal){ count++; //increment the number of recipes found TextIO.putf("%d. %s%n", count, name[i]); } } if (count>0){ //tell the user how many recipes were found TextIO.putf("%nThere are %d %s recipes that are %s, take less than %d minutes to make, and have under %d calories per serving.%n",count, type, label, time, cal); } else{ TextIO.putf("%nSorry, there are no %s recipes that are %s, take less than %d minutes to make, and have under %d calories per serving.%n%n%n",type, label, time, cal); narrowRecipes(); //ask for different criteria if no recipes were found } } /** ask the user to pick which recipe they want to know more about no parameters @return the index (int) of the chosen recipe */ public static int chooseRecipe(){ TextIO.putf("%nWhich dish would you like to get the recipe for?%n"); boolean validInput = false; String chosenRecipe; int index=0; do{ //ask the user to type in the name of the recipe and check their response is valid chosenRecipe = TextIO.getln(); validInput=checkInput(chosenRecipe); }while (!validInput); for (int i=0; i<name.length; i++){ //find the index of the recipe the user chose if (name[i].equalsIgnoreCase(chosenRecipe)){ index =i; } } return index; } /** check to make sure the user had a valid entry for which recipe they want to know more about @param chosenRecipe a string that is the recipe the user chose @return true if valid, false if not */ public static boolean checkInput(String chosenRecipe){ for (int i=0; i<name.length; i++){ //go through array of recipe names and check to see if the user's entry matches one if (name[i].equalsIgnoreCase(chosenRecipe)){ return true; } } TextIO.putf("Please type the name of the dish you would like to get the recipe for:%n"); return false; } /** Prints the title, directions, and other information about the chosen recipe @param index the index(int) of the chosen recipe @param servings the number of servings (int) the user needs to make no return */ public static void printChosenRecipe(int index, int servings){ TextIO.putf("%n%n%s%n", name[index]); //print out the title of the recipe double multiply = changeServings(index, servings); //change proportions of recipe to fit with the number of servings the user wants to make double actualServings= multiply*servingsList[index]; //calculate the actual servings the recipe will now make (should be equal to the number of servings the user needs to make) printIngandMeas(index); //print ingredients and measurements printDirections(index); //print directions printOtherInfo(index, actualServings); //print other infor } /** multiplies the quantities of ingredients by a factor so that user will know how much to add for the number of servings they need to make @param index the index (int) of the recipe @param servings the number of servings the user needs to make @return the factor by which all quantities must be multiplied */ public static double changeServings(int index, int servings){ double multiply = 1; if (servings>servingsList[index]){ //only multiply if the recipe does not make enough, some recipes cannot be scaled back and so user may need to make more than they need multiply = (double)servings/(double)servingsList[index]; meas1[index]=multiply*meas1[index]; //multiply quantities of ingredients by a factor meas2[index]=multiply*meas2[index]; meas3[index]=multiply*meas3[index]; meas4[index]=multiply*meas4[index]; meas5[index]=multiply*meas5[index]; meas6[index]=multiply*meas6[index]; meas7[index]=multiply*meas7[index]; meas8[index]=multiply*meas8[index]; } return multiply; } /** print ingredients and new measurements @param index the index (int) of the recipe no return */ public static void printIngandMeas(int index) { TextIO.putf("Ingredients: %n"); TextIO.putf("%1.2f %s %n", meas1[index], ing1[index]); TextIO.putf("%1.2f %s %n", meas2[index], ing2[index]); TextIO.putf("%1.2f %s %n", meas3[index], ing3[index]); //all recipes have at least 3 ingredients if (meas4[index]!=0) { //check to make sure there is an ingredient to print before printing it TextIO.putf("%1.2f %s %n", meas4[index], ing4[index]); }if (meas5[index]!=0) { TextIO.putf("%1.2f %s %n", meas5[index], ing5[index]); }if (meas6[index]!=0) { TextIO.putf("%1.2f %s %n", meas6[index], ing6[index]); }if (meas7[index]!=0) { TextIO.putf("%1.2f %s %n", meas7[index], ing7[index]); }if (meas8[index]!=0) { TextIO.putf("%1.2f %s %n", meas8[index], ing8[index]); } } /** print the directions for the recipe @param index the index (int) of the recipe no return */ public static void printDirections(int index){ String dir = directions[index]; //turn the directions for the recipe into a string dir String [] split = dir.split(">"); //split the string at the character ">" and store into an array split for (int i=0; i<split.length; i++){ //print out each index of the array with a carriage return after TextIO.putf("%s%n", split[i]); } } /** prints out the calories, the amount of time to make, and the actual servings of the recipe @param index the index (int) of the recipe @param actualServings the actual number of servings the recipe makes, double no return */ public static void printOtherInfo(int index, double actualServings){ TextIO.putf("%nCalories per serving: %1.0f%n", calories[index]); TextIO.putf("Time to make: %1.0f minutes%n", timeList[index]); TextIO.putf("This recipe will make %1.0f servings%n", actualServings); } /** ask the user if they want the instructions to make a different recipe no parameters @return true if they want to get the instructions for a different recipe, false if they don't */ public static boolean chooseMore(){ TextIO.putf("%nWould you like to pick another dish to get the recipe for?%n"); return TextIO.getlnBoolean(); } /** ask the user if they want to enter a different set of criteria to find new recipes no parameters @return true if they want to enter more criteria, false if they do not, program ends if false */ public static boolean more(){ TextIO.putf("%nWould you like to enter new criteria for a recipe?%n"); return TextIO.getlnBoolean(); } }
13,837
0.613572
0.608007
309
43.779934
45.632378
228
false
false
0
0
0
0
0
0
0.660194
false
false
10
50ca0ea3bbb1e7fa06e724d824dd2bdcefec05cd
21,930,103,083,273
d579c4bb4f2124d04c5b83ee8833c0e40298dbda
/src/com/hdxy/mapper/AdminMapper.java
c3bf28daec9c79554d2ef7bc5f234ee57d3e16f7
[]
no_license
zhengzhanpeng/TeacherEvaluation
https://github.com/zhengzhanpeng/TeacherEvaluation
33a8d47a362e0f30c5d75602ae3e76f8e37262ac
230d8d47289dbaf8e3ae95fd613d80cea9cc340d
refs/heads/master
2021-01-23T16:15:00.720000
2018-04-28T09:38:33
2018-04-28T09:38:33
93,246,809
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hdxy.mapper; import org.apache.ibatis.annotations.Param; import com.hdxy.pojo.Admin; public interface AdminMapper { /*通过管理员用户名获取管理员id、password、random*/ Admin getAdminByAdminName(String adminName); Admin getAdminByAdminId(Integer adminId); int addAdmin(Admin admin); int setPassword(@Param("adminId") int adminId, @Param("password") String password); }
UTF-8
Java
409
java
AdminMapper.java
Java
[]
null
[]
package com.hdxy.mapper; import org.apache.ibatis.annotations.Param; import com.hdxy.pojo.Admin; public interface AdminMapper { /*通过管理员用户名获取管理员id、password、random*/ Admin getAdminByAdminName(String adminName); Admin getAdminByAdminId(Integer adminId); int addAdmin(Admin admin); int setPassword(@Param("adminId") int adminId, @Param("password") String password); }
409
0.773087
0.773087
17
21.294117
23.287878
84
false
false
0
0
0
0
0
0
0.941176
false
false
10
fd31188ce838fe027b76c660e46ffb63b7d5fe37
2,654,289,815,900
93b093b4b929f2dd2a8ca42062ea581c24289107
/src/com/punchclock/gui/MainWindow.java
9ce6d1c8403f41eb6ed820a52fa5179ecb3ed670
[]
no_license
ahmj/PunchClock
https://github.com/ahmj/PunchClock
31c70fa952ff56ce68be40a2f59ead737199b6e5
dc6ba1665bf77d95f503acf2ef99a4baf9962b53
refs/heads/master
2016-03-24T02:35:30.805000
2015-01-25T00:24:24
2015-01-25T00:24:24
19,292,033
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.punchclock.gui; import java.awt.EventQueue; import java.io.IOException; import java.util.HashMap; import java.util.Map; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JList; import javax.swing.ListSelectionModel; import javax.swing.UIManager; import com.punchclock.client.User; import com.punchclock.handlers.FileManager; import com.punchclock.handlers.SettingsManager; import com.punchclock.handlers.UserManager; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.JLabel; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; import javax.swing.border.LineBorder; import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; import java.awt.Color; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; import javax.swing.JMenuBar; import javax.swing.JMenu; import javax.swing.JMenuItem; public class MainWindow { private JFrame frmPunchclock; private JList employeeList; private JButton inButton; private JButton outButton; private User selectedUser; private JTable table; private JLabel hoursTableLabel; private JLabel dayTableLabel; private JLabel actionVarLabel; private JLabel nameVarLabel; private JMenuBar menuBar; private JMenu menuManage; private JMenuItem ManageAdd; private JMenuItem menuManageDelete; private JMenuItem menuManageEdit; private JMenuItem menuLogin; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { MainWindow window = new MainWindow(); window.frmPunchclock.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public MainWindow() { try {FileManager.getInstance().readEmployeeFile();} catch (IOException e) {e.printStackTrace();} initialize(); } /** * Initialize the contents of the frame. */ @SuppressWarnings("serial") private void initialize() { try{ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); }catch (Exception e1) { e1.printStackTrace(); } SettingsManager.getInstance(); frmPunchclock = new JFrame(); frmPunchclock.setTitle("PunchClock"); frmPunchclock.setResizable(false); frmPunchclock.setBounds(100, 100, 519, 244); frmPunchclock.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frmPunchclock.getContentPane().setLayout(null); employeeList = new JList(UserManager.getInstance().getAllUsers().toArray()); employeeList.setBorder(new LineBorder(new Color(0, 0, 0))); employeeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); employeeList.setBounds(10, 11, 120, 180); employeeList.addMouseListener(mouseListener); frmPunchclock.getContentPane().add(employeeList); outButton = new JButton("Out"); outButton.setEnabled(false); outButton.addActionListener(new ButtonListener()); outButton.setBounds(396, 102, 107, 89); frmPunchclock.getContentPane().add(outButton); inButton = new JButton("In"); inButton.setEnabled(false); inButton.addActionListener(new ButtonListener()); inButton.setBounds(279, 102, 107, 89); frmPunchclock.getContentPane().add(inButton); JLabel nameLabel = new JLabel("Name:"); nameLabel.setBounds(140, 12, 46, 14); frmPunchclock.getContentPane().add(nameLabel); nameVarLabel = new JLabel(""); nameVarLabel.setBounds(246, 12, 160, 14); frmPunchclock.getContentPane().add(nameVarLabel); JLabel actionLabel = new JLabel("Last Action:"); actionLabel.setBounds(140, 37, 63, 14); frmPunchclock.getContentPane().add(actionLabel); actionVarLabel = new JLabel(""); actionVarLabel.setBounds(263, 37, 46, 14); frmPunchclock.getContentPane().add(actionVarLabel); table = new JTable(); table.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); table.setRowSelectionAllowed(false); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setModel(new DefaultTableModel( new Object[][] { {"Monday", null}, {"Tuesday", null}, {"Wednesday", null}, {"Thursday", null}, {"Friday", null}, {"Saturday", null}, {"Sunday", null}, }, new String[] { "Days", "Hours" } ) { boolean[] columnEditables = new boolean[] { false, false }; public boolean isCellEditable(int row, int column) { return columnEditables[column]; } }); table.getColumnModel().getColumn(0).setResizable(false); table.getColumnModel().getColumn(1).setResizable(false); table.setBounds(140, 79, 120, 112); frmPunchclock.getContentPane().add(table); dayTableLabel = new JLabel("Day"); dayTableLabel.setBounds(140, 62, 46, 14); frmPunchclock.getContentPane().add(dayTableLabel); hoursTableLabel = new JLabel("Hours"); hoursTableLabel.setBounds(200, 62, 46, 14); frmPunchclock.getContentPane().add(hoursTableLabel); menuBar = new JMenuBar(); frmPunchclock.setJMenuBar(menuBar); JMenu menuTopFile = new JMenu("File"); menuTopFile.addMenuListener(new MyMenuListener()); menuBar.add(menuTopFile); menuLogin = new JMenuItem("Login"); menuLogin.addActionListener(new MenuItemListener()); menuTopFile.add(menuLogin); menuManage = new JMenu("Manage"); menuManage.setEnabled(false); menuTopFile.add(menuManage); ManageAdd = new JMenuItem("Add Employee"); menuManage.add(ManageAdd); menuManageDelete = new JMenuItem("Delete Employee"); menuManage.add(menuManageDelete); menuManageEdit = new JMenuItem("Edit Employee"); menuManage.add(menuManageEdit); } MouseListener mouseListener = new MouseAdapter() { public void mouseClicked(MouseEvent evt){ selectedUser = UserManager.getInstance().get(employeeList.getSelectedValue().toString()); setButtonStatus(selectedUser.getPunch()); nameVarLabel.setText(selectedUser.getName()); actionVarLabel.setText("N/A"); Map<Integer, String> weekHours = new HashMap<Integer, String>(); try {weekHours = FileManager.getInstance().readCurrentWeekHours(selectedUser);} catch (IOException e) {e.printStackTrace();} for (int i = 0; i < 7; i++){ table.setValueAt(weekHours.get(i + 1), i, 1); } } }; private void setButtonStatus(boolean b){ if (b){ inButton.setEnabled(false); outButton.setEnabled(true); }else{ inButton.setEnabled(true); outButton.setEnabled(false); } } private class ButtonListener implements ActionListener{ @Override public void actionPerformed(ActionEvent evt) { if (evt.getActionCommand().equals("In")){ selectedUser.punchIn(); } else if (evt.getActionCommand().equals("Out")){ selectedUser.punchOut(); } try {FileManager.getInstance().write(selectedUser);} catch (IOException e) { e.printStackTrace();} setButtonStatus(selectedUser.getPunch()); } } private class MyMenuListener implements MenuListener { @Override public void menuSelected(MenuEvent evt) { JMenu selectedMenu = (JMenu) evt.getSource(); if (selectedMenu.getText().equals("File")){ if (SettingsManager.getInstance().getLoggedIn()) { menuManage.setEnabled(true); } else { menuManage.setEnabled(false); } } } @Override public void menuCanceled(MenuEvent evt) { } @Override public void menuDeselected(MenuEvent evt) { } } private class MenuItemListener implements ActionListener{ @Override public void actionPerformed(ActionEvent evt) { if (evt.getActionCommand().equals("Login")) { new LoginWindow(); menuLogin.setEnabled(false); } } } }
UTF-8
Java
7,723
java
MainWindow.java
Java
[]
null
[]
package com.punchclock.gui; import java.awt.EventQueue; import java.io.IOException; import java.util.HashMap; import java.util.Map; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JList; import javax.swing.ListSelectionModel; import javax.swing.UIManager; import com.punchclock.client.User; import com.punchclock.handlers.FileManager; import com.punchclock.handlers.SettingsManager; import com.punchclock.handlers.UserManager; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.JLabel; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; import javax.swing.border.LineBorder; import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; import java.awt.Color; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; import javax.swing.JMenuBar; import javax.swing.JMenu; import javax.swing.JMenuItem; public class MainWindow { private JFrame frmPunchclock; private JList employeeList; private JButton inButton; private JButton outButton; private User selectedUser; private JTable table; private JLabel hoursTableLabel; private JLabel dayTableLabel; private JLabel actionVarLabel; private JLabel nameVarLabel; private JMenuBar menuBar; private JMenu menuManage; private JMenuItem ManageAdd; private JMenuItem menuManageDelete; private JMenuItem menuManageEdit; private JMenuItem menuLogin; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { MainWindow window = new MainWindow(); window.frmPunchclock.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public MainWindow() { try {FileManager.getInstance().readEmployeeFile();} catch (IOException e) {e.printStackTrace();} initialize(); } /** * Initialize the contents of the frame. */ @SuppressWarnings("serial") private void initialize() { try{ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); }catch (Exception e1) { e1.printStackTrace(); } SettingsManager.getInstance(); frmPunchclock = new JFrame(); frmPunchclock.setTitle("PunchClock"); frmPunchclock.setResizable(false); frmPunchclock.setBounds(100, 100, 519, 244); frmPunchclock.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frmPunchclock.getContentPane().setLayout(null); employeeList = new JList(UserManager.getInstance().getAllUsers().toArray()); employeeList.setBorder(new LineBorder(new Color(0, 0, 0))); employeeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); employeeList.setBounds(10, 11, 120, 180); employeeList.addMouseListener(mouseListener); frmPunchclock.getContentPane().add(employeeList); outButton = new JButton("Out"); outButton.setEnabled(false); outButton.addActionListener(new ButtonListener()); outButton.setBounds(396, 102, 107, 89); frmPunchclock.getContentPane().add(outButton); inButton = new JButton("In"); inButton.setEnabled(false); inButton.addActionListener(new ButtonListener()); inButton.setBounds(279, 102, 107, 89); frmPunchclock.getContentPane().add(inButton); JLabel nameLabel = new JLabel("Name:"); nameLabel.setBounds(140, 12, 46, 14); frmPunchclock.getContentPane().add(nameLabel); nameVarLabel = new JLabel(""); nameVarLabel.setBounds(246, 12, 160, 14); frmPunchclock.getContentPane().add(nameVarLabel); JLabel actionLabel = new JLabel("Last Action:"); actionLabel.setBounds(140, 37, 63, 14); frmPunchclock.getContentPane().add(actionLabel); actionVarLabel = new JLabel(""); actionVarLabel.setBounds(263, 37, 46, 14); frmPunchclock.getContentPane().add(actionVarLabel); table = new JTable(); table.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); table.setRowSelectionAllowed(false); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setModel(new DefaultTableModel( new Object[][] { {"Monday", null}, {"Tuesday", null}, {"Wednesday", null}, {"Thursday", null}, {"Friday", null}, {"Saturday", null}, {"Sunday", null}, }, new String[] { "Days", "Hours" } ) { boolean[] columnEditables = new boolean[] { false, false }; public boolean isCellEditable(int row, int column) { return columnEditables[column]; } }); table.getColumnModel().getColumn(0).setResizable(false); table.getColumnModel().getColumn(1).setResizable(false); table.setBounds(140, 79, 120, 112); frmPunchclock.getContentPane().add(table); dayTableLabel = new JLabel("Day"); dayTableLabel.setBounds(140, 62, 46, 14); frmPunchclock.getContentPane().add(dayTableLabel); hoursTableLabel = new JLabel("Hours"); hoursTableLabel.setBounds(200, 62, 46, 14); frmPunchclock.getContentPane().add(hoursTableLabel); menuBar = new JMenuBar(); frmPunchclock.setJMenuBar(menuBar); JMenu menuTopFile = new JMenu("File"); menuTopFile.addMenuListener(new MyMenuListener()); menuBar.add(menuTopFile); menuLogin = new JMenuItem("Login"); menuLogin.addActionListener(new MenuItemListener()); menuTopFile.add(menuLogin); menuManage = new JMenu("Manage"); menuManage.setEnabled(false); menuTopFile.add(menuManage); ManageAdd = new JMenuItem("Add Employee"); menuManage.add(ManageAdd); menuManageDelete = new JMenuItem("Delete Employee"); menuManage.add(menuManageDelete); menuManageEdit = new JMenuItem("Edit Employee"); menuManage.add(menuManageEdit); } MouseListener mouseListener = new MouseAdapter() { public void mouseClicked(MouseEvent evt){ selectedUser = UserManager.getInstance().get(employeeList.getSelectedValue().toString()); setButtonStatus(selectedUser.getPunch()); nameVarLabel.setText(selectedUser.getName()); actionVarLabel.setText("N/A"); Map<Integer, String> weekHours = new HashMap<Integer, String>(); try {weekHours = FileManager.getInstance().readCurrentWeekHours(selectedUser);} catch (IOException e) {e.printStackTrace();} for (int i = 0; i < 7; i++){ table.setValueAt(weekHours.get(i + 1), i, 1); } } }; private void setButtonStatus(boolean b){ if (b){ inButton.setEnabled(false); outButton.setEnabled(true); }else{ inButton.setEnabled(true); outButton.setEnabled(false); } } private class ButtonListener implements ActionListener{ @Override public void actionPerformed(ActionEvent evt) { if (evt.getActionCommand().equals("In")){ selectedUser.punchIn(); } else if (evt.getActionCommand().equals("Out")){ selectedUser.punchOut(); } try {FileManager.getInstance().write(selectedUser);} catch (IOException e) { e.printStackTrace();} setButtonStatus(selectedUser.getPunch()); } } private class MyMenuListener implements MenuListener { @Override public void menuSelected(MenuEvent evt) { JMenu selectedMenu = (JMenu) evt.getSource(); if (selectedMenu.getText().equals("File")){ if (SettingsManager.getInstance().getLoggedIn()) { menuManage.setEnabled(true); } else { menuManage.setEnabled(false); } } } @Override public void menuCanceled(MenuEvent evt) { } @Override public void menuDeselected(MenuEvent evt) { } } private class MenuItemListener implements ActionListener{ @Override public void actionPerformed(ActionEvent evt) { if (evt.getActionCommand().equals("Login")) { new LoginWindow(); menuLogin.setEnabled(false); } } } }
7,723
0.730416
0.71423
256
29.167969
19.582535
92
false
false
0
0
0
0
0
0
2.664063
false
false
10
d67555e0e7d4f88dd4c336c514773fc8ec3e6233
24,197,845,773,037
2547b7ab032d80ec2a107f7c37e0aa5c5bcc792e
/Shop/src/main/java/com/mmalaenko/security/LoginFilter.java
732f3487b23ebb18afae2829ce8493eb4f53a4d0
[]
no_license
AlexseyOstrovskiy/HomeWork
https://github.com/AlexseyOstrovskiy/HomeWork
e4db5df5d1fea8b679e54d58abf719a5d21cbbd5
76785c0a39023e955d802c583d4be28f204dde55
refs/heads/master
2023-01-19T22:13:27.544000
2020-11-19T19:56:38
2020-11-19T19:56:38
224,686,489
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mmalaenko.security; import javax.servlet.*; import javax.servlet.annotation.WebFilter; import javax.servlet.http.HttpFilter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; import java.util.List; import java.util.Optional; import com.mmalaenko.model.User; import com.mmalaenko.repository.UserRepository; import com.mmalaenko.repository.impl.UserRepositoryImpl; import com.mmalaenko.service.UserService; import com.mmalaenko.service.impl.UserServiceImpl; import lombok.extern.slf4j.Slf4j; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @Slf4j @WebFilter(urlPatterns = {"/shop"}) public class LoginFilter extends HttpFilter { private UserRepository userRepository; @Override public void init() throws ServletException { userRepository=new UserRepositoryImpl(); } protected void doFilter(HttpServletRequest req, HttpServletResponse res, FilterChain chain) throws IOException, ServletException { HttpSession session= req.getSession(); String userName; String password; if (session.getAttribute("userName")==null) { userName = req.getParameter("userName"); password = req.getParameter("password"); session.setAttribute("userName", userName); session.setAttribute("password", password); } else{ userName = (String) session.getAttribute("userName"); password = (String) session.getAttribute("password"); } final Optional<User> userByLogin=userRepository.getUserByLogin(userName); if(!userByLogin.isPresent()){ userRepository.save(User.builder() .login(userName) .password(password) .build()); log.info("User save in DB in filter"); session.setAttribute("userName", userName); } if ((req.getParameter("check") != null)) { session.setAttribute("check","on"); chain.doFilter(req,res); } else { if(session.getAttribute("check")!=null) { chain.doFilter(req,res); log.info("LoginFilter done"); } else { log.info("login attempt without confirmation"); req.getRequestDispatcher("/WEB-INF/welcome-page.jsp").forward(req,res); } } } @Override public void destroy() { } }
UTF-8
Java
2,542
java
LoginFilter.java
Java
[]
null
[]
package com.mmalaenko.security; import javax.servlet.*; import javax.servlet.annotation.WebFilter; import javax.servlet.http.HttpFilter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; import java.util.List; import java.util.Optional; import com.mmalaenko.model.User; import com.mmalaenko.repository.UserRepository; import com.mmalaenko.repository.impl.UserRepositoryImpl; import com.mmalaenko.service.UserService; import com.mmalaenko.service.impl.UserServiceImpl; import lombok.extern.slf4j.Slf4j; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @Slf4j @WebFilter(urlPatterns = {"/shop"}) public class LoginFilter extends HttpFilter { private UserRepository userRepository; @Override public void init() throws ServletException { userRepository=new UserRepositoryImpl(); } protected void doFilter(HttpServletRequest req, HttpServletResponse res, FilterChain chain) throws IOException, ServletException { HttpSession session= req.getSession(); String userName; String password; if (session.getAttribute("userName")==null) { userName = req.getParameter("userName"); password = req.getParameter("password"); session.setAttribute("userName", userName); session.setAttribute("password", password); } else{ userName = (String) session.getAttribute("userName"); password = (String) session.getAttribute("password"); } final Optional<User> userByLogin=userRepository.getUserByLogin(userName); if(!userByLogin.isPresent()){ userRepository.save(User.builder() .login(userName) .password(password) .build()); log.info("User save in DB in filter"); session.setAttribute("userName", userName); } if ((req.getParameter("check") != null)) { session.setAttribute("check","on"); chain.doFilter(req,res); } else { if(session.getAttribute("check")!=null) { chain.doFilter(req,res); log.info("LoginFilter done"); } else { log.info("login attempt without confirmation"); req.getRequestDispatcher("/WEB-INF/welcome-page.jsp").forward(req,res); } } } @Override public void destroy() { } }
2,542
0.649095
0.647128
79
31.177216
24.551037
134
false
false
0
0
0
0
0
0
0.620253
false
false
10
2ee25437edf4c6f08eefe1b0668b7b3da6aa6bbf
12,695,923,368,479
7df40f6ea2209b7d48979465fd8081ec2ad198cc
/TOOLS/server/com/google/common/jimfs/Jimfs.java
e120b3b9fb04bd2bc6c46e1b9a84742169be23b7
[ "IJG" ]
permissive
warchiefmarkus/WurmServerModLauncher-0.43
https://github.com/warchiefmarkus/WurmServerModLauncher-0.43
d513810045c7f9aebbf2ec3ee38fc94ccdadd6db
3e9d624577178cd4a5c159e8f61a1dd33d9463f6
refs/heads/master
2021-09-27T10:11:56.037000
2021-09-19T16:23:45
2021-09-19T16:23:45
252,689,028
0
0
null
false
2021-09-19T16:53:10
2020-04-03T09:33:50
2021-09-19T16:49:02
2021-09-19T16:53:09
3,175
0
0
3
Java
false
false
/* */ package com.google.common.jimfs; /* */ /* */ import com.google.common.annotations.VisibleForTesting; /* */ import com.google.common.base.Preconditions; /* */ import com.google.common.collect.ImmutableMap; /* */ import java.io.IOException; /* */ import java.net.URI; /* */ import java.net.URISyntaxException; /* */ import java.nio.file.FileSystem; /* */ import java.nio.file.FileSystems; /* */ import java.util.Map; /* */ import java.util.UUID; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public final class Jimfs /* */ { /* */ public static final String URI_SCHEME = "jimfs"; /* */ /* */ public static FileSystem newFileSystem() { /* 92 */ return newFileSystem(newRandomFileSystemName()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static FileSystem newFileSystem(String name) { /* 110 */ return newFileSystem(name, Configuration.forCurrentPlatform()); /* */ } /* */ /* */ /* */ /* */ /* */ public static FileSystem newFileSystem(Configuration configuration) { /* 117 */ return newFileSystem(newRandomFileSystemName(), configuration); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static FileSystem newFileSystem(String name, Configuration configuration) { /* */ try { /* 130 */ URI uri = new URI("jimfs", name, null, null); /* 131 */ return newFileSystem(uri, configuration); /* 132 */ } catch (URISyntaxException e) { /* 133 */ throw new IllegalArgumentException(e); /* */ } /* */ } /* */ /* */ @VisibleForTesting /* */ static FileSystem newFileSystem(URI uri, Configuration config) { /* 139 */ Preconditions.checkArgument("jimfs".equals(uri.getScheme()), "uri (%s) must have scheme %s", new Object[] { uri, "jimfs" }); /* */ /* */ /* */ /* */ /* */ try { /* 145 */ JimfsFileSystem fileSystem = JimfsFileSystems.newFileSystem(JimfsFileSystemProvider.instance(), uri, config); /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 155 */ ImmutableMap<String, ?> env = ImmutableMap.of("fileSystem", fileSystem); /* 156 */ FileSystems.newFileSystem(uri, (Map<String, ?>)env, SystemJimfsFileSystemProvider.class.getClassLoader()); /* */ /* 158 */ return fileSystem; /* 159 */ } catch (IOException e) { /* 160 */ throw new AssertionError(e); /* */ } /* */ } /* */ /* */ private static String newRandomFileSystemName() { /* 165 */ return UUID.randomUUID().toString(); /* */ } /* */ } /* Location: C:\Users\leo\Desktop\server.jar!\com\google\common\jimfs\Jimfs.class * Java compiler version: 7 (51.0) * JD-Core Version: 1.1.3 */
UTF-8
Java
3,838
java
Jimfs.java
Java
[]
null
[]
/* */ package com.google.common.jimfs; /* */ /* */ import com.google.common.annotations.VisibleForTesting; /* */ import com.google.common.base.Preconditions; /* */ import com.google.common.collect.ImmutableMap; /* */ import java.io.IOException; /* */ import java.net.URI; /* */ import java.net.URISyntaxException; /* */ import java.nio.file.FileSystem; /* */ import java.nio.file.FileSystems; /* */ import java.util.Map; /* */ import java.util.UUID; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public final class Jimfs /* */ { /* */ public static final String URI_SCHEME = "jimfs"; /* */ /* */ public static FileSystem newFileSystem() { /* 92 */ return newFileSystem(newRandomFileSystemName()); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static FileSystem newFileSystem(String name) { /* 110 */ return newFileSystem(name, Configuration.forCurrentPlatform()); /* */ } /* */ /* */ /* */ /* */ /* */ public static FileSystem newFileSystem(Configuration configuration) { /* 117 */ return newFileSystem(newRandomFileSystemName(), configuration); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static FileSystem newFileSystem(String name, Configuration configuration) { /* */ try { /* 130 */ URI uri = new URI("jimfs", name, null, null); /* 131 */ return newFileSystem(uri, configuration); /* 132 */ } catch (URISyntaxException e) { /* 133 */ throw new IllegalArgumentException(e); /* */ } /* */ } /* */ /* */ @VisibleForTesting /* */ static FileSystem newFileSystem(URI uri, Configuration config) { /* 139 */ Preconditions.checkArgument("jimfs".equals(uri.getScheme()), "uri (%s) must have scheme %s", new Object[] { uri, "jimfs" }); /* */ /* */ /* */ /* */ /* */ try { /* 145 */ JimfsFileSystem fileSystem = JimfsFileSystems.newFileSystem(JimfsFileSystemProvider.instance(), uri, config); /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 155 */ ImmutableMap<String, ?> env = ImmutableMap.of("fileSystem", fileSystem); /* 156 */ FileSystems.newFileSystem(uri, (Map<String, ?>)env, SystemJimfsFileSystemProvider.class.getClassLoader()); /* */ /* 158 */ return fileSystem; /* 159 */ } catch (IOException e) { /* 160 */ throw new AssertionError(e); /* */ } /* */ } /* */ /* */ private static String newRandomFileSystemName() { /* 165 */ return UUID.randomUUID().toString(); /* */ } /* */ } /* Location: C:\Users\leo\Desktop\server.jar!\com\google\common\jimfs\Jimfs.class * Java compiler version: 7 (51.0) * JD-Core Version: 1.1.3 */
3,838
0.397603
0.384315
173
21.190752
24.063585
138
false
false
0
0
0
0
0
0
0.248555
false
false
10
5cc9a61efdee217ca194d223bcdc7f20512cb9cb
33,071,248,194,930
e268a2824f917d6e7ae22bae7d9764b904b0cbc1
/src/main/java/ch.randelshofer.simplequestion/ch/randelshofer/gift/highlight/GIFTScanner.java
e8bb9a6294ffe528410f889b07870227da9937ab
[ "MIT" ]
permissive
wrandelshofer/SimpleQuestion
https://github.com/wrandelshofer/SimpleQuestion
7a76aca32c289c5d84e66625282655a6baf8ff09
02e4d8e8c1bd4ce078524dc57153a82fb2b47dc7
refs/heads/master
2021-06-27T00:04:34.824000
2020-11-01T11:14:02
2020-11-01T11:14:02
163,732,031
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * @(#)GIFTScanner.java * Copyright © 2020 Werner Randelshofer, Switzerland. MIT License. */ package ch.randelshofer.gift.highlight; import ch.randelshofer.gui.highlight.Scanner; /** * <p>Provide a hand-written scanner for the GIFT language. * This scanner is used for syntax highlighting in the editor. * * @version 2.0.1 2008-12-03 The '.' character was wrongly marked as bad if it was * located at CONTEXT_TEXTUAL_ANSWERBEGIN. Multi-line comments were wrongly * supported. The second new-line after a single-line comment was wrongly * considered as being part of the comment. * <br>2.0 2008-02-20 Added CONTEXT_QUESTIN_BEGIN. Fixed highlighting * issues with titles. * <br>1.1.1 2006-11-29 Fixed bug in read method. * <br>1.1 2006-10-08 Fixed highlighting of full stops. */ public class GIFTScanner extends Scanner implements GIFTTokenTypes { private final static int CONTEXT_QUESTION_BEGIN = 0; private final static int CONTEXT_QUESTION_TITLE = 1; private final static int CONTEXT_QUESTION = 2; private final static int CONTEXT_ANSWERLIST_BEGIN = 3; private final static int CONTEXT_TEXTUAL_ANSWERLIST = 4; private final static int CONTEXT_NUMERICAL_ANSWERLIST = 5; private final static int CONTEXT_TEXTUAL_ANSWERBEGIN = 6; private final static int CONTEXT_TEXTUAL_ANSWERWEIGHT = 7; private final static int CONTEXT_TEXTUAL_ANSWER = 8; private final static int CONTEXT_TEXTUAL_ANSWER_PAIR = 9; private final static int CONTEXT_TEXTUAL_ANSWERFEEDBACK = 10; private final static int CONTEXT_NUMERICAL_ANSWERBEGIN = 11; private final static int CONTEXT_NUMERICAL_ANSWERWEIGHT = 12; private final static int CONTEXT_NUMERICAL_ANSWER = 13; private final static int CONTEXT_NUMERICAL_ANSWERFEEDBACK = 14; private boolean debug = false; /** * Classify the ascii characters using an array of kinds. */ private static final byte[] kind = new byte[128]; /** * Classify all * other unicode characters using an array indexed by unicode category. * See the source file java/lang/Character.java for the categories. * To find the classification of a character, use: * if (c < 128) k = kind[c]; else k = unikind[Character.getType(c)]; */ private static final byte[] unikind = new byte[31]; /** * Record the number of source code characters used up. */ private int charlength = 1; /** * To deal with an odd * or even number of backslashes preceding a unicode escape, whenever a * second backslash is coming up, mark its position as a pair. */ private int pair = 0; public GIFTScanner() { initKind(); initUniKind(); } private char next() { charlength = 1; if (start >= end) { return 26; } // EOF char c = buffer[start]; if (c != '\\') { return c; } if (start == pair) { pair = 0; charlength = 2; return '\\'; } if (start + 1 >= end) { return '\\'; } c = buffer[start + 1]; charlength = 2; if (c == '\\') { pair = start + 1; } return '\\'; } /** * <p>Read one token from the start of the current text buffer, given the * start offset, end offset, and current scanner state. The method moves * the start offset past the token, updates the scanner state, and returns * the type of the token just scanned. * <p/> * <p>The scanner state is a representative token type. It is either the * state left after the last call to read, or the type of the old token at * the same position if rescanning, or WHITESPACE if at the start of a * document. The method succeeds in all cases, returning whitespace or * comment or error tokens where necessary. Each line of a multi-line * comment is treated as a separate token, to improve incremental * rescanning. If the buffer does not extend to the end of the document, * the last token returned for the buffer may be incomplete and the caller * must rescan it. The read method can be overridden to implement different * languages. The default version splits plain text into words, numbers and * punctuation. */ @Override protected int read() { // System.out.println("GIFTScanner read "+start+".."+end+" c="+context); int begin = start; charlength = 1; if (start >= end) { return WHITESPACE; } char c = buffer[start]; int type = getKind(c); if (c == '\\') { c = next(); type = WORD; } boolean consumed = false; // comments are context free; switch (type) { case COMMENT: start = start + charlength; charlength = 1; type = readSlash(); if (type == START_COMMENT) { state = MID_COMMENT; } consumed = true; break; case WHITESPACE: start = start + charlength; charlength = 1; while (start < end) { c = buffer[start]; int k = getKind(c); if (c == '\\') { c = next(); k = WORD; } if (k != WHITESPACE) { break; } start = start + charlength; charlength = 1; } consumed = true; break; case WORD: start = start + charlength; charlength = 1; while (start < end) { c = buffer[start]; int k = getKind(c); if (c == '\\') { c = next(); k = WORD; } if (k != WORD) { break; } start = start + charlength; charlength = 1; } consumed = true; break; case NUMBER: int decimalPoint = -10; start = start + charlength; charlength = 1; while (start < end) { c = buffer[start]; int k = getKind(c); if (c == '\\') { c = next(); k = WORD; } if (k == OPERATOR && c == '.') { if (decimalPoint == -10) { decimalPoint = start; k = NUMBER; } } if (k != NUMBER) { break; } start = start + charlength; charlength = 1; } if (decimalPoint == start - 1) { start = start - 1; } consumed = true; break; } // ------------------------ switch (context) { case CONTEXT_QUESTION_BEGIN: switch (type) { case WORD: case NUMBER: type = WORD; context = CONTEXT_QUESTION; break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case ':': type = readTitleOperator(c); context = CONTEXT_QUESTION_TITLE; break; case '{': context = CONTEXT_ANSWERLIST_BEGIN; break; case '}': type = bad(type); break; default: context = CONTEXT_QUESTION; break; } consumed = true; } break; } break; case CONTEXT_QUESTION_TITLE: switch (type) { case WORD: case NUMBER: type = TITLE; break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; type = readTitleOperator(c); if (type == OPERATOR) { context = CONTEXT_QUESTION; } else { type = TITLE; } consumed = true; } break; } break; case CONTEXT_QUESTION: switch (type) { case NUMBER: type = WORD; break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '{': context = CONTEXT_ANSWERLIST_BEGIN; break; case '}': type = bad(type); break; case ':': type = readTitleOperator(':'); if (type == OPERATOR) { type = bad(type); } break; default: type = WORD; break; } consumed = true; } else { type = WORD; } break; case NEWLINE: if (!consumed) { start = start + charlength; charlength = 1; type = readQuestionSeparator(c); if (type == QUESTION_SEPARATOR) { context = CONTEXT_QUESTION_BEGIN; } consumed = true; } break; } break; case CONTEXT_ANSWERLIST_BEGIN: switch (type) { case WORD: if (isSymbol(LITERAL, new String(buffer, begin, start - begin))) { type = LITERAL; } else { type = ANSWER; // type = bad(type); } context = CONTEXT_TEXTUAL_ANSWER; break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '#': context = CONTEXT_NUMERICAL_ANSWERLIST; type = NUMERIC_OPERATOR; break; case '%': readExternal(); type = LITERAL; context = CONTEXT_TEXTUAL_ANSWERLIST; break; case '=': case '~': context = CONTEXT_TEXTUAL_ANSWERBEGIN; break; case '}': // essay question have an empty answer { } context = CONTEXT_QUESTION; break; default: context = CONTEXT_TEXTUAL_ANSWERLIST; type = bad(type); break; } consumed = true; } break; } break; case CONTEXT_TEXTUAL_ANSWERLIST: switch (type) { case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '=': case '~': context = CONTEXT_TEXTUAL_ANSWERBEGIN; break; case '}': context = CONTEXT_QUESTION; break; default: type = bad(type); break; } consumed = true; } break; } break; case CONTEXT_TEXTUAL_ANSWERBEGIN: switch (type) { case NUMBER: case WORD: type = ANSWER; context = CONTEXT_TEXTUAL_ANSWER; break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '%': context = CONTEXT_TEXTUAL_ANSWERWEIGHT; break; case '}': type = bad(type); context = CONTEXT_QUESTION; break; case '-': c = buffer[start]; charlength = 1; int k = getKind(c); if (c == '\\') { c = next(); k = ANSWER; } if (c == '>') { type = bad(OPERATOR); start = start + charlength; charlength = 1; } else { type = ANSWER; } context = CONTEXT_TEXTUAL_ANSWER; break; case '.': type = ANSWER; context = CONTEXT_TEXTUAL_ANSWER; break; default: type = bad(type); break; } consumed = true; } break; } break; case CONTEXT_TEXTUAL_ANSWERWEIGHT: switch (type) { case NUMBER: type = OPERATOR; break; case WORD: context = CONTEXT_TEXTUAL_ANSWER; type = bad(type); break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '%': context = CONTEXT_TEXTUAL_ANSWER; break; case '-': type = OPERATOR; break; case '}': type = bad(type); context = CONTEXT_QUESTION; break; default: type = bad(type); context = CONTEXT_TEXTUAL_ANSWER; break; } consumed = true; } break; } break; case CONTEXT_TEXTUAL_ANSWER: switch (type) { case NUMBER: case WORD: type = ANSWER; context = CONTEXT_TEXTUAL_ANSWER; break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '=': case '~': context = CONTEXT_TEXTUAL_ANSWERBEGIN; break; case '#': context = CONTEXT_TEXTUAL_ANSWERFEEDBACK; break; case '.': case ':': case '>': type = ANSWER; context = CONTEXT_TEXTUAL_ANSWER; break; case '-': c = buffer[start]; charlength = 1; int k = getKind(c); if (c == '\\') { c = next(); k = ANSWER; } if (c == '>') { type = OPERATOR; start = start + charlength; charlength = 1; context = CONTEXT_TEXTUAL_ANSWER_PAIR; } else { type = ANSWER; context = CONTEXT_TEXTUAL_ANSWER; } break; case '}': context = CONTEXT_QUESTION; break; default: type = bad(type); break; } consumed = true; } break; } break; case CONTEXT_TEXTUAL_ANSWER_PAIR: switch (type) { case NUMBER: case WORD: type = ANSWER; break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '=': case '~': context = CONTEXT_TEXTUAL_ANSWERBEGIN; break; case '#': context = CONTEXT_TEXTUAL_ANSWERFEEDBACK; break; case '.': case ':': case '>': type = ANSWER; break; case '-': c = buffer[start]; charlength = 1; int k = getKind(c); if (c == '\\') { c = next(); k = ANSWER; } if (c == '>') { type = bad(OPERATOR); start = start + charlength; charlength = 1; } else { type = ANSWER; } break; case '}': context = CONTEXT_QUESTION; break; default: type = bad(type); break; } consumed = true; } break; } break; case CONTEXT_TEXTUAL_ANSWERFEEDBACK: switch (type) { case NUMBER: case WORD: type = FEEDBACK; break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '=': case '~': context = CONTEXT_TEXTUAL_ANSWERBEGIN; break; case '}': context = CONTEXT_QUESTION; break; case '{': case '#': type = bad(type); break; default: type = FEEDBACK; break; } consumed = true; } break; } break; case CONTEXT_NUMERICAL_ANSWERLIST: switch (type) { case NUMBER: context = CONTEXT_NUMERICAL_ANSWER; break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '=': case '~': context = CONTEXT_NUMERICAL_ANSWERBEGIN; break; case '.': case '-': context = CONTEXT_NUMERICAL_ANSWER; break; case '%': context = CONTEXT_NUMERICAL_ANSWERWEIGHT; break; case '}': context = CONTEXT_QUESTION; break; default: type = bad(type); break; } consumed = true; } break; } break; case CONTEXT_NUMERICAL_ANSWERBEGIN: switch (type) { case NUMBER: context = CONTEXT_NUMERICAL_ANSWER; break; case WORD: type = bad(type); context = CONTEXT_NUMERICAL_ANSWER; break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '-': type = NUMBER; context = CONTEXT_NUMERICAL_ANSWER; break; case '%': context = CONTEXT_NUMERICAL_ANSWERWEIGHT; break; case '}': type = bad(type); context = CONTEXT_QUESTION; break; default: type = bad(type); break; } consumed = true; } break; } break; case CONTEXT_NUMERICAL_ANSWERWEIGHT: switch (type) { case NUMBER: type = OPERATOR; break; case WORD: context = CONTEXT_NUMERICAL_ANSWER; type = bad(type); break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '%': context = CONTEXT_NUMERICAL_ANSWER; break; case '-': type = NUMBER; break; case '}': type = bad(type); context = CONTEXT_QUESTION; break; default: type = bad(type); context = CONTEXT_NUMERICAL_ANSWER; break; } consumed = true; } break; } break; case CONTEXT_NUMERICAL_ANSWER: switch (type) { case WORD: type = bad(type); break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '=': case '~': context = CONTEXT_NUMERICAL_ANSWERBEGIN; consumed = true; break; case '#': context = CONTEXT_NUMERICAL_ANSWERFEEDBACK; consumed = true; break; case ':': consumed = true; break; case '-': type = NUMBER; consumed = true; break; case '.': if (start >= buffer.length) { type = NUMBER; break; } else { c = buffer[start]; charlength = 1; int k = getKind(c); if (c == '\\') { c = next(); k = ANSWER; } if (c == '.') { start = start + charlength; charlength = 1; } else { type = bad(type); } consumed = true; break; } case '}': context = CONTEXT_QUESTION; consumed = true; break; default: type = bad(type); consumed = true; break; } } break; } break; case CONTEXT_NUMERICAL_ANSWERFEEDBACK: switch (type) { case NUMBER: case WORD: type = FEEDBACK; break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '=': case '~': context = CONTEXT_NUMERICAL_ANSWERBEGIN; break; case '}': context = CONTEXT_QUESTION; break; case '{': type = bad(type); break; default: type = FEEDBACK; break; } consumed = true; } break; } break; default: throw new InternalError("GIFTScanner unknown context:" + context); } if (!consumed) { start = start + charlength; charlength = 1; } return type; /* switch (type) { case WHITESPACE : start = start + charlength; charlength = 1; while (start < end) { c = buffer[start]; if (c == '\\') { c = next(); } int k = getKind(c); if (k != type) { break; } start = start + charlength; charlength = 1; } break; case NEWLINE : start = start + charlength; int linecount = 1; charlength = 1; while (start < end) { c = buffer[start]; if (c == '\\') c = next(); int k = getKind(c); if (k != NEWLINE && k != WHITESPACE) { break; } start = start + charlength; charlength = 1; if (k == NEWLINE) { linecount++; } } if (linecount > 1 && (context == CONTEXT_QUESTION)) { type = QUESTION_SEPARATOR; } break; case OPERATOR: start = start + charlength; charlength = 1; type = readOperator(c); break; case COMMENT : start = start + charlength; charlength = 1; type = readSlash(); break; case ANSWERLIST_BEGIN : start = start + charlength; charlength = 1; break; case ANSWERLIST_END : start = start + charlength; charlength = 1; break; default: start = start + charlength; charlength = 1; while (start < end) { c = buffer[start]; int k = getKind(c); if (c == '\\') { c = next(); k = WORD; } if (k != type) { break; } start = start + charlength; charlength = 1; } break; } // Handle context sensitive tokens switch (type) { case COMMENT : break; case ANSWERLIST_BEGIN : if (context != CONTEXT_QUESTION_BEGIN && context != CONTEXT_QUESTION && context != CONTEXT_ANSWER_END && context != CONTEXT_TITLE_END) { type = UNRECOGNIZED; } context = CONTEXT_ANSWER; break; case ANSWERLIST_END : if (context == CONTEXT_QUESTION) { type = UNRECOGNIZED; } context = CONTEXT_ANSWER_END; break; case TITLE_BEGIN : if (context != CONTEXT_QUESTION_BEGIN) { switch (context) { case CONTEXT_TITLE : type = TITLE; break; case CONTEXT_QUESTION : case CONTEXT_ANSWER_END : type = QUESTION; break; case CONTEXT_ANSWER : case CONTEXT_TEXT_ANSWER : type = ANSWER; context = CONTEXT_TEXT_ANSWER; break; case CONTEXT_NUMERICAL_ANSWER : type = NUMBER; break; } } else { context = CONTEXT_TITLE; } break; case TITLE_END : if (context != CONTEXT_TITLE) { type = UNRECOGNIZED; } context = CONTEXT_TITLE_END; break; case NUMERIC_OPERATOR : if (context == CONTEXT_ANSWER) { context = CONTEXT_NUMERICAL_ANSWER; } else { type = UNRECOGNIZED; } break; case WHITESPACE : break; case NEWLINE : break; case QUESTION_SEPARATOR : if (context == CONTEXT_ANSWER || context == CONTEXT_NUMERICAL_ANSWER) { type = NEWLINE; } else { context = CONTEXT_QUESTION_BEGIN; } break; case OPERATOR : if (context == CONTEXT_QUESTION || context == CONTEXT_QUESTION_BEGIN) { type = UNRECOGNIZED; } break; case FEEDBACK : if (context == CONTEXT_QUESTION) { type = UNRECOGNIZED; } break; case SEPARATOR : if (context == CONTEXT_QUESTION || context == CONTEXT_QUESTION_BEGIN || context == CONTEXT_TITLE || context == CONTEXT_TITLE_END) { type = WORD; } else if (context == CONTEXT_ANSWER) { context = CONTEXT_TEXT_ANSWER; } break; case NUMBER : switch (context) { case CONTEXT_TITLE : type = TITLE; break; case CONTEXT_QUESTION_BEGIN : case CONTEXT_QUESTION : case CONTEXT_ANSWER_END : type = QUESTION; break; case CONTEXT_ANSWER : case CONTEXT_TEXT_ANSWER : type = ANSWER; context = CONTEXT_TEXT_ANSWER; break; case CONTEXT_NUMERICAL_ANSWER : type = NUMBER; break; } break; case WORD : switch (context) { case CONTEXT_TITLE : type = TITLE; break; case CONTEXT_TITLE_END : context = CONTEXT_QUESTION; type = QUESTION; break; case CONTEXT_QUESTION_BEGIN : type = QUESTION; context = CONTEXT_QUESTION; break; case CONTEXT_QUESTION : type = QUESTION; break; case CONTEXT_ANSWER : if (isSymbol(LITERAL, new String(buffer, begin, start - begin))) { type = LITERAL; } else { type = ANSWER; } context = CONTEXT_TEXT_ANSWER; break; case CONTEXT_TEXT_ANSWER : type = ANSWER; break; case CONTEXT_NUMERICAL_ANSWER : type = UNRECOGNIZED; break; case CONTEXT_ANSWER_END : context = CONTEXT_QUESTION; type = QUESTION; break; } break; } state = type; return type; */ } // Read one line of a /*...*/ comment, given the expected type int readComment(int type) { if (start >= end) { return type; } char c = buffer[start]; if (c == '\\') { c = next(); } while (true) { while (/*c != '*' &&*/c != '\n') { start = start + charlength; charlength = 1; if (start >= end) { return type; } c = buffer[start]; if (c == '\\') { c = next(); } } start = start + charlength; charlength = 1; if (c == '\n') { return type; } if (start >= end) { return type; } c = buffer[start]; if (c == '\\') { c = next(); } if (c == '/') { start = start + charlength; charlength = 1; if (type == START_COMMENT) { return COMMENT; } else { return END_COMMENT; } } } } private int readSlash() { if (start >= end) { return OPERATOR; } char c = buffer[start]; if (c == '\\') { c = next(); } if (c == '/') { while (c != '\n') { start = start + charlength; charlength = 1; if (start >= end) { return COMMENT; } c = buffer[start]; if (c == '\\') { c = next(); } } //start = start + charlength; charlength = 1; return COMMENT; } /*else if (c == '*') { start = start + charlength; charlength = 1; return readComment(START_COMMENT); }*/ return WORD;//readOperator('/'); } /** * Detects and consumes the title operator "::". * * @param c the first operator character ':' * @return OPERATOR, if the operator is a title operator. * WORD, in all other cases. */ private int readTitleOperator(char c) { if (start >= end) { return WORD; } char c2; switch (c) { case ':': c2 = buffer[start]; if (c2 != ':') { break; } start = start + charlength; charlength = 1; return OPERATOR; } return WORD; } /** * Detects and consumes the question separator "\n" (Whitespace)* "\n". * * @param c the first operator character '\n' * @return QUESTION_SEPARATOR, if the operator is a title operator. * WHITESPACE, in all other cases. */ private int readQuestionSeparator(char c) { if (start >= end) { return WHITESPACE; } int linecount = 1; while (start < end) { c = buffer[start]; int k = getKind(c); if (c == '\\') { c = next(); k = WORD; } if (k != WHITESPACE && k != NEWLINE) { break; } if (k == NEWLINE) { linecount++; } start = start + charlength; charlength = 1; } return linecount <= 1 ? WHITESPACE : QUESTION_SEPARATOR; } private int readExternal() { if (start >= end) { return LITERAL; } char c = buffer[start]; while (c != '}') { start = start + charlength; charlength = 1; if (start >= end) { return LITERAL; } c = buffer[start]; if (c == '\\') { c = next(); } } start = start + charlength - 1; charlength = 1; return LITERAL; } /*private int readFeedback() { if (start >= end) { return FEEDBACK; } char c = buffer[start]; while (c != '~' && c != '=' && c != '#' && c != '{' && c != '}') { start = start + charlength; charlength = 1; if (start >= end) { return FEEDBACK; } c = buffer[start]; if (c == '\\') c = next(); } start = start + charlength - 1; charlength = 1; return FEEDBACK; }*/ /* private int readOperator(char c) { if (start >= end) return OPERATOR; char c2; switch (c) { case ':': c2 = buffer[start]; if (c2 == '\\') { c2 = next(); } if (c2 != ':') { return NUMBER; //break; } start = start + charlength; charlength = 1; switch (context) { case CONTEXT_TITLE : return TITLE_END; default : return TITLE_BEGIN; } // break; <- not reached case '-': c2 = buffer[start]; if (c2 == '\\') { c2 = next(); } if (c2 != '>') { return NUMBER; //break; } start = start + charlength; charlength = 1; if (context == CONTEXT_NUMERICAL_ANSWER) { return UNRECOGNIZED; } break; case '.': c2 = buffer[start]; if (c2 == '\\') { c2 = next(); } if (c2 != '.') { return NUMBER; //break; } start = start + charlength; charlength = 1; return NUMBER; //break; case '#': if (context == CONTEXT_ANSWER) { return NUMERIC_OPERATOR; } else if (context == CONTEXT_QUESTION_BEGIN || context == CONTEXT_QUESTION || context == CONTEXT_TITLE || context == CONTEXT_TITLE_END) { return WORD; } else if (state == FEEDBACK) { return UNRECOGNIZED; } else { return readFeedback(); } //break; <- not reached case '>': return WORD; case '%': if (context == CONTEXT_ANSWER) { return readExternal(); } break; } return OPERATOR; } */ /** * Create the initial symbol table. */ protected void initSymbolTable() { lookup(LITERAL, "TRUE"); lookup(LITERAL, "FALSE"); lookup(LITERAL, "T"); lookup(LITERAL, "F"); } /* private char next() { if (start >= end) { return '\u0026'; //EOF character } char c = buffer[start]; if (c != '\\') { start++; return c; } if (start == pair) { pair = 0; start++; return '\\'; } if (start + 1 >= end) { start++; return '\\'; } c = buffer[start + 1]; if (c == '\\') { start++; pair = start; } return '\\'; }*/ /** * A malformed or incomplete token has a negative type. */ private int bad(int type) { return -type; } private int getKind(char c) { return (c < 128) ? kind[c] : unikind[Character.getType(c)]; } private void initKind() { for (char c = 0; c < 128; c++) { kind[c] = -1; } for (char c = 0; c < 128; c++) { switch (c) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 11: case 13: case 14: case 15: case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: case 24: case 25: case 27: case 28: case 29: case 30: case 31: case 127: kind[c] = UNRECOGNIZED; break; case '\t': kind[c] = WHITESPACE; break; case '\n': kind[c] = NEWLINE; break; case ' ': case '\f': case 26: kind[c] = WHITESPACE; break; case '#': case '%': case '-': case '>': case ':': case '.': case '\\': case '=': case '~': kind[c] = OPERATOR; break; case '/': kind[c] = COMMENT; break; case '\'': case '"': case ',': case ';': case '?': case '^': case '|': case '<': case '&': case '*': case '+': case '@': case '`': case '!': case '$': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': case '_': case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': case '(': case ')': case '[': case ']': kind[c] = WORD; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': kind[c] = NUMBER; break; case '{': kind[c] = OPERATOR; break; case '}': kind[c] = OPERATOR; break; } } for (char c = 0; c < 128; c++) { if (kind[c] == -1) { System.out.println("Char " + ((int) c) + " hasn't been classified"); } } } private void initUniKind() { for (byte b = 0; b < 31; b++) { unikind[b] = -1; } for (byte b = 0; b < 31; b++) { switch (b) { case Character.UNASSIGNED: case Character.ENCLOSING_MARK: case Character.OTHER_NUMBER: case Character.SPACE_SEPARATOR: case Character.LINE_SEPARATOR: case Character.PARAGRAPH_SEPARATOR: case Character.CONTROL: case 17: // category 17 is unused case Character.PRIVATE_USE: case Character.SURROGATE: case Character.DASH_PUNCTUATION: case Character.START_PUNCTUATION: case Character.END_PUNCTUATION: case Character.OTHER_PUNCTUATION: case Character.MATH_SYMBOL: case Character.MODIFIER_SYMBOL: case Character.OTHER_SYMBOL: case Character.INITIAL_QUOTE_PUNCTUATION: case Character.FINAL_QUOTE_PUNCTUATION: unikind[b] = WORD; break; case Character.UPPERCASE_LETTER: case Character.LOWERCASE_LETTER: case Character.TITLECASE_LETTER: case Character.MODIFIER_LETTER: case Character.OTHER_LETTER: case Character.LETTER_NUMBER: case Character.CONNECTOR_PUNCTUATION: // maybe NUMBER case Character.CURRENCY_SYMBOL: // Characters where Other_ID_Start is true unikind[b] = WORD; break; case Character.NON_SPACING_MARK: case Character.COMBINING_SPACING_MARK: case Character.DECIMAL_DIGIT_NUMBER: case Character.FORMAT: unikind[b] = WORD; break; } } for (byte b = 0; b < 31; b++) { if (unikind[b] == -1) { System.out.println("Unicode cat " + b + " hasn't been classified"); } } } }
UTF-8
Java
52,052
java
GIFTScanner.java
Java
[ { "context": "/*\n * @(#)GIFTScanner.java\n * Copyright © 2020 Werner Randelshofer, Switzerland. MIT License.\n */\npackage ch.randels", "end": 66, "score": 0.9998841881752014, "start": 47, "tag": "NAME", "value": "Werner Randelshofer" } ]
null
[]
/* * @(#)GIFTScanner.java * Copyright © 2020 <NAME>, Switzerland. MIT License. */ package ch.randelshofer.gift.highlight; import ch.randelshofer.gui.highlight.Scanner; /** * <p>Provide a hand-written scanner for the GIFT language. * This scanner is used for syntax highlighting in the editor. * * @version 2.0.1 2008-12-03 The '.' character was wrongly marked as bad if it was * located at CONTEXT_TEXTUAL_ANSWERBEGIN. Multi-line comments were wrongly * supported. The second new-line after a single-line comment was wrongly * considered as being part of the comment. * <br>2.0 2008-02-20 Added CONTEXT_QUESTIN_BEGIN. Fixed highlighting * issues with titles. * <br>1.1.1 2006-11-29 Fixed bug in read method. * <br>1.1 2006-10-08 Fixed highlighting of full stops. */ public class GIFTScanner extends Scanner implements GIFTTokenTypes { private final static int CONTEXT_QUESTION_BEGIN = 0; private final static int CONTEXT_QUESTION_TITLE = 1; private final static int CONTEXT_QUESTION = 2; private final static int CONTEXT_ANSWERLIST_BEGIN = 3; private final static int CONTEXT_TEXTUAL_ANSWERLIST = 4; private final static int CONTEXT_NUMERICAL_ANSWERLIST = 5; private final static int CONTEXT_TEXTUAL_ANSWERBEGIN = 6; private final static int CONTEXT_TEXTUAL_ANSWERWEIGHT = 7; private final static int CONTEXT_TEXTUAL_ANSWER = 8; private final static int CONTEXT_TEXTUAL_ANSWER_PAIR = 9; private final static int CONTEXT_TEXTUAL_ANSWERFEEDBACK = 10; private final static int CONTEXT_NUMERICAL_ANSWERBEGIN = 11; private final static int CONTEXT_NUMERICAL_ANSWERWEIGHT = 12; private final static int CONTEXT_NUMERICAL_ANSWER = 13; private final static int CONTEXT_NUMERICAL_ANSWERFEEDBACK = 14; private boolean debug = false; /** * Classify the ascii characters using an array of kinds. */ private static final byte[] kind = new byte[128]; /** * Classify all * other unicode characters using an array indexed by unicode category. * See the source file java/lang/Character.java for the categories. * To find the classification of a character, use: * if (c < 128) k = kind[c]; else k = unikind[Character.getType(c)]; */ private static final byte[] unikind = new byte[31]; /** * Record the number of source code characters used up. */ private int charlength = 1; /** * To deal with an odd * or even number of backslashes preceding a unicode escape, whenever a * second backslash is coming up, mark its position as a pair. */ private int pair = 0; public GIFTScanner() { initKind(); initUniKind(); } private char next() { charlength = 1; if (start >= end) { return 26; } // EOF char c = buffer[start]; if (c != '\\') { return c; } if (start == pair) { pair = 0; charlength = 2; return '\\'; } if (start + 1 >= end) { return '\\'; } c = buffer[start + 1]; charlength = 2; if (c == '\\') { pair = start + 1; } return '\\'; } /** * <p>Read one token from the start of the current text buffer, given the * start offset, end offset, and current scanner state. The method moves * the start offset past the token, updates the scanner state, and returns * the type of the token just scanned. * <p/> * <p>The scanner state is a representative token type. It is either the * state left after the last call to read, or the type of the old token at * the same position if rescanning, or WHITESPACE if at the start of a * document. The method succeeds in all cases, returning whitespace or * comment or error tokens where necessary. Each line of a multi-line * comment is treated as a separate token, to improve incremental * rescanning. If the buffer does not extend to the end of the document, * the last token returned for the buffer may be incomplete and the caller * must rescan it. The read method can be overridden to implement different * languages. The default version splits plain text into words, numbers and * punctuation. */ @Override protected int read() { // System.out.println("GIFTScanner read "+start+".."+end+" c="+context); int begin = start; charlength = 1; if (start >= end) { return WHITESPACE; } char c = buffer[start]; int type = getKind(c); if (c == '\\') { c = next(); type = WORD; } boolean consumed = false; // comments are context free; switch (type) { case COMMENT: start = start + charlength; charlength = 1; type = readSlash(); if (type == START_COMMENT) { state = MID_COMMENT; } consumed = true; break; case WHITESPACE: start = start + charlength; charlength = 1; while (start < end) { c = buffer[start]; int k = getKind(c); if (c == '\\') { c = next(); k = WORD; } if (k != WHITESPACE) { break; } start = start + charlength; charlength = 1; } consumed = true; break; case WORD: start = start + charlength; charlength = 1; while (start < end) { c = buffer[start]; int k = getKind(c); if (c == '\\') { c = next(); k = WORD; } if (k != WORD) { break; } start = start + charlength; charlength = 1; } consumed = true; break; case NUMBER: int decimalPoint = -10; start = start + charlength; charlength = 1; while (start < end) { c = buffer[start]; int k = getKind(c); if (c == '\\') { c = next(); k = WORD; } if (k == OPERATOR && c == '.') { if (decimalPoint == -10) { decimalPoint = start; k = NUMBER; } } if (k != NUMBER) { break; } start = start + charlength; charlength = 1; } if (decimalPoint == start - 1) { start = start - 1; } consumed = true; break; } // ------------------------ switch (context) { case CONTEXT_QUESTION_BEGIN: switch (type) { case WORD: case NUMBER: type = WORD; context = CONTEXT_QUESTION; break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case ':': type = readTitleOperator(c); context = CONTEXT_QUESTION_TITLE; break; case '{': context = CONTEXT_ANSWERLIST_BEGIN; break; case '}': type = bad(type); break; default: context = CONTEXT_QUESTION; break; } consumed = true; } break; } break; case CONTEXT_QUESTION_TITLE: switch (type) { case WORD: case NUMBER: type = TITLE; break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; type = readTitleOperator(c); if (type == OPERATOR) { context = CONTEXT_QUESTION; } else { type = TITLE; } consumed = true; } break; } break; case CONTEXT_QUESTION: switch (type) { case NUMBER: type = WORD; break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '{': context = CONTEXT_ANSWERLIST_BEGIN; break; case '}': type = bad(type); break; case ':': type = readTitleOperator(':'); if (type == OPERATOR) { type = bad(type); } break; default: type = WORD; break; } consumed = true; } else { type = WORD; } break; case NEWLINE: if (!consumed) { start = start + charlength; charlength = 1; type = readQuestionSeparator(c); if (type == QUESTION_SEPARATOR) { context = CONTEXT_QUESTION_BEGIN; } consumed = true; } break; } break; case CONTEXT_ANSWERLIST_BEGIN: switch (type) { case WORD: if (isSymbol(LITERAL, new String(buffer, begin, start - begin))) { type = LITERAL; } else { type = ANSWER; // type = bad(type); } context = CONTEXT_TEXTUAL_ANSWER; break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '#': context = CONTEXT_NUMERICAL_ANSWERLIST; type = NUMERIC_OPERATOR; break; case '%': readExternal(); type = LITERAL; context = CONTEXT_TEXTUAL_ANSWERLIST; break; case '=': case '~': context = CONTEXT_TEXTUAL_ANSWERBEGIN; break; case '}': // essay question have an empty answer { } context = CONTEXT_QUESTION; break; default: context = CONTEXT_TEXTUAL_ANSWERLIST; type = bad(type); break; } consumed = true; } break; } break; case CONTEXT_TEXTUAL_ANSWERLIST: switch (type) { case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '=': case '~': context = CONTEXT_TEXTUAL_ANSWERBEGIN; break; case '}': context = CONTEXT_QUESTION; break; default: type = bad(type); break; } consumed = true; } break; } break; case CONTEXT_TEXTUAL_ANSWERBEGIN: switch (type) { case NUMBER: case WORD: type = ANSWER; context = CONTEXT_TEXTUAL_ANSWER; break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '%': context = CONTEXT_TEXTUAL_ANSWERWEIGHT; break; case '}': type = bad(type); context = CONTEXT_QUESTION; break; case '-': c = buffer[start]; charlength = 1; int k = getKind(c); if (c == '\\') { c = next(); k = ANSWER; } if (c == '>') { type = bad(OPERATOR); start = start + charlength; charlength = 1; } else { type = ANSWER; } context = CONTEXT_TEXTUAL_ANSWER; break; case '.': type = ANSWER; context = CONTEXT_TEXTUAL_ANSWER; break; default: type = bad(type); break; } consumed = true; } break; } break; case CONTEXT_TEXTUAL_ANSWERWEIGHT: switch (type) { case NUMBER: type = OPERATOR; break; case WORD: context = CONTEXT_TEXTUAL_ANSWER; type = bad(type); break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '%': context = CONTEXT_TEXTUAL_ANSWER; break; case '-': type = OPERATOR; break; case '}': type = bad(type); context = CONTEXT_QUESTION; break; default: type = bad(type); context = CONTEXT_TEXTUAL_ANSWER; break; } consumed = true; } break; } break; case CONTEXT_TEXTUAL_ANSWER: switch (type) { case NUMBER: case WORD: type = ANSWER; context = CONTEXT_TEXTUAL_ANSWER; break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '=': case '~': context = CONTEXT_TEXTUAL_ANSWERBEGIN; break; case '#': context = CONTEXT_TEXTUAL_ANSWERFEEDBACK; break; case '.': case ':': case '>': type = ANSWER; context = CONTEXT_TEXTUAL_ANSWER; break; case '-': c = buffer[start]; charlength = 1; int k = getKind(c); if (c == '\\') { c = next(); k = ANSWER; } if (c == '>') { type = OPERATOR; start = start + charlength; charlength = 1; context = CONTEXT_TEXTUAL_ANSWER_PAIR; } else { type = ANSWER; context = CONTEXT_TEXTUAL_ANSWER; } break; case '}': context = CONTEXT_QUESTION; break; default: type = bad(type); break; } consumed = true; } break; } break; case CONTEXT_TEXTUAL_ANSWER_PAIR: switch (type) { case NUMBER: case WORD: type = ANSWER; break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '=': case '~': context = CONTEXT_TEXTUAL_ANSWERBEGIN; break; case '#': context = CONTEXT_TEXTUAL_ANSWERFEEDBACK; break; case '.': case ':': case '>': type = ANSWER; break; case '-': c = buffer[start]; charlength = 1; int k = getKind(c); if (c == '\\') { c = next(); k = ANSWER; } if (c == '>') { type = bad(OPERATOR); start = start + charlength; charlength = 1; } else { type = ANSWER; } break; case '}': context = CONTEXT_QUESTION; break; default: type = bad(type); break; } consumed = true; } break; } break; case CONTEXT_TEXTUAL_ANSWERFEEDBACK: switch (type) { case NUMBER: case WORD: type = FEEDBACK; break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '=': case '~': context = CONTEXT_TEXTUAL_ANSWERBEGIN; break; case '}': context = CONTEXT_QUESTION; break; case '{': case '#': type = bad(type); break; default: type = FEEDBACK; break; } consumed = true; } break; } break; case CONTEXT_NUMERICAL_ANSWERLIST: switch (type) { case NUMBER: context = CONTEXT_NUMERICAL_ANSWER; break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '=': case '~': context = CONTEXT_NUMERICAL_ANSWERBEGIN; break; case '.': case '-': context = CONTEXT_NUMERICAL_ANSWER; break; case '%': context = CONTEXT_NUMERICAL_ANSWERWEIGHT; break; case '}': context = CONTEXT_QUESTION; break; default: type = bad(type); break; } consumed = true; } break; } break; case CONTEXT_NUMERICAL_ANSWERBEGIN: switch (type) { case NUMBER: context = CONTEXT_NUMERICAL_ANSWER; break; case WORD: type = bad(type); context = CONTEXT_NUMERICAL_ANSWER; break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '-': type = NUMBER; context = CONTEXT_NUMERICAL_ANSWER; break; case '%': context = CONTEXT_NUMERICAL_ANSWERWEIGHT; break; case '}': type = bad(type); context = CONTEXT_QUESTION; break; default: type = bad(type); break; } consumed = true; } break; } break; case CONTEXT_NUMERICAL_ANSWERWEIGHT: switch (type) { case NUMBER: type = OPERATOR; break; case WORD: context = CONTEXT_NUMERICAL_ANSWER; type = bad(type); break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '%': context = CONTEXT_NUMERICAL_ANSWER; break; case '-': type = NUMBER; break; case '}': type = bad(type); context = CONTEXT_QUESTION; break; default: type = bad(type); context = CONTEXT_NUMERICAL_ANSWER; break; } consumed = true; } break; } break; case CONTEXT_NUMERICAL_ANSWER: switch (type) { case WORD: type = bad(type); break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '=': case '~': context = CONTEXT_NUMERICAL_ANSWERBEGIN; consumed = true; break; case '#': context = CONTEXT_NUMERICAL_ANSWERFEEDBACK; consumed = true; break; case ':': consumed = true; break; case '-': type = NUMBER; consumed = true; break; case '.': if (start >= buffer.length) { type = NUMBER; break; } else { c = buffer[start]; charlength = 1; int k = getKind(c); if (c == '\\') { c = next(); k = ANSWER; } if (c == '.') { start = start + charlength; charlength = 1; } else { type = bad(type); } consumed = true; break; } case '}': context = CONTEXT_QUESTION; consumed = true; break; default: type = bad(type); consumed = true; break; } } break; } break; case CONTEXT_NUMERICAL_ANSWERFEEDBACK: switch (type) { case NUMBER: case WORD: type = FEEDBACK; break; case OPERATOR: if (!consumed) { start = start + charlength; charlength = 1; switch (c) { case '=': case '~': context = CONTEXT_NUMERICAL_ANSWERBEGIN; break; case '}': context = CONTEXT_QUESTION; break; case '{': type = bad(type); break; default: type = FEEDBACK; break; } consumed = true; } break; } break; default: throw new InternalError("GIFTScanner unknown context:" + context); } if (!consumed) { start = start + charlength; charlength = 1; } return type; /* switch (type) { case WHITESPACE : start = start + charlength; charlength = 1; while (start < end) { c = buffer[start]; if (c == '\\') { c = next(); } int k = getKind(c); if (k != type) { break; } start = start + charlength; charlength = 1; } break; case NEWLINE : start = start + charlength; int linecount = 1; charlength = 1; while (start < end) { c = buffer[start]; if (c == '\\') c = next(); int k = getKind(c); if (k != NEWLINE && k != WHITESPACE) { break; } start = start + charlength; charlength = 1; if (k == NEWLINE) { linecount++; } } if (linecount > 1 && (context == CONTEXT_QUESTION)) { type = QUESTION_SEPARATOR; } break; case OPERATOR: start = start + charlength; charlength = 1; type = readOperator(c); break; case COMMENT : start = start + charlength; charlength = 1; type = readSlash(); break; case ANSWERLIST_BEGIN : start = start + charlength; charlength = 1; break; case ANSWERLIST_END : start = start + charlength; charlength = 1; break; default: start = start + charlength; charlength = 1; while (start < end) { c = buffer[start]; int k = getKind(c); if (c == '\\') { c = next(); k = WORD; } if (k != type) { break; } start = start + charlength; charlength = 1; } break; } // Handle context sensitive tokens switch (type) { case COMMENT : break; case ANSWERLIST_BEGIN : if (context != CONTEXT_QUESTION_BEGIN && context != CONTEXT_QUESTION && context != CONTEXT_ANSWER_END && context != CONTEXT_TITLE_END) { type = UNRECOGNIZED; } context = CONTEXT_ANSWER; break; case ANSWERLIST_END : if (context == CONTEXT_QUESTION) { type = UNRECOGNIZED; } context = CONTEXT_ANSWER_END; break; case TITLE_BEGIN : if (context != CONTEXT_QUESTION_BEGIN) { switch (context) { case CONTEXT_TITLE : type = TITLE; break; case CONTEXT_QUESTION : case CONTEXT_ANSWER_END : type = QUESTION; break; case CONTEXT_ANSWER : case CONTEXT_TEXT_ANSWER : type = ANSWER; context = CONTEXT_TEXT_ANSWER; break; case CONTEXT_NUMERICAL_ANSWER : type = NUMBER; break; } } else { context = CONTEXT_TITLE; } break; case TITLE_END : if (context != CONTEXT_TITLE) { type = UNRECOGNIZED; } context = CONTEXT_TITLE_END; break; case NUMERIC_OPERATOR : if (context == CONTEXT_ANSWER) { context = CONTEXT_NUMERICAL_ANSWER; } else { type = UNRECOGNIZED; } break; case WHITESPACE : break; case NEWLINE : break; case QUESTION_SEPARATOR : if (context == CONTEXT_ANSWER || context == CONTEXT_NUMERICAL_ANSWER) { type = NEWLINE; } else { context = CONTEXT_QUESTION_BEGIN; } break; case OPERATOR : if (context == CONTEXT_QUESTION || context == CONTEXT_QUESTION_BEGIN) { type = UNRECOGNIZED; } break; case FEEDBACK : if (context == CONTEXT_QUESTION) { type = UNRECOGNIZED; } break; case SEPARATOR : if (context == CONTEXT_QUESTION || context == CONTEXT_QUESTION_BEGIN || context == CONTEXT_TITLE || context == CONTEXT_TITLE_END) { type = WORD; } else if (context == CONTEXT_ANSWER) { context = CONTEXT_TEXT_ANSWER; } break; case NUMBER : switch (context) { case CONTEXT_TITLE : type = TITLE; break; case CONTEXT_QUESTION_BEGIN : case CONTEXT_QUESTION : case CONTEXT_ANSWER_END : type = QUESTION; break; case CONTEXT_ANSWER : case CONTEXT_TEXT_ANSWER : type = ANSWER; context = CONTEXT_TEXT_ANSWER; break; case CONTEXT_NUMERICAL_ANSWER : type = NUMBER; break; } break; case WORD : switch (context) { case CONTEXT_TITLE : type = TITLE; break; case CONTEXT_TITLE_END : context = CONTEXT_QUESTION; type = QUESTION; break; case CONTEXT_QUESTION_BEGIN : type = QUESTION; context = CONTEXT_QUESTION; break; case CONTEXT_QUESTION : type = QUESTION; break; case CONTEXT_ANSWER : if (isSymbol(LITERAL, new String(buffer, begin, start - begin))) { type = LITERAL; } else { type = ANSWER; } context = CONTEXT_TEXT_ANSWER; break; case CONTEXT_TEXT_ANSWER : type = ANSWER; break; case CONTEXT_NUMERICAL_ANSWER : type = UNRECOGNIZED; break; case CONTEXT_ANSWER_END : context = CONTEXT_QUESTION; type = QUESTION; break; } break; } state = type; return type; */ } // Read one line of a /*...*/ comment, given the expected type int readComment(int type) { if (start >= end) { return type; } char c = buffer[start]; if (c == '\\') { c = next(); } while (true) { while (/*c != '*' &&*/c != '\n') { start = start + charlength; charlength = 1; if (start >= end) { return type; } c = buffer[start]; if (c == '\\') { c = next(); } } start = start + charlength; charlength = 1; if (c == '\n') { return type; } if (start >= end) { return type; } c = buffer[start]; if (c == '\\') { c = next(); } if (c == '/') { start = start + charlength; charlength = 1; if (type == START_COMMENT) { return COMMENT; } else { return END_COMMENT; } } } } private int readSlash() { if (start >= end) { return OPERATOR; } char c = buffer[start]; if (c == '\\') { c = next(); } if (c == '/') { while (c != '\n') { start = start + charlength; charlength = 1; if (start >= end) { return COMMENT; } c = buffer[start]; if (c == '\\') { c = next(); } } //start = start + charlength; charlength = 1; return COMMENT; } /*else if (c == '*') { start = start + charlength; charlength = 1; return readComment(START_COMMENT); }*/ return WORD;//readOperator('/'); } /** * Detects and consumes the title operator "::". * * @param c the first operator character ':' * @return OPERATOR, if the operator is a title operator. * WORD, in all other cases. */ private int readTitleOperator(char c) { if (start >= end) { return WORD; } char c2; switch (c) { case ':': c2 = buffer[start]; if (c2 != ':') { break; } start = start + charlength; charlength = 1; return OPERATOR; } return WORD; } /** * Detects and consumes the question separator "\n" (Whitespace)* "\n". * * @param c the first operator character '\n' * @return QUESTION_SEPARATOR, if the operator is a title operator. * WHITESPACE, in all other cases. */ private int readQuestionSeparator(char c) { if (start >= end) { return WHITESPACE; } int linecount = 1; while (start < end) { c = buffer[start]; int k = getKind(c); if (c == '\\') { c = next(); k = WORD; } if (k != WHITESPACE && k != NEWLINE) { break; } if (k == NEWLINE) { linecount++; } start = start + charlength; charlength = 1; } return linecount <= 1 ? WHITESPACE : QUESTION_SEPARATOR; } private int readExternal() { if (start >= end) { return LITERAL; } char c = buffer[start]; while (c != '}') { start = start + charlength; charlength = 1; if (start >= end) { return LITERAL; } c = buffer[start]; if (c == '\\') { c = next(); } } start = start + charlength - 1; charlength = 1; return LITERAL; } /*private int readFeedback() { if (start >= end) { return FEEDBACK; } char c = buffer[start]; while (c != '~' && c != '=' && c != '#' && c != '{' && c != '}') { start = start + charlength; charlength = 1; if (start >= end) { return FEEDBACK; } c = buffer[start]; if (c == '\\') c = next(); } start = start + charlength - 1; charlength = 1; return FEEDBACK; }*/ /* private int readOperator(char c) { if (start >= end) return OPERATOR; char c2; switch (c) { case ':': c2 = buffer[start]; if (c2 == '\\') { c2 = next(); } if (c2 != ':') { return NUMBER; //break; } start = start + charlength; charlength = 1; switch (context) { case CONTEXT_TITLE : return TITLE_END; default : return TITLE_BEGIN; } // break; <- not reached case '-': c2 = buffer[start]; if (c2 == '\\') { c2 = next(); } if (c2 != '>') { return NUMBER; //break; } start = start + charlength; charlength = 1; if (context == CONTEXT_NUMERICAL_ANSWER) { return UNRECOGNIZED; } break; case '.': c2 = buffer[start]; if (c2 == '\\') { c2 = next(); } if (c2 != '.') { return NUMBER; //break; } start = start + charlength; charlength = 1; return NUMBER; //break; case '#': if (context == CONTEXT_ANSWER) { return NUMERIC_OPERATOR; } else if (context == CONTEXT_QUESTION_BEGIN || context == CONTEXT_QUESTION || context == CONTEXT_TITLE || context == CONTEXT_TITLE_END) { return WORD; } else if (state == FEEDBACK) { return UNRECOGNIZED; } else { return readFeedback(); } //break; <- not reached case '>': return WORD; case '%': if (context == CONTEXT_ANSWER) { return readExternal(); } break; } return OPERATOR; } */ /** * Create the initial symbol table. */ protected void initSymbolTable() { lookup(LITERAL, "TRUE"); lookup(LITERAL, "FALSE"); lookup(LITERAL, "T"); lookup(LITERAL, "F"); } /* private char next() { if (start >= end) { return '\u0026'; //EOF character } char c = buffer[start]; if (c != '\\') { start++; return c; } if (start == pair) { pair = 0; start++; return '\\'; } if (start + 1 >= end) { start++; return '\\'; } c = buffer[start + 1]; if (c == '\\') { start++; pair = start; } return '\\'; }*/ /** * A malformed or incomplete token has a negative type. */ private int bad(int type) { return -type; } private int getKind(char c) { return (c < 128) ? kind[c] : unikind[Character.getType(c)]; } private void initKind() { for (char c = 0; c < 128; c++) { kind[c] = -1; } for (char c = 0; c < 128; c++) { switch (c) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 11: case 13: case 14: case 15: case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: case 24: case 25: case 27: case 28: case 29: case 30: case 31: case 127: kind[c] = UNRECOGNIZED; break; case '\t': kind[c] = WHITESPACE; break; case '\n': kind[c] = NEWLINE; break; case ' ': case '\f': case 26: kind[c] = WHITESPACE; break; case '#': case '%': case '-': case '>': case ':': case '.': case '\\': case '=': case '~': kind[c] = OPERATOR; break; case '/': kind[c] = COMMENT; break; case '\'': case '"': case ',': case ';': case '?': case '^': case '|': case '<': case '&': case '*': case '+': case '@': case '`': case '!': case '$': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': case '_': case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': case '(': case ')': case '[': case ']': kind[c] = WORD; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': kind[c] = NUMBER; break; case '{': kind[c] = OPERATOR; break; case '}': kind[c] = OPERATOR; break; } } for (char c = 0; c < 128; c++) { if (kind[c] == -1) { System.out.println("Char " + ((int) c) + " hasn't been classified"); } } } private void initUniKind() { for (byte b = 0; b < 31; b++) { unikind[b] = -1; } for (byte b = 0; b < 31; b++) { switch (b) { case Character.UNASSIGNED: case Character.ENCLOSING_MARK: case Character.OTHER_NUMBER: case Character.SPACE_SEPARATOR: case Character.LINE_SEPARATOR: case Character.PARAGRAPH_SEPARATOR: case Character.CONTROL: case 17: // category 17 is unused case Character.PRIVATE_USE: case Character.SURROGATE: case Character.DASH_PUNCTUATION: case Character.START_PUNCTUATION: case Character.END_PUNCTUATION: case Character.OTHER_PUNCTUATION: case Character.MATH_SYMBOL: case Character.MODIFIER_SYMBOL: case Character.OTHER_SYMBOL: case Character.INITIAL_QUOTE_PUNCTUATION: case Character.FINAL_QUOTE_PUNCTUATION: unikind[b] = WORD; break; case Character.UPPERCASE_LETTER: case Character.LOWERCASE_LETTER: case Character.TITLECASE_LETTER: case Character.MODIFIER_LETTER: case Character.OTHER_LETTER: case Character.LETTER_NUMBER: case Character.CONNECTOR_PUNCTUATION: // maybe NUMBER case Character.CURRENCY_SYMBOL: // Characters where Other_ID_Start is true unikind[b] = WORD; break; case Character.NON_SPACING_MARK: case Character.COMBINING_SPACING_MARK: case Character.DECIMAL_DIGIT_NUMBER: case Character.FORMAT: unikind[b] = WORD; break; } } for (byte b = 0; b < 31; b++) { if (unikind[b] == -1) { System.out.println("Unicode cat " + b + " hasn't been classified"); } } } }
52,039
0.329792
0.324566
1,531
32.998039
16.873274
90
false
false
0
0
0
0
0
0
0.485304
false
false
10
04e1d8706f084f9e32d4cf8c254eeae965b1e627
14,482,629,764,863
fcb371854d34350a4f95df10f647f07c85fa53b1
/dubbo-deep-cache/cache-api/src/main/java/com/rainbow/learning/dubbo/api/cluster/FailbackClusterService.java
d3ca2c46c1b8d54a055d65a262933dc67489a614
[]
no_license
Lovelcp/dubbo-deep
https://github.com/Lovelcp/dubbo-deep
bf116c932321f6a1741f817b3c89bdabcb93c5c6
d94c69d4ba8c81212d14fde3c987599e7a36d3c0
refs/heads/master
2021-01-23T15:17:36.409000
2018-01-31T11:40:18
2018-01-31T11:40:18
102,705,163
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rainbow.learning.dubbo.api.cluster; public interface FailbackClusterService { }
UTF-8
Java
93
java
FailbackClusterService.java
Java
[]
null
[]
package com.rainbow.learning.dubbo.api.cluster; public interface FailbackClusterService { }
93
0.827957
0.827957
4
22.25
21.856064
47
false
false
0
0
0
0
0
0
0.25
false
false
10
57e7cfac84b266656fb13100ade6afb746391663
10,496,900,086,232
78e75654f4e33c07b5066b887559c533b97797ed
/storm/src/test/java/com/caseystella/analytics/outlier/StreamingOutlierIntegrationTest.java
9e1361b078c0e27bfa8d86582eb2ffc57585434b
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
visenger/streaming_outliers
https://github.com/visenger/streaming_outliers
23fe0da51dddcf71d2534c5bf700fb3228c862ec
c71194b92ba23ce5bd8487ddbdacb53a10f6f59c
refs/heads/master
2020-12-24T09:31:23.298000
2016-10-16T16:28:51
2016-10-16T16:28:51
73,286,870
1
0
null
true
2016-11-09T13:33:45
2016-11-09T13:33:45
2016-11-09T08:00:07
2016-10-16T16:28:57
2,585
0
0
0
null
null
null
package com.caseystella.analytics.outlier; import backtype.storm.Config; import backtype.storm.topology.TopologyBuilder; import com.caseystella.analytics.DataPoint; import com.caseystella.analytics.integration.components.ElasticSearchComponent; import com.caseystella.analytics.timeseries.inmemory.InMemoryTimeSeriesDB; import com.caseystella.analytics.extractor.DataPointExtractorConfig; import com.caseystella.analytics.integration.ComponentRunner; import com.caseystella.analytics.integration.Processor; import com.caseystella.analytics.integration.ReadinessState; import com.caseystella.analytics.integration.UnableToStartException; import com.caseystella.analytics.integration.components.KafkaWithZKComponent; import com.caseystella.analytics.integration.components.StormTopologyComponent; import com.caseystella.analytics.timeseries.PersistenceConfig; import com.caseystella.analytics.timeseries.TimeseriesDatabaseHandlers; import com.caseystella.analytics.util.JSONUtil; import com.google.common.base.Function; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import org.adrianwalker.multilinestring.Multiline; import org.junit.Assert; import org.junit.Test; import javax.annotation.Nullable; import java.io.File; import java.io.IOException; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.*; public class StreamingOutlierIntegrationTest { /** { "valueConverter" : "CSVConverter" , "valueConverterConfig" : { "columnMap" : { "timestamp" : 0 ,"data" : 1 } } , "measurements" : [ { "source" : "benchmark" ,"timestampField" : "timestamp" ,"timestampConverter" : "DateConverter" ,"timestampConverterConfig" : { "format" : "yyyy-MM-dd HH:mm:ss" } ,"measurementField" : "data" } ] } */ @Multiline public static String extractorConfigStr; /** { "rotationPolicy" : { "type" : "BY_AMOUNT" ,"amount" : 100 ,"unit" : "POINTS" } ,"chunkingPolicy" : { "type" : "BY_AMOUNT" ,"amount" : 10 ,"unit" : "POINTS" } ,"globalStatistics" : { } ,"sketchyOutlierAlgorithm" : "SKETCHY_MOVING_MAD" ,"batchOutlierAlgorithm" : "RAD" ,"config" : { "minAmountToPredict" : 100 ,"reservoirSize" : 100 ,"zscoreCutoffs" : { "NORMAL" : 3.5 ,"MODERATE_OUTLIER" : 5 } } } */ @Multiline public static String streamingOutlierConfigStr; /** { "databaseHandler" : "com.caseystella.analytics.timeseries.inmemory.InMemoryTimeSeriesDB" ,"config" : {} } */ @Multiline public static String persistenceConfigStr; public static String KAFKA_TOPIC = "topic"; private static String indexDir = "target/elasticsearch"; public final static DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public static Function<DataPoint, byte[]> TO_STR = new Function<DataPoint, byte[]>() { @Nullable @Override public byte[] apply(@Nullable DataPoint dataPoint) { String ts = format.format(new Date(dataPoint.getTimestamp())); return ( ts + "," + dataPoint.getValue()).getBytes(); } }; public Iterable<byte[]> getMessages() { Random r = new Random(0); List<DataPoint> points = new ArrayList<>(); int i = 0; for(i = 0; i < 1000*1000;i += 1000) { double val = r.nextDouble()*1000; DataPoint dp = (new DataPoint(i, val, null, "foo")); points.add(dp); } points.add(new DataPoint(i, 10000, null, "foo")); return Iterables.transform(points, TO_STR); } @Test public void test() throws IOException, UnableToStartException { DataPointExtractorConfig extractorConfig = JSONUtil.INSTANCE.load(extractorConfigStr , DataPointExtractorConfig.class ); com.caseystella.analytics.outlier.streaming.OutlierConfig streamingOutlierConfig = JSONUtil.INSTANCE.load(streamingOutlierConfigStr , com.caseystella.analytics.outlier.streaming.OutlierConfig.class ); PersistenceConfig persistenceConfig = JSONUtil.INSTANCE.load(persistenceConfigStr , PersistenceConfig.class ); final StringBuffer zkQuorum = new StringBuffer(); final KafkaWithZKComponent kafkaComponent = new KafkaWithZKComponent().withTopics(new ArrayList<KafkaWithZKComponent.Topic>() {{ add(new KafkaWithZKComponent.Topic(KAFKA_TOPIC, 1)); }}) .withPostStartCallback(new Function<KafkaWithZKComponent, Void>() { @Nullable @Override public Void apply(@Nullable KafkaWithZKComponent kafkaWithZKComponent) { zkQuorum.append(kafkaWithZKComponent.getZookeeperConnect()); return null; } }); final StormTopologyComponent stormComponent = new StormTopologyComponent.Builder() .withTopologyName("streaming_outliers") .build(); final ElasticSearchComponent esComponent = new ElasticSearchComponent.Builder() .withHttpPort(9211) .withIndexDir(new File(indexDir)) .build(); ComponentRunner runner = new ComponentRunner.Builder() .withComponent("es", esComponent) .withComponent("kafka", kafkaComponent) .withComponent("storm", stormComponent) .withMillisecondsBetweenAttempts(10000) .withNumRetries(100) .build(); runner.start(); try { TopologyBuilder topology = Topology.createTopology(extractorConfig , streamingOutlierConfig , persistenceConfig , KAFKA_TOPIC , zkQuorum.toString() , "localhost:9211" , 1 , 1 , 1 , "outliers" , true); Config config = new Config(); stormComponent.submitTopology(topology,config ); kafkaComponent.writeMessages(KAFKA_TOPIC, getMessages()); final String indexName = KAFKA_TOPIC + ".benchmark"; List<DataPoint> outliers = runner.process(new Processor<List<DataPoint>>() { List<DataPoint> outliers = new ArrayList<>(); @Override public ReadinessState process(ComponentRunner runner) { Collection<DataPoint> allPoints = InMemoryTimeSeriesDB.getAllPoints(KAFKA_TOPIC + ".benchmark"); Iterable<DataPoint> outlierPoints = Iterables.filter(allPoints, new Predicate<DataPoint>() { @Override public boolean apply(@Nullable DataPoint dataPoint) { String type = dataPoint.getMetadata().get(TimeseriesDatabaseHandlers.TYPE_KEY); return type != null && type.equals(TimeseriesDatabaseHandlers.OUTLIER_TYPE); } }); boolean isDone = false; try { isDone = esComponent.hasIndex(indexName) && esComponent.getAllIndexedDocs(indexName).size() > 0; } catch (IOException e) { //swallow e.printStackTrace(); } if(isDone && Iterables.size(outlierPoints) > 0) { Iterables.addAll(outliers, outlierPoints); return ReadinessState.READY; } return ReadinessState.NOT_READY; } @Override public List<DataPoint> getResult() { return outliers; } }); List<Map<String, Object>> outlierIndex = esComponent.getAllIndexedDocs(indexName); for(Map<String, Object> o : outlierIndex) { System.out.println(o); } Assert.assertEquals(outlierIndex.size(),1); Assert.assertEquals(outliers.size(), 1); Assert.assertEquals(outliers.get(0).getTimestamp(), 1000*1000); } finally { runner.stop(); InMemoryTimeSeriesDB.clear(); } } }
UTF-8
Java
10,163
java
StreamingOutlierIntegrationTest.java
Java
[ { "context": "t com.google.common.collect.Iterables;\nimport org.adrianwalker.multilinestring.Multiline;\nimport org.junit.Asser", "end": 1127, "score": 0.8324816823005676, "start": 1115, "tag": "USERNAME", "value": "adrianwalker" } ]
null
[]
package com.caseystella.analytics.outlier; import backtype.storm.Config; import backtype.storm.topology.TopologyBuilder; import com.caseystella.analytics.DataPoint; import com.caseystella.analytics.integration.components.ElasticSearchComponent; import com.caseystella.analytics.timeseries.inmemory.InMemoryTimeSeriesDB; import com.caseystella.analytics.extractor.DataPointExtractorConfig; import com.caseystella.analytics.integration.ComponentRunner; import com.caseystella.analytics.integration.Processor; import com.caseystella.analytics.integration.ReadinessState; import com.caseystella.analytics.integration.UnableToStartException; import com.caseystella.analytics.integration.components.KafkaWithZKComponent; import com.caseystella.analytics.integration.components.StormTopologyComponent; import com.caseystella.analytics.timeseries.PersistenceConfig; import com.caseystella.analytics.timeseries.TimeseriesDatabaseHandlers; import com.caseystella.analytics.util.JSONUtil; import com.google.common.base.Function; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import org.adrianwalker.multilinestring.Multiline; import org.junit.Assert; import org.junit.Test; import javax.annotation.Nullable; import java.io.File; import java.io.IOException; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.*; public class StreamingOutlierIntegrationTest { /** { "valueConverter" : "CSVConverter" , "valueConverterConfig" : { "columnMap" : { "timestamp" : 0 ,"data" : 1 } } , "measurements" : [ { "source" : "benchmark" ,"timestampField" : "timestamp" ,"timestampConverter" : "DateConverter" ,"timestampConverterConfig" : { "format" : "yyyy-MM-dd HH:mm:ss" } ,"measurementField" : "data" } ] } */ @Multiline public static String extractorConfigStr; /** { "rotationPolicy" : { "type" : "BY_AMOUNT" ,"amount" : 100 ,"unit" : "POINTS" } ,"chunkingPolicy" : { "type" : "BY_AMOUNT" ,"amount" : 10 ,"unit" : "POINTS" } ,"globalStatistics" : { } ,"sketchyOutlierAlgorithm" : "SKETCHY_MOVING_MAD" ,"batchOutlierAlgorithm" : "RAD" ,"config" : { "minAmountToPredict" : 100 ,"reservoirSize" : 100 ,"zscoreCutoffs" : { "NORMAL" : 3.5 ,"MODERATE_OUTLIER" : 5 } } } */ @Multiline public static String streamingOutlierConfigStr; /** { "databaseHandler" : "com.caseystella.analytics.timeseries.inmemory.InMemoryTimeSeriesDB" ,"config" : {} } */ @Multiline public static String persistenceConfigStr; public static String KAFKA_TOPIC = "topic"; private static String indexDir = "target/elasticsearch"; public final static DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public static Function<DataPoint, byte[]> TO_STR = new Function<DataPoint, byte[]>() { @Nullable @Override public byte[] apply(@Nullable DataPoint dataPoint) { String ts = format.format(new Date(dataPoint.getTimestamp())); return ( ts + "," + dataPoint.getValue()).getBytes(); } }; public Iterable<byte[]> getMessages() { Random r = new Random(0); List<DataPoint> points = new ArrayList<>(); int i = 0; for(i = 0; i < 1000*1000;i += 1000) { double val = r.nextDouble()*1000; DataPoint dp = (new DataPoint(i, val, null, "foo")); points.add(dp); } points.add(new DataPoint(i, 10000, null, "foo")); return Iterables.transform(points, TO_STR); } @Test public void test() throws IOException, UnableToStartException { DataPointExtractorConfig extractorConfig = JSONUtil.INSTANCE.load(extractorConfigStr , DataPointExtractorConfig.class ); com.caseystella.analytics.outlier.streaming.OutlierConfig streamingOutlierConfig = JSONUtil.INSTANCE.load(streamingOutlierConfigStr , com.caseystella.analytics.outlier.streaming.OutlierConfig.class ); PersistenceConfig persistenceConfig = JSONUtil.INSTANCE.load(persistenceConfigStr , PersistenceConfig.class ); final StringBuffer zkQuorum = new StringBuffer(); final KafkaWithZKComponent kafkaComponent = new KafkaWithZKComponent().withTopics(new ArrayList<KafkaWithZKComponent.Topic>() {{ add(new KafkaWithZKComponent.Topic(KAFKA_TOPIC, 1)); }}) .withPostStartCallback(new Function<KafkaWithZKComponent, Void>() { @Nullable @Override public Void apply(@Nullable KafkaWithZKComponent kafkaWithZKComponent) { zkQuorum.append(kafkaWithZKComponent.getZookeeperConnect()); return null; } }); final StormTopologyComponent stormComponent = new StormTopologyComponent.Builder() .withTopologyName("streaming_outliers") .build(); final ElasticSearchComponent esComponent = new ElasticSearchComponent.Builder() .withHttpPort(9211) .withIndexDir(new File(indexDir)) .build(); ComponentRunner runner = new ComponentRunner.Builder() .withComponent("es", esComponent) .withComponent("kafka", kafkaComponent) .withComponent("storm", stormComponent) .withMillisecondsBetweenAttempts(10000) .withNumRetries(100) .build(); runner.start(); try { TopologyBuilder topology = Topology.createTopology(extractorConfig , streamingOutlierConfig , persistenceConfig , KAFKA_TOPIC , zkQuorum.toString() , "localhost:9211" , 1 , 1 , 1 , "outliers" , true); Config config = new Config(); stormComponent.submitTopology(topology,config ); kafkaComponent.writeMessages(KAFKA_TOPIC, getMessages()); final String indexName = KAFKA_TOPIC + ".benchmark"; List<DataPoint> outliers = runner.process(new Processor<List<DataPoint>>() { List<DataPoint> outliers = new ArrayList<>(); @Override public ReadinessState process(ComponentRunner runner) { Collection<DataPoint> allPoints = InMemoryTimeSeriesDB.getAllPoints(KAFKA_TOPIC + ".benchmark"); Iterable<DataPoint> outlierPoints = Iterables.filter(allPoints, new Predicate<DataPoint>() { @Override public boolean apply(@Nullable DataPoint dataPoint) { String type = dataPoint.getMetadata().get(TimeseriesDatabaseHandlers.TYPE_KEY); return type != null && type.equals(TimeseriesDatabaseHandlers.OUTLIER_TYPE); } }); boolean isDone = false; try { isDone = esComponent.hasIndex(indexName) && esComponent.getAllIndexedDocs(indexName).size() > 0; } catch (IOException e) { //swallow e.printStackTrace(); } if(isDone && Iterables.size(outlierPoints) > 0) { Iterables.addAll(outliers, outlierPoints); return ReadinessState.READY; } return ReadinessState.NOT_READY; } @Override public List<DataPoint> getResult() { return outliers; } }); List<Map<String, Object>> outlierIndex = esComponent.getAllIndexedDocs(indexName); for(Map<String, Object> o : outlierIndex) { System.out.println(o); } Assert.assertEquals(outlierIndex.size(),1); Assert.assertEquals(outliers.size(), 1); Assert.assertEquals(outliers.get(0).getTimestamp(), 1000*1000); } finally { runner.stop(); InMemoryTimeSeriesDB.clear(); } } }
10,163
0.505264
0.498081
224
44.370537
29.663006
139
false
false
0
0
0
0
0
0
0.633929
false
false
10
8145eb8367757a09aa96bc4945022c318d518ac6
7,765,300,907,984
cbe1e2687f5f72c148f67af4b7e46ea45f47b34a
/app/src/main/java/cc/ssam/android/views/StableRecyclerView.java
a236de6ccd97932b01999f5355962ad808faf4f2
[]
no_license
goodhxx/Ssam
https://github.com/goodhxx/Ssam
4ffb86737eb0242f4889039c3e30d8064e777349
0b0808bd18658b5d609bbcd5a7df6fbad9041b05
refs/heads/master
2016-09-27T07:08:12.114000
2016-09-27T04:27:37
2016-09-27T04:27:37
48,720,971
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cc.ssam.android.views; import android.content.Context; import android.support.annotation.Nullable; import android.support.v7.widget.RecyclerView; import android.util.AttributeSet; import android.view.MotionEvent; /** * Created by john on 2016/9/10. */ public class StableRecyclerView extends RecyclerView { private boolean verticleScrollingEnabled = true; public void enableVersticleScroll (boolean enabled) { verticleScrollingEnabled = enabled; } public boolean isVerticleScrollingEnabled() { return verticleScrollingEnabled; } public StableRecyclerView(Context context) { super(context); } public StableRecyclerView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); } public StableRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override public boolean dispatchTouchEvent(MotionEvent ev) { if(!verticleScrollingEnabled){ if(ev.getAction() == MotionEvent.ACTION_MOVE) return true; } return super.dispatchTouchEvent(ev); } }
UTF-8
Java
1,179
java
StableRecyclerView.java
Java
[ { "context": "mport android.view.MotionEvent;\n\n/**\n * Created by john on 2016/9/10.\n */\npublic class StableRecyclerView", "end": 245, "score": 0.9879544377326965, "start": 241, "tag": "USERNAME", "value": "john" } ]
null
[]
package cc.ssam.android.views; import android.content.Context; import android.support.annotation.Nullable; import android.support.v7.widget.RecyclerView; import android.util.AttributeSet; import android.view.MotionEvent; /** * Created by john on 2016/9/10. */ public class StableRecyclerView extends RecyclerView { private boolean verticleScrollingEnabled = true; public void enableVersticleScroll (boolean enabled) { verticleScrollingEnabled = enabled; } public boolean isVerticleScrollingEnabled() { return verticleScrollingEnabled; } public StableRecyclerView(Context context) { super(context); } public StableRecyclerView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); } public StableRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override public boolean dispatchTouchEvent(MotionEvent ev) { if(!verticleScrollingEnabled){ if(ev.getAction() == MotionEvent.ACTION_MOVE) return true; } return super.dispatchTouchEvent(ev); } }
1,179
0.700594
0.693808
45
25.200001
23.964418
92
false
false
0
0
0
0
0
0
0.444444
false
false
10
e46d7bedc2d4336d9858ae3d1c5d8d3c2f593f70
27,917,287,455,385
8922e51e7b544b069ff163496780aa8b37ad4f8a
/xml/src/java/org/apache/hivemind/service/impl/BuilderFactoryLogic.java
b9f7c5c81051fb36ec9efdc8f2d30befb4417103
[ "Apache-2.0" ]
permissive
rsassi/hivemind2
https://github.com/rsassi/hivemind2
e44cd3b7634bf15180c68c20a3a4f6fa51c21dd0
2ab77f62bf2ecbea4e3e03f6bde525a90e3f1a08
refs/heads/master
2023-06-28T09:19:39.745000
2021-07-25T03:45:03
2021-07-25T03:45:03
389,251,042
0
0
null
false
2021-07-25T03:45:04
2021-07-25T03:26:24
2021-07-25T03:32:05
2021-07-25T03:45:03
0
0
0
0
Java
false
false
// Copyright 2004, 2005 The Apache Software Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package org.apache.hivemind.service.impl; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import org.apache.commons.logging.Log; import org.apache.hivemind.ApplicationRuntimeException; import org.apache.hivemind.HiveMind; import org.apache.hivemind.Location; import org.apache.hivemind.ServiceImplementationFactoryParameters; import org.apache.hivemind.internal.Module; import org.apache.hivemind.service.Autowiring; import org.apache.hivemind.service.AutowiringStrategy; import org.apache.hivemind.service.EventLinker; import org.apache.hivemind.util.ConstructorUtils; import org.apache.hivemind.util.PropertyUtils; /** * Created by {@link org.apache.hivemind.service.impl.BuilderFactory} for each service to be * created; encapsulates all the direct and indirect parameters used to construct a service. * * @author Howard Lewis Ship */ public class BuilderFactoryLogic { /** @since 1.1 */ private ServiceImplementationFactoryParameters _factoryParameters; private String _serviceId; private BuilderParameter _parameter; private Log _log; private Module _contributingModule; public BuilderFactoryLogic(ServiceImplementationFactoryParameters factoryParameters, BuilderParameter parameter) { _factoryParameters = factoryParameters; _parameter = parameter; _log = _factoryParameters.getLog(); _serviceId = factoryParameters.getServiceId(); _contributingModule = factoryParameters.getInvokingModule(); } public Object createService() { try { Object result = instantiateCoreServiceInstance(); setProperties(result); registerForEvents(result); invokeInitializer(result); return result; } catch (Exception ex) { throw new ApplicationRuntimeException(ServiceMessages.failureBuildingService( _serviceId, ex), _parameter.getLocation(), ex); } } private void error(String message, Location location, Throwable cause) { _factoryParameters.getErrorLog().error(message, location, cause); } private Object instantiateCoreServiceInstance() { Class serviceClass = _contributingModule.resolveType(_parameter.getClassName()); List parameters = _parameter.getParameters(); if (_parameter.getAutowireServices() && parameters.isEmpty()) { return instantiateConstructorAutowiredInstance(serviceClass); } return instantiateExplicitConstructorInstance(serviceClass, parameters); } private Object instantiateExplicitConstructorInstance(Class serviceClass, List builderParameters) { int numberOfParams = builderParameters.size(); List constructorCandidates = getServiceConstructorsOfLength(serviceClass, numberOfParams); outer: for (Iterator candidates = constructorCandidates.iterator(); candidates.hasNext();) { Constructor candidate = (Constructor) candidates.next(); Class[] parameterTypes = candidate.getParameterTypes(); Object[] parameters = new Object[parameterTypes.length]; for (int i = 0; i < numberOfParams; i++) { BuilderFacet facet = (BuilderFacet) builderParameters.get(i); if (!facet.isAssignableToType(_factoryParameters, parameterTypes[i])) continue outer; parameters[i] = facet.getFacetValue(_factoryParameters, parameterTypes[i]); } return ConstructorUtils.invoke(candidate, parameters); } throw new ApplicationRuntimeException(ServiceMessages.unableToFindExplicitConstructor(), _parameter.getLocation(), null); } private List getServiceConstructorsOfLength(Class serviceClass, int length) { List fixedLengthConstructors = new ArrayList(); Constructor[] constructors = serviceClass.getDeclaredConstructors(); for (int i = 0; i < constructors.length; i++) { if (!Modifier.isPublic(constructors[i].getModifiers())) continue; Class[] parameterTypes = constructors[i].getParameterTypes(); if (parameterTypes.length != length) continue; fixedLengthConstructors.add(constructors[i]); } return fixedLengthConstructors; } private Object instantiateConstructorAutowiredInstance(Class serviceClass) { List serviceConstructorCandidates = getOrderedServiceConstructors(serviceClass); outer: for (Iterator candidates = serviceConstructorCandidates.iterator(); candidates .hasNext();) { Constructor candidate = (Constructor) candidates.next(); Class[] parameterTypes = candidate.getParameterTypes(); Object[] parameters = new Object[parameterTypes.length]; for (int i = 0; i < parameters.length; i++) { BuilderFacet facet = _parameter.getFacetForType( _factoryParameters, parameterTypes[i]); if (facet != null && facet.canAutowireConstructorParameter()) parameters[i] = facet.getFacetValue(_factoryParameters, parameterTypes[i]); else if (_contributingModule.containsService(parameterTypes[i])) parameters[i] = _contributingModule.getService(parameterTypes[i]); else continue outer; } return ConstructorUtils.invoke(candidate, parameters); } throw new ApplicationRuntimeException(ServiceMessages.unableToFindAutowireConstructor(), _parameter.getLocation(), null); } private List getOrderedServiceConstructors(Class serviceClass) { List orderedInterfaceConstructors = new ArrayList(); Constructor[] constructors = serviceClass.getDeclaredConstructors(); outer: for (int i = 0; i < constructors.length; i++) { if (!Modifier.isPublic(constructors[i].getModifiers())) continue; Class[] parameterTypes = constructors[i].getParameterTypes(); if (parameterTypes.length > 0) { Set seenTypes = new HashSet(); for (int j = 0; j < parameterTypes.length; j++) { if (!parameterTypes[j].isInterface() || seenTypes.contains(parameterTypes[j])) continue outer; seenTypes.add(parameterTypes[j]); } } orderedInterfaceConstructors.add(constructors[i]); } Collections.sort(orderedInterfaceConstructors, new Comparator() { public int compare(Object o1, Object o2) { return ((Constructor) o2).getParameterTypes().length - ((Constructor) o1).getParameterTypes().length; } }); return orderedInterfaceConstructors; } private void invokeInitializer(Object service) { String methodName = _parameter.getInitializeMethod(); boolean allowMissing = HiveMind.isBlank(methodName); String searchMethodName = allowMissing ? "initializeService" : methodName; try { findAndInvokeInitializerMethod(service, searchMethodName, allowMissing); } catch (InvocationTargetException ex) { Throwable cause = ex.getTargetException(); error(ServiceMessages.unableToInitializeService(_serviceId, searchMethodName, service .getClass(), cause), _parameter.getLocation(), cause); } catch (Exception ex) { error(ServiceMessages.unableToInitializeService(_serviceId, searchMethodName, service .getClass(), ex), _parameter.getLocation(), ex); } } private void findAndInvokeInitializerMethod(Object service, String methodName, boolean allowMissing) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { Class serviceClass = service.getClass(); try { Method m = serviceClass.getMethod(methodName, (Class []) null); m.invoke(service, (Object []) null); } catch (NoSuchMethodException ex) { if (allowMissing) return; throw ex; } } private void registerForEvents(Object result) { List eventRegistrations = _parameter.getEventRegistrations(); if (eventRegistrations.isEmpty()) return; EventLinker linker = new EventLinkerImpl(_factoryParameters.getErrorLog()); Iterator i = eventRegistrations.iterator(); while (i.hasNext()) { EventRegistration er = (EventRegistration) i.next(); // Will log any errors to the errorHandler linker.addEventListener(er.getProducer(), er.getEventSetName(), result, er .getLocation()); } } private void setProperties(Object service) { List properties = _parameter.getProperties(); int count = properties.size(); // Track the writeable properties, removing names as they are wired or autowired. Set writeableProperties = new HashSet(PropertyUtils.getWriteableProperties(service)); for (int i = 0; i < count; i++) { BuilderFacet facet = (BuilderFacet) properties.get(i); String propertyName = wireProperty(service, facet); if (propertyName != null) writeableProperties.remove(propertyName); } if (_parameter.getAutowireServices() && !writeableProperties.isEmpty()) autowireServices(service, writeableProperties); } /** * Wire (or auto-wire) the property; return the name of the property actually set (if a property * is set, which is not always the case). */ private String wireProperty(Object service, BuilderFacet facet) { String propertyName = facet.getPropertyName(); try { // Autowire the property (if possible). String autowirePropertyName = facet.autowire(service, _factoryParameters); if (autowirePropertyName != null) return autowirePropertyName; // There will be a facet for log, messages, service-id, etc. even if no // property name is specified, so we skip it here. In many cases, those // facets will have just done an autowire. if (propertyName == null) return null; Class targetType = PropertyUtils.getPropertyType(service, propertyName); Object value = facet.getFacetValue(_factoryParameters, targetType); PropertyUtils.write(service, propertyName, value); if (_log.isDebugEnabled()) _log.debug("Set property " + propertyName + " to " + value); return propertyName; } catch (Exception ex) { error(ex.getMessage(), facet.getLocation(), ex); return null; } } private void autowireServices(Object service, Collection propertyNames) { Autowiring autowiring = (Autowiring) _contributingModule.getService(HiveMind.AUTOWIRING_SERVICE, Autowiring.class); String[] props = (String[]) propertyNames.toArray(new String[propertyNames.size()]); autowiring.autowireProperties(AutowiringStrategy.BY_TYPE, service, props); } }
UTF-8
Java
12,759
java
BuilderFactoryLogic.java
Java
[ { "context": "meters used to construct a service.\n * \n * @author Howard Lewis Ship\n */\npublic class BuilderFactoryLogic\n{\n /** @si", "end": 1780, "score": 0.9612466096878052, "start": 1763, "tag": "NAME", "value": "Howard Lewis Ship" } ]
null
[]
// Copyright 2004, 2005 The Apache Software Foundation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package org.apache.hivemind.service.impl; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import org.apache.commons.logging.Log; import org.apache.hivemind.ApplicationRuntimeException; import org.apache.hivemind.HiveMind; import org.apache.hivemind.Location; import org.apache.hivemind.ServiceImplementationFactoryParameters; import org.apache.hivemind.internal.Module; import org.apache.hivemind.service.Autowiring; import org.apache.hivemind.service.AutowiringStrategy; import org.apache.hivemind.service.EventLinker; import org.apache.hivemind.util.ConstructorUtils; import org.apache.hivemind.util.PropertyUtils; /** * Created by {@link org.apache.hivemind.service.impl.BuilderFactory} for each service to be * created; encapsulates all the direct and indirect parameters used to construct a service. * * @author <NAME> */ public class BuilderFactoryLogic { /** @since 1.1 */ private ServiceImplementationFactoryParameters _factoryParameters; private String _serviceId; private BuilderParameter _parameter; private Log _log; private Module _contributingModule; public BuilderFactoryLogic(ServiceImplementationFactoryParameters factoryParameters, BuilderParameter parameter) { _factoryParameters = factoryParameters; _parameter = parameter; _log = _factoryParameters.getLog(); _serviceId = factoryParameters.getServiceId(); _contributingModule = factoryParameters.getInvokingModule(); } public Object createService() { try { Object result = instantiateCoreServiceInstance(); setProperties(result); registerForEvents(result); invokeInitializer(result); return result; } catch (Exception ex) { throw new ApplicationRuntimeException(ServiceMessages.failureBuildingService( _serviceId, ex), _parameter.getLocation(), ex); } } private void error(String message, Location location, Throwable cause) { _factoryParameters.getErrorLog().error(message, location, cause); } private Object instantiateCoreServiceInstance() { Class serviceClass = _contributingModule.resolveType(_parameter.getClassName()); List parameters = _parameter.getParameters(); if (_parameter.getAutowireServices() && parameters.isEmpty()) { return instantiateConstructorAutowiredInstance(serviceClass); } return instantiateExplicitConstructorInstance(serviceClass, parameters); } private Object instantiateExplicitConstructorInstance(Class serviceClass, List builderParameters) { int numberOfParams = builderParameters.size(); List constructorCandidates = getServiceConstructorsOfLength(serviceClass, numberOfParams); outer: for (Iterator candidates = constructorCandidates.iterator(); candidates.hasNext();) { Constructor candidate = (Constructor) candidates.next(); Class[] parameterTypes = candidate.getParameterTypes(); Object[] parameters = new Object[parameterTypes.length]; for (int i = 0; i < numberOfParams; i++) { BuilderFacet facet = (BuilderFacet) builderParameters.get(i); if (!facet.isAssignableToType(_factoryParameters, parameterTypes[i])) continue outer; parameters[i] = facet.getFacetValue(_factoryParameters, parameterTypes[i]); } return ConstructorUtils.invoke(candidate, parameters); } throw new ApplicationRuntimeException(ServiceMessages.unableToFindExplicitConstructor(), _parameter.getLocation(), null); } private List getServiceConstructorsOfLength(Class serviceClass, int length) { List fixedLengthConstructors = new ArrayList(); Constructor[] constructors = serviceClass.getDeclaredConstructors(); for (int i = 0; i < constructors.length; i++) { if (!Modifier.isPublic(constructors[i].getModifiers())) continue; Class[] parameterTypes = constructors[i].getParameterTypes(); if (parameterTypes.length != length) continue; fixedLengthConstructors.add(constructors[i]); } return fixedLengthConstructors; } private Object instantiateConstructorAutowiredInstance(Class serviceClass) { List serviceConstructorCandidates = getOrderedServiceConstructors(serviceClass); outer: for (Iterator candidates = serviceConstructorCandidates.iterator(); candidates .hasNext();) { Constructor candidate = (Constructor) candidates.next(); Class[] parameterTypes = candidate.getParameterTypes(); Object[] parameters = new Object[parameterTypes.length]; for (int i = 0; i < parameters.length; i++) { BuilderFacet facet = _parameter.getFacetForType( _factoryParameters, parameterTypes[i]); if (facet != null && facet.canAutowireConstructorParameter()) parameters[i] = facet.getFacetValue(_factoryParameters, parameterTypes[i]); else if (_contributingModule.containsService(parameterTypes[i])) parameters[i] = _contributingModule.getService(parameterTypes[i]); else continue outer; } return ConstructorUtils.invoke(candidate, parameters); } throw new ApplicationRuntimeException(ServiceMessages.unableToFindAutowireConstructor(), _parameter.getLocation(), null); } private List getOrderedServiceConstructors(Class serviceClass) { List orderedInterfaceConstructors = new ArrayList(); Constructor[] constructors = serviceClass.getDeclaredConstructors(); outer: for (int i = 0; i < constructors.length; i++) { if (!Modifier.isPublic(constructors[i].getModifiers())) continue; Class[] parameterTypes = constructors[i].getParameterTypes(); if (parameterTypes.length > 0) { Set seenTypes = new HashSet(); for (int j = 0; j < parameterTypes.length; j++) { if (!parameterTypes[j].isInterface() || seenTypes.contains(parameterTypes[j])) continue outer; seenTypes.add(parameterTypes[j]); } } orderedInterfaceConstructors.add(constructors[i]); } Collections.sort(orderedInterfaceConstructors, new Comparator() { public int compare(Object o1, Object o2) { return ((Constructor) o2).getParameterTypes().length - ((Constructor) o1).getParameterTypes().length; } }); return orderedInterfaceConstructors; } private void invokeInitializer(Object service) { String methodName = _parameter.getInitializeMethod(); boolean allowMissing = HiveMind.isBlank(methodName); String searchMethodName = allowMissing ? "initializeService" : methodName; try { findAndInvokeInitializerMethod(service, searchMethodName, allowMissing); } catch (InvocationTargetException ex) { Throwable cause = ex.getTargetException(); error(ServiceMessages.unableToInitializeService(_serviceId, searchMethodName, service .getClass(), cause), _parameter.getLocation(), cause); } catch (Exception ex) { error(ServiceMessages.unableToInitializeService(_serviceId, searchMethodName, service .getClass(), ex), _parameter.getLocation(), ex); } } private void findAndInvokeInitializerMethod(Object service, String methodName, boolean allowMissing) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { Class serviceClass = service.getClass(); try { Method m = serviceClass.getMethod(methodName, (Class []) null); m.invoke(service, (Object []) null); } catch (NoSuchMethodException ex) { if (allowMissing) return; throw ex; } } private void registerForEvents(Object result) { List eventRegistrations = _parameter.getEventRegistrations(); if (eventRegistrations.isEmpty()) return; EventLinker linker = new EventLinkerImpl(_factoryParameters.getErrorLog()); Iterator i = eventRegistrations.iterator(); while (i.hasNext()) { EventRegistration er = (EventRegistration) i.next(); // Will log any errors to the errorHandler linker.addEventListener(er.getProducer(), er.getEventSetName(), result, er .getLocation()); } } private void setProperties(Object service) { List properties = _parameter.getProperties(); int count = properties.size(); // Track the writeable properties, removing names as they are wired or autowired. Set writeableProperties = new HashSet(PropertyUtils.getWriteableProperties(service)); for (int i = 0; i < count; i++) { BuilderFacet facet = (BuilderFacet) properties.get(i); String propertyName = wireProperty(service, facet); if (propertyName != null) writeableProperties.remove(propertyName); } if (_parameter.getAutowireServices() && !writeableProperties.isEmpty()) autowireServices(service, writeableProperties); } /** * Wire (or auto-wire) the property; return the name of the property actually set (if a property * is set, which is not always the case). */ private String wireProperty(Object service, BuilderFacet facet) { String propertyName = facet.getPropertyName(); try { // Autowire the property (if possible). String autowirePropertyName = facet.autowire(service, _factoryParameters); if (autowirePropertyName != null) return autowirePropertyName; // There will be a facet for log, messages, service-id, etc. even if no // property name is specified, so we skip it here. In many cases, those // facets will have just done an autowire. if (propertyName == null) return null; Class targetType = PropertyUtils.getPropertyType(service, propertyName); Object value = facet.getFacetValue(_factoryParameters, targetType); PropertyUtils.write(service, propertyName, value); if (_log.isDebugEnabled()) _log.debug("Set property " + propertyName + " to " + value); return propertyName; } catch (Exception ex) { error(ex.getMessage(), facet.getLocation(), ex); return null; } } private void autowireServices(Object service, Collection propertyNames) { Autowiring autowiring = (Autowiring) _contributingModule.getService(HiveMind.AUTOWIRING_SERVICE, Autowiring.class); String[] props = (String[]) propertyNames.toArray(new String[propertyNames.size()]); autowiring.autowireProperties(AutowiringStrategy.BY_TYPE, service, props); } }
12,748
0.639235
0.637276
384
32.229168
31.234322
123
false
false
0
0
0
0
0
0
0.557292
false
false
10
d82cd23a61c4ea43fcd3d8215e073ef4f74471ac
13,846,974,605,612
5d06fb9d11d61ccd06aa0c1a3aa8c23704804a50
/Practice Day 5/src/com/hsbc/demoserialization/Employee.java
a4c65ad0c56c51b2e339d3f5a338dadc5684a369
[]
no_license
OmAshish/Java-Programming
https://github.com/OmAshish/Java-Programming
ab2e12acfe076c8e8261d072dea49acb1b140d0c
1ff5bd394aea13455406c58870c1ea55be4bd461
refs/heads/master
2022-12-21T00:04:48.200000
2020-09-28T14:48:21
2020-09-28T14:48:21
299,338,057
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hsbc.demoserialization; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import org.omg.PortableInterceptor.ObjectIdHelper; public class Employee implements Serializable{ int empid; String ename; int salary; public Employee() { } public Employee(int empid, String ename, int salary) { super(); this.empid = empid; this.ename = ename; this.salary = salary; } @Override public String toString() { return "Employee [empid=" + empid + ", ename=" + ename + ", salary=" + salary + "]"; } public void doSerialize() { try { FileOutputStream fos = new FileOutputStream("abc.data"); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(this); fos.close(); oos.close(); } catch(FileNotFoundException e) { e.printStackTrace(); } catch(IOException e) { e.printStackTrace(); } } public Employee doDeserialize() { Employee e = null; try { FileInputStream fis = new FileInputStream("abc.data"); ObjectInputStream ois = new ObjectInputStream(fis); e = (Employee) ois.readObject(); ois.close(); fis.close(); } catch(FileNotFoundException e1) { e1.printStackTrace(); } catch(IOException e1) { e1.printStackTrace(); } catch(ClassNotFoundException e1) { e1.printStackTrace(); } return e; } }
UTF-8
Java
1,551
java
Employee.java
Java
[]
null
[]
package com.hsbc.demoserialization; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import org.omg.PortableInterceptor.ObjectIdHelper; public class Employee implements Serializable{ int empid; String ename; int salary; public Employee() { } public Employee(int empid, String ename, int salary) { super(); this.empid = empid; this.ename = ename; this.salary = salary; } @Override public String toString() { return "Employee [empid=" + empid + ", ename=" + ename + ", salary=" + salary + "]"; } public void doSerialize() { try { FileOutputStream fos = new FileOutputStream("abc.data"); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(this); fos.close(); oos.close(); } catch(FileNotFoundException e) { e.printStackTrace(); } catch(IOException e) { e.printStackTrace(); } } public Employee doDeserialize() { Employee e = null; try { FileInputStream fis = new FileInputStream("abc.data"); ObjectInputStream ois = new ObjectInputStream(fis); e = (Employee) ois.readObject(); ois.close(); fis.close(); } catch(FileNotFoundException e1) { e1.printStackTrace(); } catch(IOException e1) { e1.printStackTrace(); } catch(ClassNotFoundException e1) { e1.printStackTrace(); } return e; } }
1,551
0.671825
0.667956
90
16.233334
17.606216
86
false
false
0
0
0
0
0
0
2.111111
false
false
10
dc544da949fe6276353758bcaf5db0c3542b83e8
3,865,470,608,359
f85abe36c485c2b0582e548a5286b5b849d789e5
/app/src/main/java/com/nanodegree/mahmoud/movies/Main/Mainview.java
b364d69b9fc5a5b47205cbf5800d3c30f0787ef1
[]
no_license
melsheikh92/movies_udacity
https://github.com/melsheikh92/movies_udacity
acc21b52c4c5d0ad3df4ee02313cd0ceb2cf76ae
e3fa48c92988a4702ae4173540b9baab758b6688
refs/heads/master
2020-04-09T05:50:05.018000
2018-12-02T19:16:47
2018-12-02T19:16:47
160,081,278
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.nanodegree.mahmoud.movies.Main; /** * Created by Mahmoud on 25/02/2017. */ public interface Mainview { void showProgress(); void hideProgress(); }
UTF-8
Java
173
java
Mainview.java
Java
[ { "context": "nanodegree.mahmoud.movies.Main;\n\n/**\n * Created by Mahmoud on 25/02/2017.\n */\n\npublic interface Mainview {\n\n", "end": 70, "score": 0.9998040199279785, "start": 63, "tag": "NAME", "value": "Mahmoud" } ]
null
[]
package com.nanodegree.mahmoud.movies.Main; /** * Created by Mahmoud on 25/02/2017. */ public interface Mainview { void showProgress(); void hideProgress(); }
173
0.682081
0.635838
12
13.416667
15.505152
43
false
false
0
0
0
0
0
0
0.25
false
false
10
46872c2ab96e9a3ec66e48a2b9e7c89cca244dfd
26,499,948,232,722
0a6010607bd9e307a8e5ce0239df365247985a07
/src/main/java/br/com/willbigas/maratonajsf/bean/application/TesteApplicationBean.java
97fe6102fd96ed1c32d36c5b1e20f1df4dfffd6c
[]
no_license
willbigas/maratona-jsf
https://github.com/willbigas/maratona-jsf
cd0af7c83108a6f3b4af76e44aa5f25f91805c1e
917b7135a6bdd2ce26167b4f0e460aa59b33219e
refs/heads/master
2020-06-23T17:52:58.840000
2019-07-29T20:31:39
2019-07-29T20:31:39
198,706,153
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.willbigas.maratonajsf.bean.application; import javax.annotation.PostConstruct; import javax.enterprise.context.ApplicationScoped; import javax.inject.Named; import java.io.Serializable; import java.util.Arrays; import java.util.List; @Named @ApplicationScoped public class TesteApplicationBean implements Serializable { private List<String> categoriaList; @PostConstruct public void init() { System.out.println("Entrou no Post Construct do Application Scoped"); categoriaList = Arrays.asList("RPG" , "SYFY", "TERROR"); } public void mudarLista() { categoriaList = Arrays.asList("RPG" , "SYFY", "TERROR" ,"PORN"); } public List<String> getCategoriaList() { return categoriaList; } public void setCategoriaList(List<String> categoriaList) { this.categoriaList = categoriaList; } }
UTF-8
Java
882
java
TesteApplicationBean.java
Java
[]
null
[]
package br.com.willbigas.maratonajsf.bean.application; import javax.annotation.PostConstruct; import javax.enterprise.context.ApplicationScoped; import javax.inject.Named; import java.io.Serializable; import java.util.Arrays; import java.util.List; @Named @ApplicationScoped public class TesteApplicationBean implements Serializable { private List<String> categoriaList; @PostConstruct public void init() { System.out.println("Entrou no Post Construct do Application Scoped"); categoriaList = Arrays.asList("RPG" , "SYFY", "TERROR"); } public void mudarLista() { categoriaList = Arrays.asList("RPG" , "SYFY", "TERROR" ,"PORN"); } public List<String> getCategoriaList() { return categoriaList; } public void setCategoriaList(List<String> categoriaList) { this.categoriaList = categoriaList; } }
882
0.712018
0.712018
33
25.727272
23.740099
77
false
false
0
0
0
0
0
0
0.545455
false
false
10
10964953ecb71903f6c728f032e9fb0ab71254a3
9,732,395,911,974
203f969bd3d28f607d08c564ec141ad18806965c
/src/main/java/com/reto/retoscreenplay/userinterface/FinalPricePage.java
879f05cfbf40f0caf0c40aee93b85fb895561505
[]
no_license
ashmander/RetoScreenplay
https://github.com/ashmander/RetoScreenplay
9411336404d3fd92f1f4d55ad703bdb14cd0a0cc
d3f3240d5c552df96f52049ef505df489ac2c023
refs/heads/main
2023-03-26T02:35:31.998000
2021-03-26T23:35:06
2021-03-26T23:35:06
351,615,213
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.reto.retoscreenplay.userinterface; import net.serenitybdd.screenplay.targets.Target; import org.openqa.selenium.By; public class FinalPricePage { public static final Target FLIGHT_INFORMATION = Target .the("Flight information") .located(By.id("basket-icon")); public static final Target FINAL_PRICE = Target .the("Final price") .locatedBy("//div[@class='price']"); }
UTF-8
Java
454
java
FinalPricePage.java
Java
[]
null
[]
package com.reto.retoscreenplay.userinterface; import net.serenitybdd.screenplay.targets.Target; import org.openqa.selenium.By; public class FinalPricePage { public static final Target FLIGHT_INFORMATION = Target .the("Flight information") .located(By.id("basket-icon")); public static final Target FINAL_PRICE = Target .the("Final price") .locatedBy("//div[@class='price']"); }
454
0.64978
0.64978
15
28.266666
21.286825
58
false
false
0
0
0
0
0
0
0.333333
false
false
10
f17b2225c8b8924c8a4f8fff537a1bb89bf12999
14,422,500,182,235
f47475ddf5375c71c3ed1ecb827e06c805efdd5e
/src/main/java/framework/fubo/pages/onboarding/OnboradingPreselectionPackagePage.java
fc75f6ca79e8149ba2773e6d3e3aaf229413baa8
[]
no_license
lzrts/fubo-automation-local
https://github.com/lzrts/fubo-automation-local
7dae5e64aad7c276e325fc7d6970aa18accfba30
752520047f0afe8b0ff575fb6f99a9f2358a038d
refs/heads/master
2021-05-08T10:43:05.486000
2018-02-01T15:55:06
2018-02-01T15:55:06
119,858,009
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package framework.fubo.pages.onboarding; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.ui.ExpectedConditions; import com.google.common.base.Function; import framework.pages.LitsPageFactory; import framework.pages.Page; import io.qameta.allure.Step; public class OnboradingPreselectionPackagePage extends Page { @FindBy(xpath = "//div/span[contains(text(),'Continue to Last Step')]") private WebElement continueToLastStepButton; @Step("Proceed to step #4") public OnboardingLastStep onboardingStep4() { continueToLastStepButton.click(); return LitsPageFactory.initElements(webDriver, OnboardingLastStep.class); } public OnboradingPreselectionPackagePage(WebDriver webDriver) { super(webDriver); } @Override public Function<WebDriver, ?> isPageLoaded() { return ExpectedConditions.visibilityOf(continueToLastStepButton); } }
UTF-8
Java
962
java
OnboradingPreselectionPackagePage.java
Java
[]
null
[]
package framework.fubo.pages.onboarding; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.ui.ExpectedConditions; import com.google.common.base.Function; import framework.pages.LitsPageFactory; import framework.pages.Page; import io.qameta.allure.Step; public class OnboradingPreselectionPackagePage extends Page { @FindBy(xpath = "//div/span[contains(text(),'Continue to Last Step')]") private WebElement continueToLastStepButton; @Step("Proceed to step #4") public OnboardingLastStep onboardingStep4() { continueToLastStepButton.click(); return LitsPageFactory.initElements(webDriver, OnboardingLastStep.class); } public OnboradingPreselectionPackagePage(WebDriver webDriver) { super(webDriver); } @Override public Function<WebDriver, ?> isPageLoaded() { return ExpectedConditions.visibilityOf(continueToLastStepButton); } }
962
0.801455
0.799376
37
25
24.88677
75
false
false
0
0
0
0
0
0
0.945946
false
false
10
1de523542b0e3f14446858a0ffcc74d74054d126
8,856,222,604,499
557879b1c00a010abda1a131bbdb668306107991
/android-client/src/main/java/io/swagger/client/model/TopicModel.java
8c29871e7b57a82ba4bb1687403897a0cbc20ae1
[ "Apache-2.0" ]
permissive
ybx945ybx/WWFL
https://github.com/ybx945ybx/WWFL
64fccfa87a2c77907b49ae67538a6f715370fee4
59c5ea836d1379b70a43612a8453a601d224583c
refs/heads/master
2021-01-24T02:17:31.554000
2018-02-25T14:02:38
2018-02-25T14:02:38
122,841,073
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * 五五海淘返利APP新版接口 * 更新日志<br> 相对于上一build的变更: <br/>Nu 调整搜索模型 * * OpenAPI spec version: 1.8 build20180202-2 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. * * 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 io.swagger.client.model; import io.swagger.client.model.TopicModelTags; import java.util.*; import io.swagger.annotations.*; import com.google.gson.annotations.SerializedName; @ApiModel(description = "") public class TopicModel { @SerializedName("tid") private String tid = null; @SerializedName("board_id") private String boardId = null; @SerializedName("board_name") private String boardName = null; @SerializedName("title") private String title = null; @SerializedName("post_time") private String postTime = null; @SerializedName("author_name") private String authorName = null; @SerializedName("author_uid") private String authorUid = null; @SerializedName("view_count") private String viewCount = null; @SerializedName("reply_count") private String replyCount = null; @SerializedName("category_name") private String categoryName = null; @SerializedName("praise_count") private String praiseCount = null; @SerializedName("collection_count") private String collectionCount = null; @SerializedName("is_praised") private String isPraised = null; @SerializedName("is_hot") private String isHot = null; @SerializedName("is_best") private String isBest = null; @SerializedName("is_recommended") private String isRecommended = null; @SerializedName("avatar") private String avatar = null; @SerializedName("pics") private List<String> pics = null; @SerializedName("tags") private List<TopicModelTags> tags = null; @SerializedName("share_title") private String shareTitle = null; @SerializedName("share_content") private String shareContent = null; @SerializedName("share_content_weibo") private String shareContentWeibo = null; @SerializedName("share_url") private String shareUrl = null; @SerializedName("share_pic") private String sharePic = null; /** * 帖子ID **/ @ApiModelProperty(value = "帖子ID") public String getTid() { return tid; } public void setTid(String tid) { this.tid = tid; } /** * 版块ID **/ @ApiModelProperty(value = "版块ID") public String getBoardId() { return boardId; } public void setBoardId(String boardId) { this.boardId = boardId; } /** * 版块名称 **/ @ApiModelProperty(value = "版块名称") public String getBoardName() { return boardName; } public void setBoardName(String boardName) { this.boardName = boardName; } /** * 标题 **/ @ApiModelProperty(value = "标题") public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } /** * 发布时间 **/ @ApiModelProperty(value = "发布时间") public String getPostTime() { return postTime; } public void setPostTime(String postTime) { this.postTime = postTime; } /** * 作者名字 **/ @ApiModelProperty(value = "作者名字") public String getAuthorName() { return authorName; } public void setAuthorName(String authorName) { this.authorName = authorName; } /** * 作者ID **/ @ApiModelProperty(value = "作者ID") public String getAuthorUid() { return authorUid; } public void setAuthorUid(String authorUid) { this.authorUid = authorUid; } /** * 查看次数 **/ @ApiModelProperty(value = "查看次数") public String getViewCount() { return viewCount; } public void setViewCount(String viewCount) { this.viewCount = viewCount; } /** * 回复次数 **/ @ApiModelProperty(value = "回复次数") public String getReplyCount() { return replyCount; } public void setReplyCount(String replyCount) { this.replyCount = replyCount; } /** * 分类名称 **/ @ApiModelProperty(value = "分类名称") public String getCategoryName() { return categoryName; } public void setCategoryName(String categoryName) { this.categoryName = categoryName; } /** * 点赞数 **/ @ApiModelProperty(value = "点赞数") public String getPraiseCount() { return praiseCount; } public void setPraiseCount(String praiseCount) { this.praiseCount = praiseCount; } /** * 收藏数 **/ @ApiModelProperty(value = "收藏数") public String getCollectionCount() { return collectionCount; } public void setCollectionCount(String collectionCount) { this.collectionCount = collectionCount; } /** * 是否已赞 **/ @ApiModelProperty(value = "是否已赞") public String getIsPraised() { return isPraised; } public void setIsPraised(String isPraised) { this.isPraised = isPraised; } /** * 是否热帖 **/ @ApiModelProperty(value = "是否热帖") public String getIsHot() { return isHot; } public void setIsHot(String isHot) { this.isHot = isHot; } /** * 是否是精华帖 - 0:非精华帖 1~3:精华1~3级 **/ @ApiModelProperty(value = "是否是精华帖 - 0:非精华帖 1~3:精华1~3级") public String getIsBest() { return isBest; } public void setIsBest(String isBest) { this.isBest = isBest; } /** * 是否是推荐帖 **/ @ApiModelProperty(value = "是否是推荐帖") public String getIsRecommended() { return isRecommended; } public void setIsRecommended(String isRecommended) { this.isRecommended = isRecommended; } /** * 头像地址 **/ @ApiModelProperty(value = "头像地址") public String getAvatar() { return avatar; } public void setAvatar(String avatar) { this.avatar = avatar; } /** * 帖子包含的图片的地址,用于主题显示 **/ @ApiModelProperty(value = "帖子包含的图片的地址,用于主题显示") public List<String> getPics() { return pics; } public void setPics(List<String> pics) { this.pics = pics; } /** * 相关标签 **/ @ApiModelProperty(value = "相关标签") public List<TopicModelTags> getTags() { return tags; } public void setTags(List<TopicModelTags> tags) { this.tags = tags; } /** * 分享内容 **/ @ApiModelProperty(value = "分享内容") public String getShareTitle() { return shareTitle; } public void setShareTitle(String shareTitle) { this.shareTitle = shareTitle; } /** * 分享内容正文 **/ @ApiModelProperty(value = "分享内容正文") public String getShareContent() { return shareContent; } public void setShareContent(String shareContent) { this.shareContent = shareContent; } /** * 分享到微博的正文 **/ @ApiModelProperty(value = "分享到微博的正文") public String getShareContentWeibo() { return shareContentWeibo; } public void setShareContentWeibo(String shareContentWeibo) { this.shareContentWeibo = shareContentWeibo; } /** * 分享内容链接 **/ @ApiModelProperty(value = "分享内容链接") public String getShareUrl() { return shareUrl; } public void setShareUrl(String shareUrl) { this.shareUrl = shareUrl; } /** * 分享内容封面图片 **/ @ApiModelProperty(value = "分享内容封面图片") public String getSharePic() { return sharePic; } public void setSharePic(String sharePic) { this.sharePic = sharePic; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } TopicModel topicModel = (TopicModel) o; return (tid == null ? topicModel.tid == null : tid.equals(topicModel.tid)) && (boardId == null ? topicModel.boardId == null : boardId.equals(topicModel.boardId)) && (boardName == null ? topicModel.boardName == null : boardName.equals(topicModel.boardName)) && (title == null ? topicModel.title == null : title.equals(topicModel.title)) && (postTime == null ? topicModel.postTime == null : postTime.equals(topicModel.postTime)) && (authorName == null ? topicModel.authorName == null : authorName.equals(topicModel.authorName)) && (authorUid == null ? topicModel.authorUid == null : authorUid.equals(topicModel.authorUid)) && (viewCount == null ? topicModel.viewCount == null : viewCount.equals(topicModel.viewCount)) && (replyCount == null ? topicModel.replyCount == null : replyCount.equals(topicModel.replyCount)) && (categoryName == null ? topicModel.categoryName == null : categoryName.equals(topicModel.categoryName)) && (praiseCount == null ? topicModel.praiseCount == null : praiseCount.equals(topicModel.praiseCount)) && (collectionCount == null ? topicModel.collectionCount == null : collectionCount.equals(topicModel.collectionCount)) && (isPraised == null ? topicModel.isPraised == null : isPraised.equals(topicModel.isPraised)) && (isHot == null ? topicModel.isHot == null : isHot.equals(topicModel.isHot)) && (isBest == null ? topicModel.isBest == null : isBest.equals(topicModel.isBest)) && (isRecommended == null ? topicModel.isRecommended == null : isRecommended.equals(topicModel.isRecommended)) && (avatar == null ? topicModel.avatar == null : avatar.equals(topicModel.avatar)) && (pics == null ? topicModel.pics == null : pics.equals(topicModel.pics)) && (tags == null ? topicModel.tags == null : tags.equals(topicModel.tags)) && (shareTitle == null ? topicModel.shareTitle == null : shareTitle.equals(topicModel.shareTitle)) && (shareContent == null ? topicModel.shareContent == null : shareContent.equals(topicModel.shareContent)) && (shareContentWeibo == null ? topicModel.shareContentWeibo == null : shareContentWeibo.equals(topicModel.shareContentWeibo)) && (shareUrl == null ? topicModel.shareUrl == null : shareUrl.equals(topicModel.shareUrl)) && (sharePic == null ? topicModel.sharePic == null : sharePic.equals(topicModel.sharePic)); } @Override public int hashCode() { int result = 17; result = 31 * result + (tid == null ? 0: tid.hashCode()); result = 31 * result + (boardId == null ? 0: boardId.hashCode()); result = 31 * result + (boardName == null ? 0: boardName.hashCode()); result = 31 * result + (title == null ? 0: title.hashCode()); result = 31 * result + (postTime == null ? 0: postTime.hashCode()); result = 31 * result + (authorName == null ? 0: authorName.hashCode()); result = 31 * result + (authorUid == null ? 0: authorUid.hashCode()); result = 31 * result + (viewCount == null ? 0: viewCount.hashCode()); result = 31 * result + (replyCount == null ? 0: replyCount.hashCode()); result = 31 * result + (categoryName == null ? 0: categoryName.hashCode()); result = 31 * result + (praiseCount == null ? 0: praiseCount.hashCode()); result = 31 * result + (collectionCount == null ? 0: collectionCount.hashCode()); result = 31 * result + (isPraised == null ? 0: isPraised.hashCode()); result = 31 * result + (isHot == null ? 0: isHot.hashCode()); result = 31 * result + (isBest == null ? 0: isBest.hashCode()); result = 31 * result + (isRecommended == null ? 0: isRecommended.hashCode()); result = 31 * result + (avatar == null ? 0: avatar.hashCode()); result = 31 * result + (pics == null ? 0: pics.hashCode()); result = 31 * result + (tags == null ? 0: tags.hashCode()); result = 31 * result + (shareTitle == null ? 0: shareTitle.hashCode()); result = 31 * result + (shareContent == null ? 0: shareContent.hashCode()); result = 31 * result + (shareContentWeibo == null ? 0: shareContentWeibo.hashCode()); result = 31 * result + (shareUrl == null ? 0: shareUrl.hashCode()); result = 31 * result + (sharePic == null ? 0: sharePic.hashCode()); return result; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class TopicModel {\n"); sb.append(" tid: ").append(tid).append("\n"); sb.append(" boardId: ").append(boardId).append("\n"); sb.append(" boardName: ").append(boardName).append("\n"); sb.append(" title: ").append(title).append("\n"); sb.append(" postTime: ").append(postTime).append("\n"); sb.append(" authorName: ").append(authorName).append("\n"); sb.append(" authorUid: ").append(authorUid).append("\n"); sb.append(" viewCount: ").append(viewCount).append("\n"); sb.append(" replyCount: ").append(replyCount).append("\n"); sb.append(" categoryName: ").append(categoryName).append("\n"); sb.append(" praiseCount: ").append(praiseCount).append("\n"); sb.append(" collectionCount: ").append(collectionCount).append("\n"); sb.append(" isPraised: ").append(isPraised).append("\n"); sb.append(" isHot: ").append(isHot).append("\n"); sb.append(" isBest: ").append(isBest).append("\n"); sb.append(" isRecommended: ").append(isRecommended).append("\n"); sb.append(" avatar: ").append(avatar).append("\n"); sb.append(" pics: ").append(pics).append("\n"); sb.append(" tags: ").append(tags).append("\n"); sb.append(" shareTitle: ").append(shareTitle).append("\n"); sb.append(" shareContent: ").append(shareContent).append("\n"); sb.append(" shareContentWeibo: ").append(shareContentWeibo).append("\n"); sb.append(" shareUrl: ").append(shareUrl).append("\n"); sb.append(" sharePic: ").append(sharePic).append("\n"); sb.append("}\n"); return sb.toString(); } }
UTF-8
Java
14,400
java
TopicModel.java
Java
[ { "context": "ger code generator program.\n * https://github.com/swagger-api/swagger-codegen.git\n * Do not edit the class manu", "end": 229, "score": 0.9995548129081726, "start": 218, "tag": "USERNAME", "value": "swagger-api" }, { "context": "horName(String authorName) {\n this.authorName = authorName;\n }\n\n /**\n * 作者ID\n **/\n @ApiModelProperty(", "end": 3832, "score": 0.9428569078445435, "start": 3822, "tag": "NAME", "value": "authorName" } ]
null
[]
/** * 五五海淘返利APP新版接口 * 更新日志<br> 相对于上一build的变更: <br/>Nu 调整搜索模型 * * OpenAPI spec version: 1.8 build20180202-2 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. * * 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 io.swagger.client.model; import io.swagger.client.model.TopicModelTags; import java.util.*; import io.swagger.annotations.*; import com.google.gson.annotations.SerializedName; @ApiModel(description = "") public class TopicModel { @SerializedName("tid") private String tid = null; @SerializedName("board_id") private String boardId = null; @SerializedName("board_name") private String boardName = null; @SerializedName("title") private String title = null; @SerializedName("post_time") private String postTime = null; @SerializedName("author_name") private String authorName = null; @SerializedName("author_uid") private String authorUid = null; @SerializedName("view_count") private String viewCount = null; @SerializedName("reply_count") private String replyCount = null; @SerializedName("category_name") private String categoryName = null; @SerializedName("praise_count") private String praiseCount = null; @SerializedName("collection_count") private String collectionCount = null; @SerializedName("is_praised") private String isPraised = null; @SerializedName("is_hot") private String isHot = null; @SerializedName("is_best") private String isBest = null; @SerializedName("is_recommended") private String isRecommended = null; @SerializedName("avatar") private String avatar = null; @SerializedName("pics") private List<String> pics = null; @SerializedName("tags") private List<TopicModelTags> tags = null; @SerializedName("share_title") private String shareTitle = null; @SerializedName("share_content") private String shareContent = null; @SerializedName("share_content_weibo") private String shareContentWeibo = null; @SerializedName("share_url") private String shareUrl = null; @SerializedName("share_pic") private String sharePic = null; /** * 帖子ID **/ @ApiModelProperty(value = "帖子ID") public String getTid() { return tid; } public void setTid(String tid) { this.tid = tid; } /** * 版块ID **/ @ApiModelProperty(value = "版块ID") public String getBoardId() { return boardId; } public void setBoardId(String boardId) { this.boardId = boardId; } /** * 版块名称 **/ @ApiModelProperty(value = "版块名称") public String getBoardName() { return boardName; } public void setBoardName(String boardName) { this.boardName = boardName; } /** * 标题 **/ @ApiModelProperty(value = "标题") public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } /** * 发布时间 **/ @ApiModelProperty(value = "发布时间") public String getPostTime() { return postTime; } public void setPostTime(String postTime) { this.postTime = postTime; } /** * 作者名字 **/ @ApiModelProperty(value = "作者名字") public String getAuthorName() { return authorName; } public void setAuthorName(String authorName) { this.authorName = authorName; } /** * 作者ID **/ @ApiModelProperty(value = "作者ID") public String getAuthorUid() { return authorUid; } public void setAuthorUid(String authorUid) { this.authorUid = authorUid; } /** * 查看次数 **/ @ApiModelProperty(value = "查看次数") public String getViewCount() { return viewCount; } public void setViewCount(String viewCount) { this.viewCount = viewCount; } /** * 回复次数 **/ @ApiModelProperty(value = "回复次数") public String getReplyCount() { return replyCount; } public void setReplyCount(String replyCount) { this.replyCount = replyCount; } /** * 分类名称 **/ @ApiModelProperty(value = "分类名称") public String getCategoryName() { return categoryName; } public void setCategoryName(String categoryName) { this.categoryName = categoryName; } /** * 点赞数 **/ @ApiModelProperty(value = "点赞数") public String getPraiseCount() { return praiseCount; } public void setPraiseCount(String praiseCount) { this.praiseCount = praiseCount; } /** * 收藏数 **/ @ApiModelProperty(value = "收藏数") public String getCollectionCount() { return collectionCount; } public void setCollectionCount(String collectionCount) { this.collectionCount = collectionCount; } /** * 是否已赞 **/ @ApiModelProperty(value = "是否已赞") public String getIsPraised() { return isPraised; } public void setIsPraised(String isPraised) { this.isPraised = isPraised; } /** * 是否热帖 **/ @ApiModelProperty(value = "是否热帖") public String getIsHot() { return isHot; } public void setIsHot(String isHot) { this.isHot = isHot; } /** * 是否是精华帖 - 0:非精华帖 1~3:精华1~3级 **/ @ApiModelProperty(value = "是否是精华帖 - 0:非精华帖 1~3:精华1~3级") public String getIsBest() { return isBest; } public void setIsBest(String isBest) { this.isBest = isBest; } /** * 是否是推荐帖 **/ @ApiModelProperty(value = "是否是推荐帖") public String getIsRecommended() { return isRecommended; } public void setIsRecommended(String isRecommended) { this.isRecommended = isRecommended; } /** * 头像地址 **/ @ApiModelProperty(value = "头像地址") public String getAvatar() { return avatar; } public void setAvatar(String avatar) { this.avatar = avatar; } /** * 帖子包含的图片的地址,用于主题显示 **/ @ApiModelProperty(value = "帖子包含的图片的地址,用于主题显示") public List<String> getPics() { return pics; } public void setPics(List<String> pics) { this.pics = pics; } /** * 相关标签 **/ @ApiModelProperty(value = "相关标签") public List<TopicModelTags> getTags() { return tags; } public void setTags(List<TopicModelTags> tags) { this.tags = tags; } /** * 分享内容 **/ @ApiModelProperty(value = "分享内容") public String getShareTitle() { return shareTitle; } public void setShareTitle(String shareTitle) { this.shareTitle = shareTitle; } /** * 分享内容正文 **/ @ApiModelProperty(value = "分享内容正文") public String getShareContent() { return shareContent; } public void setShareContent(String shareContent) { this.shareContent = shareContent; } /** * 分享到微博的正文 **/ @ApiModelProperty(value = "分享到微博的正文") public String getShareContentWeibo() { return shareContentWeibo; } public void setShareContentWeibo(String shareContentWeibo) { this.shareContentWeibo = shareContentWeibo; } /** * 分享内容链接 **/ @ApiModelProperty(value = "分享内容链接") public String getShareUrl() { return shareUrl; } public void setShareUrl(String shareUrl) { this.shareUrl = shareUrl; } /** * 分享内容封面图片 **/ @ApiModelProperty(value = "分享内容封面图片") public String getSharePic() { return sharePic; } public void setSharePic(String sharePic) { this.sharePic = sharePic; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } TopicModel topicModel = (TopicModel) o; return (tid == null ? topicModel.tid == null : tid.equals(topicModel.tid)) && (boardId == null ? topicModel.boardId == null : boardId.equals(topicModel.boardId)) && (boardName == null ? topicModel.boardName == null : boardName.equals(topicModel.boardName)) && (title == null ? topicModel.title == null : title.equals(topicModel.title)) && (postTime == null ? topicModel.postTime == null : postTime.equals(topicModel.postTime)) && (authorName == null ? topicModel.authorName == null : authorName.equals(topicModel.authorName)) && (authorUid == null ? topicModel.authorUid == null : authorUid.equals(topicModel.authorUid)) && (viewCount == null ? topicModel.viewCount == null : viewCount.equals(topicModel.viewCount)) && (replyCount == null ? topicModel.replyCount == null : replyCount.equals(topicModel.replyCount)) && (categoryName == null ? topicModel.categoryName == null : categoryName.equals(topicModel.categoryName)) && (praiseCount == null ? topicModel.praiseCount == null : praiseCount.equals(topicModel.praiseCount)) && (collectionCount == null ? topicModel.collectionCount == null : collectionCount.equals(topicModel.collectionCount)) && (isPraised == null ? topicModel.isPraised == null : isPraised.equals(topicModel.isPraised)) && (isHot == null ? topicModel.isHot == null : isHot.equals(topicModel.isHot)) && (isBest == null ? topicModel.isBest == null : isBest.equals(topicModel.isBest)) && (isRecommended == null ? topicModel.isRecommended == null : isRecommended.equals(topicModel.isRecommended)) && (avatar == null ? topicModel.avatar == null : avatar.equals(topicModel.avatar)) && (pics == null ? topicModel.pics == null : pics.equals(topicModel.pics)) && (tags == null ? topicModel.tags == null : tags.equals(topicModel.tags)) && (shareTitle == null ? topicModel.shareTitle == null : shareTitle.equals(topicModel.shareTitle)) && (shareContent == null ? topicModel.shareContent == null : shareContent.equals(topicModel.shareContent)) && (shareContentWeibo == null ? topicModel.shareContentWeibo == null : shareContentWeibo.equals(topicModel.shareContentWeibo)) && (shareUrl == null ? topicModel.shareUrl == null : shareUrl.equals(topicModel.shareUrl)) && (sharePic == null ? topicModel.sharePic == null : sharePic.equals(topicModel.sharePic)); } @Override public int hashCode() { int result = 17; result = 31 * result + (tid == null ? 0: tid.hashCode()); result = 31 * result + (boardId == null ? 0: boardId.hashCode()); result = 31 * result + (boardName == null ? 0: boardName.hashCode()); result = 31 * result + (title == null ? 0: title.hashCode()); result = 31 * result + (postTime == null ? 0: postTime.hashCode()); result = 31 * result + (authorName == null ? 0: authorName.hashCode()); result = 31 * result + (authorUid == null ? 0: authorUid.hashCode()); result = 31 * result + (viewCount == null ? 0: viewCount.hashCode()); result = 31 * result + (replyCount == null ? 0: replyCount.hashCode()); result = 31 * result + (categoryName == null ? 0: categoryName.hashCode()); result = 31 * result + (praiseCount == null ? 0: praiseCount.hashCode()); result = 31 * result + (collectionCount == null ? 0: collectionCount.hashCode()); result = 31 * result + (isPraised == null ? 0: isPraised.hashCode()); result = 31 * result + (isHot == null ? 0: isHot.hashCode()); result = 31 * result + (isBest == null ? 0: isBest.hashCode()); result = 31 * result + (isRecommended == null ? 0: isRecommended.hashCode()); result = 31 * result + (avatar == null ? 0: avatar.hashCode()); result = 31 * result + (pics == null ? 0: pics.hashCode()); result = 31 * result + (tags == null ? 0: tags.hashCode()); result = 31 * result + (shareTitle == null ? 0: shareTitle.hashCode()); result = 31 * result + (shareContent == null ? 0: shareContent.hashCode()); result = 31 * result + (shareContentWeibo == null ? 0: shareContentWeibo.hashCode()); result = 31 * result + (shareUrl == null ? 0: shareUrl.hashCode()); result = 31 * result + (sharePic == null ? 0: sharePic.hashCode()); return result; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class TopicModel {\n"); sb.append(" tid: ").append(tid).append("\n"); sb.append(" boardId: ").append(boardId).append("\n"); sb.append(" boardName: ").append(boardName).append("\n"); sb.append(" title: ").append(title).append("\n"); sb.append(" postTime: ").append(postTime).append("\n"); sb.append(" authorName: ").append(authorName).append("\n"); sb.append(" authorUid: ").append(authorUid).append("\n"); sb.append(" viewCount: ").append(viewCount).append("\n"); sb.append(" replyCount: ").append(replyCount).append("\n"); sb.append(" categoryName: ").append(categoryName).append("\n"); sb.append(" praiseCount: ").append(praiseCount).append("\n"); sb.append(" collectionCount: ").append(collectionCount).append("\n"); sb.append(" isPraised: ").append(isPraised).append("\n"); sb.append(" isHot: ").append(isHot).append("\n"); sb.append(" isBest: ").append(isBest).append("\n"); sb.append(" isRecommended: ").append(isRecommended).append("\n"); sb.append(" avatar: ").append(avatar).append("\n"); sb.append(" pics: ").append(pics).append("\n"); sb.append(" tags: ").append(tags).append("\n"); sb.append(" shareTitle: ").append(shareTitle).append("\n"); sb.append(" shareContent: ").append(shareContent).append("\n"); sb.append(" shareContentWeibo: ").append(shareContentWeibo).append("\n"); sb.append(" shareUrl: ").append(shareUrl).append("\n"); sb.append(" sharePic: ").append(sharePic).append("\n"); sb.append("}\n"); return sb.toString(); } }
14,400
0.652318
0.645168
448
29.90625
27.561216
134
false
false
0
0
0
0
0
0
0.316964
false
false
10
812c60700f59197a8ffd1d8ee844e0bbd2565f9a
8,856,222,606,321
7274b19c46fb81f94ac1255129420a456b13fb50
/11th grade compsci A/CircleDriver.java
ade62677bd4c93756873cb9cef36bdce2126ca26
[]
no_license
maxxwizard/highSchool
https://github.com/maxxwizard/highSchool
9fff1cde23c81fe6c4cb17ba8fac19c38f4b3940
c75e1e1e926fe5d0bdd854a511bd699a2b7f4c37
refs/heads/master
2021-01-01T06:56:16.559000
2017-07-18T04:22:29
2017-07-18T04:22:29
97,552,342
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class CircleDriver { public static void main(String args[]) { Circle[] circle = new Circle[5]; for (int i = 0; i < circle.length; i++) { circle[i] = new Circle(i+1); } circleSort(circle); for (int i = 0; i < circle.length; i++) { System.out.println(circle[i]); } }//end main program code }//end public class CircleDriver
UTF-8
Java
383
java
CircleDriver.java
Java
[]
null
[]
public class CircleDriver { public static void main(String args[]) { Circle[] circle = new Circle[5]; for (int i = 0; i < circle.length; i++) { circle[i] = new Circle(i+1); } circleSort(circle); for (int i = 0; i < circle.length; i++) { System.out.println(circle[i]); } }//end main program code }//end public class CircleDriver
383
0.574413
0.563969
19
19.210526
16.175287
44
false
false
0
0
0
0
0
0
3
false
false
10
be33933418328167e79e0f6ac55fd6e5adea2829
7,344,394,088,219
47f6d27c677c134948d9bfe439db027436ad6542
/src/main/java/com/tpg/holidays/model/Child.java
73ded975b252dcdc600ca85993947531408fac4a
[]
no_license
tpgoldie/holidays-api
https://github.com/tpgoldie/holidays-api
809f7c51403ad113bc5fb113fa98968bc7b4ba31
a043cfa754f08e5cc6fe3f6a5bf597cf528673ff
refs/heads/master
2020-03-17T03:38:40.647000
2018-05-25T22:59:53
2018-05-25T22:59:53
133,244,361
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tpg.holidays.model; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; @Getter @Setter @EqualsAndHashCode public final class Child { private int age; }
UTF-8
Java
197
java
Child.java
Java
[]
null
[]
package com.tpg.holidays.model; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; @Getter @Setter @EqualsAndHashCode public final class Child { private int age; }
197
0.781726
0.781726
13
14.153846
11.641082
32
false
false
0
0
0
0
0
0
0.384615
false
false
10
0721c7ca6468053a1028d15840dabc87a2742a5e
13,486,197,332,781
e8c0cc802a66f98d30dae61d4c559d3a42e7fe01
/src/main/java/com/belaid/mvc/dao/ICommandeClientDao.java
633a64c234e909ba604a3bea5570117c590ed12c
[]
no_license
belaid1993/Gestion_de_stock_MVC
https://github.com/belaid1993/Gestion_de_stock_MVC
f23e74316af636a1481e1332db9ccf0a56374453
96d4ada2ef4702586193bcd3d03cf1bd601d6764
refs/heads/master
2020-07-31T11:21:18.664000
2019-11-17T17:54:20
2019-11-17T17:54:20
210,586,625
2
0
null
false
2020-10-13T16:16:16
2019-09-24T11:32:13
2019-11-17T17:55:13
2020-10-13T16:16:14
57
0
0
3
Java
false
false
package com.belaid.mvc.dao; import com.belaid.mvc.entities.CommandeClient; public interface ICommandeClientDao extends IGenericDao<CommandeClient> { }
UTF-8
Java
154
java
ICommandeClientDao.java
Java
[]
null
[]
package com.belaid.mvc.dao; import com.belaid.mvc.entities.CommandeClient; public interface ICommandeClientDao extends IGenericDao<CommandeClient> { }
154
0.824675
0.824675
7
21
26.960289
73
false
false
0
0
0
0
0
0
0.285714
false
false
10
a618dcee1986afbe014e5165a6bf323380674636
10,831,907,575,682
f499cc84fcb7fca23bbd0864dd38f8eb95c49665
/src/main/java/commonFunctions/Util.java
24b6f37ff37677ec9657adf0c21ecb5608dc5e20
[]
no_license
charumittalNM/testautothon.0.1
https://github.com/charumittalNM/testautothon.0.1
d9286f12a303745dfde46f0d6ad4805af96aed5e
16f4b6a55f211ec0ec9534ee73272cecf7212af0
refs/heads/master
2020-05-16T18:08:46.605000
2019-04-26T04:31:34
2019-04-26T04:31:34
183,216,112
0
2
null
false
2019-04-26T02:37:16
2019-04-24T11:35:36
2019-04-26T00:59:29
2019-04-26T00:59:28
6,623
0
1
1
Java
false
false
package commonFunctions; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Properties; public class Util { static Properties prop = null; public static void loadProperties(String filePath){ prop = new Properties(); InputStream input = null; try { input = new FileInputStream(filePath); prop.load(input); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); }finally{ if (input!=null) { try { input.close(); } catch (IOException e) { // TODO Auto-generated catch block //Log.error("Failed to load property file"); //ErrorCollector.Verifyfail("Failed to load the property file"); } } } } public static String getConfigData(String key){ loadProperties(System.getProperty("user.dir")+ "/src/main/resources/Config.Properties"); String value = prop.getProperty(key); return value; } }
UTF-8
Java
939
java
Util.java
Java
[]
null
[]
package commonFunctions; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Properties; public class Util { static Properties prop = null; public static void loadProperties(String filePath){ prop = new Properties(); InputStream input = null; try { input = new FileInputStream(filePath); prop.load(input); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); }finally{ if (input!=null) { try { input.close(); } catch (IOException e) { // TODO Auto-generated catch block //Log.error("Failed to load property file"); //ErrorCollector.Verifyfail("Failed to load the property file"); } } } } public static String getConfigData(String key){ loadProperties(System.getProperty("user.dir")+ "/src/main/resources/Config.Properties"); String value = prop.getProperty(key); return value; } }
939
0.685836
0.685836
41
21.829268
20.051035
90
false
false
0
0
0
0
0
0
2.292683
false
false
10
b55d481bb6f2a9704d7605e00fc661fd65d3ba82
10,831,907,575,955
318d358553a41168bd971cc239311eda92bfdbdd
/herddb-core/src/test/java/herddb/sql/JSQLParserPlannerTest.java
7ffd8f94a80c78d858ffe9a37f82da9db92c8e87
[ "Apache-2.0" ]
permissive
diennea/herddb
https://github.com/diennea/herddb
3dfd5bc6bdd77e2c4799b4844c33acdb72b6735e
47d992f1171af8e6344d4cd5812b73908b333870
refs/heads/master
2023-07-08T23:41:05.958000
2023-06-28T11:40:22
2023-06-28T11:40:22
52,507,351
300
58
Apache-2.0
false
2023-09-06T08:17:37
2016-02-25T08:01:32
2023-09-01T09:10:15
2023-09-05T14:43:54
10,424
284
44
70
Java
false
false
/* * Licensed to Diennea S.r.l. under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. Diennea S.r.l. 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 herddb.sql; import static herddb.core.TestUtils.execute; import static herddb.core.TestUtils.scan; import static org.junit.Assert.assertEquals; import herddb.core.DBManager; import herddb.mem.MemoryCommitLogManager; import herddb.mem.MemoryDataStorageManager; import herddb.mem.MemoryMetadataStorageManager; import herddb.model.DataScanner; import herddb.model.StatementEvaluationContext; import herddb.model.TransactionContext; import herddb.model.commands.CreateTableSpaceStatement; import java.util.Arrays; import java.util.Collections; import org.junit.Test; /** * * @author enrico.olivelli */ public class JSQLParserPlannerTest { @Test public void testColumnWithNameSize() throws Exception { String nodeId = "localhost"; try (DBManager manager = new DBManager("localhost", new MemoryMetadataStorageManager(), new MemoryDataStorageManager(), new MemoryCommitLogManager(), null, null)) { manager.start(); CreateTableSpaceStatement st1 = new CreateTableSpaceStatement("tblspace1", Collections.singleton(nodeId), nodeId, 1, 0, 0); manager.executeStatement(st1, StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION); manager.waitForTablespace("tblspace1", 10000); execute(manager, "CREATE TABLE tblspace1.tsql (k1 string primary key,size int)", Collections.emptyList()); execute(manager, "INSERT INTO tblspace1.tsql (k1,size) values(?,?)", Arrays.asList("mykey", 1234), TransactionContext.NO_TRANSACTION); try (DataScanner scan = scan(manager, "SELECT size,k1 FROM tblspace1.tsql where size=1234", Collections.emptyList())) { assertEquals(1, scan.consume().size()); } } } }
UTF-8
Java
2,569
java
JSQLParserPlannerTest.java
Java
[ { "context": "/*\n * Licensed to Diennea S.r.l. under one\n * or more contributor license agreeme", "end": 31, "score": 0.9126960039138794, "start": 18, "tag": "NAME", "value": "Diennea S.r.l" }, { "context": "onal information\n * regarding copyright ownership. Diennea S.r.l. licenses this file\n * to you under the Apa", "end": 204, "score": 0.9836432337760925, "start": 197, "tag": "NAME", "value": "Diennea" }, { "context": "ections;\nimport org.junit.Test;\n\n/**\n *\n * @author enrico.olivelli\n */\npublic class JSQLParserPlannerTest {\n\n @Te", "end": 1398, "score": 0.999622642993927, "start": 1383, "tag": "NAME", "value": "enrico.olivelli" } ]
null
[]
/* * Licensed to <NAME>. under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. Diennea S.r.l. 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 herddb.sql; import static herddb.core.TestUtils.execute; import static herddb.core.TestUtils.scan; import static org.junit.Assert.assertEquals; import herddb.core.DBManager; import herddb.mem.MemoryCommitLogManager; import herddb.mem.MemoryDataStorageManager; import herddb.mem.MemoryMetadataStorageManager; import herddb.model.DataScanner; import herddb.model.StatementEvaluationContext; import herddb.model.TransactionContext; import herddb.model.commands.CreateTableSpaceStatement; import java.util.Arrays; import java.util.Collections; import org.junit.Test; /** * * @author enrico.olivelli */ public class JSQLParserPlannerTest { @Test public void testColumnWithNameSize() throws Exception { String nodeId = "localhost"; try (DBManager manager = new DBManager("localhost", new MemoryMetadataStorageManager(), new MemoryDataStorageManager(), new MemoryCommitLogManager(), null, null)) { manager.start(); CreateTableSpaceStatement st1 = new CreateTableSpaceStatement("tblspace1", Collections.singleton(nodeId), nodeId, 1, 0, 0); manager.executeStatement(st1, StatementEvaluationContext.DEFAULT_EVALUATION_CONTEXT(), TransactionContext.NO_TRANSACTION); manager.waitForTablespace("tblspace1", 10000); execute(manager, "CREATE TABLE tblspace1.tsql (k1 string primary key,size int)", Collections.emptyList()); execute(manager, "INSERT INTO tblspace1.tsql (k1,size) values(?,?)", Arrays.asList("mykey", 1234), TransactionContext.NO_TRANSACTION); try (DataScanner scan = scan(manager, "SELECT size,k1 FROM tblspace1.tsql where size=1234", Collections.emptyList())) { assertEquals(1, scan.consume().size()); } } } }
2,562
0.73803
0.725963
61
41.114754
39.449116
172
false
false
0
0
0
0
0
0
0.885246
false
false
10
e087a60b47e7f4097ba00d00beb77b9be1ee92bc
12,275,016,545,980
c4c87292d2e6c2b72a2b49e6485a8d1172b9b690
/src/Ship.java
8403026a65e5ef168675cc548238cfdf134e0165
[]
no_license
iwer/TT1Prak
https://github.com/iwer/TT1Prak
2ed46c84ff5fbb24ddbcfc57295736bc47c4dd9e
930550987812d7ccc2b8a16d5db2595844cdc397
refs/heads/master
2018-01-09T11:03:24.613000
2016-01-20T11:40:11
2016-01-20T11:40:11
48,141,657
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * The Class Ship. */ public class Ship { /** The {@link Interval} number. */ int intervalNumber; /** The position. */ Interval position; /** * Instantiates a new ship. * * A ship has a constant interval number, which defines the index of the {@link Interval} * the ship is located. That way we can keep our ship positions while {@link Player}s are joining, * and the actual intervals can be recalculated, so that the ship keep their relative position * * @param intervalNumber the interval number */ public Ship(int intervalNumber) { this.intervalNumber = intervalNumber; System.out.println("Created Ship in Interval #" + intervalNumber); } /** * Gets the interval number. * * @return the interval number */ public int getIntervalNumber() { return intervalNumber; } /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { return "Ship [intervalNumber=" + intervalNumber + ", position=" + position + "]"; } /** * Gets the {@link Interval} the ship is sitting at. * * @return the position */ public Interval getPosition() { return position; } /** * Sets the {@link Interval} the ship is sitting at. Should correlate with the intervalID. * * @param position the new position */ public void setPosition(Interval position) { this.position = position; } }
UTF-8
Java
1,379
java
Ship.java
Java
[]
null
[]
/** * The Class Ship. */ public class Ship { /** The {@link Interval} number. */ int intervalNumber; /** The position. */ Interval position; /** * Instantiates a new ship. * * A ship has a constant interval number, which defines the index of the {@link Interval} * the ship is located. That way we can keep our ship positions while {@link Player}s are joining, * and the actual intervals can be recalculated, so that the ship keep their relative position * * @param intervalNumber the interval number */ public Ship(int intervalNumber) { this.intervalNumber = intervalNumber; System.out.println("Created Ship in Interval #" + intervalNumber); } /** * Gets the interval number. * * @return the interval number */ public int getIntervalNumber() { return intervalNumber; } /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { return "Ship [intervalNumber=" + intervalNumber + ", position=" + position + "]"; } /** * Gets the {@link Interval} the ship is sitting at. * * @return the position */ public Interval getPosition() { return position; } /** * Sets the {@link Interval} the ship is sitting at. Should correlate with the intervalID. * * @param position the new position */ public void setPosition(Interval position) { this.position = position; } }
1,379
0.673677
0.673677
60
21.983334
26.291628
99
false
false
0
0
0
0
0
0
1.133333
false
false
10
96206642103ffe5e166c79950f4816b53d93e637
28,054,726,429,133
746e9674e29517ae4111f8dc6c17fc01c4090bd6
/CommandsUHC/src/com/thetonyk/UHC/Commands/BorderCommand.java
f213aa06480a6d9028d60fdbfce25899f8ff6210
[]
no_license
TheTonyk/CommandsUHC
https://github.com/TheTonyk/CommandsUHC
248eff5af2763338866a45fdf4dcdd48a7bf312a
147a8016822505f2662d1eb1146879a5cf07baf5
refs/heads/master
2021-01-18T22:38:32.753000
2016-07-26T18:57:38
2016-07-26T18:57:38
57,925,183
0
2
null
false
2016-07-15T22:29:54
2016-05-02T22:25:38
2016-05-02T22:28:10
2016-07-15T22:29:54
348
0
1
0
Java
null
null
package com.thetonyk.UHC.Commands; import java.util.ArrayList; import java.util.List; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.command.TabCompleter; import com.thetonyk.UHC.Main; import com.thetonyk.UHC.Utils.GameUtils; import com.thetonyk.UHC.Utils.WorldUtils; public class BorderCommand implements CommandExecutor, TabCompleter { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (!sender.hasPermission("uhc.border")) { sender.sendMessage(Main.NO_PERMS); return true; } String gameWorld = GameUtils.getWorld(); if (args.length == 0 || !sender.hasPermission("uhc.setborder")) { if (gameWorld == null || Bukkit.getWorld(gameWorld) == null) { sender.sendMessage(Main.PREFIX + "The game is not ready."); return true; } int size = (int) Bukkit.getWorld(gameWorld).getWorldBorder().getSize(); sender.sendMessage(Main.PREFIX + "Border size: §6" + size + "§7x§6" + size + "§7."); return true; } String name = args[0]; World world = Bukkit.getWorld(name); if (!WorldUtils.exist(name)) { sender.sendMessage(Main.PREFIX + "The world '§6" + name + "§7' doesn't exist."); return true; } if (args.length == 1) { int size = world == null ? (int) WorldUtils.getSize(name) : (int) world.getWorldBorder().getSize(); sender.sendMessage(Main.PREFIX + "Size of world '§6" + name + "§7': §a" + size + "§7x§a" + size + "§7."); return true; } int size; try { size = Integer.parseInt(args[1]); } catch (Exception exception) { sender.sendMessage(Main.PREFIX + "Please enter a valid size of world."); return true; } if (size > 10000 || size < 100) { sender.sendMessage(Main.PREFIX + "Please enter a valid size of world."); return true; } WorldUtils.setSize(name, size); if (world != null) world.getWorldBorder().setSize(size); Bukkit.broadcastMessage(Main.PREFIX + "Size of world '§6" + name + "§7' set to: §a" + size + "§7x§a" + size + "§7."); return true; } @Override public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) { if (!sender.hasPermission("uhc.setborder")) return null; List<String> complete = new ArrayList<String>(); if (args.length == 1) { for (World world : Bukkit.getWorlds()) { if (world.getName().equalsIgnoreCase("lobby")) continue; complete.add(world.getName()); } } List<String> tabCompletions = new ArrayList<String>(); if (args[args.length - 1].isEmpty()) { for (String type : complete) { tabCompletions.add(type); } } else { for (String type : complete) { if (type.toLowerCase().startsWith(args[args.length - 1].toLowerCase())) tabCompletions.add(type); } } return tabCompletions; } }
UTF-8
Java
3,114
java
BorderCommand.java
Java
[]
null
[]
package com.thetonyk.UHC.Commands; import java.util.ArrayList; import java.util.List; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.command.TabCompleter; import com.thetonyk.UHC.Main; import com.thetonyk.UHC.Utils.GameUtils; import com.thetonyk.UHC.Utils.WorldUtils; public class BorderCommand implements CommandExecutor, TabCompleter { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (!sender.hasPermission("uhc.border")) { sender.sendMessage(Main.NO_PERMS); return true; } String gameWorld = GameUtils.getWorld(); if (args.length == 0 || !sender.hasPermission("uhc.setborder")) { if (gameWorld == null || Bukkit.getWorld(gameWorld) == null) { sender.sendMessage(Main.PREFIX + "The game is not ready."); return true; } int size = (int) Bukkit.getWorld(gameWorld).getWorldBorder().getSize(); sender.sendMessage(Main.PREFIX + "Border size: §6" + size + "§7x§6" + size + "§7."); return true; } String name = args[0]; World world = Bukkit.getWorld(name); if (!WorldUtils.exist(name)) { sender.sendMessage(Main.PREFIX + "The world '§6" + name + "§7' doesn't exist."); return true; } if (args.length == 1) { int size = world == null ? (int) WorldUtils.getSize(name) : (int) world.getWorldBorder().getSize(); sender.sendMessage(Main.PREFIX + "Size of world '§6" + name + "§7': §a" + size + "§7x§a" + size + "§7."); return true; } int size; try { size = Integer.parseInt(args[1]); } catch (Exception exception) { sender.sendMessage(Main.PREFIX + "Please enter a valid size of world."); return true; } if (size > 10000 || size < 100) { sender.sendMessage(Main.PREFIX + "Please enter a valid size of world."); return true; } WorldUtils.setSize(name, size); if (world != null) world.getWorldBorder().setSize(size); Bukkit.broadcastMessage(Main.PREFIX + "Size of world '§6" + name + "§7' set to: §a" + size + "§7x§a" + size + "§7."); return true; } @Override public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) { if (!sender.hasPermission("uhc.setborder")) return null; List<String> complete = new ArrayList<String>(); if (args.length == 1) { for (World world : Bukkit.getWorlds()) { if (world.getName().equalsIgnoreCase("lobby")) continue; complete.add(world.getName()); } } List<String> tabCompletions = new ArrayList<String>(); if (args[args.length - 1].isEmpty()) { for (String type : complete) { tabCompletions.add(type); } } else { for (String type : complete) { if (type.toLowerCase().startsWith(args[args.length - 1].toLowerCase())) tabCompletions.add(type); } } return tabCompletions; } }
3,114
0.63469
0.625323
136
21.764706
27.821182
119
false
false
0
0
0
0
0
0
2.639706
false
false
10
d6dcb702bbf34f89cc8b654d5ab47d5a1c6da0a8
5,506,148,128,687
e4dfd612d64ba10d458e4b40f4292a7a56110da0
/StudentGradeBookApp/src/interfaceAndGradeBook/GlobalConstant.java
34069c994c689d40d7b2cad377ca5da606417b96
[ "MIT" ]
permissive
tonyman316/StudentGradeBookApp
https://github.com/tonyman316/StudentGradeBookApp
0c1d1aa02aed4b23a9f573a14c3d17d246625f4b
76ab983f1b5c328a168cd092d43cad05aba0d0a8
refs/heads/master
2021-01-21T14:19:11.262000
2017-06-24T00:55:40
2017-06-24T00:55:40
95,265,489
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package interfaceAndGradeBook; public interface GlobalConstant { public final boolean DEBUG = false; }
UTF-8
Java
105
java
GlobalConstant.java
Java
[]
null
[]
package interfaceAndGradeBook; public interface GlobalConstant { public final boolean DEBUG = false; }
105
0.809524
0.809524
5
20
16.037457
36
false
false
0
0
0
0
0
0
0.6
false
false
10
ac837fc0a47a789a5a5dfd7017aaf31f78792bf8
11,338,713,716,934
209c17287c15bd48e952aa7bbb39a6227b986425
/Maximum.java
761e454e6509769fb263cba04fb3fcd4b683a892
[]
no_license
luckjd-7/School
https://github.com/luckjd-7/School
cbc9aa1831fa5d73aeeead9be4cd7cd965305e96
89871e18983b427ef983dffbc2dbf19e62922b60
refs/heads/master
2022-12-03T07:08:26.541000
2020-08-25T05:52:41
2020-08-25T05:52:41
290,115,813
0
0
null
false
2020-08-25T05:03:01
2020-08-25T04:49:43
2020-08-25T04:59:44
2020-08-25T05:03:00
0
0
0
0
C
false
false
public class Maximum { public static void main(String[] args) { int[] fList = {1,5,3,4,2}; int[] bList = {}; int fMax = Maximum(0,0,fList); int bMax = Maximum(0,0,bList); System.out.println(fMax); System.out.println(bMax); } public static int Maximum(int counter,int max, int[] list) { if(list.length==0) { max = -2147483648; } if(list.length==(counter-1)) { max = Math.max(max, list[counter]); return max; } if(list.length!=counter) { max = Math.max(max, list[counter]); counter++; return Maximum(counter,max,list); } return max; } }
UTF-8
Java
643
java
Maximum.java
Java
[]
null
[]
public class Maximum { public static void main(String[] args) { int[] fList = {1,5,3,4,2}; int[] bList = {}; int fMax = Maximum(0,0,fList); int bMax = Maximum(0,0,bList); System.out.println(fMax); System.out.println(bMax); } public static int Maximum(int counter,int max, int[] list) { if(list.length==0) { max = -2147483648; } if(list.length==(counter-1)) { max = Math.max(max, list[counter]); return max; } if(list.length!=counter) { max = Math.max(max, list[counter]); counter++; return Maximum(counter,max,list); } return max; } }
643
0.561431
0.528771
31
18.67742
15.561298
59
false
false
0
0
0
0
0
0
0.870968
false
false
10
7be946e599de688d2f6a08b98247067e98d337d1
5,677,946,801,019
dbed8c46f31877644c3526a9ab12237cca95579d
/algorithm/Cos/src/ps4/Solution4_8.java
d6f616316faf5a7d69954e6afd9e103fbec93811
[]
no_license
esesil/TIL
https://github.com/esesil/TIL
509f6d70072d0bc61a50334cecb7b024d7e59780
b3f2f3ac4a2a63c435d4f9dc81cea90bccb4eecb
refs/heads/main
2023-06-26T21:20:22.526000
2021-07-23T05:51:17
2021-07-23T05:51:17
335,315,710
0
0
null
false
2021-02-11T15:32:43
2021-02-02T14:27:26
2021-02-10T15:19:50
2021-02-11T15:32:10
33
0
0
0
null
false
false
package ps4; // 다음과 같이 import를 사용할 수 있습니다. import java.util.*; class Solution4_8 { ArrayList<Integer> list = new ArrayList<Integer>(); public int solution(int[] card, int n) { int[] check = card_count(card); makenum(0, 0, new int[10], card.length, check); //배열, level, 숫자, 체크배열, 카드배열 System.out.println(list); int answer = 0; for(int i=0; i<list.size(); i++) { if(list.get(i)==n) { answer= i+1; break; } else { answer= -1; } } return answer; } private void makenum(int lev, int num, int[] check, int cardlength, int[] max_check) { if(lev==cardlength) { list.add(num); return; } for(int i=1; i<=9; i++) { if(check[i]<max_check[i]) { check[i] += 1; makenum(lev+1, num*10+i, check, cardlength, max_check); check[i] -= 1; } } } private int[] card_count(int[] card) { int check[] = new int[10]; for(int i=0; i<card.length; i++) { check[card[i]] += 1; } return check; } // 아래는 테스트케이스 출력을 해보기 위한 main 메소드입니다. public static void main(String[] args) { Solution4_8 sol = new Solution4_8(); int card1[] = {1, 2, 1, 3}; int n1 = 1312; int ret1 = sol.solution(card1, n1); // [실행] 버튼을 누르면 출력 값을 볼 수 있습니다. System.out.println("solution 메소드의 반환 값은 " + ret1 + " 입니다."); int card2[] = {1, 1, 1, 2}; int n2 = 1122; int ret2 = sol.solution(card2, n2); // [실행] 버튼을 누르면 출력 값을 볼 수 있습니다. System.out.println("solution 메소드의 반환 값은 " + ret2 + " 입니다."); } }
UHC
Java
1,806
java
Solution4_8.java
Java
[]
null
[]
package ps4; // 다음과 같이 import를 사용할 수 있습니다. import java.util.*; class Solution4_8 { ArrayList<Integer> list = new ArrayList<Integer>(); public int solution(int[] card, int n) { int[] check = card_count(card); makenum(0, 0, new int[10], card.length, check); //배열, level, 숫자, 체크배열, 카드배열 System.out.println(list); int answer = 0; for(int i=0; i<list.size(); i++) { if(list.get(i)==n) { answer= i+1; break; } else { answer= -1; } } return answer; } private void makenum(int lev, int num, int[] check, int cardlength, int[] max_check) { if(lev==cardlength) { list.add(num); return; } for(int i=1; i<=9; i++) { if(check[i]<max_check[i]) { check[i] += 1; makenum(lev+1, num*10+i, check, cardlength, max_check); check[i] -= 1; } } } private int[] card_count(int[] card) { int check[] = new int[10]; for(int i=0; i<card.length; i++) { check[card[i]] += 1; } return check; } // 아래는 테스트케이스 출력을 해보기 위한 main 메소드입니다. public static void main(String[] args) { Solution4_8 sol = new Solution4_8(); int card1[] = {1, 2, 1, 3}; int n1 = 1312; int ret1 = sol.solution(card1, n1); // [실행] 버튼을 누르면 출력 값을 볼 수 있습니다. System.out.println("solution 메소드의 반환 값은 " + ret1 + " 입니다."); int card2[] = {1, 1, 1, 2}; int n2 = 1122; int ret2 = sol.solution(card2, n2); // [실행] 버튼을 누르면 출력 값을 볼 수 있습니다. System.out.println("solution 메소드의 반환 값은 " + ret2 + " 입니다."); } }
1,806
0.52701
0.49309
65
23.507692
19.39637
90
false
false
0
0
0
0
0
0
2.030769
false
false
10
9f2585b6fc6a142e857f3ddfb08cc7bbbfaf891e
33,612,414,096,900
a6df3e6a0c66634f24a11ca1aff37245862d9d82
/src/com/nightfall/smg/RandomEvents.java
8dce7ff939340fa355b54594ed2b0da2d3baa184
[]
no_license
JAhimaz/Nightfall-text-based-game
https://github.com/JAhimaz/Nightfall-text-based-game
3a5f5c5548bcfaecddc6531e40b42a77c44b0ec7
40a449568c95cdc3e96747bfec9260cf837639f1
refs/heads/develop
2021-06-18T06:14:37.451000
2021-03-27T08:50:59
2021-03-27T08:50:59
174,350,677
2
1
null
false
2019-03-24T14:20:21
2019-03-07T13:38:29
2019-03-24T10:54:08
2019-03-24T14:20:20
147
0
0
0
Java
false
null
package com.nightfall.smg; import java.util.Random; import java.lang.Math; import java.util.Scanner; import com.nightfall.main.MainGame; import com.nightfall.npc.Settler; public class RandomEvents { static Random rand = new Random(); static Scanner input = new Scanner(System.in); static double internalEvent; static int affect; //EVENTS public static void randomEvent() throws InterruptedException { //CONTINUE FROM HERE System.out.println("\n====================================="); double event = (Math.random() * 100); if(event <= 100 && event > 90) { //RainEvent RainEvent(); }if(event <= 90 && event > 85) { System.out.println("< Your Settlement Is Under Attack!"); Thread.sleep(1000); //Setup Fight System. }if(event <= 85 && event > 80) { //Random Storm (FUTURE WEATHERS) System.out.println("< Event 3"); }if(event <= 80 && event > 70) { //Random DustStorm (FUTURE WEATHERS) System.out.println("< Event 4"); }if(event <= 70 && event > 60) { //Random EarthQuake (FUTURE WEATHERS) System.out.println("< Event 5"); }if(event <= 60 && event > 40) { //Strangers Join Your Settlement! SettlerEvent(); }if(event <= 40 && event > 5) { System.out.println("< Event 7"); }if(event <= 2) { //Nuclear Bomb NuclearEvent(); } System.out.println("=====================================\n"); Thread.sleep(3000); } private static void SettlerEvent() throws InterruptedException { System.out.println("< You Eye Some Strangers In The Distance! They Approach Unarmed..."); Thread.sleep(1000); System.out.println("< They Approach With Caution As Your Settlers Draw Their Weapons..."); Thread.sleep(1000); System.out.println("< Slowly Lowering Their Weapons, Your Settlers Welcome The New Survivors..."); Thread.sleep(1000); int newSettlers = (rand.nextInt((5-2) + 2) + 1); for(int i = 1; i <= newSettlers; i++) { Settler newSettler = new Settler(); newSettler.setHealth(rand.nextInt((100-85) + 85) + 1); MainGame.settlers.add(newSettler); } System.out.println("\n< You Have Gained " + newSettlers + " New Settlers!"); } private static void NuclearEvent() throws InterruptedException { System.out.println("< Your Settlers Gaze Upon The Horizon and Notice A Dark Egg Dropping From The Sky..."); Thread.sleep(1000); System.out.println("< The Sound Whizzing Through The Air, Its A Nuclear Bomb"); Thread.sleep(1000); if(MainGame.settlementStats.hasBunker()) { System.out.println("< You're Settlers Hastily Flee To The Bunker!"); Thread.sleep(1000); System.out.println("< The Doors Shut Upon The Soundwave Impact..."); Thread.sleep(1000); System.out.println("< Upon Re-Entry To The Surface World You're Settlers Find Everything Wiped Out."); Thread.sleep(1000); System.out.println("< All Your Settlers Have Been Affected By Radiation..."); Thread.sleep(1000); //Nuclear Wipeout, Resets All Stats To Zero, Settlers Healths Are All Divided By Half, Scavengers Are All Killed. }else { System.out.println("< At This Point Theres No Hope, Your Settlement is Within the Blast Radius"); Thread.sleep(1000); System.out.println("< Your Settlers Say Their Final GoodBye As The Explosion Lights Up The Sky"); Thread.sleep(1000); System.out.println("< The Blistering Impact Of The Sound Levels Your Whole Settlement."); MainGame.playerStats.setPlayerStatus(true); } } private static void RainEvent() throws InterruptedException { System.out.println("< It Begins To Rain!"); Thread.sleep(1000); internalEvent = (Math.random() * 100); if(internalEvent <= 15 && internalEvent >= 0) { System.out.println("< Its Acid Rain, Your Water Supply is Affected!"); //Possibly harm settlers too. Thread.sleep(1000); affect = (rand.nextInt((15 - 5) + 5) + 1); System.out.println("< Your Settlement Lost " + affect + " Units of Water To The Acid Rain"); MainGame.playerStats.setWater(MainGame.playerStats.getWater() - affect); Thread.sleep(1000); internalEvent = (Math.random() * 100); if(internalEvent <= 10 && internalEvent >= 0) { System.out.println("< The Acid Rain Also Has Ruined Your Fortifications."); Thread.sleep(1000); affect = (rand.nextInt((15 - 5) + 5) + 1); System.out.println("< Your Settlements Defenses Have Fallen By " + affect); MainGame.settlementStats.setDefense(MainGame.settlementStats.getDefense() - affect); Thread.sleep(1000); } }else { System.out.println("< The Rain Is Fresh and Drinkable!"); Thread.sleep(1000); System.out.println("< Your Settlers Gather The Water For Drinking."); Thread.sleep(1000); affect = (rand.nextInt((30 - 5) + 5) + 1); System.out.println("< Your Settlement Gathered " + affect + " Units of Water"); MainGame.playerStats.setWater(MainGame.playerStats.getWater() + affect); Thread.sleep(1000); } } }
UTF-8
Java
4,988
java
RandomEvents.java
Java
[]
null
[]
package com.nightfall.smg; import java.util.Random; import java.lang.Math; import java.util.Scanner; import com.nightfall.main.MainGame; import com.nightfall.npc.Settler; public class RandomEvents { static Random rand = new Random(); static Scanner input = new Scanner(System.in); static double internalEvent; static int affect; //EVENTS public static void randomEvent() throws InterruptedException { //CONTINUE FROM HERE System.out.println("\n====================================="); double event = (Math.random() * 100); if(event <= 100 && event > 90) { //RainEvent RainEvent(); }if(event <= 90 && event > 85) { System.out.println("< Your Settlement Is Under Attack!"); Thread.sleep(1000); //Setup Fight System. }if(event <= 85 && event > 80) { //Random Storm (FUTURE WEATHERS) System.out.println("< Event 3"); }if(event <= 80 && event > 70) { //Random DustStorm (FUTURE WEATHERS) System.out.println("< Event 4"); }if(event <= 70 && event > 60) { //Random EarthQuake (FUTURE WEATHERS) System.out.println("< Event 5"); }if(event <= 60 && event > 40) { //Strangers Join Your Settlement! SettlerEvent(); }if(event <= 40 && event > 5) { System.out.println("< Event 7"); }if(event <= 2) { //Nuclear Bomb NuclearEvent(); } System.out.println("=====================================\n"); Thread.sleep(3000); } private static void SettlerEvent() throws InterruptedException { System.out.println("< You Eye Some Strangers In The Distance! They Approach Unarmed..."); Thread.sleep(1000); System.out.println("< They Approach With Caution As Your Settlers Draw Their Weapons..."); Thread.sleep(1000); System.out.println("< Slowly Lowering Their Weapons, Your Settlers Welcome The New Survivors..."); Thread.sleep(1000); int newSettlers = (rand.nextInt((5-2) + 2) + 1); for(int i = 1; i <= newSettlers; i++) { Settler newSettler = new Settler(); newSettler.setHealth(rand.nextInt((100-85) + 85) + 1); MainGame.settlers.add(newSettler); } System.out.println("\n< You Have Gained " + newSettlers + " New Settlers!"); } private static void NuclearEvent() throws InterruptedException { System.out.println("< Your Settlers Gaze Upon The Horizon and Notice A Dark Egg Dropping From The Sky..."); Thread.sleep(1000); System.out.println("< The Sound Whizzing Through The Air, Its A Nuclear Bomb"); Thread.sleep(1000); if(MainGame.settlementStats.hasBunker()) { System.out.println("< You're Settlers Hastily Flee To The Bunker!"); Thread.sleep(1000); System.out.println("< The Doors Shut Upon The Soundwave Impact..."); Thread.sleep(1000); System.out.println("< Upon Re-Entry To The Surface World You're Settlers Find Everything Wiped Out."); Thread.sleep(1000); System.out.println("< All Your Settlers Have Been Affected By Radiation..."); Thread.sleep(1000); //Nuclear Wipeout, Resets All Stats To Zero, Settlers Healths Are All Divided By Half, Scavengers Are All Killed. }else { System.out.println("< At This Point Theres No Hope, Your Settlement is Within the Blast Radius"); Thread.sleep(1000); System.out.println("< Your Settlers Say Their Final GoodBye As The Explosion Lights Up The Sky"); Thread.sleep(1000); System.out.println("< The Blistering Impact Of The Sound Levels Your Whole Settlement."); MainGame.playerStats.setPlayerStatus(true); } } private static void RainEvent() throws InterruptedException { System.out.println("< It Begins To Rain!"); Thread.sleep(1000); internalEvent = (Math.random() * 100); if(internalEvent <= 15 && internalEvent >= 0) { System.out.println("< Its Acid Rain, Your Water Supply is Affected!"); //Possibly harm settlers too. Thread.sleep(1000); affect = (rand.nextInt((15 - 5) + 5) + 1); System.out.println("< Your Settlement Lost " + affect + " Units of Water To The Acid Rain"); MainGame.playerStats.setWater(MainGame.playerStats.getWater() - affect); Thread.sleep(1000); internalEvent = (Math.random() * 100); if(internalEvent <= 10 && internalEvent >= 0) { System.out.println("< The Acid Rain Also Has Ruined Your Fortifications."); Thread.sleep(1000); affect = (rand.nextInt((15 - 5) + 5) + 1); System.out.println("< Your Settlements Defenses Have Fallen By " + affect); MainGame.settlementStats.setDefense(MainGame.settlementStats.getDefense() - affect); Thread.sleep(1000); } }else { System.out.println("< The Rain Is Fresh and Drinkable!"); Thread.sleep(1000); System.out.println("< Your Settlers Gather The Water For Drinking."); Thread.sleep(1000); affect = (rand.nextInt((30 - 5) + 5) + 1); System.out.println("< Your Settlement Gathered " + affect + " Units of Water"); MainGame.playerStats.setWater(MainGame.playerStats.getWater() + affect); Thread.sleep(1000); } } }
4,988
0.659583
0.627506
121
40.223141
29.976986
117
false
false
0
0
0
0
0
0
3.743802
false
false
10
04217a7182d0e4daad9748c38fc01c652de37041
17,970,143,177,047
5250395433683658aa662599369e9909f831f48b
/app/src/main/java/co/hewanq/hewanq/View/Activity/ActivityListJualJasa.java
af53ea8f835f9f5642cb4f172873a1b684ef5bd4
[]
no_license
DwiRK/HewanQ_Team
https://github.com/DwiRK/HewanQ_Team
7f2f3e704cfbe0811f8875cd51e457a24f280e35
e2ee7a8dd719b9f210e6fb41aa64deca1c7cd85f
refs/heads/master
2020-07-12T16:36:23.236000
2019-08-28T06:42:53
2019-08-28T06:42:53
204,864,575
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package co.hewanq.hewanq.View.Activity; import android.content.Intent; import android.graphics.drawable.ColorDrawable; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.View; import android.widget.ImageView; import java.util.HashMap; import java.util.List; import co.hewanq.hewanq.Model.JasaModel; import co.hewanq.hewanq.Model.Response.ListJasaResponse; import co.hewanq.hewanq.Presenter.ApiRequest; import co.hewanq.hewanq.Presenter.Server; import co.hewanq.hewanq.Presenter.SessionManager; import co.hewanq.hewanq.R; import co.hewanq.hewanq.View.Adapter.AdapterListJasa; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class ActivityListJualJasa extends AppCompatActivity { ImageView add_btn, no_jasa; Intent intent; private RecyclerView recyclerViewJasa; private AdapterListJasa adapterListJasa; private List<JasaModel> jasaModel; private ApiRequest apiRequest; private HashMap<String, String> userData; private SessionManager sessionManager; private int userId; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_list_jual_jasa); apiRequest = Server.getClient().create(ApiRequest.class); sessionManager = new SessionManager(ActivityListJualJasa.this); userData = sessionManager.getSavedToken(); userId = Integer.valueOf(userData.get(sessionManager.getUserId())); android.support.v7.app.ActionBar actionBar = getSupportActionBar(); actionBar.setTitle("Jasa Saya"); actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.blue_theme))); add_btn = findViewById(R.id.add_btn); no_jasa = findViewById(R.id.no_jasa); add_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { intent = new Intent(getApplicationContext(), ActivityTambahJasa.class); intent.putExtra("id", userData.get(sessionManager.getUserId())); startActivity(intent); } }); setListJasa(); } public void setListJasa() { recyclerViewJasa = findViewById(R.id.list_recycler_jasa_user); recyclerViewJasa.setHasFixedSize(true); recyclerViewJasa.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); Call<ListJasaResponse> listJasa = apiRequest.getListJasaUser(userId); listJasa.enqueue(new Callback<ListJasaResponse>() { @Override public void onResponse(Call<ListJasaResponse> call, Response<ListJasaResponse> response) { if(!response.isSuccessful()) { Log.d("Recycler", "JasaModel : " + response.message()); no_jasa.setVisibility(View.VISIBLE); } else { jasaModel = response.body().getjasa(); adapterListJasa = new AdapterListJasa(ActivityListJualJasa.this, R.layout.recyclerlist_jasa, jasaModel); recyclerViewJasa.setAdapter(adapterListJasa); no_jasa.setVisibility(View.GONE); } } @Override public void onFailure(Call<ListJasaResponse> call, Throwable t) { Log.d("Recycler", "JasaModel : " + t.getMessage()); } }); } }
UTF-8
Java
3,741
java
ActivityListJualJasa.java
Java
[]
null
[]
package co.hewanq.hewanq.View.Activity; import android.content.Intent; import android.graphics.drawable.ColorDrawable; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.View; import android.widget.ImageView; import java.util.HashMap; import java.util.List; import co.hewanq.hewanq.Model.JasaModel; import co.hewanq.hewanq.Model.Response.ListJasaResponse; import co.hewanq.hewanq.Presenter.ApiRequest; import co.hewanq.hewanq.Presenter.Server; import co.hewanq.hewanq.Presenter.SessionManager; import co.hewanq.hewanq.R; import co.hewanq.hewanq.View.Adapter.AdapterListJasa; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class ActivityListJualJasa extends AppCompatActivity { ImageView add_btn, no_jasa; Intent intent; private RecyclerView recyclerViewJasa; private AdapterListJasa adapterListJasa; private List<JasaModel> jasaModel; private ApiRequest apiRequest; private HashMap<String, String> userData; private SessionManager sessionManager; private int userId; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_list_jual_jasa); apiRequest = Server.getClient().create(ApiRequest.class); sessionManager = new SessionManager(ActivityListJualJasa.this); userData = sessionManager.getSavedToken(); userId = Integer.valueOf(userData.get(sessionManager.getUserId())); android.support.v7.app.ActionBar actionBar = getSupportActionBar(); actionBar.setTitle("Jasa Saya"); actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.blue_theme))); add_btn = findViewById(R.id.add_btn); no_jasa = findViewById(R.id.no_jasa); add_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { intent = new Intent(getApplicationContext(), ActivityTambahJasa.class); intent.putExtra("id", userData.get(sessionManager.getUserId())); startActivity(intent); } }); setListJasa(); } public void setListJasa() { recyclerViewJasa = findViewById(R.id.list_recycler_jasa_user); recyclerViewJasa.setHasFixedSize(true); recyclerViewJasa.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); Call<ListJasaResponse> listJasa = apiRequest.getListJasaUser(userId); listJasa.enqueue(new Callback<ListJasaResponse>() { @Override public void onResponse(Call<ListJasaResponse> call, Response<ListJasaResponse> response) { if(!response.isSuccessful()) { Log.d("Recycler", "JasaModel : " + response.message()); no_jasa.setVisibility(View.VISIBLE); } else { jasaModel = response.body().getjasa(); adapterListJasa = new AdapterListJasa(ActivityListJualJasa.this, R.layout.recyclerlist_jasa, jasaModel); recyclerViewJasa.setAdapter(adapterListJasa); no_jasa.setVisibility(View.GONE); } } @Override public void onFailure(Call<ListJasaResponse> call, Throwable t) { Log.d("Recycler", "JasaModel : " + t.getMessage()); } }); } }
3,741
0.665597
0.663726
110
33.00909
27.798788
112
false
false
0
0
0
0
0
0
0.645455
false
false
10
c5447cea01fbdbbb6d79a20207bfd5e48c46f31f
14,267,881,366,086
8fb048b76e83714de8d6137234a21e70b9fd58a5
/src/main/java/com/nisum/SpringBootPOC/model/Student.java
24b4130d41ec09c4702fa3a150e1cac810cd90da
[]
no_license
keerthigoli/SpringBoot
https://github.com/keerthigoli/SpringBoot
041d11817d98d816d4f9bc904dc318c46200c3f5
ae2f18dee7b9a0b61f53277682d3bd61b3b6dcfd
refs/heads/master
2020-12-20T07:30:34.987000
2020-01-24T13:12:40
2020-01-24T13:12:40
236,003,322
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.nisum.SpringBootPOC.model; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Entity @Table(name = "Student_Details") public class Student { @Id private int sid; private String sname; private String course; // @Column // @ElementCollection(targetClass = Address.class) // private List<Address> address; // @OneToMany(targetEntity = Address.class, mappedBy = "student", cascade = // CascadeType.ALL, fetch = FetchType.EAGER) // public List<Address> getAddress() { // return address; // } // public void setAddress(List<Address> address) { // this.address = address; // } public int getSid() { return sid;} public void setSid(int sid) { this.sid = sid; } public String getSname() { return sname; } public void setSname(String sname) { this.sname = sname; } public String getCourse() { return course; } public void setCourse(String course) { this.course = course; } public Student(int sid, String sname, String course) { super(); this.sid = sid; this.sname = sname; this.course = course; } public Student() { } @Override public String toString() { return "Student [sid=" + sid + ", sname=" + sname + ", course=" + course + "]"; } }
UTF-8
Java
1,549
java
Student.java
Java
[]
null
[]
package com.nisum.SpringBootPOC.model; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Entity @Table(name = "Student_Details") public class Student { @Id private int sid; private String sname; private String course; // @Column // @ElementCollection(targetClass = Address.class) // private List<Address> address; // @OneToMany(targetEntity = Address.class, mappedBy = "student", cascade = // CascadeType.ALL, fetch = FetchType.EAGER) // public List<Address> getAddress() { // return address; // } // public void setAddress(List<Address> address) { // this.address = address; // } public int getSid() { return sid;} public void setSid(int sid) { this.sid = sid; } public String getSname() { return sname; } public void setSname(String sname) { this.sname = sname; } public String getCourse() { return course; } public void setCourse(String course) { this.course = course; } public Student(int sid, String sname, String course) { super(); this.sid = sid; this.sname = sname; this.course = course; } public Student() { } @Override public String toString() { return "Student [sid=" + sid + ", sname=" + sname + ", course=" + course + "]"; } }
1,549
0.710136
0.710136
75
19.653334
18.009253
80
false
false
0
0
0
0
0
0
1.146667
false
false
10
906665be7333d0b7dffbc67c1f874cf8187237ee
6,347,961,694,881
1443168b05f1528e4cc958cc8101451af6f3d145
/src/main/java/com/joshua/easypass/entity/Vendor.java
df448931a15818a858e497ceedea4baa2a7c6457
[]
no_license
ChewApple/EasyPass
https://github.com/ChewApple/EasyPass
07b0fbbd9ee92df8f0add409a393bb50c27aa9e4
108db1ee942d39505698e5adc412cf3767f4d2ab
refs/heads/master
2020-03-16T10:34:32.352000
2018-05-14T14:03:19
2018-05-14T14:03:19
132,636,000
3
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.joshua.easypass.entity; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import java.util.Date; @Entity public class Vendor { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer vdrid; private String vdrname; private String vdraddr; private String vdraddrdetail; private String vdrplate; private String contact; private String contactphone; private String contacts; // tidang private String itemTidang; private float itemTidangTax; private float itemTidangCost; private Date itemTidangCompletedate; private String itemTidangDesc; private Integer itemTidangReqId; // guohu private String itemGuohu; private float itemGuohuTax; private float itemGuohuCost; private Date itemGuohuCompletedate; private String itemGuohuDesc; private Integer itemGuohuReqId; //shangpai private String itemShangpai; private float itemShangpaiTax; private float itemShangpaiCost; private Date itemShangpaiCompletedate; private String itemShangpaiDesc; private Integer itemShangpaiReqId; //weizhang private String itemWeizhang; private float itemWeizhangTax; private float itemWeizhangCost; private Date itemWeizhangCompletedate; private String itemWeizhangDesc; private Integer itemWeizhangReqId; //diya private String itemDiya; private float itemDiyaCost; private Date itemDiyaCompletedate; private String itemDiyaDesc; private Integer itemDiyaReqId; //jiechudiya private String itemJiechudiya; private float itemJiechudiyaCost; private Date itemJiechudiyaCompletedate; private String itemJiechudiyaDesc; private Integer itemJiechudiyaReqId; //weituo private String itemWeituo; private float itemWeituoTax; private float itemWeituoCost; private Date itemWeituoCompletedate; private String itemWeituoDesc; private Integer itemWeituoReqId; //nianjian private String itemNianjian; private float itemNianjianTax; private float itemNianjianCost; private Date itemNianjianCompletedate; private String itemNianjianDesc; private Integer itemNianjianReqId; //buhuan private String itemBuhuan; private float itemBuhuanTax; private float itemBuhuanCost; private Date itemBuhuanCompletedate; private String itemBuhuanDesc; private Integer itemBuhuanReqId; //qita private String itemQita; private float itemQitaCost; private Date itemQitaCompletedate; private String itemQitaDesc; private String state; private Date createdate; private String creator; private String add1; private String add2; private String add3; public Integer getVdrid() { return vdrid; } public void setVdrid(Integer vdrid) { this.vdrid = vdrid; } public String getVdrname() { return vdrname; } public void setVdrname(String vdrname) { this.vdrname = vdrname; } public String getVdraddr() { return vdraddr; } public void setVdraddr(String vdraddr) { this.vdraddr = vdraddr; } public String getVdraddrdetail() { return vdraddrdetail; } public void setVdraddrdetail(String vdraddrdetail) { this.vdraddrdetail = vdraddrdetail; } public String getVdrplate() { return vdrplate; } public void setVdrplate(String vdrplate) { this.vdrplate = vdrplate; } public String getContact() { return contact; } public void setContact(String contact) { this.contact = contact; } public String getContactphone() { return contactphone; } public void setContactphone(String contactphone) { this.contactphone = contactphone; } public String getContacts() { return contacts; } public void setContacts(String contacts) { this.contacts = contacts; } public String getItemTidang() { return itemTidang; } public void setItemTidang(String itemTidang) { this.itemTidang = itemTidang; } public float getItemTidangTax() { return itemTidangTax; } public void setItemTidangTax(float itemTidangTax) { this.itemTidangTax = itemTidangTax; } public float getItemTidangCost() { return itemTidangCost; } public void setItemTidangCost(float itemTidangCost) { this.itemTidangCost = itemTidangCost; } public Date getItemTidangCompletedate() { return itemTidangCompletedate; } public void setItemTidangCompletedate(Date itemTidangCompletedate) { this.itemTidangCompletedate = itemTidangCompletedate; } public String getItemTidangDesc() { return itemTidangDesc; } public void setItemTidangDesc(String itemTidangDesc) { this.itemTidangDesc = itemTidangDesc; } public Integer getItemTidangReqId() { return itemTidangReqId; } public void setItemTidangReqId(Integer itemTidangReqId) { this.itemTidangReqId = itemTidangReqId; } public String getItemGuohu() { return itemGuohu; } public void setItemGuohu(String itemGuohu) { this.itemGuohu = itemGuohu; } public float getItemGuohuTax() { return itemGuohuTax; } public void setItemGuohuTax(float itemGuohuTax) { this.itemGuohuTax = itemGuohuTax; } public float getItemGuohuCost() { return itemGuohuCost; } public void setItemGuohuCost(float itemGuohuCost) { this.itemGuohuCost = itemGuohuCost; } public Date getItemGuohuCompletedate() { return itemGuohuCompletedate; } public void setItemGuohuCompletedate(Date itemGuohuCompletedate) { this.itemGuohuCompletedate = itemGuohuCompletedate; } public String getItemGuohuDesc() { return itemGuohuDesc; } public void setItemGuohuDesc(String itemGuohuDesc) { this.itemGuohuDesc = itemGuohuDesc; } public Integer getItemGuohuReqId() { return itemGuohuReqId; } public void setItemGuohuReqId(Integer itemGuohuReqId) { this.itemGuohuReqId = itemGuohuReqId; } public String getItemShangpai() { return itemShangpai; } public void setItemShangpai(String itemShangpai) { this.itemShangpai = itemShangpai; } public float getItemShangpaiTax() { return itemShangpaiTax; } public void setItemShangpaiTax(float itemShangpaiTax) { this.itemShangpaiTax = itemShangpaiTax; } public float getItemShangpaiCost() { return itemShangpaiCost; } public void setItemShangpaiCost(float itemShangpaiCost) { this.itemShangpaiCost = itemShangpaiCost; } public Date getItemShangpaiCompletedate() { return itemShangpaiCompletedate; } public void setItemShangpaiCompletedate(Date itemShangpaiCompletedate) { this.itemShangpaiCompletedate = itemShangpaiCompletedate; } public String getItemShangpaiDesc() { return itemShangpaiDesc; } public void setItemShangpaiDesc(String itemShangpaiDesc) { this.itemShangpaiDesc = itemShangpaiDesc; } public Integer getItemShangpaiReqId() { return itemShangpaiReqId; } public void setItemShangpaiReqId(Integer itemShangpaiReqId) { this.itemShangpaiReqId = itemShangpaiReqId; } public String getItemWeizhang() { return itemWeizhang; } public void setItemWeizhang(String itemWeizhang) { this.itemWeizhang = itemWeizhang; } public float getItemWeizhangTax() { return itemWeizhangTax; } public void setItemWeizhangTax(float itemWeizhangTax) { this.itemWeizhangTax = itemWeizhangTax; } public float getItemWeizhangCost() { return itemWeizhangCost; } public void setItemWeizhangCost(float itemWeizhangCost) { this.itemWeizhangCost = itemWeizhangCost; } public Date getItemWeizhangCompletedate() { return itemWeizhangCompletedate; } public void setItemWeizhangCompletedate(Date itemWeizhangCompletedate) { this.itemWeizhangCompletedate = itemWeizhangCompletedate; } public String getItemWeizhangDesc() { return itemWeizhangDesc; } public void setItemWeizhangDesc(String itemWeizhangDesc) { this.itemWeizhangDesc = itemWeizhangDesc; } public Integer getItemWeizhangReqId() { return itemWeizhangReqId; } public void setItemWeizhangReqId(Integer itemWeizhangReqId) { this.itemWeizhangReqId = itemWeizhangReqId; } public String getItemDiya() { return itemDiya; } public void setItemDiya(String itemDiya) { this.itemDiya = itemDiya; } public float getItemDiyaCost() { return itemDiyaCost; } public void setItemDiyaCost(float itemDiyaCost) { this.itemDiyaCost = itemDiyaCost; } public Date getItemDiyaCompletedate() { return itemDiyaCompletedate; } public void setItemDiyaCompletedate(Date itemDiyaCompletedate) { this.itemDiyaCompletedate = itemDiyaCompletedate; } public String getItemDiyaDesc() { return itemDiyaDesc; } public void setItemDiyaDesc(String itemDiyaDesc) { this.itemDiyaDesc = itemDiyaDesc; } public Integer getItemDiyaReqId() { return itemDiyaReqId; } public void setItemDiyaReqId(Integer itemDiyaReqId) { this.itemDiyaReqId = itemDiyaReqId; } public String getItemJiechudiya() { return itemJiechudiya; } public void setItemJiechudiya(String itemJiechudiya) { this.itemJiechudiya = itemJiechudiya; } public float getItemJiechudiyaCost() { return itemJiechudiyaCost; } public void setItemJiechudiyaCost(float itemJiechudiyaCost) { this.itemJiechudiyaCost = itemJiechudiyaCost; } public Date getItemJiechudiyaCompletedate() { return itemJiechudiyaCompletedate; } public void setItemJiechudiyaCompletedate(Date itemJiechudiyaCompletedate) { this.itemJiechudiyaCompletedate = itemJiechudiyaCompletedate; } public String getItemJiechudiyaDesc() { return itemJiechudiyaDesc; } public void setItemJiechudiyaDesc(String itemJiechudiyaDesc) { this.itemJiechudiyaDesc = itemJiechudiyaDesc; } public Integer getItemJiechudiyaReqId() { return itemJiechudiyaReqId; } public void setItemJiechudiyaReqId(Integer itemJiechudiyaReqId) { this.itemJiechudiyaReqId = itemJiechudiyaReqId; } public String getItemWeituo() { return itemWeituo; } public void setItemWeituo(String itemWeituo) { this.itemWeituo = itemWeituo; } public float getItemWeituoTax() { return itemWeituoTax; } public void setItemWeituoTax(float itemWeituoTax) { this.itemWeituoTax = itemWeituoTax; } public float getItemWeituoCost() { return itemWeituoCost; } public void setItemWeituoCost(float itemWeituoCost) { this.itemWeituoCost = itemWeituoCost; } public Date getItemWeituoCompletedate() { return itemWeituoCompletedate; } public void setItemWeituoCompletedate(Date itemWeituoCompletedate) { this.itemWeituoCompletedate = itemWeituoCompletedate; } public String getItemWeituoDesc() { return itemWeituoDesc; } public void setItemWeituoDesc(String itemWeituoDesc) { this.itemWeituoDesc = itemWeituoDesc; } public Integer getItemWeituoReqId() { return itemWeituoReqId; } public void setItemWeituoReqId(Integer itemWeituoReqId) { this.itemWeituoReqId = itemWeituoReqId; } public String getItemNianjian() { return itemNianjian; } public void setItemNianjian(String itemNianjian) { this.itemNianjian = itemNianjian; } public float getItemNianjianTax() { return itemNianjianTax; } public void setItemNianjianTax(float itemNianjianTax) { this.itemNianjianTax = itemNianjianTax; } public float getItemNianjianCost() { return itemNianjianCost; } public void setItemNianjianCost(float itemNianjianCost) { this.itemNianjianCost = itemNianjianCost; } public Date getItemNianjianCompletedate() { return itemNianjianCompletedate; } public void setItemNianjianCompletedate(Date itemNianjianCompletedate) { this.itemNianjianCompletedate = itemNianjianCompletedate; } public String getItemNianjianDesc() { return itemNianjianDesc; } public void setItemNianjianDesc(String itemNianjianDesc) { this.itemNianjianDesc = itemNianjianDesc; } public Integer getItemNianjianReqId() { return itemNianjianReqId; } public void setItemNianjianReqId(Integer itemNianjianReqId) { this.itemNianjianReqId = itemNianjianReqId; } public String getItemBuhuan() { return itemBuhuan; } public void setItemBuhuan(String itemBuhuan) { this.itemBuhuan = itemBuhuan; } public float getItemBuhuanTax() { return itemBuhuanTax; } public void setItemBuhuanTax(float itemBuhuanTax) { this.itemBuhuanTax = itemBuhuanTax; } public float getItemBuhuanCost() { return itemBuhuanCost; } public void setItemBuhuanCost(float itemBuhuanCost) { this.itemBuhuanCost = itemBuhuanCost; } public Date getItemBuhuanCompletedate() { return itemBuhuanCompletedate; } public void setItemBuhuanCompletedate(Date itemBuhuanCompletedate) { this.itemBuhuanCompletedate = itemBuhuanCompletedate; } public String getItemBuhuanDesc() { return itemBuhuanDesc; } public void setItemBuhuanDesc(String itemBuhuanDesc) { this.itemBuhuanDesc = itemBuhuanDesc; } public Integer getItemBuhuanReqId() { return itemBuhuanReqId; } public void setItemBuhuanReqId(Integer itemBuhuanReqId) { this.itemBuhuanReqId = itemBuhuanReqId; } public String getItemQita() { return itemQita; } public void setItemQita(String itemQita) { this.itemQita = itemQita; } public float getItemQitaCost() { return itemQitaCost; } public void setItemQitaCost(float itemQitaCost) { this.itemQitaCost = itemQitaCost; } public Date getItemQitaCompletedate() { return itemQitaCompletedate; } public void setItemQitaCompletedate(Date itemQitaCompletedate) { this.itemQitaCompletedate = itemQitaCompletedate; } public String getItemQitaDesc() { return itemQitaDesc; } public void setItemQitaDesc(String itemQitaDesc) { this.itemQitaDesc = itemQitaDesc; } public String getState() { return state; } public void setState(String state) { this.state = state; } public Date getCreatedate() { return createdate; } public void setCreatedate(Date createdate) { this.createdate = createdate; } public String getCreator() { return creator; } public void setCreator(String creator) { this.creator = creator; } public String getAdd1() { return add1; } public void setAdd1(String add1) { this.add1 = add1; } public String getAdd2() { return add2; } public void setAdd2(String add2) { this.add2 = add2; } public String getAdd3() { return add3; } public void setAdd3(String add3) { this.add3 = add3; } }
UTF-8
Java
15,954
java
Vendor.java
Java
[]
null
[]
package com.joshua.easypass.entity; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import java.util.Date; @Entity public class Vendor { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer vdrid; private String vdrname; private String vdraddr; private String vdraddrdetail; private String vdrplate; private String contact; private String contactphone; private String contacts; // tidang private String itemTidang; private float itemTidangTax; private float itemTidangCost; private Date itemTidangCompletedate; private String itemTidangDesc; private Integer itemTidangReqId; // guohu private String itemGuohu; private float itemGuohuTax; private float itemGuohuCost; private Date itemGuohuCompletedate; private String itemGuohuDesc; private Integer itemGuohuReqId; //shangpai private String itemShangpai; private float itemShangpaiTax; private float itemShangpaiCost; private Date itemShangpaiCompletedate; private String itemShangpaiDesc; private Integer itemShangpaiReqId; //weizhang private String itemWeizhang; private float itemWeizhangTax; private float itemWeizhangCost; private Date itemWeizhangCompletedate; private String itemWeizhangDesc; private Integer itemWeizhangReqId; //diya private String itemDiya; private float itemDiyaCost; private Date itemDiyaCompletedate; private String itemDiyaDesc; private Integer itemDiyaReqId; //jiechudiya private String itemJiechudiya; private float itemJiechudiyaCost; private Date itemJiechudiyaCompletedate; private String itemJiechudiyaDesc; private Integer itemJiechudiyaReqId; //weituo private String itemWeituo; private float itemWeituoTax; private float itemWeituoCost; private Date itemWeituoCompletedate; private String itemWeituoDesc; private Integer itemWeituoReqId; //nianjian private String itemNianjian; private float itemNianjianTax; private float itemNianjianCost; private Date itemNianjianCompletedate; private String itemNianjianDesc; private Integer itemNianjianReqId; //buhuan private String itemBuhuan; private float itemBuhuanTax; private float itemBuhuanCost; private Date itemBuhuanCompletedate; private String itemBuhuanDesc; private Integer itemBuhuanReqId; //qita private String itemQita; private float itemQitaCost; private Date itemQitaCompletedate; private String itemQitaDesc; private String state; private Date createdate; private String creator; private String add1; private String add2; private String add3; public Integer getVdrid() { return vdrid; } public void setVdrid(Integer vdrid) { this.vdrid = vdrid; } public String getVdrname() { return vdrname; } public void setVdrname(String vdrname) { this.vdrname = vdrname; } public String getVdraddr() { return vdraddr; } public void setVdraddr(String vdraddr) { this.vdraddr = vdraddr; } public String getVdraddrdetail() { return vdraddrdetail; } public void setVdraddrdetail(String vdraddrdetail) { this.vdraddrdetail = vdraddrdetail; } public String getVdrplate() { return vdrplate; } public void setVdrplate(String vdrplate) { this.vdrplate = vdrplate; } public String getContact() { return contact; } public void setContact(String contact) { this.contact = contact; } public String getContactphone() { return contactphone; } public void setContactphone(String contactphone) { this.contactphone = contactphone; } public String getContacts() { return contacts; } public void setContacts(String contacts) { this.contacts = contacts; } public String getItemTidang() { return itemTidang; } public void setItemTidang(String itemTidang) { this.itemTidang = itemTidang; } public float getItemTidangTax() { return itemTidangTax; } public void setItemTidangTax(float itemTidangTax) { this.itemTidangTax = itemTidangTax; } public float getItemTidangCost() { return itemTidangCost; } public void setItemTidangCost(float itemTidangCost) { this.itemTidangCost = itemTidangCost; } public Date getItemTidangCompletedate() { return itemTidangCompletedate; } public void setItemTidangCompletedate(Date itemTidangCompletedate) { this.itemTidangCompletedate = itemTidangCompletedate; } public String getItemTidangDesc() { return itemTidangDesc; } public void setItemTidangDesc(String itemTidangDesc) { this.itemTidangDesc = itemTidangDesc; } public Integer getItemTidangReqId() { return itemTidangReqId; } public void setItemTidangReqId(Integer itemTidangReqId) { this.itemTidangReqId = itemTidangReqId; } public String getItemGuohu() { return itemGuohu; } public void setItemGuohu(String itemGuohu) { this.itemGuohu = itemGuohu; } public float getItemGuohuTax() { return itemGuohuTax; } public void setItemGuohuTax(float itemGuohuTax) { this.itemGuohuTax = itemGuohuTax; } public float getItemGuohuCost() { return itemGuohuCost; } public void setItemGuohuCost(float itemGuohuCost) { this.itemGuohuCost = itemGuohuCost; } public Date getItemGuohuCompletedate() { return itemGuohuCompletedate; } public void setItemGuohuCompletedate(Date itemGuohuCompletedate) { this.itemGuohuCompletedate = itemGuohuCompletedate; } public String getItemGuohuDesc() { return itemGuohuDesc; } public void setItemGuohuDesc(String itemGuohuDesc) { this.itemGuohuDesc = itemGuohuDesc; } public Integer getItemGuohuReqId() { return itemGuohuReqId; } public void setItemGuohuReqId(Integer itemGuohuReqId) { this.itemGuohuReqId = itemGuohuReqId; } public String getItemShangpai() { return itemShangpai; } public void setItemShangpai(String itemShangpai) { this.itemShangpai = itemShangpai; } public float getItemShangpaiTax() { return itemShangpaiTax; } public void setItemShangpaiTax(float itemShangpaiTax) { this.itemShangpaiTax = itemShangpaiTax; } public float getItemShangpaiCost() { return itemShangpaiCost; } public void setItemShangpaiCost(float itemShangpaiCost) { this.itemShangpaiCost = itemShangpaiCost; } public Date getItemShangpaiCompletedate() { return itemShangpaiCompletedate; } public void setItemShangpaiCompletedate(Date itemShangpaiCompletedate) { this.itemShangpaiCompletedate = itemShangpaiCompletedate; } public String getItemShangpaiDesc() { return itemShangpaiDesc; } public void setItemShangpaiDesc(String itemShangpaiDesc) { this.itemShangpaiDesc = itemShangpaiDesc; } public Integer getItemShangpaiReqId() { return itemShangpaiReqId; } public void setItemShangpaiReqId(Integer itemShangpaiReqId) { this.itemShangpaiReqId = itemShangpaiReqId; } public String getItemWeizhang() { return itemWeizhang; } public void setItemWeizhang(String itemWeizhang) { this.itemWeizhang = itemWeizhang; } public float getItemWeizhangTax() { return itemWeizhangTax; } public void setItemWeizhangTax(float itemWeizhangTax) { this.itemWeizhangTax = itemWeizhangTax; } public float getItemWeizhangCost() { return itemWeizhangCost; } public void setItemWeizhangCost(float itemWeizhangCost) { this.itemWeizhangCost = itemWeizhangCost; } public Date getItemWeizhangCompletedate() { return itemWeizhangCompletedate; } public void setItemWeizhangCompletedate(Date itemWeizhangCompletedate) { this.itemWeizhangCompletedate = itemWeizhangCompletedate; } public String getItemWeizhangDesc() { return itemWeizhangDesc; } public void setItemWeizhangDesc(String itemWeizhangDesc) { this.itemWeizhangDesc = itemWeizhangDesc; } public Integer getItemWeizhangReqId() { return itemWeizhangReqId; } public void setItemWeizhangReqId(Integer itemWeizhangReqId) { this.itemWeizhangReqId = itemWeizhangReqId; } public String getItemDiya() { return itemDiya; } public void setItemDiya(String itemDiya) { this.itemDiya = itemDiya; } public float getItemDiyaCost() { return itemDiyaCost; } public void setItemDiyaCost(float itemDiyaCost) { this.itemDiyaCost = itemDiyaCost; } public Date getItemDiyaCompletedate() { return itemDiyaCompletedate; } public void setItemDiyaCompletedate(Date itemDiyaCompletedate) { this.itemDiyaCompletedate = itemDiyaCompletedate; } public String getItemDiyaDesc() { return itemDiyaDesc; } public void setItemDiyaDesc(String itemDiyaDesc) { this.itemDiyaDesc = itemDiyaDesc; } public Integer getItemDiyaReqId() { return itemDiyaReqId; } public void setItemDiyaReqId(Integer itemDiyaReqId) { this.itemDiyaReqId = itemDiyaReqId; } public String getItemJiechudiya() { return itemJiechudiya; } public void setItemJiechudiya(String itemJiechudiya) { this.itemJiechudiya = itemJiechudiya; } public float getItemJiechudiyaCost() { return itemJiechudiyaCost; } public void setItemJiechudiyaCost(float itemJiechudiyaCost) { this.itemJiechudiyaCost = itemJiechudiyaCost; } public Date getItemJiechudiyaCompletedate() { return itemJiechudiyaCompletedate; } public void setItemJiechudiyaCompletedate(Date itemJiechudiyaCompletedate) { this.itemJiechudiyaCompletedate = itemJiechudiyaCompletedate; } public String getItemJiechudiyaDesc() { return itemJiechudiyaDesc; } public void setItemJiechudiyaDesc(String itemJiechudiyaDesc) { this.itemJiechudiyaDesc = itemJiechudiyaDesc; } public Integer getItemJiechudiyaReqId() { return itemJiechudiyaReqId; } public void setItemJiechudiyaReqId(Integer itemJiechudiyaReqId) { this.itemJiechudiyaReqId = itemJiechudiyaReqId; } public String getItemWeituo() { return itemWeituo; } public void setItemWeituo(String itemWeituo) { this.itemWeituo = itemWeituo; } public float getItemWeituoTax() { return itemWeituoTax; } public void setItemWeituoTax(float itemWeituoTax) { this.itemWeituoTax = itemWeituoTax; } public float getItemWeituoCost() { return itemWeituoCost; } public void setItemWeituoCost(float itemWeituoCost) { this.itemWeituoCost = itemWeituoCost; } public Date getItemWeituoCompletedate() { return itemWeituoCompletedate; } public void setItemWeituoCompletedate(Date itemWeituoCompletedate) { this.itemWeituoCompletedate = itemWeituoCompletedate; } public String getItemWeituoDesc() { return itemWeituoDesc; } public void setItemWeituoDesc(String itemWeituoDesc) { this.itemWeituoDesc = itemWeituoDesc; } public Integer getItemWeituoReqId() { return itemWeituoReqId; } public void setItemWeituoReqId(Integer itemWeituoReqId) { this.itemWeituoReqId = itemWeituoReqId; } public String getItemNianjian() { return itemNianjian; } public void setItemNianjian(String itemNianjian) { this.itemNianjian = itemNianjian; } public float getItemNianjianTax() { return itemNianjianTax; } public void setItemNianjianTax(float itemNianjianTax) { this.itemNianjianTax = itemNianjianTax; } public float getItemNianjianCost() { return itemNianjianCost; } public void setItemNianjianCost(float itemNianjianCost) { this.itemNianjianCost = itemNianjianCost; } public Date getItemNianjianCompletedate() { return itemNianjianCompletedate; } public void setItemNianjianCompletedate(Date itemNianjianCompletedate) { this.itemNianjianCompletedate = itemNianjianCompletedate; } public String getItemNianjianDesc() { return itemNianjianDesc; } public void setItemNianjianDesc(String itemNianjianDesc) { this.itemNianjianDesc = itemNianjianDesc; } public Integer getItemNianjianReqId() { return itemNianjianReqId; } public void setItemNianjianReqId(Integer itemNianjianReqId) { this.itemNianjianReqId = itemNianjianReqId; } public String getItemBuhuan() { return itemBuhuan; } public void setItemBuhuan(String itemBuhuan) { this.itemBuhuan = itemBuhuan; } public float getItemBuhuanTax() { return itemBuhuanTax; } public void setItemBuhuanTax(float itemBuhuanTax) { this.itemBuhuanTax = itemBuhuanTax; } public float getItemBuhuanCost() { return itemBuhuanCost; } public void setItemBuhuanCost(float itemBuhuanCost) { this.itemBuhuanCost = itemBuhuanCost; } public Date getItemBuhuanCompletedate() { return itemBuhuanCompletedate; } public void setItemBuhuanCompletedate(Date itemBuhuanCompletedate) { this.itemBuhuanCompletedate = itemBuhuanCompletedate; } public String getItemBuhuanDesc() { return itemBuhuanDesc; } public void setItemBuhuanDesc(String itemBuhuanDesc) { this.itemBuhuanDesc = itemBuhuanDesc; } public Integer getItemBuhuanReqId() { return itemBuhuanReqId; } public void setItemBuhuanReqId(Integer itemBuhuanReqId) { this.itemBuhuanReqId = itemBuhuanReqId; } public String getItemQita() { return itemQita; } public void setItemQita(String itemQita) { this.itemQita = itemQita; } public float getItemQitaCost() { return itemQitaCost; } public void setItemQitaCost(float itemQitaCost) { this.itemQitaCost = itemQitaCost; } public Date getItemQitaCompletedate() { return itemQitaCompletedate; } public void setItemQitaCompletedate(Date itemQitaCompletedate) { this.itemQitaCompletedate = itemQitaCompletedate; } public String getItemQitaDesc() { return itemQitaDesc; } public void setItemQitaDesc(String itemQitaDesc) { this.itemQitaDesc = itemQitaDesc; } public String getState() { return state; } public void setState(String state) { this.state = state; } public Date getCreatedate() { return createdate; } public void setCreatedate(Date createdate) { this.createdate = createdate; } public String getCreator() { return creator; } public void setCreator(String creator) { this.creator = creator; } public String getAdd1() { return add1; } public void setAdd1(String add1) { this.add1 = add1; } public String getAdd2() { return add2; } public void setAdd2(String add2) { this.add2 = add2; } public String getAdd3() { return add3; } public void setAdd3(String add3) { this.add3 = add3; } }
15,954
0.684593
0.683277
653
23.431852
20.808475
80
false
false
0
0
0
0
0
0
0.330781
false
false
10
1910d2dee3439aa07aaa68f752706809baa2c2ad
17,162,689,371,896
837d248e99c25e34fe90dd94c213027350afea51
/OOP/OOP2_Vererbung/Quader.java
ca99d2508e326b230672bdc5f3530ade14ad2b31
[]
no_license
Smaxs2001/infomatik
https://github.com/Smaxs2001/infomatik
c88cb22bbfe51197ee06789d7424f4885bdb2387
86ca15e6b26336e42310edd907dbe8c9c80ad6a2
refs/heads/master
2020-04-17T21:53:20.127000
2020-03-07T16:17:17
2020-03-07T16:17:17
166,970,878
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Quader { protected int länge; protected int breite; protected int höhe; public Quader(int a, int b, int c) { // ToDo } public Quader() { länge = 0; breite = 0; höhe = 0; } public int volumen() { return länge*breite*höhe; } }
UTF-8
Java
331
java
Quader.java
Java
[]
null
[]
public class Quader { protected int länge; protected int breite; protected int höhe; public Quader(int a, int b, int c) { // ToDo } public Quader() { länge = 0; breite = 0; höhe = 0; } public int volumen() { return länge*breite*höhe; } }
331
0.501538
0.492308
23
13.086957
11.886832
40
false
false
0
0
0
0
0
0
0.391304
false
false
10
f200df4308328317d7e4a28f7c84e3aaf22e4c26
6,347,961,663,545
eafdbf95d1f04c13e4a6f9b7817ed49808ce9ff9
/src/main/java/shrikant/algorithms/searching/Searching1.java
791b7d0eb250792e7309620bf04ffcb7df366c24
[]
no_license
shrikool/agileParkingLot
https://github.com/shrikool/agileParkingLot
0ffc66e101b654734ecca245fd36adfd4b9f4de1
55a8af701467a8bf5b682e472aff02fa2b271841
refs/heads/master
2020-04-28T10:01:23.185000
2018-07-23T07:57:12
2018-07-23T07:57:12
34,366,399
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package shrikant.algorithms.searching; import java.util.Arrays; public class Searching1 { // given a array of 2n integers in the following format // a1a2a3a4b1b2b3b4 // Shuffle the array to a1b1a2b2a3b3a4b4a5b5 // without any extra memory public static void main(String[] args) { int[] initialArray = new int[]{1, 2, 3, 4, 11, 12, 13, 14}; shuffleArray(initialArray, 0, initialArray.length - 1); System.out.println(Arrays.toString(initialArray)); } private static void shuffleArray(int[] initialArray, int start, int end) { if (end - start <= 1) return; int mid = start + ((end - start) / 2); int startToSwap = start + ((mid - start) / 2) + 1; swapRange(initialArray, startToSwap, mid + 1); shuffleArray(initialArray, start, mid); shuffleArray(initialArray, mid + 1, end); } private static void swapRange(int[] initialArray, int start, int mid) { int tmid = mid; int tstart = start; while (tstart < mid) { swapInt(initialArray, tstart++, tmid++); } } private static void swapInt(int[] initialArray, int from, int to) { int temp = initialArray[from]; initialArray[from] = initialArray[to]; initialArray[to] = temp; } }
UTF-8
Java
1,324
java
Searching1.java
Java
[]
null
[]
package shrikant.algorithms.searching; import java.util.Arrays; public class Searching1 { // given a array of 2n integers in the following format // a1a2a3a4b1b2b3b4 // Shuffle the array to a1b1a2b2a3b3a4b4a5b5 // without any extra memory public static void main(String[] args) { int[] initialArray = new int[]{1, 2, 3, 4, 11, 12, 13, 14}; shuffleArray(initialArray, 0, initialArray.length - 1); System.out.println(Arrays.toString(initialArray)); } private static void shuffleArray(int[] initialArray, int start, int end) { if (end - start <= 1) return; int mid = start + ((end - start) / 2); int startToSwap = start + ((mid - start) / 2) + 1; swapRange(initialArray, startToSwap, mid + 1); shuffleArray(initialArray, start, mid); shuffleArray(initialArray, mid + 1, end); } private static void swapRange(int[] initialArray, int start, int mid) { int tmid = mid; int tstart = start; while (tstart < mid) { swapInt(initialArray, tstart++, tmid++); } } private static void swapInt(int[] initialArray, int from, int to) { int temp = initialArray[from]; initialArray[from] = initialArray[to]; initialArray[to] = temp; } }
1,324
0.610272
0.58006
40
32.099998
24.003958
78
false
false
0
0
0
0
0
0
1
false
false
10
a88b35d257ce1e35e950f9e5b673c3147b9db7d7
24,670,292,169,581
a77da9c2cd8532e6ab336f54a088856c9c3a136a
/L2/Client/InputType.java
4fa79f062e23dc1bff9db187ed18ba4ad958fbbf
[]
no_license
ShakiMan/RSI-2021
https://github.com/ShakiMan/RSI-2021
bbd34c543e082a9c2d62db28cc2fa0680b181d14
20c23dcff82525cd67c6649ca7dd85cd47e4cac5
refs/heads/master
2023-03-24T04:32:21.082000
2021-03-21T22:27:48
2021-03-21T22:27:48
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.Serializable; public class InputType implements Serializable { private static final long SERIAL_VERSION_UID = 101L; public String operation; private final double x1; private final double x2; public InputType(double x1, double x2) { this.x1 = x1; this.x2 = x2; } public double getX1() { return x1; } public double getX2() { return x2; } }
UTF-8
Java
429
java
InputType.java
Java
[]
null
[]
import java.io.Serializable; public class InputType implements Serializable { private static final long SERIAL_VERSION_UID = 101L; public String operation; private final double x1; private final double x2; public InputType(double x1, double x2) { this.x1 = x1; this.x2 = x2; } public double getX1() { return x1; } public double getX2() { return x2; } }
429
0.620047
0.585082
21
19.428572
16.401426
56
false
false
0
0
0
0
0
0
0.47619
false
false
10
c2e9fe2c0db56633a32c7d9508fb50e4fdd7421e
31,842,887,542,724
6dbae30c806f661bcdcbc5f5f6a366ad702b1eea
/Corpus/eclipse.jdt.core/5.java
206a8dd9bcdfedcbade7a13ec8105b8303c52e2e
[ "MIT" ]
permissive
SurfGitHub/BLIZZARD-Replication-Package-ESEC-FSE2018
https://github.com/SurfGitHub/BLIZZARD-Replication-Package-ESEC-FSE2018
d3fd21745dfddb2979e8ac262588cfdfe471899f
0f8f4affd0ce1ecaa8ff8f487426f8edd6ad02c0
refs/heads/master
2020-03-31T15:52:01.005000
2018-10-01T23:38:50
2018-10-01T23:38:50
152,354,327
1
0
MIT
true
2018-10-10T02:57:02
2018-10-10T02:57:02
2018-10-01T23:38:52
2018-10-01T23:38:50
135,431
0
0
0
null
false
null
package b2; /* Test case for bug 8928 Unable to find references or declarations of methods that use static inner classes in the signature */ public class Y { public void foo(X.Inner inner) { } }
UTF-8
Java
205
java
5.java
Java
[]
null
[]
package b2; /* Test case for bug 8928 Unable to find references or declarations of methods that use static inner classes in the signature */ public class Y { public void foo(X.Inner inner) { } }
205
0.717073
0.692683
8
24.625
40.669209
128
false
false
0
0
0
0
0
0
0.125
false
false
10
5c5f3ef4098497e592f28932a90b7c0d92f0c11f
26,826,365,738,387
3ad04e247c2093f043354a529ccf1c6f196b1d7c
/IWB/src/com/ibp/controller/AddMessageServlet.java
215f83ebbfecf81f080115be2338dffa4e86a662
[]
no_license
meher404/IWB
https://github.com/meher404/IWB
ee364a0ee6f754e5d33052342db1817a6de64e8c
730c6988da6de287cf91fb334ff4a0a821ac244f
refs/heads/master
2021-01-23T03:21:56.461000
2014-06-07T06:44:12
2014-06-07T06:44:12
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ibp.controller; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.neo4j.graphdb.GraphDatabaseService; import com.ibp.model.DBUtilities; /** * Servlet implementation class AddMessageServlet */ @WebServlet("/AddMessageServlet") public class AddMessageServlet extends HttpServlet { private static final long serialVersionUID = 1L; GraphDatabaseService graph; Connection sqlConnection; /** * @see HttpServlet#HttpServlet() */ public AddMessageServlet() { super(); } public void init() throws ServletException { System.out.println("init called from AddMessage"); graph= (GraphDatabaseService) this.getServletContext().getAttribute("db"); sqlConnection=(Connection) this.getServletContext().getAttribute("sqlDBConnection"); } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { DBUtilities dbUtilities= new DBUtilities(graph,sqlConnection); PrintWriter pw=response.getWriter(); System.out.println("-> In do get of Addmessage function"); String url=request.getParameter("url"); String uId=request.getParameter("uid"); // String uname=request.getParameter("uname"); String message=request.getParameter("mes"); String chatType=request.getParameter("chatType"); System.out.println("url->"+url); System.out.println("uid->"+uId); // System.out.println("uname->"+uname); System.out.println("message->"+message); System.out.println("Chattype->"+chatType); System.out.println("addmessage called^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"); if(chatType.equalsIgnoreCase("similar")) { dbUtilities.addMessagesToCoreNode( uId, url, message);; //need to be implemented with parameters } else { dbUtilities.addMessageToURLNode( uId, url, message);; //need to be implemented with parameters } pw.write("rcvd"); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } }
UTF-8
Java
2,587
java
AddMessageServlet.java
Java
[]
null
[]
package com.ibp.controller; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.neo4j.graphdb.GraphDatabaseService; import com.ibp.model.DBUtilities; /** * Servlet implementation class AddMessageServlet */ @WebServlet("/AddMessageServlet") public class AddMessageServlet extends HttpServlet { private static final long serialVersionUID = 1L; GraphDatabaseService graph; Connection sqlConnection; /** * @see HttpServlet#HttpServlet() */ public AddMessageServlet() { super(); } public void init() throws ServletException { System.out.println("init called from AddMessage"); graph= (GraphDatabaseService) this.getServletContext().getAttribute("db"); sqlConnection=(Connection) this.getServletContext().getAttribute("sqlDBConnection"); } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { DBUtilities dbUtilities= new DBUtilities(graph,sqlConnection); PrintWriter pw=response.getWriter(); System.out.println("-> In do get of Addmessage function"); String url=request.getParameter("url"); String uId=request.getParameter("uid"); // String uname=request.getParameter("uname"); String message=request.getParameter("mes"); String chatType=request.getParameter("chatType"); System.out.println("url->"+url); System.out.println("uid->"+uId); // System.out.println("uname->"+uname); System.out.println("message->"+message); System.out.println("Chattype->"+chatType); System.out.println("addmessage called^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"); if(chatType.equalsIgnoreCase("similar")) { dbUtilities.addMessagesToCoreNode( uId, url, message);; //need to be implemented with parameters } else { dbUtilities.addMessageToURLNode( uId, url, message);; //need to be implemented with parameters } pw.write("rcvd"); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } }
2,587
0.71666
0.715887
78
31.166666
31.156519
119
false
false
0
0
0
0
0
0
1.75641
false
false
10
a9163aa7d847f25e95c0949f1a1966be9e46f124
4,372,276,724,393
aecf56d5d5b49c7a209819ebfbda7b9ec058c073
/src/main/java/Day17/BTVN/Bai1/CarGasI.java
99a417ad7f2120649179272c93d891c720ebc324
[]
no_license
HoaDinh/JUnit
https://github.com/HoaDinh/JUnit
4c573d59051335e86d66938d43d7495c31b14805
b533e7a5dbf0feb165eebbde59a957208f530498
refs/heads/master
2023-06-24T06:50:09.787000
2021-07-23T07:24:54
2021-07-23T07:24:54
371,860,783
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Day17.BTVN.Bai1; public class CarGasI extends Cars implements IManualCar { private long typeGas; public long getTypeGas() { return typeGas; } public void setTypeGas(long typeGas) { this.typeGas = typeGas; } public CarGasI() { } public CarGasI(String name, String color, String branch, String seats, long typeGas) { super(name, color, branch, seats); this.typeGas = typeGas; } @Override public String toString() { return "Car{" + "name=" + super.getName() + ", color='" + super.getColor() + '\'' + ", branch=" + super.getBranch() + '\'' + ", typeGas" + typeGas+ '\'' + ", seats=" + super.getSeats()+ '}'; } @Override public void run(int speed) { System.out.println("Speed max "+speed +"km/h"); } /*@Override public String toString() { return "CarGas{" + "typeGas=" + typeGas + '}' +super.toString(); }*/ }
UTF-8
Java
1,071
java
CarGasI.java
Java
[]
null
[]
package Day17.BTVN.Bai1; public class CarGasI extends Cars implements IManualCar { private long typeGas; public long getTypeGas() { return typeGas; } public void setTypeGas(long typeGas) { this.typeGas = typeGas; } public CarGasI() { } public CarGasI(String name, String color, String branch, String seats, long typeGas) { super(name, color, branch, seats); this.typeGas = typeGas; } @Override public String toString() { return "Car{" + "name=" + super.getName() + ", color='" + super.getColor() + '\'' + ", branch=" + super.getBranch() + '\'' + ", typeGas" + typeGas+ '\'' + ", seats=" + super.getSeats()+ '}'; } @Override public void run(int speed) { System.out.println("Speed max "+speed +"km/h"); } /*@Override public String toString() { return "CarGas{" + "typeGas=" + typeGas + '}' +super.toString(); }*/ }
1,071
0.507937
0.505135
41
25.121952
20.577272
90
false
false
0
0
0
0
0
0
0.487805
false
false
10
1dbab69f581bc7ba5fb8e487c854f0157df96a52
22,832,046,172,168
268292f5dfe7fd50ece57b03208a5b68cc67c216
/src/main/java/ui/Administrator/adminMainPanel.java
474338cdf77d1aa5ccc30d2272d0f1cd0476b331
[]
no_license
jingl-skywalker/cssclient
https://github.com/jingl-skywalker/cssclient
985828978ae15d9282acc73d828367d344bf4021
47d374356074c2f95e85956f1676b2ee94d9fa2f
refs/heads/master
2021-01-10T20:00:34.831000
2013-11-30T13:55:31
2013-11-30T13:55:31
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package ui.Administrator; /** * * @author zili chen */ public class adminMainPanel extends javax.swing.JPanel { /** * Creates new form adminMainPanel */ public adminMainPanel() { initComponents(); } /** * 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() { titelPanel2 = new javax.swing.JPanel(); peopleLogo2 = new javax.swing.JLabel(); nameLogo2 = new javax.swing.JLabel(); arrowLogo2 = new javax.swing.JLabel(); currentLogo2 = new javax.swing.JLabel(); backLogo2 = new javax.swing.JLabel(); backLabel2 = new javax.swing.JLabel(); homeLogo2 = new javax.swing.JLabel(); homeLabel2 = new javax.swing.JLabel(); exitLogo2 = new javax.swing.JLabel(); exitLabel2 = new javax.swing.JLabel(); viewInfoButton = new javax.swing.JButton(); viewInfoLabel = new javax.swing.JLabel(); addUserLabel = new javax.swing.JLabel(); addUserButton = new javax.swing.JButton(); keywordButton = new javax.swing.JButton(); keyLabel = new javax.swing.JLabel(); perInfoButton = new javax.swing.JButton(); perInfoLabel = new javax.swing.JLabel(); notePanel = new javax.swing.JPanel(); modifyInfoButton = new javax.swing.JButton(); modifyInfoLabel = new javax.swing.JLabel(); deleteUserButton = new javax.swing.JButton(); deleteUserLabel = new javax.swing.JLabel(); setBackground(new java.awt.Color(0, 0, 0)); titelPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); titelPanel2.setPreferredSize(new java.awt.Dimension(365, 37)); peopleLogo2.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N peopleLogo2.setText("Logo"); nameLogo2.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N nameLogo2.setText("name"); arrowLogo2.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N arrowLogo2.setText("->"); currentLogo2.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N currentLogo2.setText("current"); backLogo2.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N backLogo2.setText("Logo"); backLabel2.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N backLabel2.setText("back"); homeLogo2.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N homeLogo2.setText("Logo"); homeLabel2.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N homeLabel2.setText("home"); exitLogo2.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N exitLogo2.setText("Logo"); exitLabel2.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N exitLabel2.setText("exit"); javax.swing.GroupLayout titelPanel2Layout = new javax.swing.GroupLayout(titelPanel2); titelPanel2.setLayout(titelPanel2Layout); titelPanel2Layout.setHorizontalGroup( titelPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(titelPanel2Layout.createSequentialGroup() .addContainerGap() .addComponent(peopleLogo2) .addGap(18, 18, 18) .addComponent(nameLogo2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(arrowLogo2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(currentLogo2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 443, Short.MAX_VALUE) .addComponent(backLogo2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(backLabel2) .addGap(18, 18, 18) .addComponent(homeLogo2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(homeLabel2) .addGap(18, 18, 18) .addComponent(exitLogo2) .addGap(5, 5, 5) .addComponent(exitLabel2) .addContainerGap()) ); titelPanel2Layout.setVerticalGroup( titelPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(titelPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(titelPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(peopleLogo2) .addComponent(nameLogo2) .addComponent(arrowLogo2) .addComponent(currentLogo2) .addComponent(backLogo2) .addComponent(backLabel2) .addComponent(homeLogo2) .addComponent(homeLabel2) .addComponent(exitLogo2) .addComponent(exitLabel2)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); viewInfoButton.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N viewInfoButton.setText("viewInfo"); viewInfoButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { viewInfoButtonActionPerformed(evt); } }); viewInfoLabel.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N viewInfoLabel.setForeground(new java.awt.Color(240, 240, 240)); viewInfoLabel.setText("查看用户信息"); addUserLabel.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N addUserLabel.setForeground(new java.awt.Color(240, 240, 240)); addUserLabel.setText("增添用户"); addUserButton.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N addUserButton.setText("add"); addUserButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { addUserButtonActionPerformed(evt); } }); keywordButton.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N keywordButton.setText("keyword"); keywordButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { keywordButtonActionPerformed(evt); } }); keyLabel.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N keyLabel.setForeground(new java.awt.Color(240, 240, 240)); keyLabel.setText("密码重置"); perInfoButton.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N perInfoButton.setText("perInfo"); perInfoButton.setToolTipText(""); perInfoButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { perInfoButtonActionPerformed(evt); } }); perInfoLabel.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N perInfoLabel.setForeground(new java.awt.Color(240, 240, 240)); perInfoLabel.setText("个人信息"); notePanel.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true)); notePanel.setToolTipText(""); javax.swing.GroupLayout notePanelLayout = new javax.swing.GroupLayout(notePanel); notePanel.setLayout(notePanelLayout); notePanelLayout.setHorizontalGroup( notePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 579, Short.MAX_VALUE) ); notePanelLayout.setVerticalGroup( notePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 173, Short.MAX_VALUE) ); modifyInfoButton.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N modifyInfoButton.setText("modifyInfo"); modifyInfoButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { modifyInfoButtonActionPerformed(evt); } }); modifyInfoLabel.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N modifyInfoLabel.setForeground(new java.awt.Color(240, 240, 240)); modifyInfoLabel.setText("修改用户信息"); deleteUserButton.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N deleteUserButton.setText("delete"); deleteUserButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { deleteUserButtonActionPerformed(evt); } }); deleteUserLabel.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N deleteUserLabel.setForeground(new java.awt.Color(240, 240, 240)); deleteUserLabel.setText("删除用户"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(titelPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 889, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addGap(51, 51, 51) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(notePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(viewInfoLabel) .addComponent(viewInfoButton, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(29, 29, 29) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(modifyInfoLabel) .addComponent(modifyInfoButton, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(29, 29, 29) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(addUserButton, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) .addComponent(addUserLabel))) .addGap(40, 40, 40) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(deleteUserButton, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) .addComponent(deleteUserLabel))) .addGap(42, 42, 42) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(keywordButton, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) .addComponent(keyLabel))) .addGap(47, 47, 47) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) .addComponent(perInfoLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 10, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(perInfoButton, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(titelPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(43, 43, 43) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(viewInfoButton, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(addUserButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(viewInfoLabel)) .addGroup(layout.createSequentialGroup() .addComponent(modifyInfoButton, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(modifyInfoLabel) .addComponent(addUserLabel) .addComponent(deleteUserLabel)))) .addComponent(keyLabel) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(deleteUserButton, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(keywordButton, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(perInfoButton, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(perInfoLabel))) .addGap(18, 18, 18) .addComponent(notePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 27, Short.MAX_VALUE)) ); }// </editor-fold>//GEN-END:initComponents private void viewInfoButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewInfoButtonActionPerformed // TODO add your handling code here: }//GEN-LAST:event_viewInfoButtonActionPerformed private void addUserButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addUserButtonActionPerformed // TODO add your handling code here: }//GEN-LAST:event_addUserButtonActionPerformed private void keywordButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_keywordButtonActionPerformed // TODO add your handling code here: }//GEN-LAST:event_keywordButtonActionPerformed private void perInfoButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_perInfoButtonActionPerformed // TODO add your handling code here: }//GEN-LAST:event_perInfoButtonActionPerformed private void modifyInfoButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_modifyInfoButtonActionPerformed // TODO add your handling code here: }//GEN-LAST:event_modifyInfoButtonActionPerformed private void deleteUserButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteUserButtonActionPerformed // TODO add your handling code here: }//GEN-LAST:event_deleteUserButtonActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton addUserButton; private javax.swing.JLabel addUserLabel; private javax.swing.JLabel arrowLogo2; private javax.swing.JLabel backLabel2; private javax.swing.JLabel backLogo2; private javax.swing.JLabel currentLogo2; private javax.swing.JButton deleteUserButton; private javax.swing.JLabel deleteUserLabel; private javax.swing.JLabel exitLabel2; private javax.swing.JLabel exitLogo2; private javax.swing.JLabel homeLabel2; private javax.swing.JLabel homeLogo2; private javax.swing.JLabel keyLabel; private javax.swing.JButton keywordButton; private javax.swing.JButton modifyInfoButton; private javax.swing.JLabel modifyInfoLabel; private javax.swing.JLabel nameLogo2; private javax.swing.JPanel notePanel; private javax.swing.JLabel peopleLogo2; private javax.swing.JButton perInfoButton; private javax.swing.JLabel perInfoLabel; private javax.swing.JPanel titelPanel2; private javax.swing.JButton viewInfoButton; private javax.swing.JLabel viewInfoLabel; // End of variables declaration//GEN-END:variables }
UTF-8
Java
18,712
java
adminMainPanel.java
Java
[ { "context": ".\n */\npackage ui.Administrator;\n\n/**\n *\n * @author zili chen\n */\npublic class adminMainPanel extends javax.swi", "end": 154, "score": 0.9987391829490662, "start": 145, "tag": "NAME", "value": "zili chen" }, { "context": ".Color(240, 240, 240));\n keyLabel.setText(\"密码重置\");\n\n perInfoButton.setFont(new java.awt.Fo", "end": 7134, "score": 0.9800440669059753, "start": 7130, "tag": "PASSWORD", "value": "密码重置" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package ui.Administrator; /** * * @author <NAME> */ public class adminMainPanel extends javax.swing.JPanel { /** * Creates new form adminMainPanel */ public adminMainPanel() { initComponents(); } /** * 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() { titelPanel2 = new javax.swing.JPanel(); peopleLogo2 = new javax.swing.JLabel(); nameLogo2 = new javax.swing.JLabel(); arrowLogo2 = new javax.swing.JLabel(); currentLogo2 = new javax.swing.JLabel(); backLogo2 = new javax.swing.JLabel(); backLabel2 = new javax.swing.JLabel(); homeLogo2 = new javax.swing.JLabel(); homeLabel2 = new javax.swing.JLabel(); exitLogo2 = new javax.swing.JLabel(); exitLabel2 = new javax.swing.JLabel(); viewInfoButton = new javax.swing.JButton(); viewInfoLabel = new javax.swing.JLabel(); addUserLabel = new javax.swing.JLabel(); addUserButton = new javax.swing.JButton(); keywordButton = new javax.swing.JButton(); keyLabel = new javax.swing.JLabel(); perInfoButton = new javax.swing.JButton(); perInfoLabel = new javax.swing.JLabel(); notePanel = new javax.swing.JPanel(); modifyInfoButton = new javax.swing.JButton(); modifyInfoLabel = new javax.swing.JLabel(); deleteUserButton = new javax.swing.JButton(); deleteUserLabel = new javax.swing.JLabel(); setBackground(new java.awt.Color(0, 0, 0)); titelPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); titelPanel2.setPreferredSize(new java.awt.Dimension(365, 37)); peopleLogo2.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N peopleLogo2.setText("Logo"); nameLogo2.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N nameLogo2.setText("name"); arrowLogo2.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N arrowLogo2.setText("->"); currentLogo2.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N currentLogo2.setText("current"); backLogo2.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N backLogo2.setText("Logo"); backLabel2.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N backLabel2.setText("back"); homeLogo2.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N homeLogo2.setText("Logo"); homeLabel2.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N homeLabel2.setText("home"); exitLogo2.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N exitLogo2.setText("Logo"); exitLabel2.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N exitLabel2.setText("exit"); javax.swing.GroupLayout titelPanel2Layout = new javax.swing.GroupLayout(titelPanel2); titelPanel2.setLayout(titelPanel2Layout); titelPanel2Layout.setHorizontalGroup( titelPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(titelPanel2Layout.createSequentialGroup() .addContainerGap() .addComponent(peopleLogo2) .addGap(18, 18, 18) .addComponent(nameLogo2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(arrowLogo2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(currentLogo2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 443, Short.MAX_VALUE) .addComponent(backLogo2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(backLabel2) .addGap(18, 18, 18) .addComponent(homeLogo2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(homeLabel2) .addGap(18, 18, 18) .addComponent(exitLogo2) .addGap(5, 5, 5) .addComponent(exitLabel2) .addContainerGap()) ); titelPanel2Layout.setVerticalGroup( titelPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(titelPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(titelPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(peopleLogo2) .addComponent(nameLogo2) .addComponent(arrowLogo2) .addComponent(currentLogo2) .addComponent(backLogo2) .addComponent(backLabel2) .addComponent(homeLogo2) .addComponent(homeLabel2) .addComponent(exitLogo2) .addComponent(exitLabel2)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); viewInfoButton.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N viewInfoButton.setText("viewInfo"); viewInfoButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { viewInfoButtonActionPerformed(evt); } }); viewInfoLabel.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N viewInfoLabel.setForeground(new java.awt.Color(240, 240, 240)); viewInfoLabel.setText("查看用户信息"); addUserLabel.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N addUserLabel.setForeground(new java.awt.Color(240, 240, 240)); addUserLabel.setText("增添用户"); addUserButton.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N addUserButton.setText("add"); addUserButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { addUserButtonActionPerformed(evt); } }); keywordButton.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N keywordButton.setText("keyword"); keywordButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { keywordButtonActionPerformed(evt); } }); keyLabel.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N keyLabel.setForeground(new java.awt.Color(240, 240, 240)); keyLabel.setText("<PASSWORD>"); perInfoButton.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N perInfoButton.setText("perInfo"); perInfoButton.setToolTipText(""); perInfoButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { perInfoButtonActionPerformed(evt); } }); perInfoLabel.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N perInfoLabel.setForeground(new java.awt.Color(240, 240, 240)); perInfoLabel.setText("个人信息"); notePanel.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true)); notePanel.setToolTipText(""); javax.swing.GroupLayout notePanelLayout = new javax.swing.GroupLayout(notePanel); notePanel.setLayout(notePanelLayout); notePanelLayout.setHorizontalGroup( notePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 579, Short.MAX_VALUE) ); notePanelLayout.setVerticalGroup( notePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 173, Short.MAX_VALUE) ); modifyInfoButton.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N modifyInfoButton.setText("modifyInfo"); modifyInfoButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { modifyInfoButtonActionPerformed(evt); } }); modifyInfoLabel.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N modifyInfoLabel.setForeground(new java.awt.Color(240, 240, 240)); modifyInfoLabel.setText("修改用户信息"); deleteUserButton.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N deleteUserButton.setText("delete"); deleteUserButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { deleteUserButtonActionPerformed(evt); } }); deleteUserLabel.setFont(new java.awt.Font("微软雅黑", 0, 14)); // NOI18N deleteUserLabel.setForeground(new java.awt.Color(240, 240, 240)); deleteUserLabel.setText("删除用户"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(titelPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 889, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addGap(51, 51, 51) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(notePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(viewInfoLabel) .addComponent(viewInfoButton, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(29, 29, 29) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(modifyInfoLabel) .addComponent(modifyInfoButton, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(29, 29, 29) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(addUserButton, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) .addComponent(addUserLabel))) .addGap(40, 40, 40) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(deleteUserButton, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) .addComponent(deleteUserLabel))) .addGap(42, 42, 42) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(keywordButton, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) .addComponent(keyLabel))) .addGap(47, 47, 47) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) .addComponent(perInfoLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 10, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(perInfoButton, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(titelPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(43, 43, 43) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(viewInfoButton, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(addUserButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(viewInfoLabel)) .addGroup(layout.createSequentialGroup() .addComponent(modifyInfoButton, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(modifyInfoLabel) .addComponent(addUserLabel) .addComponent(deleteUserLabel)))) .addComponent(keyLabel) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(deleteUserButton, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(keywordButton, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(perInfoButton, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(perInfoLabel))) .addGap(18, 18, 18) .addComponent(notePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 27, Short.MAX_VALUE)) ); }// </editor-fold>//GEN-END:initComponents private void viewInfoButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewInfoButtonActionPerformed // TODO add your handling code here: }//GEN-LAST:event_viewInfoButtonActionPerformed private void addUserButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addUserButtonActionPerformed // TODO add your handling code here: }//GEN-LAST:event_addUserButtonActionPerformed private void keywordButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_keywordButtonActionPerformed // TODO add your handling code here: }//GEN-LAST:event_keywordButtonActionPerformed private void perInfoButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_perInfoButtonActionPerformed // TODO add your handling code here: }//GEN-LAST:event_perInfoButtonActionPerformed private void modifyInfoButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_modifyInfoButtonActionPerformed // TODO add your handling code here: }//GEN-LAST:event_modifyInfoButtonActionPerformed private void deleteUserButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteUserButtonActionPerformed // TODO add your handling code here: }//GEN-LAST:event_deleteUserButtonActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton addUserButton; private javax.swing.JLabel addUserLabel; private javax.swing.JLabel arrowLogo2; private javax.swing.JLabel backLabel2; private javax.swing.JLabel backLogo2; private javax.swing.JLabel currentLogo2; private javax.swing.JButton deleteUserButton; private javax.swing.JLabel deleteUserLabel; private javax.swing.JLabel exitLabel2; private javax.swing.JLabel exitLogo2; private javax.swing.JLabel homeLabel2; private javax.swing.JLabel homeLogo2; private javax.swing.JLabel keyLabel; private javax.swing.JButton keywordButton; private javax.swing.JButton modifyInfoButton; private javax.swing.JLabel modifyInfoLabel; private javax.swing.JLabel nameLogo2; private javax.swing.JPanel notePanel; private javax.swing.JLabel peopleLogo2; private javax.swing.JButton perInfoButton; private javax.swing.JLabel perInfoLabel; private javax.swing.JPanel titelPanel2; private javax.swing.JButton viewInfoButton; private javax.swing.JLabel viewInfoLabel; // End of variables declaration//GEN-END:variables }
18,707
0.639989
0.618777
349
51.95129
36.194485
189
false
false
0
0
0
0
0
0
0.830946
false
false
10
7090768d6ab975299175a3a6cf214b0631a531ec
20,813,411,556,547
c426f7b90138151ffeb50a0d2c0d631abeb466b6
/inception/inception-project-initializers/src/main/java/de/tudarmstadt/ukp/clarin/webanno/project/initializers/OrthographyLayerInitializer.java
bca0fe29ec4ff0498568a8b9c7a055f5e2164bfe
[ "Apache-2.0" ]
permissive
inception-project/inception
https://github.com/inception-project/inception
7a06b8cd1f8e6a7eb44ee69e842590cf2989df5f
ec95327e195ca461dd90c2761237f92a879a1e61
refs/heads/main
2023-09-02T07:52:53.578000
2023-09-02T07:44:11
2023-09-02T07:44:11
127,004,420
511
141
Apache-2.0
false
2023-09-13T19:09:49
2018-03-27T15:04:00
2023-09-12T12:46:44
2023-09-13T19:09:49
111,239
514
141
282
Java
false
false
/* * Licensed to the Technische Universität Darmstadt under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Technische Universität Darmstadt * 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. * * 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 de.tudarmstadt.ukp.clarin.webanno.project.initializers; import static de.tudarmstadt.ukp.clarin.webanno.support.WebAnnoConst.SPAN_TYPE; import static java.util.Arrays.asList; import java.io.IOException; import java.util.List; import org.apache.uima.cas.CAS; import org.springframework.beans.factory.annotation.Autowired; import de.tudarmstadt.ukp.clarin.webanno.api.project.ProjectInitializer; import de.tudarmstadt.ukp.clarin.webanno.model.AnchoringMode; import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature; import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer; import de.tudarmstadt.ukp.clarin.webanno.model.OverlapMode; import de.tudarmstadt.ukp.clarin.webanno.model.Project; import de.tudarmstadt.ukp.clarin.webanno.model.TagSet; import de.tudarmstadt.ukp.clarin.webanno.project.initializers.config.ProjectInitializersAutoConfiguration; import de.tudarmstadt.ukp.dkpro.core.api.transform.type.SofaChangeAnnotation; import de.tudarmstadt.ukp.inception.schema.AnnotationSchemaService; /** * <p> * This class is exposed as a Spring Component via * {@link ProjectInitializersAutoConfiguration#orthographyLayerInitializer}. * </p> */ public class OrthographyLayerInitializer implements LayerInitializer { private final AnnotationSchemaService annotationSchemaService; @Autowired public OrthographyLayerInitializer(AnnotationSchemaService aAnnotationSchemaService) { annotationSchemaService = aAnnotationSchemaService; } @Override public String getName() { return "Spelling correction"; } @Override public List<Class<? extends ProjectInitializer>> getDependencies() { return asList( // Because locks to token boundaries TokenLayerInitializer.class, // Tagsets SofaChangeOperationTagSetInitializer.class); } @Override public boolean alreadyApplied(Project aProject) { return annotationSchemaService.existsLayer(SofaChangeAnnotation.class.getName(), aProject); } @Override public void configure(Project aProject) throws IOException { AnnotationLayer orthography = new AnnotationLayer(SofaChangeAnnotation.class.getName(), "Orthography Correction", SPAN_TYPE, aProject, true, AnchoringMode.SINGLE_TOKEN, OverlapMode.NO_OVERLAP); annotationSchemaService.createOrUpdateLayer(orthography); AnnotationFeature correction = new AnnotationFeature(); correction.setDescription("Correct this token using the specified operation."); correction.setName("value"); correction.setType(CAS.TYPE_NAME_STRING); correction.setProject(aProject); correction.setUiName("Correction"); correction.setLayer(orthography); annotationSchemaService.createFeature(correction); TagSet operationTagset = annotationSchemaService .getTagSet(SofaChangeOperationTagSetInitializer.TAG_SET_NAME, aProject); AnnotationFeature operation = new AnnotationFeature(); operation.setDescription("An operation taken to change this token."); operation.setName("operation"); operation.setType(CAS.TYPE_NAME_STRING); operation.setProject(aProject); operation.setUiName("Operation"); operation.setLayer(orthography); operation.setVisible(false); operation.setTagset(operationTagset); operation.setRequired(true); annotationSchemaService.createFeature(operation); } }
UTF-8
Java
4,366
java
OrthographyLayerInitializer.java
Java
[]
null
[]
/* * Licensed to the Technische Universität Darmstadt under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Technische Universität Darmstadt * 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. * * 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 de.tudarmstadt.ukp.clarin.webanno.project.initializers; import static de.tudarmstadt.ukp.clarin.webanno.support.WebAnnoConst.SPAN_TYPE; import static java.util.Arrays.asList; import java.io.IOException; import java.util.List; import org.apache.uima.cas.CAS; import org.springframework.beans.factory.annotation.Autowired; import de.tudarmstadt.ukp.clarin.webanno.api.project.ProjectInitializer; import de.tudarmstadt.ukp.clarin.webanno.model.AnchoringMode; import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature; import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer; import de.tudarmstadt.ukp.clarin.webanno.model.OverlapMode; import de.tudarmstadt.ukp.clarin.webanno.model.Project; import de.tudarmstadt.ukp.clarin.webanno.model.TagSet; import de.tudarmstadt.ukp.clarin.webanno.project.initializers.config.ProjectInitializersAutoConfiguration; import de.tudarmstadt.ukp.dkpro.core.api.transform.type.SofaChangeAnnotation; import de.tudarmstadt.ukp.inception.schema.AnnotationSchemaService; /** * <p> * This class is exposed as a Spring Component via * {@link ProjectInitializersAutoConfiguration#orthographyLayerInitializer}. * </p> */ public class OrthographyLayerInitializer implements LayerInitializer { private final AnnotationSchemaService annotationSchemaService; @Autowired public OrthographyLayerInitializer(AnnotationSchemaService aAnnotationSchemaService) { annotationSchemaService = aAnnotationSchemaService; } @Override public String getName() { return "Spelling correction"; } @Override public List<Class<? extends ProjectInitializer>> getDependencies() { return asList( // Because locks to token boundaries TokenLayerInitializer.class, // Tagsets SofaChangeOperationTagSetInitializer.class); } @Override public boolean alreadyApplied(Project aProject) { return annotationSchemaService.existsLayer(SofaChangeAnnotation.class.getName(), aProject); } @Override public void configure(Project aProject) throws IOException { AnnotationLayer orthography = new AnnotationLayer(SofaChangeAnnotation.class.getName(), "Orthography Correction", SPAN_TYPE, aProject, true, AnchoringMode.SINGLE_TOKEN, OverlapMode.NO_OVERLAP); annotationSchemaService.createOrUpdateLayer(orthography); AnnotationFeature correction = new AnnotationFeature(); correction.setDescription("Correct this token using the specified operation."); correction.setName("value"); correction.setType(CAS.TYPE_NAME_STRING); correction.setProject(aProject); correction.setUiName("Correction"); correction.setLayer(orthography); annotationSchemaService.createFeature(correction); TagSet operationTagset = annotationSchemaService .getTagSet(SofaChangeOperationTagSetInitializer.TAG_SET_NAME, aProject); AnnotationFeature operation = new AnnotationFeature(); operation.setDescription("An operation taken to change this token."); operation.setName("operation"); operation.setType(CAS.TYPE_NAME_STRING); operation.setProject(aProject); operation.setUiName("Operation"); operation.setLayer(orthography); operation.setVisible(false); operation.setTagset(operationTagset); operation.setRequired(true); annotationSchemaService.createFeature(operation); } }
4,366
0.744959
0.744042
112
37.964287
29.584301
106
false
false
0
0
0
0
0
0
0.517857
false
false
10
e8f11bbca3cb4d7d6341dc29a635449f09bc7b63
5,738,076,336,212
23c78fc73085047744139da21ee5818c7c90df73
/src/main/java/teamrtg/rsg/config/ConfigManager.java
59d921684855648431c0b928424cee817607e100
[]
no_license
Team-RTG/Realistic-Structure-Generation
https://github.com/Team-RTG/Realistic-Structure-Generation
b4a2f25bc9d3f99cb0dfb5339a943ade7b05f273
1455082698af09bcd76233b3f1d23fc4a0bd959c
refs/heads/master
2021-01-10T15:08:52.562000
2016-03-12T22:17:50
2016-03-12T22:17:50
52,832,415
11
5
null
null
null
null
null
null
null
null
null
null
null
null
null
package teamrtg.rsg.config; import java.io.File; public class ConfigManager { public static File rsgConfigFile; public static File villageConfigFile; private ConfigRSG configRSG = new ConfigRSG(); public ConfigRSG rsg() { return configRSG; } public static void init(String configpath) { rsgConfigFile = new File(configpath + "RSG.cfg"); villageConfigFile = new File(configpath + "Villages.cfg"); ConfigRSG.init(rsgConfigFile); VillageConfigManager.init(villageConfigFile); } }
UTF-8
Java
577
java
ConfigManager.java
Java
[]
null
[]
package teamrtg.rsg.config; import java.io.File; public class ConfigManager { public static File rsgConfigFile; public static File villageConfigFile; private ConfigRSG configRSG = new ConfigRSG(); public ConfigRSG rsg() { return configRSG; } public static void init(String configpath) { rsgConfigFile = new File(configpath + "RSG.cfg"); villageConfigFile = new File(configpath + "Villages.cfg"); ConfigRSG.init(rsgConfigFile); VillageConfigManager.init(villageConfigFile); } }
577
0.656846
0.656846
26
21.192308
20.801292
66
false
false
0
0
0
0
0
0
0.384615
false
false
10
d77ce1b6364a43f4a2f6e9e3b1db924e90b7be90
5,738,076,335,878
8925f4d20e9a4608ff76ac45c148fcfe02b75cd9
/practice-server/src/main/java/com/ayt/example/server/thread/WaitNotifyInterupt.java
f71b070979b3f77368e5148a25110263bca32e8d
[]
no_license
doushimutou/concurrent-practice
https://github.com/doushimutou/concurrent-practice
0a75d22c08ec7f11d5b1a4e842ed567e28ebb136
0c6a92909e69366b22b4680c18459c566d2bf89d
refs/heads/master
2023-05-11T15:56:27.935000
2019-12-19T05:54:28
2019-12-19T05:54:28
221,351,336
0
0
null
false
2023-05-09T18:16:20
2019-11-13T02:03:03
2019-12-19T05:54:49
2023-05-09T18:16:17
98
0
0
2
Java
false
false
package com.ayt.example.server.thread; /** * Description * Author ayt on * 线程wait后,被中断会抛interruptExcetion异常 */ public class WaitNotifyInterupt { private static Object obj = new Object(); public static void main(String[] args) throws InterruptedException { Thread threadA = new Thread(() -> { try { synchronized (obj) { System.out.println("--begin"); obj.wait(); } System.out.println("----end"); } catch (Exception e) { System.out.println("出错了"); } }); threadA.start(); Thread.sleep(10000); System.out.println("begin interrupt threadA"); threadA.interrupt(); System.out.println("end interrupt threadA"); } }
UTF-8
Java
695
java
WaitNotifyInterupt.java
Java
[ { "context": "ample.server.thread;\n\n/**\n * Description\n * Author ayt on\n * 线程wait后,被中断会抛interruptExcetion异常\n */\npubli", "end": 72, "score": 0.9991902112960815, "start": 69, "tag": "USERNAME", "value": "ayt" } ]
null
[]
package com.ayt.example.server.thread; /** * Description * Author ayt on * 线程wait后,被中断会抛interruptExcetion异常 */ public class WaitNotifyInterupt { private static Object obj = new Object(); public static void main(String[] args) throws InterruptedException { Thread threadA = new Thread(() -> { try { synchronized (obj) { System.out.println("--begin"); obj.wait(); } System.out.println("----end"); } catch (Exception e) { System.out.println("出错了"); } }); threadA.start(); Thread.sleep(10000); System.out.println("begin interrupt threadA"); threadA.interrupt(); System.out.println("end interrupt threadA"); } }
695
0.656672
0.649175
30
21.233334
17.574001
69
false
false
0
0
0
0
0
0
2.133333
false
false
10
8ea733a116e7d7de869c01873af8091f56851982
30,185,030,166,886
ef8c444e8d494d27ab248707d12d7c30fc407702
/gateway/src/main/java/com/jd/blockchain/gateway/web/GatewayWebSecurityConfigurer.java
df78a5985d3e6ef1cae20a803c080aeb3d32ab31
[]
permissive
blockchain-jd-com/jdchain-core
https://github.com/blockchain-jd-com/jdchain-core
334e45928da4eccfada97be14b13bbbddc9986bb
5a85be3e7fcff00dd5203dcfc835fd180260c9cd
refs/heads/master
2023-06-25T08:56:59.183000
2022-10-18T09:10:09
2022-10-18T09:10:09
229,806,492
5
14
Apache-2.0
false
2023-06-14T22:48:08
2019-12-23T18:51:35
2022-12-19T07:04:16
2023-06-14T22:48:07
9,970
5
14
3
Java
false
false
package com.jd.blockchain.gateway.web; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import utils.StringUtils; @Configuration @EnableWebSecurity public class GatewayWebSecurityConfigurer extends WebSecurityConfigurerAdapter { @Value("${spring.security.ignored:}") String ignored; @Value("${spring.security.user.name:}") String userName; @Value("${spring.security.user.password:}") String userPassword; @Override protected void configure(HttpSecurity http) throws Exception { if (!StringUtils.isEmpty(userName) && !StringUtils.isEmpty(userPassword)) { if (!StringUtils.isEmpty(ignored)) { http.authorizeRequests().antMatchers(ignored.split(",")).permitAll().anyRequest().authenticated().and().formLogin().and().httpBasic().and().csrf().disable(); } else { http.authorizeRequests().anyRequest().authenticated().and().formLogin().and().httpBasic().and().csrf().disable(); } } else { http.authorizeRequests().anyRequest().permitAll().and().csrf().disable(); } } }
UTF-8
Java
1,485
java
GatewayWebSecurityConfigurer.java
Java
[]
null
[]
package com.jd.blockchain.gateway.web; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import utils.StringUtils; @Configuration @EnableWebSecurity public class GatewayWebSecurityConfigurer extends WebSecurityConfigurerAdapter { @Value("${spring.security.ignored:}") String ignored; @Value("${spring.security.user.name:}") String userName; @Value("${spring.security.user.password:}") String userPassword; @Override protected void configure(HttpSecurity http) throws Exception { if (!StringUtils.isEmpty(userName) && !StringUtils.isEmpty(userPassword)) { if (!StringUtils.isEmpty(ignored)) { http.authorizeRequests().antMatchers(ignored.split(",")).permitAll().anyRequest().authenticated().and().formLogin().and().httpBasic().and().csrf().disable(); } else { http.authorizeRequests().anyRequest().authenticated().and().formLogin().and().httpBasic().and().csrf().disable(); } } else { http.authorizeRequests().anyRequest().permitAll().and().csrf().disable(); } } }
1,485
0.700337
0.700337
33
43
40.883427
173
false
false
0
0
0
0
0
0
0.424242
false
false
10
07ae467b89e0b3d7a61ad56467a7f723e305bc42
10,737,418,292,048
97b962e4be138437c871adbfb7e9dcd842bf9753
/src/main/java/com/szzii/cn/DispatchAdvice.java
88a7e47964c2d080dc6d2d9e695d1ab76ce6a4a8
[]
no_license
shanzhaozheng/transpond-agent
https://github.com/shanzhaozheng/transpond-agent
74f6d24c5d3dc258834e39ba679dbfa8c0df0488
be0d0ab60e2e0bb38ab7c1831cd660be0bd40233
refs/heads/master
2023-02-03T06:12:39.993000
2021-07-11T14:54:42
2021-07-11T14:54:42
318,451,895
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.szzii.cn; import com.szzii.cn.entity.RequestEntity; import com.szzii.cn.stereotype.Routing; import com.szzii.cn.util.CommonUtil; import net.bytebuddy.asm.Advice; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; /** * * @author szz */ public class DispatchAdvice { @Advice.OnMethodEnter() public static void enter(@Advice.Argument (0) Object var1,@Advice.Origin("#t") String className, @Advice.Origin("#m") String methodName) { try { Class<?> requestClass = var1.getClass(); if (!var1.getClass().getSimpleName().equals("MyRequestWrapper")){ return; } Method getServletPath = requestClass.getMethod("getServletPath"); String servletPath = (String)getServletPath.invoke(var1); if (!filterUrl(servletPath)){ return; } try { RequestEntity requestEntity = CommonUtil.buildRequestEntity(var1); Dispatch.doDispatch(requestEntity); } catch (Exception e) { e.printStackTrace(); } } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); }catch (Exception e){ e.printStackTrace(); } } @Advice.OnMethodExit() public static void exit(@Advice.Origin("#t") String className, @Advice.Origin("#m") String methodName) { } public static boolean filterUrl(String url){ Routing[] values = Routing.values(); for (Routing value : values) { if (url.startsWith(value.getUrl())){ return true; } } return false; } }
UTF-8
Java
1,872
java
DispatchAdvice.java
Java
[ { "context": "mport java.lang.reflect.Method;\n\n/**\n *\n * @author szz\n */\npublic class DispatchAdvice {\n\n\n\n\n @Advice", "end": 283, "score": 0.9996192455291748, "start": 280, "tag": "USERNAME", "value": "szz" } ]
null
[]
package com.szzii.cn; import com.szzii.cn.entity.RequestEntity; import com.szzii.cn.stereotype.Routing; import com.szzii.cn.util.CommonUtil; import net.bytebuddy.asm.Advice; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; /** * * @author szz */ public class DispatchAdvice { @Advice.OnMethodEnter() public static void enter(@Advice.Argument (0) Object var1,@Advice.Origin("#t") String className, @Advice.Origin("#m") String methodName) { try { Class<?> requestClass = var1.getClass(); if (!var1.getClass().getSimpleName().equals("MyRequestWrapper")){ return; } Method getServletPath = requestClass.getMethod("getServletPath"); String servletPath = (String)getServletPath.invoke(var1); if (!filterUrl(servletPath)){ return; } try { RequestEntity requestEntity = CommonUtil.buildRequestEntity(var1); Dispatch.doDispatch(requestEntity); } catch (Exception e) { e.printStackTrace(); } } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); }catch (Exception e){ e.printStackTrace(); } } @Advice.OnMethodExit() public static void exit(@Advice.Origin("#t") String className, @Advice.Origin("#m") String methodName) { } public static boolean filterUrl(String url){ Routing[] values = Routing.values(); for (Routing value : values) { if (url.startsWith(value.getUrl())){ return true; } } return false; } }
1,872
0.588675
0.58547
66
27.363636
27.492498
142
false
false
0
0
0
0
0
0
0.378788
false
false
10
b9320deded4db809672a511e63ea0ab806ee83f5
35,716,948,033,552
85f6aa4a7c6178d85ab799d331e5fbc266591e1b
/app-server/src/com/skillsimprover/gittest/server/ServerApp.java
089f6f6ef6926766f0cc63dd2b330c75811a871d
[]
no_license
SkillsImprover/git-modules-test
https://github.com/SkillsImprover/git-modules-test
254e74bea9793c4fd2a23c3731afa0b47e999f1a
235192c36a59a6a5c0dde82dfcab352db4690894
refs/heads/master
2020-07-22T21:39:40.531000
2019-09-09T15:05:44
2019-09-09T15:05:44
207,336,503
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.skillsimprover.gittest.server; public class ServerApp { public static void main(String[] args) { System.out.println("Server running..."); } }
UTF-8
Java
172
java
ServerApp.java
Java
[]
null
[]
package com.skillsimprover.gittest.server; public class ServerApp { public static void main(String[] args) { System.out.println("Server running..."); } }
172
0.674419
0.674419
8
20.5
20.13703
48
false
false
0
0
0
0
0
0
0.25
false
false
10
824729527e6369dab61166ea98b0bf41ed8ac4f7
31,224,412,307,074
359d4020398298333b7da4d1a8e4870fe8e34ad1
/slideadapter/src/main/java/com/tuacy/slideadapter/SlideItemLayoutLayout.java
95ea0f0214db3a01e4f68f658b8be229ea798fab
[]
no_license
tuacy/Slide
https://github.com/tuacy/Slide
9ec0f7e324d784967bb0fb49b0d2261c77e8ab00
2a501bb3d1b3f88bf968be86beb8f92ef841daa1
refs/heads/master
2021-07-03T15:11:03.367000
2017-09-25T08:29:22
2017-09-25T08:29:22
104,535,965
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tuacy.slideadapter; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import android.widget.AbsListView; import android.widget.HorizontalScrollView; public class SlideItemLayoutLayout extends HorizontalScrollView implements SlideItemLayoutAction { private int mLeftWidth; private int mRightWidth; private boolean mIsOpen; public SlideItemLayoutLayout(Context context) { this(context, null); } public SlideItemLayoutLayout(Context context, AttributeSet attrs) { this(context, attrs, 0); } public SlideItemLayoutLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); setOverScrollMode(View.OVER_SCROLL_NEVER); setHorizontalScrollBarEnabled(false); } @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); scrollTo(mLeftWidth, 0); } @Override public void computeScroll() { super.computeScroll(); } @Override public boolean dispatchTouchEvent(MotionEvent ev) { if (getSlideAdapter().getOpenSlideItem() != null && getSlideAdapter().getOpenSlideItem() != this) { closeOpenMenu(); // return true; } return super.dispatchTouchEvent(ev); } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { return super.onInterceptTouchEvent(ev); } @Override public boolean onTouchEvent(MotionEvent ev) { closeOpenMenu(); if (getSlidingItem() != null && getSlidingItem() != this) { return false; } setScrollingItem(this); switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: closeOpenMenu(); break; case MotionEvent.ACTION_UP: setScrollingItem(null); int scrollX = getScrollX(); if (scrollX < mLeftWidth / 2) { openLeftMenu(); } if (scrollX >= mLeftWidth / 2 && scrollX <= mLeftWidth + mRightWidth / 2) { closeMenu(); } if (scrollX > mLeftWidth + mRightWidth / 2) { openRightMenu(); } return false; } return super.onTouchEvent(ev); } @Override public boolean isMenuOpen() { return mIsOpen; } @Override public void setLeftMenuWidth(int width) { mLeftWidth = width; } @Override public void openLeftMenu() { mIsOpen = true; this.smoothScrollTo(0, 0); if (getSlideAdapter() != null) { getSlideAdapter().setOpenSlideItem(this); } } @Override public void setRightMenuWidth(int width) { mRightWidth = width; } @Override public void openRightMenu() { mIsOpen = true; this.smoothScrollBy(mRightWidth + mLeftWidth + mRightWidth, 0); if (getSlideAdapter() != null) { getSlideAdapter().setOpenSlideItem(this); } } @Override public void closeMenu() { mIsOpen = false; this.smoothScrollTo(mLeftWidth, 0); } @Override public SlideAdapterAction getSlideAdapter() { View view = this; while (true) { view = (View) view.getParent(); if (view == null) { break; } if (view instanceof RecyclerView || view instanceof AbsListView) { break; } } if (view == null) { return null; } if (view instanceof RecyclerView) { return (SlideAdapterAction) ((RecyclerView) view).getAdapter(); } else { return (SlideAdapterAction) ((AbsListView) view).getAdapter(); } } private void closeOpenMenu() { if (!isMenuOpen() && getSlideAdapter() != null) { getSlideAdapter().closeOpenSlideItem(); } } private SlideItemLayoutAction getSlidingItem() { if (getSlideAdapter() != null) { return getSlideAdapter().getActiveSlideItem(); } return null; } private void setScrollingItem(SlideItemLayoutAction item) { if (getSlideAdapter() != null) { getSlideAdapter().setActiveSlideItem(item); } } }
UTF-8
Java
3,776
java
SlideItemLayoutLayout.java
Java
[]
null
[]
package com.tuacy.slideadapter; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import android.widget.AbsListView; import android.widget.HorizontalScrollView; public class SlideItemLayoutLayout extends HorizontalScrollView implements SlideItemLayoutAction { private int mLeftWidth; private int mRightWidth; private boolean mIsOpen; public SlideItemLayoutLayout(Context context) { this(context, null); } public SlideItemLayoutLayout(Context context, AttributeSet attrs) { this(context, attrs, 0); } public SlideItemLayoutLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); setOverScrollMode(View.OVER_SCROLL_NEVER); setHorizontalScrollBarEnabled(false); } @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); scrollTo(mLeftWidth, 0); } @Override public void computeScroll() { super.computeScroll(); } @Override public boolean dispatchTouchEvent(MotionEvent ev) { if (getSlideAdapter().getOpenSlideItem() != null && getSlideAdapter().getOpenSlideItem() != this) { closeOpenMenu(); // return true; } return super.dispatchTouchEvent(ev); } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { return super.onInterceptTouchEvent(ev); } @Override public boolean onTouchEvent(MotionEvent ev) { closeOpenMenu(); if (getSlidingItem() != null && getSlidingItem() != this) { return false; } setScrollingItem(this); switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: closeOpenMenu(); break; case MotionEvent.ACTION_UP: setScrollingItem(null); int scrollX = getScrollX(); if (scrollX < mLeftWidth / 2) { openLeftMenu(); } if (scrollX >= mLeftWidth / 2 && scrollX <= mLeftWidth + mRightWidth / 2) { closeMenu(); } if (scrollX > mLeftWidth + mRightWidth / 2) { openRightMenu(); } return false; } return super.onTouchEvent(ev); } @Override public boolean isMenuOpen() { return mIsOpen; } @Override public void setLeftMenuWidth(int width) { mLeftWidth = width; } @Override public void openLeftMenu() { mIsOpen = true; this.smoothScrollTo(0, 0); if (getSlideAdapter() != null) { getSlideAdapter().setOpenSlideItem(this); } } @Override public void setRightMenuWidth(int width) { mRightWidth = width; } @Override public void openRightMenu() { mIsOpen = true; this.smoothScrollBy(mRightWidth + mLeftWidth + mRightWidth, 0); if (getSlideAdapter() != null) { getSlideAdapter().setOpenSlideItem(this); } } @Override public void closeMenu() { mIsOpen = false; this.smoothScrollTo(mLeftWidth, 0); } @Override public SlideAdapterAction getSlideAdapter() { View view = this; while (true) { view = (View) view.getParent(); if (view == null) { break; } if (view instanceof RecyclerView || view instanceof AbsListView) { break; } } if (view == null) { return null; } if (view instanceof RecyclerView) { return (SlideAdapterAction) ((RecyclerView) view).getAdapter(); } else { return (SlideAdapterAction) ((AbsListView) view).getAdapter(); } } private void closeOpenMenu() { if (!isMenuOpen() && getSlideAdapter() != null) { getSlideAdapter().closeOpenSlideItem(); } } private SlideItemLayoutAction getSlidingItem() { if (getSlideAdapter() != null) { return getSlideAdapter().getActiveSlideItem(); } return null; } private void setScrollingItem(SlideItemLayoutAction item) { if (getSlideAdapter() != null) { getSlideAdapter().setActiveSlideItem(item); } } }
3,776
0.702331
0.699417
164
22.024391
21.596903
101
false
false
0
0
0
0
0
0
2.103658
false
false
10
0c74a98eba0138fe473c23cf2f94124d92fd32d6
20,452,634,324,522
5e35e670c2590bd8e58bc3f98466f07aa695510e
/java/com/zjgsu/shuidiansys/dao/IElectricHistoryDao.java
fc70ca4c8fb8ec116933c335c5412fb8cb83e321
[]
no_license
ShawMY/WaterAndElectSystem
https://github.com/ShawMY/WaterAndElectSystem
98d6e34c3b814d8fb8f4bb6ed565a4048c393fa7
cf55d38533f637ede957554ab719de2f9621ee63
refs/heads/master
2020-04-25T16:41:18.700000
2019-03-28T08:08:38
2019-03-28T08:08:38
172,920,884
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.zjgsu.shuidiansys.dao; import com.zjgsu.shuidiansys.pojo.ElectricHistory; import java.util.List; import java.util.Map; public interface IElectricHistoryDao { public int getRowCountByPage(); public List<ElectricHistory> selectByParams(Map<String,Object> params); public int delete(List<String> ids); public int update(ElectricHistory electric); public int insert(ElectricHistory electric); }
UTF-8
Java
430
java
IElectricHistoryDao.java
Java
[]
null
[]
package com.zjgsu.shuidiansys.dao; import com.zjgsu.shuidiansys.pojo.ElectricHistory; import java.util.List; import java.util.Map; public interface IElectricHistoryDao { public int getRowCountByPage(); public List<ElectricHistory> selectByParams(Map<String,Object> params); public int delete(List<String> ids); public int update(ElectricHistory electric); public int insert(ElectricHistory electric); }
430
0.772093
0.772093
18
22.888889
23.158606
75
false
false
0
0
0
0
0
0
0.555556
false
false
10
ad6012f6e51c08b35f257771ffd28a7fdfe9557f
34,153,579,948,515
c78ec9af6447be4abf7ce9fcaea3a0473d2c18ec
/src/ika_toolbox/PICpaker.java
443af73749bcc4c0c4d3f5e5bffed22cab8cbebe
[]
no_license
airzhangfish/ika_map_editor
https://github.com/airzhangfish/ika_map_editor
c2bef9648b181b1be6aaab868e8296806d7ca7b0
cfacc21a3e905569cefee9fc77b69b63ef629b65
refs/heads/master
2021-01-11T13:57:18.711000
2017-06-20T16:24:11
2017-06-20T16:24:11
94,911,700
5
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ika_toolbox; import java.awt.*; import java.awt.event.*; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import javax.swing.*; public class PICpaker extends JPanel implements ActionListener { private static final long serialVersionUID = 1L; private static JButton loadbin = new JButton("选取打包文件"); private static JLabel step2label = new JLabel("Step 2: 打包说明"); public PICpaker() { this.setLayout(new GridLayout(7, 1)); this.add(new JLabel("图片资源打包工具")); this.add(new JLabel("Step 1: 选择要打包的文件")); this.add(loadbin); this.add(step2label); loadbin.addActionListener(this); } public void actionPerformed(ActionEvent arg0) { Object obj = arg0.getSource(); // Open.. if (obj == loadbin) { open_file(); } } private void open_file() { JFileChooser c = new JFileChooser(); c.setMultiSelectionEnabled(true); int rVal = c.showOpenDialog(this); if (rVal == JFileChooser.APPROVE_OPTION) { File[] files = c.getSelectedFiles(); if (files != null) { pic_pack(files); } } } public void pic_pack(File[] file){ getPNG(file); output_Res(file); output_TXT(file); } static byte[] PNGbox; static int PNGlong = 0; static long total_PNG_length = 0; public static void getPNG(File[] file) { total_PNG_length=0; PNGlong = 0; for (int i = 0; i < file.length; i++) { total_PNG_length = total_PNG_length + file[i].length(); } PNGlong = (int) total_PNG_length + 2 * (file.length) + 2; PNGbox = new byte[PNGlong]; int PNGBOXID = 0; PNGbox[PNGBOXID] = (byte) ( (file.length) >> 8); PNGBOXID++; PNGbox[PNGBOXID] = (byte) ( (file.length) - (PNGbox[PNGBOXID] << 8)); PNGBOXID++; for (int i = 0; i < file.length; i++) { PNGbox[PNGBOXID] = (byte) (file[i].length() >> 8); PNGBOXID++; PNGbox[PNGBOXID] = (byte) (file[i].length() - ( ( (int) PNGbox[PNGBOXID]) << 8)); PNGBOXID++; try { FileInputStream fo = new FileInputStream(file[i]); byte[] mx=new byte[fo.available()]; fo.read(mx); for (int j = 0; j < mx.length; j++) { PNGbox[PNGBOXID] = mx[j]; PNGBOXID++; } } catch (Exception ex) { step2label.setText("Step 2: 打包失败,请检查选取文件的状态"); System.out.println("read " + file[i] + " error"); } } } public static void output_TXT(File[] file) { File txtFile = SDef.createFile(file[0].getParent()+"\\imgpak.txt"); String outputpackerinfo = "//图片打包数据\r\n\r\n"; for (int i = 0; i < file.length; i++) { outputpackerinfo = outputpackerinfo + " public static final byte " + file[i].getName().substring(0, file[i].getName().length() - 4) + " = " + i + "; //" + file[i].getName()+ "\r\n"; } outputpackerinfo=outputpackerinfo+addsrc; try { FileOutputStream fo = new FileOutputStream(txtFile); fo.write(outputpackerinfo.getBytes()); fo.close(); System.out.println("paktxt over"); } catch (Exception ex) { step2label.setText("Step 2: 打包失败,请检查选取文件的状态"); System.out.println("paktxt error"); } } public static void output_Res(File[] file) { File pakFile = SDef.createFile(file[0].getParent()+"\\imgpak.bin"); try { FileOutputStream fo = new FileOutputStream(pakFile); fo.write(PNGbox); fo.close(); System.out.println("pak over"); step2label.setText("Step 2: 打包成功,请查看文件夹下的imgpak.txt和imgpak.bin文件"); } catch (Exception ex) { step2label.setText("Step 2: 打包失败,请检查选取文件的状态"); System.out.println("output_Res error"); } } static String addsrc="\r\n\r\n\r\n//copy到代码里面读取打包资源,如果要读取其中的文件可以用skip()自行添加\r\nImage[] imgpak;"+"\r\n"+ "public void loadImagepak(String path) {"+"\r\n"+ " InputStream is = this.getClass().getResourceAsStream(path);"+"\r\n"+ " try {"+"\r\n"+ " int totalImage = is.read();"+"\r\n"+ " imgpak=new Image[totalImage];"+"\r\n"+ " for (int i = 0; i < totalImage; i++) {"+"\r\n"+ " int imagelength = (is.read() << 8) + is.read();"+"\r\n"+ " byte[] imgmrtix = new byte[imagelength];"+"\r\n"+ " is.read(imgmrtix, 0, imagelength);"+"\r\n"+ " imgpak[i] = Image.createImage(imgmrtix, 0, imagelength);"+"\r\n"+ " }"+"\r\n"+ " }"+"\r\n"+ " catch (Exception e) {"+"\r\n"+ " System.out.println(\"imagepak read error\");"+"\r\n"+ " }"+"\r\n"+ "}"+"\r\n"; }
GB18030
Java
4,494
java
PICpaker.java
Java
[]
null
[]
package ika_toolbox; import java.awt.*; import java.awt.event.*; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import javax.swing.*; public class PICpaker extends JPanel implements ActionListener { private static final long serialVersionUID = 1L; private static JButton loadbin = new JButton("选取打包文件"); private static JLabel step2label = new JLabel("Step 2: 打包说明"); public PICpaker() { this.setLayout(new GridLayout(7, 1)); this.add(new JLabel("图片资源打包工具")); this.add(new JLabel("Step 1: 选择要打包的文件")); this.add(loadbin); this.add(step2label); loadbin.addActionListener(this); } public void actionPerformed(ActionEvent arg0) { Object obj = arg0.getSource(); // Open.. if (obj == loadbin) { open_file(); } } private void open_file() { JFileChooser c = new JFileChooser(); c.setMultiSelectionEnabled(true); int rVal = c.showOpenDialog(this); if (rVal == JFileChooser.APPROVE_OPTION) { File[] files = c.getSelectedFiles(); if (files != null) { pic_pack(files); } } } public void pic_pack(File[] file){ getPNG(file); output_Res(file); output_TXT(file); } static byte[] PNGbox; static int PNGlong = 0; static long total_PNG_length = 0; public static void getPNG(File[] file) { total_PNG_length=0; PNGlong = 0; for (int i = 0; i < file.length; i++) { total_PNG_length = total_PNG_length + file[i].length(); } PNGlong = (int) total_PNG_length + 2 * (file.length) + 2; PNGbox = new byte[PNGlong]; int PNGBOXID = 0; PNGbox[PNGBOXID] = (byte) ( (file.length) >> 8); PNGBOXID++; PNGbox[PNGBOXID] = (byte) ( (file.length) - (PNGbox[PNGBOXID] << 8)); PNGBOXID++; for (int i = 0; i < file.length; i++) { PNGbox[PNGBOXID] = (byte) (file[i].length() >> 8); PNGBOXID++; PNGbox[PNGBOXID] = (byte) (file[i].length() - ( ( (int) PNGbox[PNGBOXID]) << 8)); PNGBOXID++; try { FileInputStream fo = new FileInputStream(file[i]); byte[] mx=new byte[fo.available()]; fo.read(mx); for (int j = 0; j < mx.length; j++) { PNGbox[PNGBOXID] = mx[j]; PNGBOXID++; } } catch (Exception ex) { step2label.setText("Step 2: 打包失败,请检查选取文件的状态"); System.out.println("read " + file[i] + " error"); } } } public static void output_TXT(File[] file) { File txtFile = SDef.createFile(file[0].getParent()+"\\imgpak.txt"); String outputpackerinfo = "//图片打包数据\r\n\r\n"; for (int i = 0; i < file.length; i++) { outputpackerinfo = outputpackerinfo + " public static final byte " + file[i].getName().substring(0, file[i].getName().length() - 4) + " = " + i + "; //" + file[i].getName()+ "\r\n"; } outputpackerinfo=outputpackerinfo+addsrc; try { FileOutputStream fo = new FileOutputStream(txtFile); fo.write(outputpackerinfo.getBytes()); fo.close(); System.out.println("paktxt over"); } catch (Exception ex) { step2label.setText("Step 2: 打包失败,请检查选取文件的状态"); System.out.println("paktxt error"); } } public static void output_Res(File[] file) { File pakFile = SDef.createFile(file[0].getParent()+"\\imgpak.bin"); try { FileOutputStream fo = new FileOutputStream(pakFile); fo.write(PNGbox); fo.close(); System.out.println("pak over"); step2label.setText("Step 2: 打包成功,请查看文件夹下的imgpak.txt和imgpak.bin文件"); } catch (Exception ex) { step2label.setText("Step 2: 打包失败,请检查选取文件的状态"); System.out.println("output_Res error"); } } static String addsrc="\r\n\r\n\r\n//copy到代码里面读取打包资源,如果要读取其中的文件可以用skip()自行添加\r\nImage[] imgpak;"+"\r\n"+ "public void loadImagepak(String path) {"+"\r\n"+ " InputStream is = this.getClass().getResourceAsStream(path);"+"\r\n"+ " try {"+"\r\n"+ " int totalImage = is.read();"+"\r\n"+ " imgpak=new Image[totalImage];"+"\r\n"+ " for (int i = 0; i < totalImage; i++) {"+"\r\n"+ " int imagelength = (is.read() << 8) + is.read();"+"\r\n"+ " byte[] imgmrtix = new byte[imagelength];"+"\r\n"+ " is.read(imgmrtix, 0, imagelength);"+"\r\n"+ " imgpak[i] = Image.createImage(imgmrtix, 0, imagelength);"+"\r\n"+ " }"+"\r\n"+ " }"+"\r\n"+ " catch (Exception e) {"+"\r\n"+ " System.out.println(\"imagepak read error\");"+"\r\n"+ " }"+"\r\n"+ "}"+"\r\n"; }
4,494
0.623059
0.613647
142
28.929577
25.885078
188
false
false
0
0
0
0
0
0
1.133803
false
false
10
4d3c6f6d270187c700692a7a4068667c0b77fbfc
29,351,806,513,508
dd176c3582bdb1bd1ba1bf04fde7601a65646f94
/code/fgame/Hero.java
8e39ddcdca8f6d7a2c874adaee7128b62e630db0
[]
no_license
hochae2018/Java-program-practice-2019
https://github.com/hochae2018/Java-program-practice-2019
765be7db2d861573d63b1a566d8e76fbb4188d17
a2d600c0af8eb8bcada707ae5f7a1abe4c0eeddb
refs/heads/master
2020-04-27T16:12:00.851000
2019-05-31T10:18:18
2019-05-31T10:18:18
174,476,013
5
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package fgame; import java.awt.image.BufferedImage; public class Hero extends FlyingObject{ protected static BufferedImage[] heroExps; protected int fire = 1; public Hero() { } public Hero(BufferedImage image){ super(97,124,200,500); this.image = image; life = 3; } public void move(int x ,int y) { this.x =x; this.y = y; } @Override public void move() { } public void add(Bee b){ if(b.award()==1){ life++; } if(b.award()==0){ fire =20; } } public Bullet[] shootBullets() { int x =(int)(this.x+(w/2-8/2)); int y =(int)(this.y - 14); if(fire == 1){ Bullet b = new Bullet(x, y, -1.5); return new Bullet[]{b}; }else{ fire--; Bullet b1 = new Bullet(x+10,y, -1.5); Bullet b2 = new Bullet(x-10,y, -1.5); return new Bullet[]{b1,b2}; } } public BufferedImage getImg(){ if(isLife()){ return image; }else{ if(i<heroExps.length){ BufferedImage image=heroExps[i++]; return image; } else{ return null; } } } public boolean isDelete(){ return life==0&&i==heroExps.length; } }
UTF-8
Java
1,139
java
Hero.java
Java
[]
null
[]
package fgame; import java.awt.image.BufferedImage; public class Hero extends FlyingObject{ protected static BufferedImage[] heroExps; protected int fire = 1; public Hero() { } public Hero(BufferedImage image){ super(97,124,200,500); this.image = image; life = 3; } public void move(int x ,int y) { this.x =x; this.y = y; } @Override public void move() { } public void add(Bee b){ if(b.award()==1){ life++; } if(b.award()==0){ fire =20; } } public Bullet[] shootBullets() { int x =(int)(this.x+(w/2-8/2)); int y =(int)(this.y - 14); if(fire == 1){ Bullet b = new Bullet(x, y, -1.5); return new Bullet[]{b}; }else{ fire--; Bullet b1 = new Bullet(x+10,y, -1.5); Bullet b2 = new Bullet(x-10,y, -1.5); return new Bullet[]{b1,b2}; } } public BufferedImage getImg(){ if(isLife()){ return image; }else{ if(i<heroExps.length){ BufferedImage image=heroExps[i++]; return image; } else{ return null; } } } public boolean isDelete(){ return life==0&&i==heroExps.length; } }
1,139
0.56014
0.526778
62
16.370968
13.182631
43
false
false
0
0
0
0
0
0
2.33871
false
false
10
bbd75d8f594ccd0c4f9fa3ef0fb8d16a320c75a1
2,001,454,804,191
a84201e4cad6ca16926b5e0201fa01ba635b9690
/Project402/Peojec402/app/src/main/java/com/example/cs/peojec401/MainActivity.java
cfc94c9291658ed101b51f159dd78be905df0594
[]
no_license
Jobben21/Project402
https://github.com/Jobben21/Project402
64ca34b2ee14bca6b3fa6830e04f029765a494dc
caf35231120de30a4505e228756d1d9db822b98d
refs/heads/master
2021-04-09T17:05:55.562000
2018-08-01T15:35:11
2018-08-01T15:35:11
125,697,453
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.cs.peojec401; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { private ArrayList<String> mainfood_name = new ArrayList<>(); private ArrayList<String> mainfood_image = new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.content_food_dialog); MainDishFood(); } public void MainDishFood(){ mainfood_name.add("ผัดช่า"); mainfood_image.add("https://drive.google.com/open?id=1eQ1NzwGO87dlJNLeTO21BXnN75cBt1Ul"); mainfood_name.add("หมูตุ๋น"); mainfood_image.add("https://drive.google.com/open?id=1dW_KDWf5Rt9BzR6T3xpqa1Jbu1HkzA-6\n"); } }
UTF-8
Java
875
java
MainActivity.java
Java
[]
null
[]
package com.example.cs.peojec401; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { private ArrayList<String> mainfood_name = new ArrayList<>(); private ArrayList<String> mainfood_image = new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.content_food_dialog); MainDishFood(); } public void MainDishFood(){ mainfood_name.add("ผัดช่า"); mainfood_image.add("https://drive.google.com/open?id=1eQ1NzwGO87dlJNLeTO21BXnN75cBt1Ul"); mainfood_name.add("หมูตุ๋น"); mainfood_image.add("https://drive.google.com/open?id=1dW_KDWf5Rt9BzR6T3xpqa1Jbu1HkzA-6\n"); } }
875
0.700824
0.67609
36
22.611111
28.309086
99
false
false
0
0
0
0
0
0
0.361111
false
false
10
9659bc9100c69580c76060c8e7c2d0d206b09524
13,967,233,649,306
d6920bff5730bf8823315e15b0858c68a91db544
/android/Procyon/gnu/expr/BlockExitException.java
4a5328c077b0c5d763f42f2df6126181dbe3be8e
[]
no_license
AppWerft/Ti.FeitianSmartcardReader
https://github.com/AppWerft/Ti.FeitianSmartcardReader
f862f9a2a01e1d2f71e09794aa8ff5e28264e458
48657e262044be3ae8b395065d814e169bd8ad7d
refs/heads/master
2020-05-09T10:54:56.278000
2020-03-17T08:04:07
2020-03-17T08:04:07
181,058,540
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// // Decompiled by Procyon v0.5.36 // package gnu.expr; class BlockExitException extends RuntimeException { ExitExp exit; Object result; public BlockExitException(final ExitExp exit, final Object result) { this.exit = exit; this.result = result; } }
UTF-8
Java
292
java
BlockExitException.java
Java
[]
null
[]
// // Decompiled by Procyon v0.5.36 // package gnu.expr; class BlockExitException extends RuntimeException { ExitExp exit; Object result; public BlockExitException(final ExitExp exit, final Object result) { this.exit = exit; this.result = result; } }
292
0.657534
0.643836
16
17.25
19.806881
72
false
false
0
0
0
0
0
0
0.375
false
false
10
4d681ba1ebdaf157dcf10ad7f1f3e30c22ff2c26
317,827,614,770
b94ba0e9aa6e1d41dbb335bd8a95e01e5cde077c
/src/main/java/com/jjimenez/filmaffinity/entity/Person.java
136038238614c30cf2fbecdc42c01f4fb86cc245
[]
no_license
jjimenezh/FilmAffinityAPI
https://github.com/jjimenezh/FilmAffinityAPI
4f22a7f142eb7490614562cf3fd8eed050732ce8
d071eae841f83ae0de8c4fc15054370266fa0179
refs/heads/master
2020-04-06T06:56:38.104000
2017-07-01T14:09:31
2017-07-01T14:09:31
65,628,618
2
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * */ package com.jjimenez.filmaffinity.entity; import java.util.List; /** * Abstract entity for encapsulated a Person * * @author Jesus jimenez * @since 0.2.0 */ public abstract class Person { private String name; private List<Movie> movieList; public String getName() { return name; } public void setName(String name) { this.name = name; } public List<Movie> getMovieList() { return movieList; } public void setMovieList(List<Movie> movieList) { this.movieList = movieList; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((movieList == null) ? 0 : movieList.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Person other = (Person) obj; if (movieList == null) { if (other.movieList != null) return false; } else if (!movieList.equals(other.movieList)) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; return true; } @Override public String toString() { return "Person [name=" + name + ", movieList=" + movieList + "]"; } }
UTF-8
Java
1,362
java
Person.java
Java
[ { "context": "ct entity for encapsulated a Person\n * \n * @author Jesus jimenez\n * @since 0.2.0\n */\npublic abstract class Person ", "end": 156, "score": 0.999880313873291, "start": 143, "tag": "NAME", "value": "Jesus jimenez" } ]
null
[]
/** * */ package com.jjimenez.filmaffinity.entity; import java.util.List; /** * Abstract entity for encapsulated a Person * * @author <NAME> * @since 0.2.0 */ public abstract class Person { private String name; private List<Movie> movieList; public String getName() { return name; } public void setName(String name) { this.name = name; } public List<Movie> getMovieList() { return movieList; } public void setMovieList(List<Movie> movieList) { this.movieList = movieList; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((movieList == null) ? 0 : movieList.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Person other = (Person) obj; if (movieList == null) { if (other.movieList != null) return false; } else if (!movieList.equals(other.movieList)) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; return true; } @Override public String toString() { return "Person [name=" + name + ", movieList=" + movieList + "]"; } }
1,355
0.638767
0.632893
71
18.183098
17.380829
77
false
false
0
0
0
0
0
0
1.549296
false
false
10
c3082f7794e012c9fea2cb7fbd0867f2565e0312
26,577,257,666,021
17ce605aa1fe9ed30736de66134069e906187849
/src/SpecialGraphics.java
8a168d7ae4cb31dbd2a479e12793de7c9a789cf2
[]
no_license
andy-hanson/mangos-caffeinated-hilarity
https://github.com/andy-hanson/mangos-caffeinated-hilarity
f702a9f835521f1e9fbd108588ea083c85a20c36
8f89e85ff14e42dfae9246a2ce7effc3092ee7b1
refs/heads/master
2021-01-25T10:22:02.127000
2015-03-09T03:49:25
2015-03-09T03:49:25
31,560,258
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.*; import java.awt.*; public class SpecialGraphics extends GameObject { final private double STARS_ANGLE_RANGE = Math.PI/3; final private double STARS_MAG_RANGE = 0.25; //AS A FRACTION OF IT final private double STARS_VY_PLUS = 2; final private int STARS_LAST_TIME = 80; final private int NUM_STAR_TYPES = 5; private java.util.List<GraphicsFX> fx; public SpecialGraphics(Main m) { super(m); fx = new ArrayList<GraphicsFX>(); } public void compute() { for(int i=0; i<fx.size(); i++) { if(fx.get(i).isDead()) { fx.remove(i); i--; } else fx.get(i).compute(); } } public void draw(Graphics2D g) { for(GraphicsFX gfx : fx) gfx.draw(g); } public void getScore(double x, double y, int score, double playerVX, double playerVY) { fx.add(new ScoreFX(main,x,y,score)); //SPOUT SOME STARS!!! double mag = Math.sqrt(playerVX*playerVX+playerVY*playerVY); double angle = Math.atan2(playerVY,playerVX) + Math.PI; //Spout stars going in direction about opposite that in which player came. for(int i=0; i < score; i++) { double thisAngle = angle + (Math.random()-.5)*STARS_ANGLE_RANGE; double thisMag = mag + (Math.random()-.5)*STARS_MAG_RANGE; int starType = (int) (Math.random()*NUM_STAR_TYPES); fx.add(new ProjectileFX(main, Helpers.pathJoin("star","star"+starType), x,y, mag*Math.cos(thisAngle),mag*Math.sin(thisAngle)-STARS_VY_PLUS, STARS_LAST_TIME)); } } public void getComboLost() { for(int i = 0; i < fx.size(); i++) if (fx.get(i) instanceof ScoreFX) { fx.remove(i); i--; } } public void getNewLevel() { fx = new ArrayList<GraphicsFX>(); } }
UTF-8
Java
1,688
java
SpecialGraphics.java
Java
[]
null
[]
import java.util.*; import java.awt.*; public class SpecialGraphics extends GameObject { final private double STARS_ANGLE_RANGE = Math.PI/3; final private double STARS_MAG_RANGE = 0.25; //AS A FRACTION OF IT final private double STARS_VY_PLUS = 2; final private int STARS_LAST_TIME = 80; final private int NUM_STAR_TYPES = 5; private java.util.List<GraphicsFX> fx; public SpecialGraphics(Main m) { super(m); fx = new ArrayList<GraphicsFX>(); } public void compute() { for(int i=0; i<fx.size(); i++) { if(fx.get(i).isDead()) { fx.remove(i); i--; } else fx.get(i).compute(); } } public void draw(Graphics2D g) { for(GraphicsFX gfx : fx) gfx.draw(g); } public void getScore(double x, double y, int score, double playerVX, double playerVY) { fx.add(new ScoreFX(main,x,y,score)); //SPOUT SOME STARS!!! double mag = Math.sqrt(playerVX*playerVX+playerVY*playerVY); double angle = Math.atan2(playerVY,playerVX) + Math.PI; //Spout stars going in direction about opposite that in which player came. for(int i=0; i < score; i++) { double thisAngle = angle + (Math.random()-.5)*STARS_ANGLE_RANGE; double thisMag = mag + (Math.random()-.5)*STARS_MAG_RANGE; int starType = (int) (Math.random()*NUM_STAR_TYPES); fx.add(new ProjectileFX(main, Helpers.pathJoin("star","star"+starType), x,y, mag*Math.cos(thisAngle),mag*Math.sin(thisAngle)-STARS_VY_PLUS, STARS_LAST_TIME)); } } public void getComboLost() { for(int i = 0; i < fx.size(); i++) if (fx.get(i) instanceof ScoreFX) { fx.remove(i); i--; } } public void getNewLevel() { fx = new ArrayList<GraphicsFX>(); } }
1,688
0.646919
0.638033
53
29.886793
28.802294
132
false
false
0
0
0
0
0
0
2.339623
false
false
10
8623529c1eb346cf4dccf3e15e8202bc93990a8c
14,078,902,807,701
3442b1b91a7cc3940a6e2d78a89ce959d364d447
/src/main/java/com/zwsec/twoexcel/createdata/TestClass.java
a37efb4f3d3332ab2f711c4ac69c86662cdfad3c
[]
no_license
zhuyk1995/docfile-excelfile-eclipse
https://github.com/zhuyk1995/docfile-excelfile-eclipse
3becdafeab17c43378d72f9dbde0531b43ce71ea
4a16f0f484f13c29d3ba1bccc4d9b0a9d5df8aa6
refs/heads/master
2020-05-17T08:25:01.305000
2019-05-08T08:49:16
2019-05-08T08:49:16
183,605,109
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.zwsec.twoexcel.createdata; /** * @author 作者: ZHUYAKANG * @createDate 创建时间:2019年5月6日 下午5:51:43 */ public class TestClass { }
GB18030
Java
161
java
TestClass.java
Java
[ { "context": "e com.zwsec.twoexcel.createdata;\n/**\n* @author 作者: ZHUYAKANG\n* @createDate 创建时间:2019年5月6日 下午5:51:43\n*/\npublic ", "end": 66, "score": 0.9992524981498718, "start": 57, "tag": "NAME", "value": "ZHUYAKANG" } ]
null
[]
package com.zwsec.twoexcel.createdata; /** * @author 作者: ZHUYAKANG * @createDate 创建时间:2019年5月6日 下午5:51:43 */ public class TestClass { }
161
0.729927
0.649635
8
16.125
15.519645
38
false
false
0
0
0
0
0
0
0.125
false
false
10
8182ab72487306f287e5bebbc65ee5c70c199c9b
21,612,275,482,731
8a2616248b4e75e7b01cce1aed904c02449e396e
/src/main/java/br/com/treino/ecommerce/model/Compra.java
3503f366e9a47091161c1300e2d3965175474eff
[ "Apache-2.0" ]
permissive
luizgustv/bootcamp-01-template-ecommerce
https://github.com/luizgustv/bootcamp-01-template-ecommerce
eb29db1ddb9f4002315f37e382012eb3d14cc7ec
3b7905ac53e153b044e0b675c7a6226f06f651c8
refs/heads/master
2022-12-31T05:35:31.959000
2020-10-23T14:07:16
2020-10-23T14:07:16
299,613,025
0
0
null
true
2020-09-29T12:38:35
2020-09-29T12:38:35
2020-09-29T11:54:59
2020-09-29T11:54:56
0
0
0
0
null
false
false
package br.com.treino.ecommerce.model; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToOne; import javax.validation.Valid; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import javax.validation.constraints.Positive; public class Compra { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @ManyToOne private @NotNull @Valid Produto produto; private @NotNull @Positive int quantidade; @ManyToOne private @NotNull @Valid Usuario comprador; private @NotBlank String meioPagamento; private @NotNull String status; public Compra(@NotNull @Valid Produto produto, @NotNull @Positive int quantidade, @NotNull @Valid Usuario comprador, @NotBlank String meioPagamento) { this.produto = produto; this.comprador = comprador; this.quantidade = quantidade; this.meioPagamento = meioPagamento; this.status = "INICIADA"; } @Override public String toString() { return "Compra{" + "produto=" + produto + ", quantidade=" + quantidade + ", comprador=" + comprador + ", meioPagamento='" + meioPagamento + '\'' + ", status='" + status + '\'' + '}'; } }
UTF-8
Java
1,419
java
Compra.java
Java
[]
null
[]
package br.com.treino.ecommerce.model; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToOne; import javax.validation.Valid; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import javax.validation.constraints.Positive; public class Compra { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @ManyToOne private @NotNull @Valid Produto produto; private @NotNull @Positive int quantidade; @ManyToOne private @NotNull @Valid Usuario comprador; private @NotBlank String meioPagamento; private @NotNull String status; public Compra(@NotNull @Valid Produto produto, @NotNull @Positive int quantidade, @NotNull @Valid Usuario comprador, @NotBlank String meioPagamento) { this.produto = produto; this.comprador = comprador; this.quantidade = quantidade; this.meioPagamento = meioPagamento; this.status = "INICIADA"; } @Override public String toString() { return "Compra{" + "produto=" + produto + ", quantidade=" + quantidade + ", comprador=" + comprador + ", meioPagamento='" + meioPagamento + '\'' + ", status='" + status + '\'' + '}'; } }
1,419
0.651163
0.651163
45
30.533333
20.900398
86
false
false
0
0
0
0
0
0
0.622222
false
false
10
d5c6a6c7ec0b64ab35372a031b1c63877fc085ad
15,539,191,703,787
26634e7f0e3aa71962cff612be125be90d7a6ee1
/app/src/main/java/com/example/esadeli/dicodingmovieapp/MovieDetailActivity.java
7eca1f4fde74d1c01496547f7bc51317acc9351d
[]
no_license
esadeli/DicodingMovieApp
https://github.com/esadeli/DicodingMovieApp
b0b03701cea573a2db6a977e99acf970f53452db
b4ac84a1842d7495fa15f49dfc30384649f97375
refs/heads/master
2020-03-22T07:53:15.830000
2018-08-02T11:24:42
2018-08-02T11:24:42
139,674,604
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.esadeli.dicodingmovieapp; import android.content.ContentValues; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.bumptech.glide.Glide; import static com.example.esadeli.dicodingmovieapp.data.DatabaseContract.MovieColumns.COLUMN_IMAGE_LINK; import static com.example.esadeli.dicodingmovieapp.data.DatabaseContract.MovieColumns.COLUMN_OVERVIEW; import static com.example.esadeli.dicodingmovieapp.data.DatabaseContract.MovieColumns.COLUMN_RATING; import static com.example.esadeli.dicodingmovieapp.data.DatabaseContract.MovieColumns.COLUMN_RELEASE_DATE; import static com.example.esadeli.dicodingmovieapp.data.DatabaseContract.MovieColumns.COLUMN_TITLE; import static com.example.esadeli.dicodingmovieapp.data.DatabaseContract.MovieColumns.CONTENT_URI; /** * Activity to see detail data of the selected movie * */ public class MovieDetailActivity extends AppCompatActivity implements View.OnClickListener { public static String EXTRA_IMG_URL= "extra-img-url"; public static String EXTRA_TITLE = "extra-title"; public static String EXTRA_RATING = "extra-rating"; public static String EXTRA_REL_DATE = "extra-rel-date"; public static String EXTRA_SYNOPSIS = "extra-synopsis"; public static String EXTRA_FROM_FAVORITE = "extra-from-favorite"; //View Object private Button databaseBtn; //String data: String titleDetail; String imgUrlDetail; String ratingDetail; String relDateDetail; String synopsisDetail; String fromFavorite; // string to differentiate button behavior @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_movie_detail); TextView detailTitleTV = findViewById(R.id.titleDetailTV); TextView detailRatingTV = findViewById(R.id.ratingDetailTV); TextView detailRelDateTV = findViewById(R.id.releaseDateDetailTV); TextView detailSynopsisTV = findViewById(R.id.synopsisTV); ImageView detailPosterImg = findViewById(R.id.big_poster_img); databaseBtn = findViewById(R.id.database_btn); titleDetail = getIntent().getStringExtra(EXTRA_TITLE); imgUrlDetail = getIntent().getStringExtra(EXTRA_IMG_URL); ratingDetail = getIntent().getStringExtra(EXTRA_RATING); relDateDetail = getIntent().getStringExtra(EXTRA_REL_DATE); synopsisDetail = getIntent().getStringExtra(EXTRA_SYNOPSIS); fromFavorite = getIntent().getStringExtra(EXTRA_FROM_FAVORITE); // Customized button name if(fromFavorite==null){ databaseBtn.setText(R.string.button_save); }else if(fromFavorite.equals(getResources().getString(R.string.button_save_disabled))){ databaseBtn.setVisibility(View.GONE); } databaseBtn.setOnClickListener(this); detailTitleTV.setText(titleDetail); detailRatingTV.setText(ratingDetail); detailRelDateTV.setText(relDateDetail); detailSynopsisTV.setText(synopsisDetail); detailPosterImg.setContentDescription(titleDetail); Glide.with(this) .load(imgUrlDetail) .override(250,250) .crossFade() .into(detailPosterImg); } @Override public void onClick(View v) { if(v.getId() == R.id.database_btn){ if(fromFavorite == null){ //send data to database ContentValues movieDetailValues = new ContentValues(); movieDetailValues.put(COLUMN_TITLE,titleDetail); movieDetailValues.put(COLUMN_RATING,ratingDetail); movieDetailValues.put(COLUMN_RELEASE_DATE,relDateDetail); movieDetailValues.put(COLUMN_OVERVIEW,synopsisDetail); movieDetailValues.put(COLUMN_IMAGE_LINK,imgUrlDetail); getContentResolver().insert(CONTENT_URI,movieDetailValues); Toast.makeText(this,"Save "+titleDetail +" as favorite",Toast.LENGTH_SHORT).show(); } } } }
UTF-8
Java
4,276
java
MovieDetailActivity.java
Java
[]
null
[]
package com.example.esadeli.dicodingmovieapp; import android.content.ContentValues; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.bumptech.glide.Glide; import static com.example.esadeli.dicodingmovieapp.data.DatabaseContract.MovieColumns.COLUMN_IMAGE_LINK; import static com.example.esadeli.dicodingmovieapp.data.DatabaseContract.MovieColumns.COLUMN_OVERVIEW; import static com.example.esadeli.dicodingmovieapp.data.DatabaseContract.MovieColumns.COLUMN_RATING; import static com.example.esadeli.dicodingmovieapp.data.DatabaseContract.MovieColumns.COLUMN_RELEASE_DATE; import static com.example.esadeli.dicodingmovieapp.data.DatabaseContract.MovieColumns.COLUMN_TITLE; import static com.example.esadeli.dicodingmovieapp.data.DatabaseContract.MovieColumns.CONTENT_URI; /** * Activity to see detail data of the selected movie * */ public class MovieDetailActivity extends AppCompatActivity implements View.OnClickListener { public static String EXTRA_IMG_URL= "extra-img-url"; public static String EXTRA_TITLE = "extra-title"; public static String EXTRA_RATING = "extra-rating"; public static String EXTRA_REL_DATE = "extra-rel-date"; public static String EXTRA_SYNOPSIS = "extra-synopsis"; public static String EXTRA_FROM_FAVORITE = "extra-from-favorite"; //View Object private Button databaseBtn; //String data: String titleDetail; String imgUrlDetail; String ratingDetail; String relDateDetail; String synopsisDetail; String fromFavorite; // string to differentiate button behavior @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_movie_detail); TextView detailTitleTV = findViewById(R.id.titleDetailTV); TextView detailRatingTV = findViewById(R.id.ratingDetailTV); TextView detailRelDateTV = findViewById(R.id.releaseDateDetailTV); TextView detailSynopsisTV = findViewById(R.id.synopsisTV); ImageView detailPosterImg = findViewById(R.id.big_poster_img); databaseBtn = findViewById(R.id.database_btn); titleDetail = getIntent().getStringExtra(EXTRA_TITLE); imgUrlDetail = getIntent().getStringExtra(EXTRA_IMG_URL); ratingDetail = getIntent().getStringExtra(EXTRA_RATING); relDateDetail = getIntent().getStringExtra(EXTRA_REL_DATE); synopsisDetail = getIntent().getStringExtra(EXTRA_SYNOPSIS); fromFavorite = getIntent().getStringExtra(EXTRA_FROM_FAVORITE); // Customized button name if(fromFavorite==null){ databaseBtn.setText(R.string.button_save); }else if(fromFavorite.equals(getResources().getString(R.string.button_save_disabled))){ databaseBtn.setVisibility(View.GONE); } databaseBtn.setOnClickListener(this); detailTitleTV.setText(titleDetail); detailRatingTV.setText(ratingDetail); detailRelDateTV.setText(relDateDetail); detailSynopsisTV.setText(synopsisDetail); detailPosterImg.setContentDescription(titleDetail); Glide.with(this) .load(imgUrlDetail) .override(250,250) .crossFade() .into(detailPosterImg); } @Override public void onClick(View v) { if(v.getId() == R.id.database_btn){ if(fromFavorite == null){ //send data to database ContentValues movieDetailValues = new ContentValues(); movieDetailValues.put(COLUMN_TITLE,titleDetail); movieDetailValues.put(COLUMN_RATING,ratingDetail); movieDetailValues.put(COLUMN_RELEASE_DATE,relDateDetail); movieDetailValues.put(COLUMN_OVERVIEW,synopsisDetail); movieDetailValues.put(COLUMN_IMAGE_LINK,imgUrlDetail); getContentResolver().insert(CONTENT_URI,movieDetailValues); Toast.makeText(this,"Save "+titleDetail +" as favorite",Toast.LENGTH_SHORT).show(); } } } }
4,276
0.711413
0.709776
110
37.872726
30.71633
106
false
false
0
0
0
0
0
0
0.627273
false
false
10
9ace2755661dcbcb2250116b2b33af0d0df01212
27,711,129,016,116
7defb714ebe19f68a92528ae58f76191bd40a946
/src/main/java/cn/tianqb/mapper/OrderMapper.java
1654aadf39a2649e9813deb08ca7b8593b4325c6
[]
no_license
QingboTian/catering-system
https://github.com/QingboTian/catering-system
1f72ab2bbb83a229512c8b5c13fd7477c36b675c
67be003c82d6ca3a14435e3b40ae72aac35a3c99
refs/heads/master
2023-04-15T07:57:11.529000
2021-04-28T14:13:05
2021-04-28T14:13:05
343,468,210
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.tianqb.mapper; import cn.tianqb.pojo.po.OrderPO; import cn.tianqb.pojo.example.OrderExample; import org.apache.ibatis.annotations.*; import org.apache.ibatis.type.JdbcType; import java.util.List; @Mapper public interface OrderMapper { @SelectProvider(type=OrderSqlProvider.class, method="countByExample") int countByExample(OrderExample example); @DeleteProvider(type=OrderSqlProvider.class, method="deleteByExample") int deleteByExample(OrderExample example); @Delete({ "delete from order_table", "where id = #{id,jdbcType=INTEGER}" }) int deleteByPrimaryKey(Integer id); @Insert({ "insert into order_table (id, order_id, ", "total_price, phone, ", "address, remark, ", "created, modified, ", "creator, modifier, ", "status)", "values (#{id,jdbcType=INTEGER}, #{orderId,jdbcType=VARCHAR}, ", "#{totalPrice,jdbcType=DOUBLE}, #{phone,jdbcType=VARCHAR}, ", "#{address,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, ", "#{created,jdbcType=TIMESTAMP}, #{modified,jdbcType=TIMESTAMP}, ", "#{creator,jdbcType=VARCHAR}, #{modifier,jdbcType=VARCHAR}, ", "#{status,jdbcType=INTEGER})" }) int insert(OrderPO record); @InsertProvider(type=OrderSqlProvider.class, method="insertSelective") int insertSelective(OrderPO record); @SelectProvider(type=OrderSqlProvider.class, method="selectByExample") @Results({ @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true), @Result(column="order_id", property="orderId", jdbcType=JdbcType.VARCHAR), @Result(column="total_price", property="totalPrice", jdbcType=JdbcType.DOUBLE), @Result(column="phone", property="phone", jdbcType=JdbcType.VARCHAR), @Result(column="address", property="address", jdbcType=JdbcType.VARCHAR), @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR), @Result(column="created", property="created", jdbcType=JdbcType.TIMESTAMP), @Result(column="modified", property="modified", jdbcType=JdbcType.TIMESTAMP), @Result(column="creator", property="creator", jdbcType=JdbcType.VARCHAR), @Result(column="modifier", property="modifier", jdbcType=JdbcType.VARCHAR), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER) }) List<OrderPO> selectByExample(OrderExample example); @Select({ "select", "id, order_id, total_price, phone, address, remark, created, modified, creator, ", "modifier, status", "from order_table", "where id = #{id,jdbcType=INTEGER}" }) @Results({ @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true), @Result(column="order_id", property="orderId", jdbcType=JdbcType.VARCHAR), @Result(column="total_price", property="totalPrice", jdbcType=JdbcType.DOUBLE), @Result(column="phone", property="phone", jdbcType=JdbcType.VARCHAR), @Result(column="address", property="address", jdbcType=JdbcType.VARCHAR), @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR), @Result(column="created", property="created", jdbcType=JdbcType.TIMESTAMP), @Result(column="modified", property="modified", jdbcType=JdbcType.TIMESTAMP), @Result(column="creator", property="creator", jdbcType=JdbcType.VARCHAR), @Result(column="modifier", property="modifier", jdbcType=JdbcType.VARCHAR), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER) }) OrderPO selectByPrimaryKey(Integer id); @UpdateProvider(type=OrderSqlProvider.class, method="updateByExampleSelective") int updateByExampleSelective(@Param("record") OrderPO record, @Param("example") OrderExample example); @UpdateProvider(type=OrderSqlProvider.class, method="updateByExample") int updateByExample(@Param("record") OrderPO record, @Param("example") OrderExample example); @UpdateProvider(type=OrderSqlProvider.class, method="updateByPrimaryKeySelective") int updateByPrimaryKeySelective(OrderPO record); @Update({ "update order_table", "set order_id = #{orderId,jdbcType=VARCHAR},", "total_price = #{totalPrice,jdbcType=DOUBLE},", "phone = #{phone,jdbcType=VARCHAR},", "address = #{address,jdbcType=VARCHAR},", "remark = #{remark,jdbcType=VARCHAR},", "created = #{created,jdbcType=TIMESTAMP},", "modified = #{modified,jdbcType=TIMESTAMP},", "creator = #{creator,jdbcType=VARCHAR},", "modifier = #{modifier,jdbcType=VARCHAR},", "status = #{status,jdbcType=INTEGER}", "where id = #{id,jdbcType=INTEGER}" }) int updateByPrimaryKey(OrderPO record); }
UTF-8
Java
4,836
java
OrderMapper.java
Java
[]
null
[]
package cn.tianqb.mapper; import cn.tianqb.pojo.po.OrderPO; import cn.tianqb.pojo.example.OrderExample; import org.apache.ibatis.annotations.*; import org.apache.ibatis.type.JdbcType; import java.util.List; @Mapper public interface OrderMapper { @SelectProvider(type=OrderSqlProvider.class, method="countByExample") int countByExample(OrderExample example); @DeleteProvider(type=OrderSqlProvider.class, method="deleteByExample") int deleteByExample(OrderExample example); @Delete({ "delete from order_table", "where id = #{id,jdbcType=INTEGER}" }) int deleteByPrimaryKey(Integer id); @Insert({ "insert into order_table (id, order_id, ", "total_price, phone, ", "address, remark, ", "created, modified, ", "creator, modifier, ", "status)", "values (#{id,jdbcType=INTEGER}, #{orderId,jdbcType=VARCHAR}, ", "#{totalPrice,jdbcType=DOUBLE}, #{phone,jdbcType=VARCHAR}, ", "#{address,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, ", "#{created,jdbcType=TIMESTAMP}, #{modified,jdbcType=TIMESTAMP}, ", "#{creator,jdbcType=VARCHAR}, #{modifier,jdbcType=VARCHAR}, ", "#{status,jdbcType=INTEGER})" }) int insert(OrderPO record); @InsertProvider(type=OrderSqlProvider.class, method="insertSelective") int insertSelective(OrderPO record); @SelectProvider(type=OrderSqlProvider.class, method="selectByExample") @Results({ @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true), @Result(column="order_id", property="orderId", jdbcType=JdbcType.VARCHAR), @Result(column="total_price", property="totalPrice", jdbcType=JdbcType.DOUBLE), @Result(column="phone", property="phone", jdbcType=JdbcType.VARCHAR), @Result(column="address", property="address", jdbcType=JdbcType.VARCHAR), @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR), @Result(column="created", property="created", jdbcType=JdbcType.TIMESTAMP), @Result(column="modified", property="modified", jdbcType=JdbcType.TIMESTAMP), @Result(column="creator", property="creator", jdbcType=JdbcType.VARCHAR), @Result(column="modifier", property="modifier", jdbcType=JdbcType.VARCHAR), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER) }) List<OrderPO> selectByExample(OrderExample example); @Select({ "select", "id, order_id, total_price, phone, address, remark, created, modified, creator, ", "modifier, status", "from order_table", "where id = #{id,jdbcType=INTEGER}" }) @Results({ @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true), @Result(column="order_id", property="orderId", jdbcType=JdbcType.VARCHAR), @Result(column="total_price", property="totalPrice", jdbcType=JdbcType.DOUBLE), @Result(column="phone", property="phone", jdbcType=JdbcType.VARCHAR), @Result(column="address", property="address", jdbcType=JdbcType.VARCHAR), @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR), @Result(column="created", property="created", jdbcType=JdbcType.TIMESTAMP), @Result(column="modified", property="modified", jdbcType=JdbcType.TIMESTAMP), @Result(column="creator", property="creator", jdbcType=JdbcType.VARCHAR), @Result(column="modifier", property="modifier", jdbcType=JdbcType.VARCHAR), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER) }) OrderPO selectByPrimaryKey(Integer id); @UpdateProvider(type=OrderSqlProvider.class, method="updateByExampleSelective") int updateByExampleSelective(@Param("record") OrderPO record, @Param("example") OrderExample example); @UpdateProvider(type=OrderSqlProvider.class, method="updateByExample") int updateByExample(@Param("record") OrderPO record, @Param("example") OrderExample example); @UpdateProvider(type=OrderSqlProvider.class, method="updateByPrimaryKeySelective") int updateByPrimaryKeySelective(OrderPO record); @Update({ "update order_table", "set order_id = #{orderId,jdbcType=VARCHAR},", "total_price = #{totalPrice,jdbcType=DOUBLE},", "phone = #{phone,jdbcType=VARCHAR},", "address = #{address,jdbcType=VARCHAR},", "remark = #{remark,jdbcType=VARCHAR},", "created = #{created,jdbcType=TIMESTAMP},", "modified = #{modified,jdbcType=TIMESTAMP},", "creator = #{creator,jdbcType=VARCHAR},", "modifier = #{modifier,jdbcType=VARCHAR},", "status = #{status,jdbcType=INTEGER}", "where id = #{id,jdbcType=INTEGER}" }) int updateByPrimaryKey(OrderPO record); }
4,836
0.669975
0.669975
105
45.057144
30.740644
106
false
false
0
0
0
0
0
0
1.733333
false
false
10
caa14b190644657a80a3b49ad2641d2a9c6b6835
3,977,139,744,087
817d222856630a70bb5b4dbeb2447ee44c234f1d
/Android/app/src/main/java/com/limitless/app/views/PostRowView.java
b28c538e1a267a82dc19e336d93b3457dd091baa
[]
no_license
anthony-lipscomb-dev/LimitLess
https://github.com/anthony-lipscomb-dev/LimitLess
615c3ebef1cafd5ef06a5b6e793892d1fc964ae4
f8057a0a277f42c3c1924de553a65e2ea7ad8bce
refs/heads/master
2015-08-21T03:28:59.550000
2015-06-07T23:00:23
2015-06-07T23:00:23
31,639,516
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.limitless.app.views; import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.widget.RelativeLayout; import com.limitless.app.domainObjects.Post; /** * Created by anthonylipscomb on 4/8/15. */ public abstract class PostRowView extends RelativeLayout { public PostRowView(Context context) { super(context); } public PostRowView(Context context, AttributeSet attrs) { super(context, attrs); } public PostRowView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } public abstract void setData(Post data); }
UTF-8
Java
672
java
PostRowView.java
Java
[ { "context": "mitless.app.domainObjects.Post;\n\n/**\n * Created by anthonylipscomb on 4/8/15.\n */\npublic abstract class PostRowView ", "end": 244, "score": 0.9995911717414856, "start": 229, "tag": "USERNAME", "value": "anthonylipscomb" } ]
null
[]
package com.limitless.app.views; import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.widget.RelativeLayout; import com.limitless.app.domainObjects.Post; /** * Created by anthonylipscomb on 4/8/15. */ public abstract class PostRowView extends RelativeLayout { public PostRowView(Context context) { super(context); } public PostRowView(Context context, AttributeSet attrs) { super(context, attrs); } public PostRowView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } public abstract void setData(Post data); }
672
0.727679
0.721726
28
23
22.515074
79
false
false
0
0
0
0
0
0
0.571429
false
false
10
f96cd85c3c2905480359c2e7332436712d79862d
3,977,139,744,942
358f1a032b88401a244fd7a123bd6a7319f2f23a
/src/core/pages/CampEditorPage.java
1570b8c8545f520a69ac3617a00654b669984c69
[]
no_license
karokarokaro/SBAD
https://github.com/karokarokaro/SBAD
ffae8479cf99b74fcb136c279c63cc4291605f3d
d1f9e021e3bbc7f7541e9eee682e60f8edf6cac3
refs/heads/master
2020-07-03T08:42:03.753000
2015-02-10T08:17:32
2015-02-10T08:17:32
25,939,462
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package core.pages; import core.database.Attributes; import core.database.DBAttribute; import core.database.DBObject; import core.entity.UserRoles; import core.exceptions.RedirectException; import core.helpers.TempHelper; import core.helpers.TemplateRenderer; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.math.BigInteger; import java.sql.Timestamp; import java.util.*; public class CampEditorPage extends HtmlPage { public CampEditorPage(HttpServletRequest request, HttpServletResponse response) { super(request, response); } protected void init() throws Exception { super.init(); addScriptFile("/crm/js/admin.js"); addScriptFile("/crm/js/inedit.js"); setTitle("Редактор компаний"); } protected void authorize() throws Exception { if (getUser() == null || !(UserRoles.Buyer.equals(getUser().getRole()) || UserRoles.Manager.equals(getUser().getRole()))) throw new RedirectException("/login.jsp"); } protected void renderBody() throws Exception { TemplateRenderer body = new TemplateRenderer(request, response, new BigInteger("4786")) { protected void mapTemplateModel() throws Exception { Map user = new HashMap<String, String>(); templateParams.put("user", user); user.put("login", getUser().getLogin()); user.put("id", getUser().getId().toString()); user.put("fullName", getUser().getMiniInfo()); user.put("isAdmin", getUser().isAdmin()); user.put("isGuest", getUser().isGuest()); user.put("roleDescr", getUser().getRole().getDescription()); List campaigns = new ArrayList(); templateParams.put("campaigns", campaigns); List<DBObject> camps = TempHelper.getCampaigns2ByUser(getUser()); Collections.sort(camps, new Comparator<DBObject>() { @Override public int compare(DBObject o1, DBObject o2) { Timestamp timestamp1 = o1.getAttributeById(Attributes.CREATED_WHEN).getTimestampValue(); Timestamp timestamp2 = o2.getAttributeById(Attributes.CREATED_WHEN).getTimestampValue(); return timestamp1.compareTo(timestamp2); } }); int i = 0; for (DBObject obj: camps) { DBAttribute enabled = obj.getAttributeById(Attributes.ENABLED); if (enabled != null && !enabled.getBooleanValue()) continue; ++i; Map campaign = new HashMap(); campaigns.add(campaign); campaign.put("seqNumber", i); campaign.put("id", obj.getId().toString()); Map name = new HashMap(); campaign.put("name", name); name.put("attrId", Attributes.NAME); if (obj.getAttributeById(Attributes.NAME) != null) { name.put("value", obj.getAttributeById(Attributes.NAME).getTextValue()); } else { name.put("value", ""); } Map address = new HashMap(); campaign.put("address", address); address.put("attrId", Attributes.ADDRESS); if (obj.getAttributeById(Attributes.ADDRESS) != null) { address.put("value", obj.getAttributeById(Attributes.ADDRESS).getTextValue()); } else { address.put("value", ""); } Map mapImg = new HashMap(); campaign.put("scheme", mapImg); mapImg.put("attrId", Attributes.MAP); if (obj.getAttributeById(Attributes.MAP) != null && obj.getAttributeById(Attributes.MAP).getTextValue().length() > 0) { mapImg.put("value", obj.getAttributeById(Attributes.MAP).getTextValue()); mapImg.put("uploaded", true); } else { mapImg.put("value", ""); mapImg.put("uploaded", false); } Map km = new HashMap(); campaign.put("km", km); km.put("attrId", Attributes.KM); if (obj.getAttributeById(Attributes.KM) != null) { km.put("value", obj.getAttributeById(Attributes.KM).getTextValue()); } else { km.put("value", ""); } // Map fio = new HashMap(); // campaign.put("fio", fio); // fio.put("attrId", Attributes.FIO); // if (obj.getAttributeById(Attributes.FIO) != null) { // fio.put("value", obj.getAttributeById(Attributes.FIO).getTextValue()); // } else { // fio.put("value", ""); // } Map contacts = new HashMap(); campaign.put("contacts", contacts); contacts.put("attrId", Attributes.CONTACTS); DBAttribute cont = obj.getAttributeById(Attributes.CONTACTS); if (cont != null) { contacts.put("value", cont.getTextValue()); } else { contacts.put("value", ""); } } } }; out.append(body.render()); } }
UTF-8
Java
5,953
java
CampEditorPage.java
Java
[]
null
[]
package core.pages; import core.database.Attributes; import core.database.DBAttribute; import core.database.DBObject; import core.entity.UserRoles; import core.exceptions.RedirectException; import core.helpers.TempHelper; import core.helpers.TemplateRenderer; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.math.BigInteger; import java.sql.Timestamp; import java.util.*; public class CampEditorPage extends HtmlPage { public CampEditorPage(HttpServletRequest request, HttpServletResponse response) { super(request, response); } protected void init() throws Exception { super.init(); addScriptFile("/crm/js/admin.js"); addScriptFile("/crm/js/inedit.js"); setTitle("Редактор компаний"); } protected void authorize() throws Exception { if (getUser() == null || !(UserRoles.Buyer.equals(getUser().getRole()) || UserRoles.Manager.equals(getUser().getRole()))) throw new RedirectException("/login.jsp"); } protected void renderBody() throws Exception { TemplateRenderer body = new TemplateRenderer(request, response, new BigInteger("4786")) { protected void mapTemplateModel() throws Exception { Map user = new HashMap<String, String>(); templateParams.put("user", user); user.put("login", getUser().getLogin()); user.put("id", getUser().getId().toString()); user.put("fullName", getUser().getMiniInfo()); user.put("isAdmin", getUser().isAdmin()); user.put("isGuest", getUser().isGuest()); user.put("roleDescr", getUser().getRole().getDescription()); List campaigns = new ArrayList(); templateParams.put("campaigns", campaigns); List<DBObject> camps = TempHelper.getCampaigns2ByUser(getUser()); Collections.sort(camps, new Comparator<DBObject>() { @Override public int compare(DBObject o1, DBObject o2) { Timestamp timestamp1 = o1.getAttributeById(Attributes.CREATED_WHEN).getTimestampValue(); Timestamp timestamp2 = o2.getAttributeById(Attributes.CREATED_WHEN).getTimestampValue(); return timestamp1.compareTo(timestamp2); } }); int i = 0; for (DBObject obj: camps) { DBAttribute enabled = obj.getAttributeById(Attributes.ENABLED); if (enabled != null && !enabled.getBooleanValue()) continue; ++i; Map campaign = new HashMap(); campaigns.add(campaign); campaign.put("seqNumber", i); campaign.put("id", obj.getId().toString()); Map name = new HashMap(); campaign.put("name", name); name.put("attrId", Attributes.NAME); if (obj.getAttributeById(Attributes.NAME) != null) { name.put("value", obj.getAttributeById(Attributes.NAME).getTextValue()); } else { name.put("value", ""); } Map address = new HashMap(); campaign.put("address", address); address.put("attrId", Attributes.ADDRESS); if (obj.getAttributeById(Attributes.ADDRESS) != null) { address.put("value", obj.getAttributeById(Attributes.ADDRESS).getTextValue()); } else { address.put("value", ""); } Map mapImg = new HashMap(); campaign.put("scheme", mapImg); mapImg.put("attrId", Attributes.MAP); if (obj.getAttributeById(Attributes.MAP) != null && obj.getAttributeById(Attributes.MAP).getTextValue().length() > 0) { mapImg.put("value", obj.getAttributeById(Attributes.MAP).getTextValue()); mapImg.put("uploaded", true); } else { mapImg.put("value", ""); mapImg.put("uploaded", false); } Map km = new HashMap(); campaign.put("km", km); km.put("attrId", Attributes.KM); if (obj.getAttributeById(Attributes.KM) != null) { km.put("value", obj.getAttributeById(Attributes.KM).getTextValue()); } else { km.put("value", ""); } // Map fio = new HashMap(); // campaign.put("fio", fio); // fio.put("attrId", Attributes.FIO); // if (obj.getAttributeById(Attributes.FIO) != null) { // fio.put("value", obj.getAttributeById(Attributes.FIO).getTextValue()); // } else { // fio.put("value", ""); // } Map contacts = new HashMap(); campaign.put("contacts", contacts); contacts.put("attrId", Attributes.CONTACTS); DBAttribute cont = obj.getAttributeById(Attributes.CONTACTS); if (cont != null) { contacts.put("value", cont.getTextValue()); } else { contacts.put("value", ""); } } } }; out.append(body.render()); } }
5,953
0.496716
0.494189
128
44.382813
27.162165
112
false
false
0
0
0
0
0
0
0.96875
false
false
10
90d791adddb56f3b67f2551da58f1acca6a82b06
1,056,561,954,817
fef13a801ca59012623b3e59e4a4884ae8de9835
/src/com/sayedshibily/projects/MovieBean.java
79efed6d62b83195a951f1e42bec5189f74ad38d
[]
no_license
shibilyt/Movie-Wishlist
https://github.com/shibilyt/Movie-Wishlist
6a1c202294603febf20c907c4804779a2caf609d
ac00122ae6678bd213d5d1520d13537ba1d9c57e
refs/heads/master
2020-05-02T03:16:37.509000
2019-03-25T05:57:40
2019-03-25T05:57:40
177,724,400
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sayedshibily.projects; import java.util.Comparator; public class MovieBean implements Comparable<MovieBean>{ private String movieName; private String directorName; private String producerName; private int rating; private String review; public MovieBean(String movieName, String directorName, String producerName, int rating, String review) { this.movieName = movieName; this.directorName = directorName; this.producerName = producerName; this.rating = rating; this.review = review; } public MovieBean() { } public String getMovieName() { return movieName; } public void setMovieName(String movieName) { this.movieName = movieName; } public String getDirectorName() { return directorName; } public void setDirectorName(String directorName) { this.directorName = directorName; } public String getProducerName() { return producerName; } public void setProducerName(String producerName) { this.producerName = producerName; } public int getRating() { return rating; } public void setRating(int rating) { this.rating = rating; } public String getReview() { return review; } public void setReview(String review) { this.review = review; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((directorName == null) ? 0 : directorName.hashCode()); result = prime * result + ((movieName == null) ? 0 : movieName.hashCode()); result = prime * result + ((producerName == null) ? 0 : producerName.hashCode()); result = prime * result + rating; result = prime * result + ((review == null) ? 0 : review.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof MovieBean)) return false; MovieBean other = (MovieBean) obj; if (directorName == null) { if (other.directorName != null) return false; } else if (!directorName.equals(other.directorName)) return false; if (movieName == null) { if (other.movieName != null) return false; } else if (!movieName.equals(other.movieName)) return false; if (producerName == null) { if (other.producerName != null) return false; } else if (!producerName.equals(other.producerName)) return false; if (rating != other.rating) return false; if (review == null) { if (other.review != null) return false; } else if (!review.equals(other.review)) return false; return true; } @Override public String toString() { return getMovieName() +":"+ getDirectorName() +":"+ getProducerName() +":"+ getRating() +":"+ getReview(); } @Override public int compareTo(MovieBean m) { return this.movieName.compareTo(m.movieName); } } class SortMovieByDirector implements Comparator<MovieBean>{ @Override public int compare(MovieBean o1, MovieBean o2) { return o1.getDirectorName().compareTo(o2.getDirectorName()); } } class SortMovieByRating implements Comparator<MovieBean>{ @Override public int compare(MovieBean o1, MovieBean o2) { return o1.getRating() - o2.getRating(); } } class SortMovieByReviews implements Comparator<MovieBean>{ @Override public int compare(MovieBean o1, MovieBean o2) { return o1.getReview().compareTo(o2.getReview()); } }
UTF-8
Java
3,339
java
MovieBean.java
Java
[]
null
[]
package com.sayedshibily.projects; import java.util.Comparator; public class MovieBean implements Comparable<MovieBean>{ private String movieName; private String directorName; private String producerName; private int rating; private String review; public MovieBean(String movieName, String directorName, String producerName, int rating, String review) { this.movieName = movieName; this.directorName = directorName; this.producerName = producerName; this.rating = rating; this.review = review; } public MovieBean() { } public String getMovieName() { return movieName; } public void setMovieName(String movieName) { this.movieName = movieName; } public String getDirectorName() { return directorName; } public void setDirectorName(String directorName) { this.directorName = directorName; } public String getProducerName() { return producerName; } public void setProducerName(String producerName) { this.producerName = producerName; } public int getRating() { return rating; } public void setRating(int rating) { this.rating = rating; } public String getReview() { return review; } public void setReview(String review) { this.review = review; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((directorName == null) ? 0 : directorName.hashCode()); result = prime * result + ((movieName == null) ? 0 : movieName.hashCode()); result = prime * result + ((producerName == null) ? 0 : producerName.hashCode()); result = prime * result + rating; result = prime * result + ((review == null) ? 0 : review.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof MovieBean)) return false; MovieBean other = (MovieBean) obj; if (directorName == null) { if (other.directorName != null) return false; } else if (!directorName.equals(other.directorName)) return false; if (movieName == null) { if (other.movieName != null) return false; } else if (!movieName.equals(other.movieName)) return false; if (producerName == null) { if (other.producerName != null) return false; } else if (!producerName.equals(other.producerName)) return false; if (rating != other.rating) return false; if (review == null) { if (other.review != null) return false; } else if (!review.equals(other.review)) return false; return true; } @Override public String toString() { return getMovieName() +":"+ getDirectorName() +":"+ getProducerName() +":"+ getRating() +":"+ getReview(); } @Override public int compareTo(MovieBean m) { return this.movieName.compareTo(m.movieName); } } class SortMovieByDirector implements Comparator<MovieBean>{ @Override public int compare(MovieBean o1, MovieBean o2) { return o1.getDirectorName().compareTo(o2.getDirectorName()); } } class SortMovieByRating implements Comparator<MovieBean>{ @Override public int compare(MovieBean o1, MovieBean o2) { return o1.getRating() - o2.getRating(); } } class SortMovieByReviews implements Comparator<MovieBean>{ @Override public int compare(MovieBean o1, MovieBean o2) { return o1.getReview().compareTo(o2.getReview()); } }
3,339
0.695118
0.689428
153
20.82353
21.999144
108
false
false
0
0
0
0
0
0
1.647059
false
false
10
6038278828ec551adba9d6b8c4c70c12b693c4d5
12,068,858,128,417
c405a619b6b21b9e5abba96930452180de530a5a
/app/src/main/java/com/example/ryan/qwiktix/Ticket.java
6b58b93c155dd3485a766f6aead52814d1a33c82
[]
no_license
rkuemmel1/QwikTix
https://github.com/rkuemmel1/QwikTix
de3fa7cf085ec6536cc491d8e517b5d5e7194bfc
fcdbe47b81390e0a009085cc5f8499e6e7487bfb
refs/heads/master
2021-01-22T10:08:41.595000
2017-04-30T21:35:51
2017-04-30T21:35:51
81,991,471
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.ryan.qwiktix; import java.util.Date; /** * Created by brade_000 on 2/18/2017. * * will probably want to take in: * - seat location * - number of seats * - time of event * - any additional information field */ public class Ticket { public String endTime; public String event; public int price; public String status; public String timePosted; public String userEmail; public String uID; public Ticket(String event, int price,String timePosted, String endTime, String userEmail, String uID){ this.event = event; this.price = price; this.timePosted = timePosted; this.endTime = endTime; this.userEmail = userEmail; this.uID = uID; status = "pending"; //timePosted = "3/30/2017"; } public Ticket(){} public String getEndTime() { return endTime; } public void setEndTime(String endTime) { this.endTime = endTime; } public String getEvent() { return event; } public void setEvent(String event) { this.event = event; } public int getPrice() { return price; } public void setPrice(int price) { this.price = price; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getTimePosted() { return timePosted; } public void setTimePosted(String timePosted) { this.timePosted = timePosted; } public String getUserEmail() { return userEmail; } public void setUserEmail(String userEmail) { this.userEmail = userEmail; } public String getuID() { return uID; } public void setuID(String uID) { this.uID = uID; } }
UTF-8
Java
1,844
java
Ticket.java
Java
[ { "context": "wiktix;\n\nimport java.util.Date;\n\n/**\n * Created by brade_000 on 2/18/2017.\n *\n * will probably want to take in", "end": 86, "score": 0.9996097683906555, "start": 77, "tag": "USERNAME", "value": "brade_000" } ]
null
[]
package com.example.ryan.qwiktix; import java.util.Date; /** * Created by brade_000 on 2/18/2017. * * will probably want to take in: * - seat location * - number of seats * - time of event * - any additional information field */ public class Ticket { public String endTime; public String event; public int price; public String status; public String timePosted; public String userEmail; public String uID; public Ticket(String event, int price,String timePosted, String endTime, String userEmail, String uID){ this.event = event; this.price = price; this.timePosted = timePosted; this.endTime = endTime; this.userEmail = userEmail; this.uID = uID; status = "pending"; //timePosted = "3/30/2017"; } public Ticket(){} public String getEndTime() { return endTime; } public void setEndTime(String endTime) { this.endTime = endTime; } public String getEvent() { return event; } public void setEvent(String event) { this.event = event; } public int getPrice() { return price; } public void setPrice(int price) { this.price = price; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getTimePosted() { return timePosted; } public void setTimePosted(String timePosted) { this.timePosted = timePosted; } public String getUserEmail() { return userEmail; } public void setUserEmail(String userEmail) { this.userEmail = userEmail; } public String getuID() { return uID; } public void setuID(String uID) { this.uID = uID; } }
1,844
0.598698
0.589479
92
19.043478
17.261992
107
false
false
0
0
0
0
0
0
0.391304
false
false
10
5a2e7b2d6af0d8782102ee049346ad2926c0662d
850,403,549,445
e23bcddcba120dfd053243f8c31f9e40c13b2eca
/src/main/java/com/yiwa/springboot_cache/mapper/EmployeeMapper.java
28b6af1e1953e42434b32e0e7563d5a90481a58a
[]
no_license
xqqlove/springboot_cache
https://github.com/xqqlove/springboot_cache
41b6e3b709543fb7e4cddd82efd853452cd53264
311653ef9cc5d801697fcd3d6f46e1f961bc8cc6
refs/heads/master
2022-05-28T07:43:24.568000
2020-05-02T01:46:31
2020-05-02T01:46:31
260,594,135
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yiwa.springboot_cache.mapper; import com.yiwa.springboot_cache.beans.Employee; import org.apache.ibatis.annotations.*; import org.springframework.stereotype.Service; @Mapper public interface EmployeeMapper { @Select("select * from tbl_employee where id=#{id}") public Employee getEmployee(Integer id); @Update("update tbl_employee set last_name=#{lastName},gender=#{gender},email=#{email},dept_id=#{deptId} where id=#{id}") public void updateEmp(Employee employee); @Delete("delete from tbl_employee where id=#{id}") public void deleteEmpById(Integer id); @Insert("insert into tbl_employee(last_name,gender,email,dept_id) values(#{lastName},#{gender},#{email},#{deptId})") public void insertEmployee(Employee employee); @Select("select * from tbl_employee where last_name=#{lastName}") public Employee getEmpBylastName(String lastName); }
UTF-8
Java
899
java
EmployeeMapper.java
Java
[]
null
[]
package com.yiwa.springboot_cache.mapper; import com.yiwa.springboot_cache.beans.Employee; import org.apache.ibatis.annotations.*; import org.springframework.stereotype.Service; @Mapper public interface EmployeeMapper { @Select("select * from tbl_employee where id=#{id}") public Employee getEmployee(Integer id); @Update("update tbl_employee set last_name=#{lastName},gender=#{gender},email=#{email},dept_id=#{deptId} where id=#{id}") public void updateEmp(Employee employee); @Delete("delete from tbl_employee where id=#{id}") public void deleteEmpById(Integer id); @Insert("insert into tbl_employee(last_name,gender,email,dept_id) values(#{lastName},#{gender},#{email},#{deptId})") public void insertEmployee(Employee employee); @Select("select * from tbl_employee where last_name=#{lastName}") public Employee getEmpBylastName(String lastName); }
899
0.730812
0.730812
25
34.959999
34.747639
125
false
false
0
0
0
0
0
0
0.72
false
false
10
c9c42b11c91eef1e69f4c67876f4048fb27f4fae
10,256,381,903,093
f6cad4e8a527d317c0f5230dacc0650b43b1ba29
/src/main/java/com/jnlc/codegenerate/util/FileUtil.java
52c387c39db800346a4160af42413fae90a9a87a
[]
no_license
zyfxgary/codegenerate
https://github.com/zyfxgary/codegenerate
df314109db31257e1f4c40284ea77b752869612e
670d10c155ebae7fb4ae6836193ad5f47b7bc60f
refs/heads/master
2021-06-08T20:02:42.857000
2016-11-22T05:23:04
2016-11-22T05:23:04
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jnlc.codegenerate.util; import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * 文件操作功能类 * @author lisl * */ public class FileUtil { /** * 获取指定文件下的文件信息 * @param targetProject * @return */ public static List<File> getFiles(String filePath) { File file=new File(filePath); File[] files=file.listFiles(); List<File> fileList=new ArrayList<File>(); fileList= Arrays.asList(files); return fileList; } }
UTF-8
Java
547
java
FileUtil.java
Java
[ { "context": "ort java.util.List;\r\n\r\n/**\r\n * 文件操作功能类\r\n * @author lisl\r\n *\r\n */\r\npublic class FileUtil {\r\n\t/**\r\n\t * 获取指定", "end": 174, "score": 0.9996480941772461, "start": 170, "tag": "USERNAME", "value": "lisl" } ]
null
[]
package com.jnlc.codegenerate.util; import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * 文件操作功能类 * @author lisl * */ public class FileUtil { /** * 获取指定文件下的文件信息 * @param targetProject * @return */ public static List<File> getFiles(String filePath) { File file=new File(filePath); File[] files=file.listFiles(); List<File> fileList=new ArrayList<File>(); fileList= Arrays.asList(files); return fileList; } }
547
0.662082
0.662082
26
17.576923
14.398646
53
false
false
0
0
0
0
0
0
1.038462
false
false
10
4b5a9d056d853c42a6b40772fdd653b72877f625
11,708,080,887,541
54b8d80f6d9e2454da5ae8ffec030a15ed41d89e
/app/src/main/java/com/boge/bogebook/mvp/view/ReaderView.java
e38e03b99ea8c1564befbd365133cc57918fc765
[]
no_license
Watchet/BogeBook
https://github.com/Watchet/BogeBook
d01862c4a10b33f1018666725643e52c6c1b4b67
14080b09cc1a1191d9e0613479a3391140e77741
refs/heads/master
2020-06-04T03:50:44.268000
2017-12-13T06:24:50
2017-12-13T06:24:50
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.boge.bogebook.mvp.view; import com.boge.bogebook.entity.BookToc; import com.boge.bogebook.entity.ChapterRead; import com.boge.bogebook.mvp.view.base.BaseView; /** * @author boge * @version 1.0 * @date 2016/11/2 */ public interface ReaderView extends BaseView{ void setBookToc(BookToc bookToc); void showChapterRead(ChapterRead.ChapterBean chapterBean , int chapter); }
UTF-8
Java
399
java
ReaderView.java
Java
[ { "context": "e.bogebook.mvp.view.base.BaseView;\n\n/**\n * @author boge\n * @version 1.0\n * @date 2016/11/2\n */\n\npublic in", "end": 192, "score": 0.9996809363365173, "start": 188, "tag": "USERNAME", "value": "boge" } ]
null
[]
package com.boge.bogebook.mvp.view; import com.boge.bogebook.entity.BookToc; import com.boge.bogebook.entity.ChapterRead; import com.boge.bogebook.mvp.view.base.BaseView; /** * @author boge * @version 1.0 * @date 2016/11/2 */ public interface ReaderView extends BaseView{ void setBookToc(BookToc bookToc); void showChapterRead(ChapterRead.ChapterBean chapterBean , int chapter); }
399
0.754386
0.73183
19
20
22.275784
76
false
false
0
0
0
0
0
0
0.368421
false
false
10
23685a2a2b09642050c2f8c8c8a932202ae55eda
33,706,903,349,578
6261d5c2b0b2965e939dbe79ecdd2458e676cce6
/src/main/java/com/tippy/report/Report.java
7e60fe72b641b6e5759ac44a1ea9c1caab500595
[]
no_license
TippyWang/JavaAdvanced
https://github.com/TippyWang/JavaAdvanced
2252bf39710a1675756cddd9119c2dc31e5ea754
34c8fa4f24c22147fbf4d612b9a38ff95ba01404
refs/heads/master
2023-07-08T15:54:37.967000
2021-08-11T11:37:23
2021-08-11T11:37:23
394,967,737
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tippy.report; public interface Report { boolean load(); void print(); }
UTF-8
Java
93
java
Report.java
Java
[]
null
[]
package com.tippy.report; public interface Report { boolean load(); void print(); }
93
0.666667
0.666667
6
14.5
10.32392
25
false
false
0
0
0
0
0
0
0.5
false
false
10
1fed7f01b612fc8eca2ca61763237704cb3cbe6a
25,202,868,113,644
95d20c83d8aff34e314c56a3ecb2b87c9fa9fc86
/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/TraceTimeViewport.java
b93a249aa4b60cc0172554a4378ca83495275c6e
[ "GPL-1.0-or-later", "GPL-3.0-only", "Apache-2.0", "LicenseRef-scancode-public-domain", "LGPL-2.1-only", "LicenseRef-scancode-unknown-license-reference" ]
permissive
NationalSecurityAgency/ghidra
https://github.com/NationalSecurityAgency/ghidra
969fe0d2ca25cb8ac72f66f0f90fc7fb2dbfa68d
7cc135eb6bfabd166cbc23f7951dae09a7e03c39
refs/heads/master
2023-08-31T21:20:23.376000
2023-08-29T23:08:54
2023-08-29T23:08:54
173,228,436
45,212
6,204
Apache-2.0
false
2023-09-14T18:00:39
2019-03-01T03:27:48
2023-09-14T16:08:34
2023-09-14T18:00:38
315,176
42,614
5,179
1,427
Java
false
false
/* ### * IP: GHIDRA * * 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 ghidra.trace.model; import java.util.*; import java.util.function.Function; import ghidra.program.model.address.*; /** * A convenience for tracking the time structure of a trace and querying the trace accordingly. */ public interface TraceTimeViewport { public interface Occlusion<T> { boolean occluded(T object, AddressRange range, Lifespan span); void remove(T object, AddressSet remains, Lifespan span); } public interface QueryOcclusion<T> extends Occlusion<T> { @Override default boolean occluded(T object, AddressRange range, Lifespan span) { for (T found : query(range, span)) { if (found == object) { continue; } if (itemOccludes(range, found)) { return true; } } return false; } @Override default void remove(T object, AddressSet remains, Lifespan span) { // TODO: Split query by parts of remains? Probably not worth it. for (T found : query( new AddressRangeImpl(remains.getMinAddress(), remains.getMaxAddress()), span)) { if (found == object) { continue; } removeItem(remains, found); if (remains.isEmpty()) { return; } } } Iterable<? extends T> query(AddressRange range, Lifespan span); boolean itemOccludes(AddressRange range, T t); void removeItem(AddressSet remains, T t); } public interface RangeQueryOcclusion<T> extends QueryOcclusion<T> { @Override default boolean itemOccludes(AddressRange range, T t) { return range(t).intersects(range); } @Override default void removeItem(AddressSet remains, T t) { remains.delete(range(t)); } AddressRange range(T t); } public interface SetQueryOcclusion<T> extends QueryOcclusion<T> { @Override default boolean itemOccludes(AddressRange range, T t) { return set(t).intersects(range.getMinAddress(), range.getMaxAddress()); } @Override default void removeItem(AddressSet remains, T t) { for (AddressRange range : set(t)) { remains.delete(range); if (remains.isEmpty()) { return; } } } AddressSetView set(T t); } /** * Set the snapshot for this viewport * * @param snap the snap */ void setSnap(long snap); /** * Add a listener for when the forking structure of this viewport changes * * <p> * This can occur when the snap changes or when any snapshot involved changes * * @param l the listener */ void addChangeListener(Runnable l); /** * Remove a listener for forking structure changes * * @see #addChangeListener(Runnable) * @param l the listener */ void removeChangeListener(Runnable l); /** * Check if this view is forked * * <p> * The view is considered forked if any snap previous to this has a schedule with an initial * snap other than the immediately-preceding one. Such forks "break" the linearity of the * trace's usual time line. * * @return true if forked, false otherwise */ boolean isForked(); /** * Check if the given lifespan contains any upper snap among the involved spans * * @param lifespan the lifespan to consider * @return true if it contains any upper snap, false otherwise. */ boolean containsAnyUpper(Lifespan lifespan); /** * Check if any part of the given object is occluded by more-recent objects * * @param <T> the type of the object * @param range the address range of the object * @param lifespan the lifespan of the object * @param object optionally, the object to examine. Used to avoid "self occlusion" * @param occlusion a mechanism for querying other like objects and checking for occlusion * @return true if completely visible, false if even partially occluded */ <T> boolean isCompletelyVisible(AddressRange range, Lifespan lifespan, T object, Occlusion<T> occlusion); /** * Compute the parts of a given object that are visible past more-recent objects * * @param <T> the type of the object * @param set the addresses comprising the object * @param lifespan the lifespan of the object * @param object the object to examine * @param occlusion a mechanism for query other like objects and removing occluded parts * @return the set of visible addresses */ <T> AddressSet computeVisibleParts(AddressSetView set, Lifespan lifespan, T object, Occlusion<T> occlusion); List<Lifespan> getOrderedSpans(); /** * Get the snaps involved in the view in most-recent-first order * * <p> * The first is always this view's snap. Following are the source snaps of each previous * snapshot's schedule where applicable. * * @return the list of snaps */ List<Long> getOrderedSnaps(); /** * Get the snaps involved in the view in least-recent-first order * * @return the list of snaps */ List<Long> getReversedSnaps(); /** * Get the first non-null result of the function, applied to the most-recent snaps first * * <p> * Typically, func both retrieves an object and tests for its suitability. * * @param <T> the type of object to retrieve * @param func the function on a snap to retrieve an object * @return the first non-null result */ <T> T getTop(Function<Long, T> func); /** * Merge iterators from each involved snap into a single iterator * * <p> * Typically, the resulting iterator is passed through a filter to test each objects * suitability. * * @param <T> the type of objects in each iterator * @param iterFunc a function on a snap to retrieve each iterator * @param comparator the comparator for merging, which must yield the same order as each * iterator * @return the merged iterator */ <T> Iterator<T> mergedIterator(Function<Long, Iterator<T>> iterFunc, Comparator<? super T> comparator); /** * Union address sets from each involved snap * * <p> * The returned union is computed lazily. * * @param setFunc a function on a snap to retrieve the address set * @return the union */ AddressSetView unionedAddresses(Function<Long, AddressSetView> setFunc); }
UTF-8
Java
6,578
java
TraceTimeViewport.java
Java
[ { "context": "/* ###\n * IP: GHIDRA\n *\n * Licensed under the Apache License, Ver", "end": 15, "score": 0.5752185583114624, "start": 14, "tag": "NAME", "value": "G" } ]
null
[]
/* ### * IP: GHIDRA * * 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 ghidra.trace.model; import java.util.*; import java.util.function.Function; import ghidra.program.model.address.*; /** * A convenience for tracking the time structure of a trace and querying the trace accordingly. */ public interface TraceTimeViewport { public interface Occlusion<T> { boolean occluded(T object, AddressRange range, Lifespan span); void remove(T object, AddressSet remains, Lifespan span); } public interface QueryOcclusion<T> extends Occlusion<T> { @Override default boolean occluded(T object, AddressRange range, Lifespan span) { for (T found : query(range, span)) { if (found == object) { continue; } if (itemOccludes(range, found)) { return true; } } return false; } @Override default void remove(T object, AddressSet remains, Lifespan span) { // TODO: Split query by parts of remains? Probably not worth it. for (T found : query( new AddressRangeImpl(remains.getMinAddress(), remains.getMaxAddress()), span)) { if (found == object) { continue; } removeItem(remains, found); if (remains.isEmpty()) { return; } } } Iterable<? extends T> query(AddressRange range, Lifespan span); boolean itemOccludes(AddressRange range, T t); void removeItem(AddressSet remains, T t); } public interface RangeQueryOcclusion<T> extends QueryOcclusion<T> { @Override default boolean itemOccludes(AddressRange range, T t) { return range(t).intersects(range); } @Override default void removeItem(AddressSet remains, T t) { remains.delete(range(t)); } AddressRange range(T t); } public interface SetQueryOcclusion<T> extends QueryOcclusion<T> { @Override default boolean itemOccludes(AddressRange range, T t) { return set(t).intersects(range.getMinAddress(), range.getMaxAddress()); } @Override default void removeItem(AddressSet remains, T t) { for (AddressRange range : set(t)) { remains.delete(range); if (remains.isEmpty()) { return; } } } AddressSetView set(T t); } /** * Set the snapshot for this viewport * * @param snap the snap */ void setSnap(long snap); /** * Add a listener for when the forking structure of this viewport changes * * <p> * This can occur when the snap changes or when any snapshot involved changes * * @param l the listener */ void addChangeListener(Runnable l); /** * Remove a listener for forking structure changes * * @see #addChangeListener(Runnable) * @param l the listener */ void removeChangeListener(Runnable l); /** * Check if this view is forked * * <p> * The view is considered forked if any snap previous to this has a schedule with an initial * snap other than the immediately-preceding one. Such forks "break" the linearity of the * trace's usual time line. * * @return true if forked, false otherwise */ boolean isForked(); /** * Check if the given lifespan contains any upper snap among the involved spans * * @param lifespan the lifespan to consider * @return true if it contains any upper snap, false otherwise. */ boolean containsAnyUpper(Lifespan lifespan); /** * Check if any part of the given object is occluded by more-recent objects * * @param <T> the type of the object * @param range the address range of the object * @param lifespan the lifespan of the object * @param object optionally, the object to examine. Used to avoid "self occlusion" * @param occlusion a mechanism for querying other like objects and checking for occlusion * @return true if completely visible, false if even partially occluded */ <T> boolean isCompletelyVisible(AddressRange range, Lifespan lifespan, T object, Occlusion<T> occlusion); /** * Compute the parts of a given object that are visible past more-recent objects * * @param <T> the type of the object * @param set the addresses comprising the object * @param lifespan the lifespan of the object * @param object the object to examine * @param occlusion a mechanism for query other like objects and removing occluded parts * @return the set of visible addresses */ <T> AddressSet computeVisibleParts(AddressSetView set, Lifespan lifespan, T object, Occlusion<T> occlusion); List<Lifespan> getOrderedSpans(); /** * Get the snaps involved in the view in most-recent-first order * * <p> * The first is always this view's snap. Following are the source snaps of each previous * snapshot's schedule where applicable. * * @return the list of snaps */ List<Long> getOrderedSnaps(); /** * Get the snaps involved in the view in least-recent-first order * * @return the list of snaps */ List<Long> getReversedSnaps(); /** * Get the first non-null result of the function, applied to the most-recent snaps first * * <p> * Typically, func both retrieves an object and tests for its suitability. * * @param <T> the type of object to retrieve * @param func the function on a snap to retrieve an object * @return the first non-null result */ <T> T getTop(Function<Long, T> func); /** * Merge iterators from each involved snap into a single iterator * * <p> * Typically, the resulting iterator is passed through a filter to test each objects * suitability. * * @param <T> the type of objects in each iterator * @param iterFunc a function on a snap to retrieve each iterator * @param comparator the comparator for merging, which must yield the same order as each * iterator * @return the merged iterator */ <T> Iterator<T> mergedIterator(Function<Long, Iterator<T>> iterFunc, Comparator<? super T> comparator); /** * Union address sets from each involved snap * * <p> * The returned union is computed lazily. * * @param setFunc a function on a snap to retrieve the address set * @return the union */ AddressSetView unionedAddresses(Function<Long, AddressSetView> setFunc); }
6,578
0.699605
0.698997
233
27.23176
27.914606
95
false
false
0
0
0
0
0
0
1.592275
false
false
10
44ddb0034a872759f6853256db468d49cae82427
14,078,902,811,246
c549a2bb92de05399000c3b8d71f9a2840cb6b8c
/src/main/java/org/adoptopenjdk/jitwatch/sandbox/Sandbox.java
835083c54a5e785366d95824efc45ce2b3a7fcf9
[ "BSD-2-Clause-Views" ]
permissive
apadki/jitwatch
https://github.com/apadki/jitwatch
0cb030b14e03fd0a68e363807330bf7e8219d4de
b86cb3ea62e12326b76a2c88d9d493f52434408b
refs/heads/master
2021-01-24T02:17:52.656000
2014-08-21T19:48:50
2014-08-21T19:48:50
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (c) 2013, 2014 Chris Newland. * Licensed under https://github.com/AdoptOpenJDK/jitwatch/blob/master/LICENSE-BSD * Instructions: https://github.com/AdoptOpenJDK/jitwatch/wiki */ package org.adoptopenjdk.jitwatch.sandbox; import static org.adoptopenjdk.jitwatch.core.JITWatchConstants.S_DOT; import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import org.adoptopenjdk.jitwatch.core.ILogParser; import org.adoptopenjdk.jitwatch.core.JITWatchConfig; import org.adoptopenjdk.jitwatch.core.JITWatchConstants; import org.adoptopenjdk.jitwatch.core.JITWatchConfig.CompressedOops; import org.adoptopenjdk.jitwatch.core.JITWatchConfig.TieredCompilation; import org.adoptopenjdk.jitwatch.model.IMetaMember; import org.adoptopenjdk.jitwatch.model.IReadOnlyJITDataModel; import org.adoptopenjdk.jitwatch.model.MetaClass; import org.adoptopenjdk.jitwatch.ui.sandbox.ISandboxStage; import org.adoptopenjdk.jitwatch.util.FileUtil; import org.adoptopenjdk.jitwatch.util.ParseUtil; import org.adoptopenjdk.jitwatch.util.StringUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class Sandbox { private static final Logger logger = LoggerFactory.getLogger(Sandbox.class); private ISandboxStage sandboxStage; public static final Path SANDBOX_DIR; public static final Path SANDBOX_SOURCE_DIR; public static final Path SANDBOX_CLASS_DIR; private static final String SANDBOX_LOGFILE = "sandbox.log"; private File sandboxLogFile = new File(SANDBOX_DIR.toFile(), SANDBOX_LOGFILE); private ILogParser logParser; private String firstClassName; private String classContainingMain; static { String userDir = System.getProperty("user.dir"); SANDBOX_DIR = Paths.get(userDir, "sandbox"); SANDBOX_SOURCE_DIR = Paths.get(userDir, "sandbox", "sources"); SANDBOX_CLASS_DIR = Paths.get(userDir, "sandbox", "classes"); initialise(); } private static void initialise() { File sandboxSources = SANDBOX_SOURCE_DIR.toFile(); if (!sandboxSources.exists()) { logger.debug("Creating Sandbox source directory {}", sandboxSources); sandboxSources.mkdirs(); if (sandboxSources.exists()) { copyExamples(); } } File sandboxClasses = SANDBOX_CLASS_DIR.toFile(); if (!sandboxClasses.exists()) { sandboxClasses.mkdirs(); } } public void reset() { logger.debug("Resetting Sandbox to default settings"); FileUtil.emptyDir(SANDBOX_DIR.toFile()); initialise(); } private static void copyExamples() { File srcDir = new File("src/main/resources/examples"); File dstDir = SANDBOX_SOURCE_DIR.toFile(); logger.debug("Copying Sandbox examples from {} to {}", srcDir, dstDir); FileUtil.copyFilesToDir(srcDir, dstDir); } public Sandbox(ILogParser parser, ISandboxStage logger) { this.logParser = parser; this.sandboxStage = logger; } public void runSandbox(List<String> sourceFiles) throws Exception { firstClassName = null; classContainingMain = null; List<File> compileList = new ArrayList<>(); for (String source : sourceFiles) { File sourceFile = writeSourceFile(source); compileList.add(sourceFile); } sandboxStage.log("Compiling: " + StringUtil.listToString(compileList)); ClassCompiler compiler = new ClassCompiler(); boolean compiledOK = compiler.compile(compileList, SANDBOX_CLASS_DIR.toFile()); sandboxStage.log("Compilation success: " + compiledOK); if (compiledOK) { if (classContainingMain != null) { ClassExecutor classExecutor = new ClassExecutor(); boolean executionSuccess = executeTestLoad(classExecutor, logParser.getConfig().isSandboxIntelMode()); sandboxStage.log("Execution success: " + executionSuccess); if (executionSuccess) { runJITWatch(); showTriView(); } else { sandboxStage.showError(classExecutor.getErrorStream()); } } else { sandboxStage.log("No main method found"); } } else { String compilationMessages = compiler.getCompilationMessages(); sandboxStage.showError(compilationMessages); } } private File writeSourceFile(String source) throws IOException { String sourcePackage = ParseUtil.getPackageFromSource(source); String sourceClass = ParseUtil.getClassFromSource(source); StringBuilder fqNameSourceBuilder = new StringBuilder(); if (sourcePackage.length() > 0) { fqNameSourceBuilder.append(sourcePackage).append(S_DOT); } fqNameSourceBuilder.append(sourceClass); String fqNameSource = fqNameSourceBuilder.toString(); if (source.contains("public static void main(") || source.contains("public static void main (")) { classContainingMain = fqNameSource; sandboxStage.log("Found main method in " + classContainingMain); } if (firstClassName == null) { firstClassName = fqNameSource; } sandboxStage.log("Writing source file: " + fqNameSource + ".java"); return FileUtil.writeSource(SANDBOX_SOURCE_DIR.toFile(), fqNameSource, source); } private boolean executeTestLoad(ClassExecutor classExecutor, boolean intelMode) throws Exception { List<String> classpath = new ArrayList<>(); classpath.add(SANDBOX_CLASS_DIR.toString()); classpath.addAll(logParser.getConfig().getClassLocations()); List<String> options = new ArrayList<>(); options.add("-XX:+UnlockDiagnosticVMOptions"); options.add("-XX:+TraceClassLoading"); options.add("-XX:+LogCompilation"); options.add("-XX:LogFile=" + sandboxLogFile.getCanonicalPath()); if (logParser.getConfig().isPrintAssembly()) { options.add("-XX:+PrintAssembly"); if (intelMode) { options.add("-XX:PrintAssemblyOptions=intel"); } } TieredCompilation tieredMode = logParser.getConfig().getTieredCompilationMode(); if (tieredMode == TieredCompilation.FORCE_TIERED) { options.add("-XX:+TieredCompilation"); } else if (tieredMode == TieredCompilation.FORCE_NO_TIERED) { options.add("-XX:-TieredCompilation"); } CompressedOops oopsMode = logParser.getConfig().getCompressedOopsMode(); if (oopsMode == CompressedOops.FORCE_COMPRESSED) { options.add("-XX:+TieredCompilation"); } else if (oopsMode == CompressedOops.FORCE_NO_COMPRESSED) { options.add("-XX:-TieredCompilation"); } if (logParser.getConfig().getFreqInlineSize() != JITWatchConstants.DEFAULT_FREQ_INLINE_SIZE) { options.add("-XX:FreqInlineSize=" + logParser.getConfig().getFreqInlineSize()); } if (logParser.getConfig().getMaxInlineSize() != JITWatchConstants.DEFAULT_MAX_INLINE_SIZE) { options.add("-XX:MaxInlineSize=" + logParser.getConfig().getMaxInlineSize()); } if (logParser.getConfig().getCompilerThreshold() != JITWatchConstants.DEFAULT_COMPILER_THRESHOLD) { options.add("-XX:CompilerThreshold=" + logParser.getConfig().getCompilerThreshold()); } sandboxStage.log("Executing: " + classContainingMain); sandboxStage.log("Classpath: " + StringUtil.listToString(classpath, File.pathSeparatorChar)); sandboxStage.log("VM options: " + StringUtil.listToString(options)); return classExecutor.execute(classContainingMain, classpath, options); } private void runJITWatch() throws IOException { JITWatchConfig config = logParser.getConfig(); List<String> sourceLocations = new ArrayList<>(config.getSourceLocations()); List<String> classLocations = new ArrayList<>(config.getClassLocations()); String sandboxSourceDirString = SANDBOX_SOURCE_DIR.toString(); String sandboxClassDirString = SANDBOX_CLASS_DIR.toString(); boolean configChanged = false; if (!sourceLocations.contains(sandboxSourceDirString)) { configChanged = true; sourceLocations.add(sandboxSourceDirString); } if (!classLocations.contains(sandboxClassDirString)) { configChanged = true; classLocations.add(sandboxClassDirString); } File jdkSrcZip = JITWatchConfig.getJDKSourceZip(); if (jdkSrcZip != null) { String jdkSourceZipString = jdkSrcZip.toPath().toString(); if (!sourceLocations.contains(jdkSourceZipString)) { configChanged = true; sourceLocations.add(jdkSourceZipString); } } config.setSourceLocations(sourceLocations); config.setClassLocations(classLocations); if (configChanged) { config.saveConfig(); } logParser.reset(); logParser.readLogFile(sandboxLogFile); sandboxStage.log("Parsing complete"); } private void showTriView() { IReadOnlyJITDataModel model = logParser.getModel(); sandboxStage.log("Looking up class: " + firstClassName); MetaClass metaClass = model.getPackageManager().getMetaClass(firstClassName); IMetaMember triViewMember = null; if (metaClass != null) { sandboxStage.log("Found: " + metaClass.getFullyQualifiedName()); sandboxStage.log("looking for compiled members"); // select first compiled member if any List<IMetaMember> memberList = metaClass.getMetaMembers(); for (IMetaMember mm : memberList) { sandboxStage.log("Checking JIT compilation status of " + mm.toString()); if (triViewMember == null) { // take the first member encountered triViewMember = mm; } if (mm.isCompiled()) { // override with the first JIT-compiled member triViewMember = mm; break; } } } sandboxStage.openTriView(triViewMember); } }
UTF-8
Java
9,348
java
Sandbox.java
Java
[ { "context": "/*\n * Copyright (c) 2013, 2014 Chris Newland.\n * Licensed under https://github.com/AdoptOpenJD", "end": 44, "score": 0.9996811747550964, "start": 31, "tag": "NAME", "value": "Chris Newland" }, { "context": "ris Newland.\n * Licensed under https://github.com/AdoptOpenJDK/jitwatch/blob/master/LICENSE-BSD\n * Instructions:", "end": 95, "score": 0.9905654788017273, "start": 83, "tag": "USERNAME", "value": "AdoptOpenJDK" }, { "context": "r/LICENSE-BSD\n * Instructions: https://github.com/AdoptOpenJDK/jitwatch/wiki\n */\npackage org.adoptopenjdk.jitwat", "end": 177, "score": 0.9952802062034607, "start": 165, "tag": "USERNAME", "value": "AdoptOpenJDK" } ]
null
[]
/* * Copyright (c) 2013, 2014 <NAME>. * Licensed under https://github.com/AdoptOpenJDK/jitwatch/blob/master/LICENSE-BSD * Instructions: https://github.com/AdoptOpenJDK/jitwatch/wiki */ package org.adoptopenjdk.jitwatch.sandbox; import static org.adoptopenjdk.jitwatch.core.JITWatchConstants.S_DOT; import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import org.adoptopenjdk.jitwatch.core.ILogParser; import org.adoptopenjdk.jitwatch.core.JITWatchConfig; import org.adoptopenjdk.jitwatch.core.JITWatchConstants; import org.adoptopenjdk.jitwatch.core.JITWatchConfig.CompressedOops; import org.adoptopenjdk.jitwatch.core.JITWatchConfig.TieredCompilation; import org.adoptopenjdk.jitwatch.model.IMetaMember; import org.adoptopenjdk.jitwatch.model.IReadOnlyJITDataModel; import org.adoptopenjdk.jitwatch.model.MetaClass; import org.adoptopenjdk.jitwatch.ui.sandbox.ISandboxStage; import org.adoptopenjdk.jitwatch.util.FileUtil; import org.adoptopenjdk.jitwatch.util.ParseUtil; import org.adoptopenjdk.jitwatch.util.StringUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class Sandbox { private static final Logger logger = LoggerFactory.getLogger(Sandbox.class); private ISandboxStage sandboxStage; public static final Path SANDBOX_DIR; public static final Path SANDBOX_SOURCE_DIR; public static final Path SANDBOX_CLASS_DIR; private static final String SANDBOX_LOGFILE = "sandbox.log"; private File sandboxLogFile = new File(SANDBOX_DIR.toFile(), SANDBOX_LOGFILE); private ILogParser logParser; private String firstClassName; private String classContainingMain; static { String userDir = System.getProperty("user.dir"); SANDBOX_DIR = Paths.get(userDir, "sandbox"); SANDBOX_SOURCE_DIR = Paths.get(userDir, "sandbox", "sources"); SANDBOX_CLASS_DIR = Paths.get(userDir, "sandbox", "classes"); initialise(); } private static void initialise() { File sandboxSources = SANDBOX_SOURCE_DIR.toFile(); if (!sandboxSources.exists()) { logger.debug("Creating Sandbox source directory {}", sandboxSources); sandboxSources.mkdirs(); if (sandboxSources.exists()) { copyExamples(); } } File sandboxClasses = SANDBOX_CLASS_DIR.toFile(); if (!sandboxClasses.exists()) { sandboxClasses.mkdirs(); } } public void reset() { logger.debug("Resetting Sandbox to default settings"); FileUtil.emptyDir(SANDBOX_DIR.toFile()); initialise(); } private static void copyExamples() { File srcDir = new File("src/main/resources/examples"); File dstDir = SANDBOX_SOURCE_DIR.toFile(); logger.debug("Copying Sandbox examples from {} to {}", srcDir, dstDir); FileUtil.copyFilesToDir(srcDir, dstDir); } public Sandbox(ILogParser parser, ISandboxStage logger) { this.logParser = parser; this.sandboxStage = logger; } public void runSandbox(List<String> sourceFiles) throws Exception { firstClassName = null; classContainingMain = null; List<File> compileList = new ArrayList<>(); for (String source : sourceFiles) { File sourceFile = writeSourceFile(source); compileList.add(sourceFile); } sandboxStage.log("Compiling: " + StringUtil.listToString(compileList)); ClassCompiler compiler = new ClassCompiler(); boolean compiledOK = compiler.compile(compileList, SANDBOX_CLASS_DIR.toFile()); sandboxStage.log("Compilation success: " + compiledOK); if (compiledOK) { if (classContainingMain != null) { ClassExecutor classExecutor = new ClassExecutor(); boolean executionSuccess = executeTestLoad(classExecutor, logParser.getConfig().isSandboxIntelMode()); sandboxStage.log("Execution success: " + executionSuccess); if (executionSuccess) { runJITWatch(); showTriView(); } else { sandboxStage.showError(classExecutor.getErrorStream()); } } else { sandboxStage.log("No main method found"); } } else { String compilationMessages = compiler.getCompilationMessages(); sandboxStage.showError(compilationMessages); } } private File writeSourceFile(String source) throws IOException { String sourcePackage = ParseUtil.getPackageFromSource(source); String sourceClass = ParseUtil.getClassFromSource(source); StringBuilder fqNameSourceBuilder = new StringBuilder(); if (sourcePackage.length() > 0) { fqNameSourceBuilder.append(sourcePackage).append(S_DOT); } fqNameSourceBuilder.append(sourceClass); String fqNameSource = fqNameSourceBuilder.toString(); if (source.contains("public static void main(") || source.contains("public static void main (")) { classContainingMain = fqNameSource; sandboxStage.log("Found main method in " + classContainingMain); } if (firstClassName == null) { firstClassName = fqNameSource; } sandboxStage.log("Writing source file: " + fqNameSource + ".java"); return FileUtil.writeSource(SANDBOX_SOURCE_DIR.toFile(), fqNameSource, source); } private boolean executeTestLoad(ClassExecutor classExecutor, boolean intelMode) throws Exception { List<String> classpath = new ArrayList<>(); classpath.add(SANDBOX_CLASS_DIR.toString()); classpath.addAll(logParser.getConfig().getClassLocations()); List<String> options = new ArrayList<>(); options.add("-XX:+UnlockDiagnosticVMOptions"); options.add("-XX:+TraceClassLoading"); options.add("-XX:+LogCompilation"); options.add("-XX:LogFile=" + sandboxLogFile.getCanonicalPath()); if (logParser.getConfig().isPrintAssembly()) { options.add("-XX:+PrintAssembly"); if (intelMode) { options.add("-XX:PrintAssemblyOptions=intel"); } } TieredCompilation tieredMode = logParser.getConfig().getTieredCompilationMode(); if (tieredMode == TieredCompilation.FORCE_TIERED) { options.add("-XX:+TieredCompilation"); } else if (tieredMode == TieredCompilation.FORCE_NO_TIERED) { options.add("-XX:-TieredCompilation"); } CompressedOops oopsMode = logParser.getConfig().getCompressedOopsMode(); if (oopsMode == CompressedOops.FORCE_COMPRESSED) { options.add("-XX:+TieredCompilation"); } else if (oopsMode == CompressedOops.FORCE_NO_COMPRESSED) { options.add("-XX:-TieredCompilation"); } if (logParser.getConfig().getFreqInlineSize() != JITWatchConstants.DEFAULT_FREQ_INLINE_SIZE) { options.add("-XX:FreqInlineSize=" + logParser.getConfig().getFreqInlineSize()); } if (logParser.getConfig().getMaxInlineSize() != JITWatchConstants.DEFAULT_MAX_INLINE_SIZE) { options.add("-XX:MaxInlineSize=" + logParser.getConfig().getMaxInlineSize()); } if (logParser.getConfig().getCompilerThreshold() != JITWatchConstants.DEFAULT_COMPILER_THRESHOLD) { options.add("-XX:CompilerThreshold=" + logParser.getConfig().getCompilerThreshold()); } sandboxStage.log("Executing: " + classContainingMain); sandboxStage.log("Classpath: " + StringUtil.listToString(classpath, File.pathSeparatorChar)); sandboxStage.log("VM options: " + StringUtil.listToString(options)); return classExecutor.execute(classContainingMain, classpath, options); } private void runJITWatch() throws IOException { JITWatchConfig config = logParser.getConfig(); List<String> sourceLocations = new ArrayList<>(config.getSourceLocations()); List<String> classLocations = new ArrayList<>(config.getClassLocations()); String sandboxSourceDirString = SANDBOX_SOURCE_DIR.toString(); String sandboxClassDirString = SANDBOX_CLASS_DIR.toString(); boolean configChanged = false; if (!sourceLocations.contains(sandboxSourceDirString)) { configChanged = true; sourceLocations.add(sandboxSourceDirString); } if (!classLocations.contains(sandboxClassDirString)) { configChanged = true; classLocations.add(sandboxClassDirString); } File jdkSrcZip = JITWatchConfig.getJDKSourceZip(); if (jdkSrcZip != null) { String jdkSourceZipString = jdkSrcZip.toPath().toString(); if (!sourceLocations.contains(jdkSourceZipString)) { configChanged = true; sourceLocations.add(jdkSourceZipString); } } config.setSourceLocations(sourceLocations); config.setClassLocations(classLocations); if (configChanged) { config.saveConfig(); } logParser.reset(); logParser.readLogFile(sandboxLogFile); sandboxStage.log("Parsing complete"); } private void showTriView() { IReadOnlyJITDataModel model = logParser.getModel(); sandboxStage.log("Looking up class: " + firstClassName); MetaClass metaClass = model.getPackageManager().getMetaClass(firstClassName); IMetaMember triViewMember = null; if (metaClass != null) { sandboxStage.log("Found: " + metaClass.getFullyQualifiedName()); sandboxStage.log("looking for compiled members"); // select first compiled member if any List<IMetaMember> memberList = metaClass.getMetaMembers(); for (IMetaMember mm : memberList) { sandboxStage.log("Checking JIT compilation status of " + mm.toString()); if (triViewMember == null) { // take the first member encountered triViewMember = mm; } if (mm.isCompiled()) { // override with the first JIT-compiled member triViewMember = mm; break; } } } sandboxStage.openTriView(triViewMember); } }
9,341
0.73374
0.732563
357
25.187675
27.365686
106
false
false
0
0
0
0
0
0
1.991597
false
false
10
392014d46780645d7a47956149065208f3e76038
35,364,760,735,664
7baacda04d2b99c6a1c7f8df2a3f9a852400f585
/src/com/app/client/investment/MainActivity.java
089761f2879341b22e181588fea8e157222ea945
[]
no_license
srsman/InvestmentManager
https://github.com/srsman/InvestmentManager
2605e1fa80d8f89dac9a66aaa4bdf0b5b99d474c
12eac97800908841140981e582d2d0ca8d60a710
refs/heads/master
2021-01-22T19:40:57.817000
2015-04-09T06:29:24
2015-04-09T06:29:40
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.app.client.investment; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.RelativeLayout; import android.widget.Toast; import com.app.client.investment.assetallocationlab.AssetAllocationLabActivity; import com.app.client.investment.fundmanager.FundManagerActivity; import com.app.client.investment.fundresearch.FundResearchActivity; import com.app.client.investment.juxianfang.Juxianfangactivity; import com.app.client.investment.manager.InvestmentManagerActivity; import com.app.client.investment.managertool.InvestmentManagerToolActivity; public class MainActivity extends Activity implements OnClickListener{ private RelativeLayout btnFundManager ; private RelativeLayout btnFundResearch ; private RelativeLayout btnInvestmentManager ; private RelativeLayout btnInvestmentTool ; private RelativeLayout btnForum ; private RelativeLayout btnHelp ; private RelativeLayout btnJuxianyuan ; // private Button btnAssetAllocationLab; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getActionBar().hide(); setContentView(R.layout.activity_main); initViews(); initListener(); initData(); } private void initViews() { // TODO Auto-generated method stub btnFundManager = (RelativeLayout) findViewById(R.id.btnFundManager); btnFundResearch = (RelativeLayout) findViewById(R.id.btnFundResearch); btnInvestmentManager = (RelativeLayout) findViewById(R.id.btnInvestmentManager); btnInvestmentTool = (RelativeLayout) findViewById(R.id.btnInvestmentTool); btnForum = (RelativeLayout) findViewById(R.id.btnForum); btnHelp = (RelativeLayout) findViewById(R.id.btnHelp); btnJuxianyuan = (RelativeLayout) findViewById(R.id.btnJuxianyuan); // btnAssetAllocationLab = (Button) findViewById(R.id.btnAssetAllocationLab); } private void initListener() { // TODO Auto-generated method stub btnFundManager.setOnClickListener(this); btnFundResearch.setOnClickListener(this) ; btnInvestmentManager.setOnClickListener(this) ; btnInvestmentTool.setOnClickListener(this) ; btnForum.setOnClickListener(this); btnHelp.setOnClickListener(this); btnJuxianyuan.setOnClickListener(this); // btnAssetAllocationLab.setOnClickListener(this); } private void initData() { // TODO Auto-generated method stub } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.btnFundManager: gotoFundManager(); break ; case R.id.btnInvestmentManager: gotoInvestmentManager(); break; case R.id.btnFundResearch: gotoFundResearch(); break ; case R.id.btnInvestmentTool: gotoInvestmentTool(); break; case R.id.btnForum: gotoForum(); break ; case R.id.btnHelp: gotoHelp(); break ; case R.id.btnJuxianyuan: gotoJuxianyuan(); break ; // case R.id.btnAssetAllocationLab: // gotoAssetAllocationLab(); default: break; } } public void gotoForum(){ Toast.makeText(this, "未实现", Toast.LENGTH_LONG).show(); } public void gotoHelp(){ Toast.makeText(this, "未实现", Toast.LENGTH_LONG).show(); } public void gotoJuxianyuan(){ // Toast.makeText(this, "未实现", Toast.LENGTH_LONG).show(); Intent intent = new Intent(this, Juxianfangactivity.class); startActivity(intent); } public void gotoInvestmentTool(){ Intent intent = new Intent(this, InvestmentManagerToolActivity.class); startActivity(intent); } public void gotoFundManager() { // TODO Auto-generated method stub Intent intent = new Intent(this, FundManagerActivity.class); startActivity(intent); } public void gotoInvestmentManager(){ Intent intent = new Intent(this, InvestmentManagerActivity.class); startActivity(intent); } public void gotoFundResearch(){ Intent intent = new Intent(this, FundResearchActivity.class); startActivity(intent); } public void gotoAssetAllocationLab() { Intent intent = new Intent(this, AssetAllocationLabActivity.class); startActivity(intent); } }
GB18030
Java
4,179
java
MainActivity.java
Java
[]
null
[]
package com.app.client.investment; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.RelativeLayout; import android.widget.Toast; import com.app.client.investment.assetallocationlab.AssetAllocationLabActivity; import com.app.client.investment.fundmanager.FundManagerActivity; import com.app.client.investment.fundresearch.FundResearchActivity; import com.app.client.investment.juxianfang.Juxianfangactivity; import com.app.client.investment.manager.InvestmentManagerActivity; import com.app.client.investment.managertool.InvestmentManagerToolActivity; public class MainActivity extends Activity implements OnClickListener{ private RelativeLayout btnFundManager ; private RelativeLayout btnFundResearch ; private RelativeLayout btnInvestmentManager ; private RelativeLayout btnInvestmentTool ; private RelativeLayout btnForum ; private RelativeLayout btnHelp ; private RelativeLayout btnJuxianyuan ; // private Button btnAssetAllocationLab; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getActionBar().hide(); setContentView(R.layout.activity_main); initViews(); initListener(); initData(); } private void initViews() { // TODO Auto-generated method stub btnFundManager = (RelativeLayout) findViewById(R.id.btnFundManager); btnFundResearch = (RelativeLayout) findViewById(R.id.btnFundResearch); btnInvestmentManager = (RelativeLayout) findViewById(R.id.btnInvestmentManager); btnInvestmentTool = (RelativeLayout) findViewById(R.id.btnInvestmentTool); btnForum = (RelativeLayout) findViewById(R.id.btnForum); btnHelp = (RelativeLayout) findViewById(R.id.btnHelp); btnJuxianyuan = (RelativeLayout) findViewById(R.id.btnJuxianyuan); // btnAssetAllocationLab = (Button) findViewById(R.id.btnAssetAllocationLab); } private void initListener() { // TODO Auto-generated method stub btnFundManager.setOnClickListener(this); btnFundResearch.setOnClickListener(this) ; btnInvestmentManager.setOnClickListener(this) ; btnInvestmentTool.setOnClickListener(this) ; btnForum.setOnClickListener(this); btnHelp.setOnClickListener(this); btnJuxianyuan.setOnClickListener(this); // btnAssetAllocationLab.setOnClickListener(this); } private void initData() { // TODO Auto-generated method stub } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.btnFundManager: gotoFundManager(); break ; case R.id.btnInvestmentManager: gotoInvestmentManager(); break; case R.id.btnFundResearch: gotoFundResearch(); break ; case R.id.btnInvestmentTool: gotoInvestmentTool(); break; case R.id.btnForum: gotoForum(); break ; case R.id.btnHelp: gotoHelp(); break ; case R.id.btnJuxianyuan: gotoJuxianyuan(); break ; // case R.id.btnAssetAllocationLab: // gotoAssetAllocationLab(); default: break; } } public void gotoForum(){ Toast.makeText(this, "未实现", Toast.LENGTH_LONG).show(); } public void gotoHelp(){ Toast.makeText(this, "未实现", Toast.LENGTH_LONG).show(); } public void gotoJuxianyuan(){ // Toast.makeText(this, "未实现", Toast.LENGTH_LONG).show(); Intent intent = new Intent(this, Juxianfangactivity.class); startActivity(intent); } public void gotoInvestmentTool(){ Intent intent = new Intent(this, InvestmentManagerToolActivity.class); startActivity(intent); } public void gotoFundManager() { // TODO Auto-generated method stub Intent intent = new Intent(this, FundManagerActivity.class); startActivity(intent); } public void gotoInvestmentManager(){ Intent intent = new Intent(this, InvestmentManagerActivity.class); startActivity(intent); } public void gotoFundResearch(){ Intent intent = new Intent(this, FundResearchActivity.class); startActivity(intent); } public void gotoAssetAllocationLab() { Intent intent = new Intent(this, AssetAllocationLabActivity.class); startActivity(intent); } }
4,179
0.766402
0.766402
149
26.926174
22.91481
82
false
false
0
0
0
0
0
0
2.006711
false
false
10
1227de09dafa16ddbe9572282cc3c95c8bf88a5e
31,267,361,963,639
aef4fecb6210f3ddd03051dc832082cbbb0592f9
/src/se/robertfoss/ChanImageBrowser/ProgressBarHandler.java
5891cc7b991e9a7f62790e083ea7730d89d9a726
[]
no_license
Amnuaychai/4chan-image-browser
https://github.com/Amnuaychai/4chan-image-browser
d73bacfa050e369ed325199050c4114f729f194c
475ae5ba6ddda4339498e930d4c6e4d1da34a42a
refs/heads/master
2017-12-22T07:55:57.428000
2013-12-18T02:42:29
2013-12-18T02:42:29
50,643,478
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package se.robertfoss.ChanImageBrowser; import android.os.Handler; import android.os.Message; import android.widget.ProgressBar; public class ProgressBarHandler extends Handler{ ProgressBar pb; public ProgressBarHandler(ProgressBar pb) { super(); this.pb = pb; } @Override public void handleMessage(Message msg) { if (msg.arg1 == 0) { pb.setIndeterminate(false); } else { pb.setIndeterminate(true); } pb.setProgress(msg.arg2); } }
UTF-8
Java
462
java
ProgressBarHandler.java
Java
[]
null
[]
package se.robertfoss.ChanImageBrowser; import android.os.Handler; import android.os.Message; import android.widget.ProgressBar; public class ProgressBarHandler extends Handler{ ProgressBar pb; public ProgressBarHandler(ProgressBar pb) { super(); this.pb = pb; } @Override public void handleMessage(Message msg) { if (msg.arg1 == 0) { pb.setIndeterminate(false); } else { pb.setIndeterminate(true); } pb.setProgress(msg.arg2); } }
462
0.725108
0.718615
25
17.48
15.577214
48
false
false
0
0
0
0
0
0
1.44
false
false
10